From d58b83bb4aabf028399b427f3b71d7932543ef0e Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 01:37:44 +0100 Subject: [PATCH 01/55] Added fastdl folder --- GarrysMod/gmodserver | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GarrysMod/gmodserver b/GarrysMod/gmodserver index 363eb01c8..4e62e63a5 100644 --- a/GarrysMod/gmodserver +++ b/GarrysMod/gmodserver @@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="271215" +version="190216" #### Variables #### @@ -70,6 +70,7 @@ selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/garrysmod" +addonsdir="${systemdir}/addons" executabledir="${filesdir}" executable="./srcds_run" servercfg="${servicename}.cfg" From 490dbc55fbf25a684f5d7ab20946cae4caa025bc Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 01:39:37 +0100 Subject: [PATCH 02/55] Fastdl creator --- functions/command_fastdl.sh | 209 ++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 functions/command_fastdl.sh diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh new file mode 100644 index 000000000..1c25c310e --- /dev/null +++ b/functions/command_fastdl.sh @@ -0,0 +1,209 @@ +#!/bin/bash +# LGSM command_fastdl function +# Author: Daniel Gibbs +# Contributor: UltimateByte +# Website: http://gameservermanagers.com +lgsm_version="190216" + +# Description: Creates a FastDL folder + +local modulename="FastDL Creator" +function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" + +check.sh + +# Directories +fastdldir="${rootdir}/fastdl" +# Server lua autorun dir, used to autorun lua on client connect to the server +luasvautorundir="${systemdir}/lua/audoturn/server" +luafastdlfile="lgsm_cl_force_fastdl.lua" +luafastdlfullpath="${luasvautorundir}/${luafastdlfile}" + +fn_fastdl_init(){ +# User confirmation for starting process +echo "Generate a FastDL Folder ?" +while true; do + read -p "Continue? [y/N]" yn + case $yn in + [Yy]* ) break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done +# Create FastDL folder if it doesn't exit +if [ ! -d "${fastdldir}" ]; then + echo "Creating FastDL directory" + mkdir -v "${fastdldir}" + sleep 1 +else + echo "Updating FastDL..." +fi +# Ask for lua resource add file use +echo "Do you wish to use a lua file to force clients to download FastDL content ?" +echo "It can be necessary for addons devs that forgot about registering their files to be downloaded through FastDL" +while true; do + read -p "Continue? [y/n]" yn + case $yn in + [Yy]* ) luaressource="on"; break;; + [Nn]* ) luaressource="off"; return 1;; + * ) echo "Please answer yes or no.";; + esac +done +} + +fn_gmod_fastdl(){ +# Copy all needed files for fastDL +echo "Gathering all needed FastDL files..." +sleep 1 + +cd "${systemdir}" + +# Map Files +echo "Copying map files" +sleep 1 +find . -name '*.bsp' | cpio -updm "${fastdldir}" +echo "Done" +sleep 1 + +# Materials +echo "Copying Materials" +sleep 1 +find . -name '*.vtf' | cpio -updm "${fastdldir}" +find . -name '*.vmt' | cpio -updm "${fastdldir}" +echo "Done" +sleep 1 + +# Models +echo "Copying Models" +sleep 1 +find . -name '*.vtx' | cpio -updm "${fastdldir}" +find . -name '*.vvd' | cpio -updm "${fastdldir}" +find . -name '*.mdl' | cpio -updm "${fastdldir}" +find . -name '*.phy' | cpio -updm "${fastdldir}" +echo "Done" +sleep 1 + +# Particles +echo "Copying Particles" +sleep 1 +find . -name '*.pcf' | cpio -updm "${fastdldir}" +echo "Done" +sleep 1 + +# Sounds +echo "Copying Sounds" +sleep 1 +find . -name '*.wav' | cpio -updm "${fastdldir}" +find . -name '*.mp3' | cpio -updm "${fastdldir}" +find . -name '*.ogg' | cpio -updm "${fastdldir}" +echo "Done" +sleep 1 + +# Resources (mostly fonts) +echo "Copying fonts and png" +sleep 1 +find . -name '*.otf' | cpio -updm "${fastdldir}" +find . -name '*.ttf' | cpio -updm "${fastdldir}" +find . -name '*.png' | cpio -updm "${fastdldir}" +echo "Done" +sleep 1 + +# Going back to scriptfolder to avoid mistakes +cd ${rootdir} + +# Correct addons folder structure +if [ -d "${fastdldir}/addons" ]; then + echo "Possible FastDL files found into addons" + echo "Moving those files to their correct folder" + sleep 2 + cp -Rf ${fastdldir}/addons/*/* "${fastdldir}" + rm -R "${fastdldir}/addons" + echo "Done" + sleep 1 +fi + +# Correct content that may be into a lua folder by mistake like some darkrpmodification addons +if [ -d "${fastdldir}/lua" ]; then + echo "Some FastDL files (often addons in darkrpmodifications) may be in the wrong folder" + sleep 1 + echo "Copying those files to their hopefully correct locations" + sleep 1 + cp -Rf "${fastdldir}/lua/"* "${fastdldir}" + echo "Done" + sleep 1 +fi +} + + +# bzip2 compression +fn_check_bzip2(){ +# Returns true if not installed +if [ -z "$(command -v bzip2)" ]; then + bzip2installed="0" + echo "WARNING bzip2 packed is not installed !" + sleep 2 + echo "You can't compress your FastDL files !" + sleep 2 + echo "Loading time won't be as good as possible for your players." + sleep 2 + echo "It's advised that your install bzip2 and re-run the fastdl command." + sleep 3 +else + bzip2installed="1" +fi +} + +fn_fastdl_bzip2(){ +echo "Do you want to compress files using bzip2 for even faster client download ?" +echo "It may take a while..." + while true; do + read -p "Continue? [y/N]" yn + case $yn in + [Yy]* ) break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac + done + +echo "Compressing files using bzip2..." +sleep 2 + +# bzip2 all files that are not already compressed (keeping original files) +find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -k \{\} \; +echo "bzip2 compression done" +sleep 1 +} + +# Function to implement +fn_lua_fastdl(){ +if [ luaressource="off" == "on" ]; then + if [ -f "${luafastdlfullpath}" ]; then + echo "Removing " +} + +fn_fastdl_completed(){ +echo "----------------------------------" +echo "Congratulations, it's done" +echo "Now you should configure your HTTP server to target the fastdl folder that was created" +echo "Or copy files to an external server" +echo "Don't forget to change your sv_downloadurl accordingly in ${servercfgfullpath}" +if [ "$bzip2installed" == "0" ]; then +echo "By the way, you'd better install bzip2 an re-run this command" +fi +echo "----------------------------------" +exit +} + +# Game checking +# Garry's Mod +if [ "${gamename}" == "Garry's Mod" ]; then + fn_fastdl_init + fn_gmod_fastdl + fn_check_bzip2 + if [ "${bzip2installed}" == "1" ]; then + fn_fastdl_bzip2 + fi + fn_lua_fastdl + fn_fastdl_completed + exit +fi From 1859394bbfebe2516559a286e0abc40543ab6eb6 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 01:41:17 +0100 Subject: [PATCH 03/55] Added fastdl command --- functions/core_functions.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/functions/core_functions.sh b/functions/core_functions.sh index 7b0f148cd..a17a1b898 100644 --- a/functions/core_functions.sh +++ b/functions/core_functions.sh @@ -2,7 +2,7 @@ # LGSM core_functions.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="170116" +lgsm_version="190216" # Description: Defines all functions to allow download and execution of functions using fn_runfunction. # This function is called first before any other function. Without this file other functions would not load. @@ -85,6 +85,11 @@ functionfile="${FUNCNAME}" fn_runfunction } +command_fastdl.sh(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + command_ts3_server_pass.sh(){ functionfile="${FUNCNAME}" fn_runfunction From ec6ab23409c9d39104e716e391f3ef7e6c25f823 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 01:45:00 +0100 Subject: [PATCH 04/55] Added gmod getopt specific + fastdl --- functions/core_getopt.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/functions/core_getopt.sh b/functions/core_getopt.sh index 95196d0ef..c5b6916c3 100644 --- a/functions/core_getopt.sh +++ b/functions/core_getopt.sh @@ -206,6 +206,8 @@ case "$getopt" in fn_autoinstall;; dd|depsdetect) command_dev_detect_deps.sh;; + fd|fastdl) + command_fastdl.sh;; *) echo "Usage: $0 [option]" echo "${gamename} - Linux Game Server Manager - Version ${version}" @@ -414,6 +416,8 @@ if [ "${gamename}" == "Mumble" ]; then fn_getopt_mumble elif [ "${gamename}" == "Teamspeak 3" ]; then fn_getopt_teamspeak3 +elif [ "${gamename}" == "Garry's Mod" ]; then + fn_getopt_gmodserver elif [ "${engine}" == "unreal2" ]; then if [ "${gamename}" == "Unreal Tournament 2004" ]; then fn_getopt_ut2k4 @@ -424,4 +428,4 @@ elif [ "${engine}" == "unreal" ]; then fn_getopt_unreal else fn_getopt_generic -fi \ No newline at end of file +fi From 4a49c05a5fff922cc50343fdcd9d712d5bdecbe2 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 02:36:05 +0100 Subject: [PATCH 05/55] lua file resource generator and tweaks --- functions/command_fastdl.sh | 44 +++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 1c25c310e..5d9cd5ae3 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -13,7 +13,8 @@ function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" check.sh # Directories -fastdldir="${rootdir}/fastdl" +webdir="${rootdir}/www" +fastdldir="${webdir}/fastdl" # Server lua autorun dir, used to autorun lua on client connect to the server luasvautorundir="${systemdir}/lua/audoturn/server" luafastdlfile="lgsm_cl_force_fastdl.lua" @@ -31,6 +32,10 @@ while true; do esac done # Create FastDL folder if it doesn't exit +if [ ! -d "${webdir}" ]; then + echo "Creating www directory" + mkdir -v "${webdir}" + sleep 1 if [ ! -d "${fastdldir}" ]; then echo "Creating FastDL directory" mkdir -v "${fastdldir}" @@ -39,13 +44,13 @@ else echo "Updating FastDL..." fi # Ask for lua resource add file use -echo "Do you wish to use a lua file to force clients to download FastDL content ?" -echo "It can be necessary for addons devs that forgot about registering their files to be downloaded through FastDL" +echo "Do you wish to generate a lua file to force clients to download all FastDL content ?" +echo "It is useful for many addons where devs didn't register their files to be downloaded through FastDL." while true; do read -p "Continue? [y/n]" yn case $yn in [Yy]* ) luaressource="on"; break;; - [Nn]* ) luaressource="off"; return 1;; + [Nn]* ) luaressource="off"; return 0;; * ) echo "Please answer yes or no.";; esac done @@ -174,19 +179,40 @@ echo "bzip2 compression done" sleep 1 } -# Function to implement +# Generate lua file that will force download any file into the FastDL folder fn_lua_fastdl(){ -if [ luaressource="off" == "on" ]; then +# Remove lua file if luaressource is turned off +if [ ${luaressource} == "off" ]; then if [ -f "${luafastdlfullpath}" ]; then - echo "Removing " + echo "Removing download enforcer" + sleep 1 + rm -R "${luafastdlfullpath}" + fi +fi +if [ ${luaressource == "on" ]; then + if [ -f "${luafastdlfullpath}" ]; then + echo "Removing old download enforcer" + sleep 1 + rm "${luafastdlfullpath}" + fi + echo "Generating new download enforcer" + sleep 1 + find "${fastdldir}" \( -name "." ! -name "*.bz2" \) -printf '%P\n' | while read line; do + echo "resource.AddFile("\""${line}"\"")" >> "${luafastdlfullpath}" + done + echo "Download enforcer generated" + sleep 1 +fi } fn_fastdl_completed(){ echo "----------------------------------" echo "Congratulations, it's done" -echo "Now you should configure your HTTP server to target the fastdl folder that was created" +echo "Now you should configure your HTTP server to target the fastdl folder that was created in ${fastdldir}" echo "Or copy files to an external server" echo "Don't forget to change your sv_downloadurl accordingly in ${servercfgfullpath}" +echo "You may want to use the www folder to host a loadingurl too," +echo "for that purpose, just make a loadingurl folder next to the fastdl folder and put your loadingurl in it" if [ "$bzip2installed" == "0" ]; then echo "By the way, you'd better install bzip2 an re-run this command" fi @@ -203,7 +229,7 @@ if [ "${gamename}" == "Garry's Mod" ]; then if [ "${bzip2installed}" == "1" ]; then fn_fastdl_bzip2 fi - fn_lua_fastdl + fn_lua_fastdl fn_fastdl_completed exit fi From 53777c59ecebde52e2c3dd8ecea90045bd2a2cd6 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 02:41:08 +0100 Subject: [PATCH 06/55] missing fi --- functions/command_fastdl.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 5d9cd5ae3..5769d7beb 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -36,6 +36,7 @@ if [ ! -d "${webdir}" ]; then echo "Creating www directory" mkdir -v "${webdir}" sleep 1 +fi if [ ! -d "${fastdldir}" ]; then echo "Creating FastDL directory" mkdir -v "${fastdldir}" From fde1c3a9abfab3db29deec8d48f5b3f38095bffb Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 02:43:05 +0100 Subject: [PATCH 07/55] fixed syntax --- functions/command_fastdl.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 5769d7beb..8eef409cf 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -183,14 +183,14 @@ sleep 1 # Generate lua file that will force download any file into the FastDL folder fn_lua_fastdl(){ # Remove lua file if luaressource is turned off -if [ ${luaressource} == "off" ]; then +if [ "${luaressource}" == "off" ]; then if [ -f "${luafastdlfullpath}" ]; then echo "Removing download enforcer" sleep 1 rm -R "${luafastdlfullpath}" fi fi -if [ ${luaressource == "on" ]; then +if [ "${luaressource}"" == "on" ]; then if [ -f "${luafastdlfullpath}" ]; then echo "Removing old download enforcer" sleep 1 From c875598a5ade6a26bf42ad077a27ef774826d5fb Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 02:45:20 +0100 Subject: [PATCH 08/55] double quotes and stuff --- functions/command_fastdl.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 8eef409cf..4ba97046e 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -115,14 +115,14 @@ echo "Done" sleep 1 # Going back to scriptfolder to avoid mistakes -cd ${rootdir} +cd "${rootdir}" # Correct addons folder structure if [ -d "${fastdldir}/addons" ]; then echo "Possible FastDL files found into addons" echo "Moving those files to their correct folder" sleep 2 - cp -Rf ${fastdldir}/addons/*/* "${fastdldir}" + cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}" rm -R "${fastdldir}/addons" echo "Done" sleep 1 @@ -190,7 +190,7 @@ if [ "${luaressource}" == "off" ]; then rm -R "${luafastdlfullpath}" fi fi -if [ "${luaressource}"" == "on" ]; then +if [ "${luaressource}" == "on" ]; then if [ -f "${luafastdlfullpath}" ]; then echo "Removing old download enforcer" sleep 1 From 4695b10cfd116d1001a54cca89e0c8a3ed02a754 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 02:51:01 +0100 Subject: [PATCH 09/55] exit/return fixes --- functions/command_fastdl.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 4ba97046e..1182bdd18 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -31,7 +31,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -# Create FastDL folder if it doesn't exit +# Create FastDL folder if it doesn't exist if [ ! -d "${webdir}" ]; then echo "Creating www directory" mkdir -v "${webdir}" @@ -166,7 +166,7 @@ echo "It may take a while..." read -p "Continue? [y/N]" yn case $yn in [Yy]* ) break;; - [Nn]* ) exit;; + [Nn]* ) return 0;; * ) echo "Please answer yes or no.";; esac done @@ -218,7 +218,6 @@ if [ "$bzip2installed" == "0" ]; then echo "By the way, you'd better install bzip2 an re-run this command" fi echo "----------------------------------" -exit } # Game checking From 298caab68f92e9e4311d11a04b89647b5f15bb2d Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 03:58:26 +0100 Subject: [PATCH 10/55] many improvements to test --- functions/command_fastdl.sh | 168 +++++++++++++++++++++++------------- 1 file changed, 106 insertions(+), 62 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 1182bdd18..5a8166910 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -15,14 +15,17 @@ check.sh # Directories webdir="${rootdir}/www" fastdldir="${webdir}/fastdl" +addonsdir="${systemdir}/addons" # Server lua autorun dir, used to autorun lua on client connect to the server luasvautorundir="${systemdir}/lua/audoturn/server" luafastdlfile="lgsm_cl_force_fastdl.lua" luafastdlfullpath="${luasvautorundir}/${luafastdlfile}" fn_fastdl_init(){ -# User confirmation for starting process -echo "Generate a FastDL Folder ?" +# User confirmation +fn_printdots "Welcome to LGSM's FastDL generator" +fn_scriptlog "Started FastDL creation" +sleep 1 while true; do read -p "Continue? [y/N]" yn case $yn in @@ -31,24 +34,62 @@ while true; do * ) echo "Please answer yes or no.";; esac done -# Create FastDL folder if it doesn't exist +fn_scriptlog "Initiating FastDL creation" + +# Check and create folders if [ ! -d "${webdir}" ]; then - echo "Creating www directory" + fn_printinfo "Creating www directory..." + sleep 0.5 mkdir -v "${webdir}" sleep 1 + fn_scriptlog "FastDL created ${webdir}" fi if [ ! -d "${fastdldir}" ]; then - echo "Creating FastDL directory" + newfastdl=1 + fn_printinfo "Creating FastDL directory..." + sleep 0.5 mkdir -v "${fastdldir}" sleep 1 + fn_scriptlog "FastDL created ${fastdldir}" else - echo "Updating FastDL..." + newfastdl=0 fi -# Ask for lua resource add file use -echo "Do you wish to generate a lua file to force clients to download all FastDL content ?" +} + +fn_fastdl_config(){ +fn_printinfo "Configuration..." +fn_scriptlog "Configuration" +sleep 2 +if [ ${newfastdl} == 1 ]; then + fn_printinfo "Do you wish to clear old FastDL files?" + echo "(Useful if some files changed)" + while true; do + read -p "Clear old FastDL? [y/n]" yn + case $yn in + [Yy]* ) clearoldfastdl="on"; fn_scriptlog "clearoldfastdl enabled"; break;; + [Nn]* ) clearoldfastdl="off"; fn_scriptlog "clearoldfastdl disabled" break;; + * ) echo "Please answer yes or no.";; + esac + done +fi +echo "Compress files using bzip2 for faster client download?" +echo "(It may take a while)" +while true; do + read -p "Use bzip2? [y/n]" yn + case $yn in + [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; break;; + [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled" break;; + * ) echo "Please answer yes or no.";; + esac +done +} + +fn_fastdl_gmod_config(){ +# Ask for download enforcer using lua addfile resource generator +echo "Do you wish to force clients to downloading the whole FastDL content?" echo "It is useful for many addons where devs didn't register their files to be downloaded through FastDL." while true; do - read -p "Continue? [y/n]" yn + read -p "Use download enforcer? [y/n]" yn case $yn in [Yy]* ) luaressource="on"; break;; [Nn]* ) luaressource="off"; return 0;; @@ -57,73 +98,83 @@ while true; do done } +fn_clearoldfastdl(){ +if [ clearoldfastdl == "on" ] + fn_printinfo "Clearing existing FastDL folder" + fn_scriptlog "Clearing existing FastDL folder" + sleep 1 + rm -R "${fastdldir}"/* +} + fn_gmod_fastdl(){ # Copy all needed files for fastDL -echo "Gathering all needed FastDL files..." +fn_printdots "Gathering all needed FastDL files..." sleep 1 -cd "${systemdir}" - # Map Files -echo "Copying map files" +fn_printdots "Copying map files..." +fn_scriptlog "Copying map files" sleep 1 -find . -name '*.bsp' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.bsp' | cpio -updm "${fastdldir}" echo "Done" sleep 1 # Materials -echo "Copying Materials" +fn_printdots "Copying materials" +fn_scriptlog "Copying materials" sleep 1 -find . -name '*.vtf' | cpio -updm "${fastdldir}" -find . -name '*.vmt' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.vtf' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.vmt' | cpio -updm "${fastdldir}" echo "Done" sleep 1 # Models -echo "Copying Models" +fn_printdots "Copying models" +fn_scriptlog "Copying models" sleep 1 -find . -name '*.vtx' | cpio -updm "${fastdldir}" -find . -name '*.vvd' | cpio -updm "${fastdldir}" -find . -name '*.mdl' | cpio -updm "${fastdldir}" -find . -name '*.phy' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.vtx' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.vvd' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.mdl' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.phy' | cpio -updm "${fastdldir}" echo "Done" sleep 1 # Particles -echo "Copying Particles" +fn_printdots "Copying particles" +fn_scriptlog "Copying particles" sleep 1 -find . -name '*.pcf' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.pcf' | cpio -updm "${fastdldir}" echo "Done" sleep 1 # Sounds -echo "Copying Sounds" +fn_printdots "Copying sounds" +fn_scriptlog "Copying sounds" sleep 1 -find . -name '*.wav' | cpio -updm "${fastdldir}" -find . -name '*.mp3' | cpio -updm "${fastdldir}" -find . -name '*.ogg' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.wav' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.mp3' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.ogg' | cpio -updm "${fastdldir}" echo "Done" sleep 1 # Resources (mostly fonts) -echo "Copying fonts and png" +fn_printdots "Copying fonts and png" +fn_scriptlog "Copying fonts and png" sleep 1 -find . -name '*.otf' | cpio -updm "${fastdldir}" -find . -name '*.ttf' | cpio -updm "${fastdldir}" -find . -name '*.png' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.otf' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.ttf' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.png' | cpio -updm "${fastdldir}" echo "Done" sleep 1 -# Going back to scriptfolder to avoid mistakes -cd "${rootdir}" - # Correct addons folder structure if [ -d "${fastdldir}/addons" ]; then echo "Possible FastDL files found into addons" - echo "Moving those files to their correct folder" + echo "Copying those files to their correct folder" sleep 2 cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}" - rm -R "${fastdldir}/addons" +# As we're not sure about the correct file structure, duplicate instead of remove +# rm -R "${fastdldir}/addons" echo "Done" sleep 1 fi @@ -146,38 +197,27 @@ fn_check_bzip2(){ # Returns true if not installed if [ -z "$(command -v bzip2)" ]; then bzip2installed="0" - echo "WARNING bzip2 packed is not installed !" - sleep 2 - echo "You can't compress your FastDL files !" + fn_printinfo "bzip2 is not installed !" + fn_scriptlog "bzip2 is not installed" + echo "We advise using it" + echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl#bzip2-compression" sleep 2 - echo "Loading time won't be as good as possible for your players." - sleep 2 - echo "It's advised that your install bzip2 and re-run the fastdl command." - sleep 3 else bzip2installed="1" fi } fn_fastdl_bzip2(){ -echo "Do you want to compress files using bzip2 for even faster client download ?" -echo "It may take a while..." - while true; do - read -p "Continue? [y/N]" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) return 0;; - * ) echo "Please answer yes or no.";; - esac - done -echo "Compressing files using bzip2..." -sleep 2 - -# bzip2 all files that are not already compressed (keeping original files) -find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -k \{\} \; -echo "bzip2 compression done" -sleep 1 +if [ bzip2enable == "on" ]; then + fn_printinfo "Compressing files using bzip2..." + fn_scriptlog "Compressing files using bzip2..." + sleep 2 + # bzip2 all files that are not already compressed (keeping original files) + find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -k \{\} \; + fn_printinfo "bzip2 compression done" + fn_scriptlog "bzip2 compression done" + sleep 1 } # Generate lua file that will force download any file into the FastDL folder @@ -218,14 +258,18 @@ if [ "$bzip2installed" == "0" ]; then echo "By the way, you'd better install bzip2 an re-run this command" fi echo "----------------------------------" +echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl" } # Game checking # Garry's Mod if [ "${gamename}" == "Garry's Mod" ]; then + fn_check_bzip2 fn_fastdl_init + fn_fastdl_config + fn_fastdl_gmod_config + fn_clearoldfastdl fn_gmod_fastdl - fn_check_bzip2 if [ "${bzip2installed}" == "1" ]; then fn_fastdl_bzip2 fi From e7beeb76ac31891cea13b3bbcfe1f90506fe587e Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 04:07:28 +0100 Subject: [PATCH 11/55] missing fis and then and more fixes --- functions/command_fastdl.sh | 66 +++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 5a8166910..fd410400c 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -21,6 +21,20 @@ luasvautorundir="${systemdir}/lua/audoturn/server" luafastdlfile="lgsm_cl_force_fastdl.lua" luafastdlfullpath="${luasvautorundir}/${luafastdlfile}" +fn_check_bzip2(){ +# Returns true if not installed +if [ -z "$(command -v bzip2)" ]; then + bzip2installed="0" + fn_printinfo "bzip2 is not installed !" + fn_scriptlog "bzip2 is not installed" + echo "We advise using it" + echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl#bzip2-compression" + sleep 2 +else + bzip2installed="1" +fi +} + fn_fastdl_init(){ # User confirmation fn_printdots "Welcome to LGSM's FastDL generator" @@ -72,20 +86,22 @@ if [ ${newfastdl} == 1 ]; then esac done fi -echo "Compress files using bzip2 for faster client download?" -echo "(It may take a while)" -while true; do - read -p "Use bzip2? [y/n]" yn - case $yn in - [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; break;; - [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled" break;; - * ) echo "Please answer yes or no.";; - esac -done +if [ ${bzip2installed} == 1 ]; then + echo "Compress files using bzip2 for faster client download?" + echo "(It may take a while)" + while true; do + read -p "Use bzip2? [y/n]" yn + case $yn in + [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; break;; + [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled" break;; + * ) echo "Please answer yes or no.";; + esac + done +fi } fn_fastdl_gmod_config(){ -# Ask for download enforcer using lua addfile resource generator +# Prompt for download enforcer, that is using a .lua addfile resource generator echo "Do you wish to force clients to downloading the whole FastDL content?" echo "It is useful for many addons where devs didn't register their files to be downloaded through FastDL." while true; do @@ -98,12 +114,13 @@ while true; do done } -fn_clearoldfastdl(){ -if [ clearoldfastdl == "on" ] +fn_clear_old_fastdl(){ +if [ clearoldfastdl == "on" ]; then fn_printinfo "Clearing existing FastDL folder" fn_scriptlog "Clearing existing FastDL folder" sleep 1 - rm -R "${fastdldir}"/* + rm -R "${fastdldir}"/* +fi } fn_gmod_fastdl(){ @@ -191,25 +208,9 @@ if [ -d "${fastdldir}/lua" ]; then fi } - -# bzip2 compression -fn_check_bzip2(){ -# Returns true if not installed -if [ -z "$(command -v bzip2)" ]; then - bzip2installed="0" - fn_printinfo "bzip2 is not installed !" - fn_scriptlog "bzip2 is not installed" - echo "We advise using it" - echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl#bzip2-compression" - sleep 2 -else - bzip2installed="1" -fi -} - fn_fastdl_bzip2(){ -if [ bzip2enable == "on" ]; then +if [ ${bzip2enable} == "on" ]; then fn_printinfo "Compressing files using bzip2..." fn_scriptlog "Compressing files using bzip2..." sleep 2 @@ -218,6 +219,7 @@ if [ bzip2enable == "on" ]; then fn_printinfo "bzip2 compression done" fn_scriptlog "bzip2 compression done" sleep 1 +fi } # Generate lua file that will force download any file into the FastDL folder @@ -268,7 +270,7 @@ if [ "${gamename}" == "Garry's Mod" ]; then fn_fastdl_init fn_fastdl_config fn_fastdl_gmod_config - fn_clearoldfastdl + fn_clear_old_fastdl fn_gmod_fastdl if [ "${bzip2installed}" == "1" ]; then fn_fastdl_bzip2 From 7f28e93a25edbd0307a423f2cb27e5fcbeba594b Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 04:17:43 +0100 Subject: [PATCH 12/55] test user interface --- functions/command_fastdl.sh | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index fd410400c..f78fe3a23 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -37,7 +37,8 @@ fi fn_fastdl_init(){ # User confirmation -fn_printdots "Welcome to LGSM's FastDL generator" +fn_printok "Welcome to LGSM's FastDL generator" +echo -en "\n" fn_scriptlog "Started FastDL creation" sleep 1 while true; do @@ -52,7 +53,7 @@ fn_scriptlog "Initiating FastDL creation" # Check and create folders if [ ! -d "${webdir}" ]; then - fn_printinfo "Creating www directory..." + fn_printdots "Creating www directory..." sleep 0.5 mkdir -v "${webdir}" sleep 1 @@ -60,11 +61,13 @@ if [ ! -d "${webdir}" ]; then fi if [ ! -d "${fastdldir}" ]; then newfastdl=1 - fn_printinfo "Creating FastDL directory..." + fn_printdots "Creating FastDL directory..." sleep 0.5 mkdir -v "${fastdldir}" sleep 1 fn_scriptlog "FastDL created ${fastdldir}" + fn_printok "Folders created" + echo -en "\n" else newfastdl=0 fi @@ -73,27 +76,29 @@ fi fn_fastdl_config(){ fn_printinfo "Configuration..." fn_scriptlog "Configuration" +echo -en "\n" sleep 2 if [ ${newfastdl} == 1 ]; then - fn_printinfo "Do you wish to clear old FastDL files?" - echo "(Useful if some files changed)" + fn_printdots "Enable clearing old FastDL files? (Useful if some files changed)" while true; do read -p "Clear old FastDL? [y/n]" yn case $yn in - [Yy]* ) clearoldfastdl="on"; fn_scriptlog "clearoldfastdl enabled"; break;; - [Nn]* ) clearoldfastdl="off"; fn_scriptlog "clearoldfastdl disabled" break;; + [Yy]* ) clearoldfastdl="on"; fn_scriptlog "clearoldfastdl enabled"; fn_printok "Enabled"; break;; + [Nn]* ) clearoldfastdl="off"; fn_scriptlog "clearoldfastdl disabled"; fn_printok "Disabled"; break;; * ) echo "Please answer yes or no.";; esac done + echo -en "\n" fi if [ ${bzip2installed} == 1 ]; then - echo "Compress files using bzip2 for faster client download?" - echo "(It may take a while)" + fn_printdots "Enable file compressiong using bzip2?" + echo -en "\n" + echo "It may take a while but is advised for faster client download" while true; do read -p "Use bzip2? [y/n]" yn case $yn in - [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; break;; - [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled" break;; + [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; fn_printok "Enabled"; break;; + [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled"; fn_printok "Disabled;" break;; * ) echo "Please answer yes or no.";; esac done From 306e5c0041120c16959148e00fb8ba9709e2aeb7 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 04:31:00 +0100 Subject: [PATCH 13/55] correct printok --- functions/command_fastdl.sh | 59 +++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index f78fe3a23..35c99c77b 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -74,34 +74,37 @@ fi } fn_fastdl_config(){ -fn_printinfo "Configuration..." +fn_printinfo "Entering configuration" fn_scriptlog "Configuration" echo -en "\n" sleep 2 if [ ${newfastdl} == 1 ]; then - fn_printdots "Enable clearing old FastDL files? (Useful if some files changed)" + fn_printdots "Enable clearing old FastDL files?" + sleep 1 while true; do read -p "Clear old FastDL? [y/n]" yn case $yn in - [Yy]* ) clearoldfastdl="on"; fn_scriptlog "clearoldfastdl enabled"; fn_printok "Enabled"; break;; - [Nn]* ) clearoldfastdl="off"; fn_scriptlog "clearoldfastdl disabled"; fn_printok "Disabled"; break;; + [Yy]* ) clearoldfastdl="on"; fn_scriptlog "clearoldfastdl enabled"; fn_printok "Clearing Enabled"; break;; + [Nn]* ) clearoldfastdl="off"; fn_scriptlog "clearoldfastdl disabled"; fn_printok "Clearing Disabled"; break;; * ) echo "Please answer yes or no.";; esac done + sleep 1 echo -en "\n" fi if [ ${bzip2installed} == 1 ]; then - fn_printdots "Enable file compressiong using bzip2?" - echo -en "\n" - echo "It may take a while but is advised for faster client download" + fn_printdots "Enable file compression using bzip2?" + sleep 1 while true; do read -p "Use bzip2? [y/n]" yn case $yn in - [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; fn_printok "Enabled"; break;; - [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled"; fn_printok "Disabled;" break;; + [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; fn_printok "bzip2 Enabled"; break;; + [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled"; fn_printok "bzip2 Disabled;" break;; * ) echo "Please answer yes or no.";; esac done + sleep 1 + echo -en "\n" fi } @@ -112,10 +115,12 @@ echo "It is useful for many addons where devs didn't register their files to be while true; do read -p "Use download enforcer? [y/n]" yn case $yn in - [Yy]* ) luaressource="on"; break;; - [Nn]* ) luaressource="off"; return 0;; + [Yy]* ) luaressource="on"; fn_scriptlog "DL enforcer Enabled"; fn_printok "DL enforcer Enabled"; break;; + [Nn]* ) luaressource="off"; "DL enforcer Disabled"; fn_printok "DL enforcer Disabled"; break;; * ) echo "Please answer yes or no.";; esac + sleep1 + echo -en "\n" done } @@ -125,12 +130,16 @@ if [ clearoldfastdl == "on" ]; then fn_scriptlog "Clearing existing FastDL folder" sleep 1 rm -R "${fastdldir}"/* + fn_printok "Old FastDL folder cleared" + fn_scriptlog "Old FastDL folder cleared" + echo -en "\n" fi } fn_gmod_fastdl(){ # Copy all needed files for fastDL fn_printdots "Gathering all needed FastDL files..." +echo -en "\n" sleep 1 # Map Files @@ -138,7 +147,8 @@ fn_printdots "Copying map files..." fn_scriptlog "Copying map files" sleep 1 find "${addonsdir}" -name '*.bsp' | cpio -updm "${fastdldir}" -echo "Done" +fn_printok +echo -en "\n" sleep 1 # Materials @@ -147,7 +157,8 @@ fn_scriptlog "Copying materials" sleep 1 find "${addonsdir}" -name '*.vtf' | cpio -updm "${fastdldir}" find "${addonsdir}" -name '*.vmt' | cpio -updm "${fastdldir}" -echo "Done" +fn_printok +echo -en "\n" sleep 1 # Models @@ -158,7 +169,8 @@ find "${addonsdir}" -name '*.vtx' | cpio -updm "${fastdldir}" find "${addonsdir}" -name '*.vvd' | cpio -updm "${fastdldir}" find "${addonsdir}" -name '*.mdl' | cpio -updm "${fastdldir}" find "${addonsdir}" -name '*.phy' | cpio -updm "${fastdldir}" -echo "Done" +fn_printok +echo -en "\n" sleep 1 # Particles @@ -166,7 +178,8 @@ fn_printdots "Copying particles" fn_scriptlog "Copying particles" sleep 1 find "${addonsdir}" -name '*.pcf' | cpio -updm "${fastdldir}" -echo "Done" +fn_printok +echo -en "\n" sleep 1 # Sounds @@ -176,7 +189,8 @@ sleep 1 find "${addonsdir}" -name '*.wav' | cpio -updm "${fastdldir}" find "${addonsdir}" -name '*.mp3' | cpio -updm "${fastdldir}" find "${addonsdir}" -name '*.ogg' | cpio -updm "${fastdldir}" -echo "Done" +fn_printok +echo -en "\n" sleep 1 # Resources (mostly fonts) @@ -186,7 +200,8 @@ sleep 1 find "${addonsdir}" -name '*.otf' | cpio -updm "${fastdldir}" find "${addonsdir}" -name '*.ttf' | cpio -updm "${fastdldir}" find "${addonsdir}" -name '*.png' | cpio -updm "${fastdldir}" -echo "Done" +fn_printok +echo -en "\n" sleep 1 # Correct addons folder structure @@ -197,18 +212,18 @@ if [ -d "${fastdldir}/addons" ]; then cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}" # As we're not sure about the correct file structure, duplicate instead of remove # rm -R "${fastdldir}/addons" - echo "Done" + fn_printok + echo -en "\n" sleep 1 fi # Correct content that may be into a lua folder by mistake like some darkrpmodification addons if [ -d "${fastdldir}/lua" ]; then - echo "Some FastDL files (often addons in darkrpmodifications) may be in the wrong folder" - sleep 1 - echo "Copying those files to their hopefully correct locations" + fn_printdots "Stupid filestructure fix" sleep 1 cp -Rf "${fastdldir}/lua/"* "${fastdldir}" - echo "Done" + fn_printok + echo -en "\n" sleep 1 fi } From 079dde953d86defce6018205142eafe40e8dae4d Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 04:34:46 +0100 Subject: [PATCH 14/55] test fix prompt --- functions/command_fastdl.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 35c99c77b..7b589be5c 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -27,6 +27,8 @@ if [ -z "$(command -v bzip2)" ]; then bzip2installed="0" fn_printinfo "bzip2 is not installed !" fn_scriptlog "bzip2 is not installed" + echo -en "\n" + sleep 1 echo "We advise using it" echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl#bzip2-compression" sleep 2 @@ -80,6 +82,7 @@ echo -en "\n" sleep 2 if [ ${newfastdl} == 1 ]; then fn_printdots "Enable clearing old FastDL files?" + echo "" sleep 1 while true; do read -p "Clear old FastDL? [y/n]" yn From 38fece3b0b09db0656a143e15788057a69cd1adc Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 04:37:02 +0100 Subject: [PATCH 15/55] test fix prompt 2 --- functions/command_fastdl.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 7b589be5c..f52b041e2 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -96,10 +96,10 @@ if [ ${newfastdl} == 1 ]; then echo -en "\n" fi if [ ${bzip2installed} == 1 ]; then - fn_printdots "Enable file compression using bzip2?" + fn_printdots sleep 1 while true; do - read -p "Use bzip2? [y/n]" yn + read -p "Enable file compression using bzip2?? [Y/n]" Yn case $yn in [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; fn_printok "bzip2 Enabled"; break;; [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled"; fn_printok "bzip2 Disabled;" break;; From 687153d889806f689afce4057fa6f3d8514ffec6 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 04:43:35 +0100 Subject: [PATCH 16/55] fix newfastDL + user iface --- functions/command_fastdl.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index f52b041e2..2dc3cd033 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -7,7 +7,7 @@ lgsm_version="190216" # Description: Creates a FastDL folder -local modulename="FastDL Creator" +local modulename="FastDL" function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" check.sh @@ -57,7 +57,7 @@ fn_scriptlog "Initiating FastDL creation" if [ ! -d "${webdir}" ]; then fn_printdots "Creating www directory..." sleep 0.5 - mkdir -v "${webdir}" + mkdir "${webdir}" sleep 1 fn_scriptlog "FastDL created ${webdir}" fi @@ -65,7 +65,7 @@ if [ ! -d "${fastdldir}" ]; then newfastdl=1 fn_printdots "Creating FastDL directory..." sleep 0.5 - mkdir -v "${fastdldir}" + mkdir "${fastdldir}" sleep 1 fn_scriptlog "FastDL created ${fastdldir}" fn_printok "Folders created" @@ -80,12 +80,10 @@ fn_printinfo "Entering configuration" fn_scriptlog "Configuration" echo -en "\n" sleep 2 -if [ ${newfastdl} == 1 ]; then - fn_printdots "Enable clearing old FastDL files?" - echo "" - sleep 1 +if [ ${newfastdl} == 0 ]; then + fn_printdots while true; do - read -p "Clear old FastDL? [y/n]" yn + read -p "Clear old FastDL files? [y/n]" yn case $yn in [Yy]* ) clearoldfastdl="on"; fn_scriptlog "clearoldfastdl enabled"; fn_printok "Clearing Enabled"; break;; [Nn]* ) clearoldfastdl="off"; fn_scriptlog "clearoldfastdl disabled"; fn_printok "Clearing Disabled"; break;; @@ -113,13 +111,12 @@ fi fn_fastdl_gmod_config(){ # Prompt for download enforcer, that is using a .lua addfile resource generator -echo "Do you wish to force clients to downloading the whole FastDL content?" -echo "It is useful for many addons where devs didn't register their files to be downloaded through FastDL." +fn_printdots while true; do - read -p "Use download enforcer? [y/n]" yn + read -p "Use client download enforcer? [y/n]" yn case $yn in - [Yy]* ) luaressource="on"; fn_scriptlog "DL enforcer Enabled"; fn_printok "DL enforcer Enabled"; break;; - [Nn]* ) luaressource="off"; "DL enforcer Disabled"; fn_printok "DL enforcer Disabled"; break;; + [Yy]* ) luaressource="on"; fn_scriptlog "DL enforcer Enabled"; fn_printok "Enforcer Enabled"; break;; + [Nn]* ) luaressource="off"; "DL enforcer Disabled"; fn_printok "Enforcer Disabled"; break;; * ) echo "Please answer yes or no.";; esac sleep1 From 8329b07f1f8445e066ac434b23c7ae54c7d7e90f Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 04:44:02 +0100 Subject: [PATCH 17/55] double ? --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 2dc3cd033..76027fb80 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -97,7 +97,7 @@ if [ ${bzip2installed} == 1 ]; then fn_printdots sleep 1 while true; do - read -p "Enable file compression using bzip2?? [Y/n]" Yn + read -p "Enable file compression using bzip2? [Y/n]" Yn case $yn in [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; fn_printok "bzip2 Enabled"; break;; [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled"; fn_printok "bzip2 Disabled;" break;; From 0b6b6ea6244dbb6fa5d33e6a1aa6ca63cd6d2023 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 04:53:43 +0100 Subject: [PATCH 18/55] > /dev/null 2>&1 --- functions/command_fastdl.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 76027fb80..b8c1fa033 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -146,7 +146,7 @@ sleep 1 fn_printdots "Copying map files..." fn_scriptlog "Copying map files" sleep 1 -find "${addonsdir}" -name '*.bsp' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.bsp' | cpio -updm "${fastdldir}" > /dev/null 2>&1 fn_printok echo -en "\n" sleep 1 @@ -155,8 +155,8 @@ sleep 1 fn_printdots "Copying materials" fn_scriptlog "Copying materials" sleep 1 -find "${addonsdir}" -name '*.vtf' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.vmt' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.vtf' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.vmt' | cpio -updm "${fastdldir}" > /dev/null 2>&1 fn_printok echo -en "\n" sleep 1 @@ -165,10 +165,10 @@ sleep 1 fn_printdots "Copying models" fn_scriptlog "Copying models" sleep 1 -find "${addonsdir}" -name '*.vtx' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.vvd' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.mdl' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.phy' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.vtx' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.vvd' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.mdl' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.phy' | cpio -updm "${fastdldir}" > /dev/null 2>&1 fn_printok echo -en "\n" sleep 1 @@ -177,7 +177,7 @@ sleep 1 fn_printdots "Copying particles" fn_scriptlog "Copying particles" sleep 1 -find "${addonsdir}" -name '*.pcf' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.pcf' | cpio -updm "${fastdldir}" > /dev/null 2>&1 fn_printok echo -en "\n" sleep 1 @@ -186,9 +186,9 @@ sleep 1 fn_printdots "Copying sounds" fn_scriptlog "Copying sounds" sleep 1 -find "${addonsdir}" -name '*.wav' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.mp3' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.ogg' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.wav' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.mp3' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.ogg' | cpio -updm "${fastdldir}" > /dev/null 2>&1 fn_printok echo -en "\n" sleep 1 @@ -197,9 +197,9 @@ sleep 1 fn_printdots "Copying fonts and png" fn_scriptlog "Copying fonts and png" sleep 1 -find "${addonsdir}" -name '*.otf' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.ttf' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.png' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.otf' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.ttf' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.png' | cpio -updm "${fastdldir}" > /dev/null 2>&1 fn_printok echo -en "\n" sleep 1 @@ -235,7 +235,7 @@ if [ ${bzip2enable} == "on" ]; then fn_scriptlog "Compressing files using bzip2..." sleep 2 # bzip2 all files that are not already compressed (keeping original files) - find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -k \{\} \; + find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -k \{\} \; > /dev/null 2>&1 fn_printinfo "bzip2 compression done" fn_scriptlog "bzip2 compression done" sleep 1 From 1381bfca5ad3d735178b0f8d8caf40eb4862d8a8 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 04:57:14 +0100 Subject: [PATCH 19/55] /dev/null wrong idea, test --warning=none --- functions/command_fastdl.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index b8c1fa033..becdc3427 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -146,7 +146,7 @@ sleep 1 fn_printdots "Copying map files..." fn_scriptlog "Copying map files" sleep 1 -find "${addonsdir}" -name '*.bsp' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.bsp' | cpio -updm --warning=none "${fastdldir}" fn_printok echo -en "\n" sleep 1 @@ -155,8 +155,8 @@ sleep 1 fn_printdots "Copying materials" fn_scriptlog "Copying materials" sleep 1 -find "${addonsdir}" -name '*.vtf' | cpio -updm "${fastdldir}" > /dev/null 2>&1 -find "${addonsdir}" -name '*.vmt' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.vtf' | cpio -updm --warning=none "${fastdldir}" +find "${addonsdir}" -name '*.vmt' | cpio -updm --warning=none "${fastdldir}" fn_printok echo -en "\n" sleep 1 @@ -165,10 +165,10 @@ sleep 1 fn_printdots "Copying models" fn_scriptlog "Copying models" sleep 1 -find "${addonsdir}" -name '*.vtx' | cpio -updm "${fastdldir}" > /dev/null 2>&1 -find "${addonsdir}" -name '*.vvd' | cpio -updm "${fastdldir}" > /dev/null 2>&1 -find "${addonsdir}" -name '*.mdl' | cpio -updm "${fastdldir}" > /dev/null 2>&1 -find "${addonsdir}" -name '*.phy' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.vtx' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.vvd' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.mdl' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.phy' | cpio -updm "${fastdldir}" fn_printok echo -en "\n" sleep 1 @@ -177,7 +177,7 @@ sleep 1 fn_printdots "Copying particles" fn_scriptlog "Copying particles" sleep 1 -find "${addonsdir}" -name '*.pcf' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.pcf' | cpio -updm "${fastdldir}" fn_printok echo -en "\n" sleep 1 @@ -186,9 +186,9 @@ sleep 1 fn_printdots "Copying sounds" fn_scriptlog "Copying sounds" sleep 1 -find "${addonsdir}" -name '*.wav' | cpio -updm "${fastdldir}" > /dev/null 2>&1 -find "${addonsdir}" -name '*.mp3' | cpio -updm "${fastdldir}" > /dev/null 2>&1 -find "${addonsdir}" -name '*.ogg' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.wav' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.mp3' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.ogg' | cpio -updm "${fastdldir}" fn_printok echo -en "\n" sleep 1 @@ -197,9 +197,9 @@ sleep 1 fn_printdots "Copying fonts and png" fn_scriptlog "Copying fonts and png" sleep 1 -find "${addonsdir}" -name '*.otf' | cpio -updm "${fastdldir}" > /dev/null 2>&1 -find "${addonsdir}" -name '*.ttf' | cpio -updm "${fastdldir}" > /dev/null 2>&1 -find "${addonsdir}" -name '*.png' | cpio -updm "${fastdldir}" > /dev/null 2>&1 +find "${addonsdir}" -name '*.otf' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.ttf' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.png' | cpio -updm "${fastdldir}" fn_printok echo -en "\n" sleep 1 @@ -235,7 +235,7 @@ if [ ${bzip2enable} == "on" ]; then fn_scriptlog "Compressing files using bzip2..." sleep 2 # bzip2 all files that are not already compressed (keeping original files) - find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -k \{\} \; > /dev/null 2>&1 + find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -k \{\} \; fn_printinfo "bzip2 compression done" fn_scriptlog "bzip2 compression done" sleep 1 From b3a9c506aef31b8e92630da42ac50ba4eca42fea Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 05:01:55 +0100 Subject: [PATCH 20/55] quiet cpio --- functions/command_fastdl.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index becdc3427..432402760 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -146,7 +146,7 @@ sleep 1 fn_printdots "Copying map files..." fn_scriptlog "Copying map files" sleep 1 -find "${addonsdir}" -name '*.bsp' | cpio -updm --warning=none "${fastdldir}" +find "${addonsdir}" -name '*.bsp' | cpio --quiet -updm "${fastdldir}" fn_printok echo -en "\n" sleep 1 @@ -155,8 +155,8 @@ sleep 1 fn_printdots "Copying materials" fn_scriptlog "Copying materials" sleep 1 -find "${addonsdir}" -name '*.vtf' | cpio -updm --warning=none "${fastdldir}" -find "${addonsdir}" -name '*.vmt' | cpio -updm --warning=none "${fastdldir}" +find "${addonsdir}" -name '*.vtf' | cpio --quiet -updm "${fastdldir}" +find "${addonsdir}" -name '*.vmt' | cpio --quiet -updm "${fastdldir}" fn_printok echo -en "\n" sleep 1 @@ -165,10 +165,10 @@ sleep 1 fn_printdots "Copying models" fn_scriptlog "Copying models" sleep 1 -find "${addonsdir}" -name '*.vtx' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.vvd' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.mdl' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.phy' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.vtx' | cpio --quiet -updm "${fastdldir}" +find "${addonsdir}" -name '*.vvd' | cpio --quiet -updm "${fastdldir}" +find "${addonsdir}" -name '*.mdl' | cpio --quiet -updm "${fastdldir}" +find "${addonsdir}" -name '*.phy' | cpio --quiet -updm "${fastdldir}" fn_printok echo -en "\n" sleep 1 @@ -177,7 +177,7 @@ sleep 1 fn_printdots "Copying particles" fn_scriptlog "Copying particles" sleep 1 -find "${addonsdir}" -name '*.pcf' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.pcf' | cpio --quiet -updm "${fastdldir}" fn_printok echo -en "\n" sleep 1 @@ -186,9 +186,9 @@ sleep 1 fn_printdots "Copying sounds" fn_scriptlog "Copying sounds" sleep 1 -find "${addonsdir}" -name '*.wav' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.mp3' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.ogg' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.wav' | cpio --quiet -updm "${fastdldir}" +find "${addonsdir}" -name '*.mp3' | cpio --quiet -updm "${fastdldir}" +find "${addonsdir}" -name '*.ogg' | cpio --quiet -updm "${fastdldir}" fn_printok echo -en "\n" sleep 1 @@ -197,9 +197,9 @@ sleep 1 fn_printdots "Copying fonts and png" fn_scriptlog "Copying fonts and png" sleep 1 -find "${addonsdir}" -name '*.otf' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.ttf' | cpio -updm "${fastdldir}" -find "${addonsdir}" -name '*.png' | cpio -updm "${fastdldir}" +find "${addonsdir}" -name '*.otf' | cpio --quiet -updm "${fastdldir}" +find "${addonsdir}" -name '*.ttf' | cpio --quiet -updm "${fastdldir}" +find "${addonsdir}" -name '*.png' | cpio --quiet -updm "${fastdldir}" fn_printok echo -en "\n" sleep 1 From cd2b8efa19ac7c9650efdd4416d3246bb66ba7d6 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 05:05:29 +0100 Subject: [PATCH 21/55] fix variable --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 432402760..44d276d5a 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -125,7 +125,7 @@ done } fn_clear_old_fastdl(){ -if [ clearoldfastdl == "on" ]; then +if [ ${clearoldfastdl} == "on" ]; then fn_printinfo "Clearing existing FastDL folder" fn_scriptlog "Clearing existing FastDL folder" sleep 1 From 07294450a2cdb9e8c127de1e7e634c4fff20840c Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 05:42:26 +0100 Subject: [PATCH 22/55] better display & comments / silent bzip2 --- functions/command_fastdl.sh | 90 ++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 44d276d5a..69d91ae56 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -62,6 +62,7 @@ if [ ! -d "${webdir}" ]; then fn_scriptlog "FastDL created ${webdir}" fi if [ ! -d "${fastdldir}" ]; then + # No folder, won't ask for removing old ones newfastdl=1 fn_printdots "Creating FastDL directory..." sleep 0.5 @@ -71,19 +72,22 @@ if [ ! -d "${fastdldir}" ]; then fn_printok "Folders created" echo -en "\n" else + # Used to prompt for removing old files newfastdl=0 fi } fn_fastdl_config(){ +# Global settings for FastDL creation fn_printinfo "Entering configuration" fn_scriptlog "Configuration" echo -en "\n" sleep 2 +# Prompt for clearing old files if folder was already here if [ ${newfastdl} == 0 ]; then fn_printdots while true; do - read -p "Clear old FastDL files? [y/n]" yn + read -p "Clear old FastDL files? [y/N]" yN case $yn in [Yy]* ) clearoldfastdl="on"; fn_scriptlog "clearoldfastdl enabled"; fn_printok "Clearing Enabled"; break;; [Nn]* ) clearoldfastdl="off"; fn_scriptlog "clearoldfastdl disabled"; fn_printok "Clearing Disabled"; break;; @@ -93,9 +97,9 @@ if [ ${newfastdl} == 0 ]; then sleep 1 echo -en "\n" fi +# Prompt for using bzip2 if it's installed if [ ${bzip2installed} == 1 ]; then fn_printdots - sleep 1 while true; do read -p "Enable file compression using bzip2? [Y/n]" Yn case $yn in @@ -113,7 +117,7 @@ fn_fastdl_gmod_config(){ # Prompt for download enforcer, that is using a .lua addfile resource generator fn_printdots while true; do - read -p "Use client download enforcer? [y/n]" yn + read -p "Use client download enforcer? [Y/n]" Yn case $yn in [Yy]* ) luaressource="on"; fn_scriptlog "DL enforcer Enabled"; fn_printok "Enforcer Enabled"; break;; [Nn]* ) luaressource="off"; "DL enforcer Disabled"; fn_printok "Enforcer Disabled"; break;; @@ -125,6 +129,7 @@ done } fn_clear_old_fastdl(){ +# Clearing old FastDL if user answered yes if [ ${clearoldfastdl} == "on" ]; then fn_printinfo "Clearing existing FastDL folder" fn_scriptlog "Clearing existing FastDL folder" @@ -138,7 +143,7 @@ fi fn_gmod_fastdl(){ # Copy all needed files for fastDL -fn_printdots "Gathering all needed FastDL files..." +fn_printdots "Gathering all needed files..." echo -en "\n" sleep 1 @@ -147,95 +152,97 @@ fn_printdots "Copying map files..." fn_scriptlog "Copying map files" sleep 1 find "${addonsdir}" -name '*.bsp' | cpio --quiet -updm "${fastdldir}" -fn_printok +fn_printok "Map files copied" echo -en "\n" sleep 1 # Materials -fn_printdots "Copying materials" +fn_printdots "Copying materials..." fn_scriptlog "Copying materials" sleep 1 find "${addonsdir}" -name '*.vtf' | cpio --quiet -updm "${fastdldir}" find "${addonsdir}" -name '*.vmt' | cpio --quiet -updm "${fastdldir}" -fn_printok +fn_printok "Materials copied" echo -en "\n" sleep 1 # Models -fn_printdots "Copying models" +fn_printdots "Copying models..." fn_scriptlog "Copying models" sleep 1 find "${addonsdir}" -name '*.vtx' | cpio --quiet -updm "${fastdldir}" find "${addonsdir}" -name '*.vvd' | cpio --quiet -updm "${fastdldir}" find "${addonsdir}" -name '*.mdl' | cpio --quiet -updm "${fastdldir}" find "${addonsdir}" -name '*.phy' | cpio --quiet -updm "${fastdldir}" -fn_printok +fn_printok "Models copied" echo -en "\n" sleep 1 # Particles -fn_printdots "Copying particles" +fn_printdots "Copying particles..." fn_scriptlog "Copying particles" sleep 1 find "${addonsdir}" -name '*.pcf' | cpio --quiet -updm "${fastdldir}" -fn_printok +fn_printok "Particles copied" echo -en "\n" sleep 1 # Sounds -fn_printdots "Copying sounds" +fn_printdots "Copying sounds..." fn_scriptlog "Copying sounds" sleep 1 find "${addonsdir}" -name '*.wav' | cpio --quiet -updm "${fastdldir}" find "${addonsdir}" -name '*.mp3' | cpio --quiet -updm "${fastdldir}" find "${addonsdir}" -name '*.ogg' | cpio --quiet -updm "${fastdldir}" -fn_printok +fn_printok "Sounds copied" echo -en "\n" sleep 1 # Resources (mostly fonts) -fn_printdots "Copying fonts and png" +fn_printdots "Copying fonts and png..." fn_scriptlog "Copying fonts and png" sleep 1 find "${addonsdir}" -name '*.otf' | cpio --quiet -updm "${fastdldir}" find "${addonsdir}" -name '*.ttf' | cpio --quiet -updm "${fastdldir}" find "${addonsdir}" -name '*.png' | cpio --quiet -updm "${fastdldir}" -fn_printok +fn_printok "Fonts and png copied" echo -en "\n" sleep 1 # Correct addons folder structure if [ -d "${fastdldir}/addons" ]; then - echo "Possible FastDL files found into addons" + fn_printinfo "Correcting file structure" + fn_scriptlog "Correcting file structure" + sleep 2 echo "Copying those files to their correct folder" sleep 2 cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}" -# As we're not sure about the correct file structure, duplicate instead of remove -# rm -R "${fastdldir}/addons" - fn_printok + # As we're not sure about the correct file structure, duplicate instead of remove + # rm -R "${fastdldir}/addons" + fn_printok "Corrected file structure" echo -en "\n" sleep 1 fi # Correct content that may be into a lua folder by mistake like some darkrpmodification addons if [ -d "${fastdldir}/lua" ]; then - fn_printdots "Stupid filestructure fix" + fn_printdots "Stupid file structure fix" sleep 1 cp -Rf "${fastdldir}/lua/"* "${fastdldir}" - fn_printok + fn_printok "Stupid file structure fixed" echo -en "\n" sleep 1 fi } fn_fastdl_bzip2(){ - +# Compressing using bzip2 if user said yes if [ ${bzip2enable} == "on" ]; then fn_printinfo "Compressing files using bzip2..." fn_scriptlog "Compressing files using bzip2..." sleep 2 # bzip2 all files that are not already compressed (keeping original files) - find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -k \{\} \; + find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -qk \{\} \; fn_printinfo "bzip2 compression done" fn_scriptlog "bzip2 compression done" sleep 1 @@ -244,7 +251,7 @@ fi # Generate lua file that will force download any file into the FastDL folder fn_lua_fastdl(){ -# Remove lua file if luaressource is turned off +# Remove lua file if luaressource is turned off and file exists if [ "${luaressource}" == "off" ]; then if [ -f "${luafastdlfullpath}" ]; then echo "Removing download enforcer" @@ -252,38 +259,43 @@ if [ "${luaressource}" == "off" ]; then rm -R "${luafastdlfullpath}" fi fi +# Remove old lua file and generate a new one if user said yes if [ "${luaressource}" == "on" ]; then if [ -f "${luafastdlfullpath}" ]; then - echo "Removing old download enforcer" + fn_printdots "Removing old download enforcer" sleep 1 rm "${luafastdlfullpath}" + fn_printok "Removed old download enforcer" + fn_scriptlog "Removed old download inforcer" + echo -en "\n" + sleep 1 fi - echo "Generating new download enforcer" + fn_printdots "Generating new download enforcer" + fn_scriptlog "Generating new download enforcer" sleep 1 + # Read all filenames and put them into a lua file at the right path find "${fastdldir}" \( -name "." ! -name "*.bz2" \) -printf '%P\n' | while read line; do echo "resource.AddFile("\""${line}"\"")" >> "${luafastdlfullpath}" done - echo "Download enforcer generated" + fn_printok "Download enforcer generated" + fn_scriptlog "Download enforcer generated" + echo -en "\n" sleep 1 fi } fn_fastdl_completed(){ -echo "----------------------------------" -echo "Congratulations, it's done" -echo "Now you should configure your HTTP server to target the fastdl folder that was created in ${fastdldir}" -echo "Or copy files to an external server" -echo "Don't forget to change your sv_downloadurl accordingly in ${servercfgfullpath}" -echo "You may want to use the www folder to host a loadingurl too," -echo "for that purpose, just make a loadingurl folder next to the fastdl folder and put your loadingurl in it" +# Finished message +fn_printok "Congratulations, it's done" +fn_scriptlog "FastDL job done" +echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl" +echo -en "\n" if [ "$bzip2installed" == "0" ]; then echo "By the way, you'd better install bzip2 an re-run this command" fi -echo "----------------------------------" -echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl" } -# Game checking +# Game checking and functions running # Garry's Mod if [ "${gamename}" == "Garry's Mod" ]; then fn_check_bzip2 @@ -292,10 +304,8 @@ if [ "${gamename}" == "Garry's Mod" ]; then fn_fastdl_gmod_config fn_clear_old_fastdl fn_gmod_fastdl - if [ "${bzip2installed}" == "1" ]; then - fn_fastdl_bzip2 - fi fn_lua_fastdl + fn_fastdl_bzip2 fn_fastdl_completed exit fi From 433c99ad64dd934f214792c8bf81e919cafb6cca Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:03:04 +0100 Subject: [PATCH 23/55] two main fixes & improved user experience --- functions/command_fastdl.sh | 72 ++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 69d91ae56..1f9941add 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -146,12 +146,13 @@ fn_gmod_fastdl(){ fn_printdots "Gathering all needed files..." echo -en "\n" sleep 1 - +# No choice to cd to the directory, as find can't then display relative folder +cd "${addonsdir}" # Map Files fn_printdots "Copying map files..." fn_scriptlog "Copying map files" sleep 1 -find "${addonsdir}" -name '*.bsp' | cpio --quiet -updm "${fastdldir}" +find . -name '*.bsp' | cpio --quiet -updm "${fastdldir}" fn_printok "Map files copied" echo -en "\n" sleep 1 @@ -160,8 +161,8 @@ sleep 1 fn_printdots "Copying materials..." fn_scriptlog "Copying materials" sleep 1 -find "${addonsdir}" -name '*.vtf' | cpio --quiet -updm "${fastdldir}" -find "${addonsdir}" -name '*.vmt' | cpio --quiet -updm "${fastdldir}" +find . -name '*.vtf' | cpio --quiet -updm "${fastdldir}" +find . -name '*.vmt' | cpio --quiet -updm "${fastdldir}" fn_printok "Materials copied" echo -en "\n" sleep 1 @@ -170,10 +171,10 @@ sleep 1 fn_printdots "Copying models..." fn_scriptlog "Copying models" sleep 1 -find "${addonsdir}" -name '*.vtx' | cpio --quiet -updm "${fastdldir}" -find "${addonsdir}" -name '*.vvd' | cpio --quiet -updm "${fastdldir}" -find "${addonsdir}" -name '*.mdl' | cpio --quiet -updm "${fastdldir}" -find "${addonsdir}" -name '*.phy' | cpio --quiet -updm "${fastdldir}" +find . -name '*.vtx' | cpio --quiet -updm "${fastdldir}" +find . -name '*.vvd' | cpio --quiet -updm "${fastdldir}" +find . -name '*.mdl' | cpio --quiet -updm "${fastdldir}" +find . -name '*.phy' | cpio --quiet -updm "${fastdldir}" fn_printok "Models copied" echo -en "\n" sleep 1 @@ -182,7 +183,7 @@ sleep 1 fn_printdots "Copying particles..." fn_scriptlog "Copying particles" sleep 1 -find "${addonsdir}" -name '*.pcf' | cpio --quiet -updm "${fastdldir}" +find . -name '*.pcf' | cpio --quiet -updm "${fastdldir}" fn_printok "Particles copied" echo -en "\n" sleep 1 @@ -191,9 +192,9 @@ sleep 1 fn_printdots "Copying sounds..." fn_scriptlog "Copying sounds" sleep 1 -find "${addonsdir}" -name '*.wav' | cpio --quiet -updm "${fastdldir}" -find "${addonsdir}" -name '*.mp3' | cpio --quiet -updm "${fastdldir}" -find "${addonsdir}" -name '*.ogg' | cpio --quiet -updm "${fastdldir}" +find . -name '*.wav' | cpio --quiet -updm "${fastdldir}" +find . -name '*.mp3' | cpio --quiet -updm "${fastdldir}" +find . -name '*.ogg' | cpio --quiet -updm "${fastdldir}" fn_printok "Sounds copied" echo -en "\n" sleep 1 @@ -202,12 +203,14 @@ sleep 1 fn_printdots "Copying fonts and png..." fn_scriptlog "Copying fonts and png" sleep 1 -find "${addonsdir}" -name '*.otf' | cpio --quiet -updm "${fastdldir}" -find "${addonsdir}" -name '*.ttf' | cpio --quiet -updm "${fastdldir}" -find "${addonsdir}" -name '*.png' | cpio --quiet -updm "${fastdldir}" +find . -name '*.otf' | cpio --quiet -updm "${fastdldir}" +find . -name '*.ttf' | cpio --quiet -updm "${fastdldir}" +find . -name '*.png' | cpio --quiet -updm "${fastdldir}" fn_printok "Fonts and png copied" echo -en "\n" sleep 1 +# Going back to rootdir in order to prevent crap from happening +cd "${rootdir}" # Correct addons folder structure if [ -d "${fastdldir}/addons" ]; then @@ -231,21 +234,7 @@ if [ -d "${fastdldir}/lua" ]; then cp -Rf "${fastdldir}/lua/"* "${fastdldir}" fn_printok "Stupid file structure fixed" echo -en "\n" - sleep 1 -fi -} - -fn_fastdl_bzip2(){ -# Compressing using bzip2 if user said yes -if [ ${bzip2enable} == "on" ]; then - fn_printinfo "Compressing files using bzip2..." - fn_scriptlog "Compressing files using bzip2..." sleep 2 - # bzip2 all files that are not already compressed (keeping original files) - find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -qk \{\} \; - fn_printinfo "bzip2 compression done" - fn_scriptlog "bzip2 compression done" - sleep 1 fi } @@ -254,9 +243,13 @@ fn_lua_fastdl(){ # Remove lua file if luaressource is turned off and file exists if [ "${luaressource}" == "off" ]; then if [ -f "${luafastdlfullpath}" ]; then - echo "Removing download enforcer" + fn_printdots "Removing download enforcer" sleep 1 rm -R "${luafastdlfullpath}" + fn_printok "Removed download enforcer" + fn_scriptlog "Removed old download inforcer" + echo -en "\n" + sleep 2 fi fi # Remove old lua file and generate a new one if user said yes @@ -266,7 +259,7 @@ if [ "${luaressource}" == "on" ]; then sleep 1 rm "${luafastdlfullpath}" fn_printok "Removed old download enforcer" - fn_scriptlog "Removed old download inforcer" + fn_scriptlog "Removed old download enforcer" echo -en "\n" sleep 1 fi @@ -275,11 +268,26 @@ if [ "${luaressource}" == "on" ]; then sleep 1 # Read all filenames and put them into a lua file at the right path find "${fastdldir}" \( -name "." ! -name "*.bz2" \) -printf '%P\n' | while read line; do - echo "resource.AddFile("\""${line}"\"")" >> "${luafastdlfullpath}" + echo "resource.AddFile("\""${line}"\"")" >> ${luafastdlfullpath} done fn_printok "Download enforcer generated" fn_scriptlog "Download enforcer generated" echo -en "\n" + echo "" + sleep 2 +fi +} + +fn_fastdl_bzip2(){ +# Compressing using bzip2 if user said yes +if [ ${bzip2enable} == "on" ]; then + fn_printdots "Compressing files using bzip2..." + fn_scriptlog "Compressing files using bzip2..." + sleep 2 + # bzip2 all files that are not already compressed (keeping original files) + find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -qk \{\} \; + fn_printinfo "bzip2 compression done" + fn_scriptlog "bzip2 compression done" sleep 1 fi } From 1242f0729ab84b4c859c5aa5b703b0c6c3530f6e Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:11:22 +0100 Subject: [PATCH 24/55] improved user experience --- functions/command_fastdl.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 1f9941add..c22a8f9f1 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -55,21 +55,25 @@ fn_scriptlog "Initiating FastDL creation" # Check and create folders if [ ! -d "${webdir}" ]; then - fn_printdots "Creating www directory..." - sleep 0.5 - mkdir "${webdir}" + fn_printinfo "Creating FastDL directories..." + echo -en "\n" sleep 1 + fn_printdots "Creating ${webdir} directory." + mkdir "${webdir}" + fn_printok fn_scriptlog "FastDL created ${webdir}" + sleep 1 + echo -en "\n" fi if [ ! -d "${fastdldir}" ]; then # No folder, won't ask for removing old ones newfastdl=1 fn_printdots "Creating FastDL directory..." - sleep 0.5 - mkdir "${fastdldir}" sleep 1 + mkdir "${fastdldir}" fn_scriptlog "FastDL created ${fastdldir}" fn_printok "Folders created" + sleep 1 echo -en "\n" else # Used to prompt for removing old files @@ -81,8 +85,8 @@ fn_fastdl_config(){ # Global settings for FastDL creation fn_printinfo "Entering configuration" fn_scriptlog "Configuration" -echo -en "\n" sleep 2 +echo -en "\n" # Prompt for clearing old files if folder was already here if [ ${newfastdl} == 0 ]; then fn_printdots @@ -123,7 +127,7 @@ while true; do [Nn]* ) luaressource="off"; "DL enforcer Disabled"; fn_printok "Enforcer Disabled"; break;; * ) echo "Please answer yes or no.";; esac - sleep1 + sleep 1 echo -en "\n" done } @@ -137,6 +141,7 @@ if [ ${clearoldfastdl} == "on" ]; then rm -R "${fastdldir}"/* fn_printok "Old FastDL folder cleared" fn_scriptlog "Old FastDL folder cleared" + sleep 1 echo -en "\n" fi } @@ -296,10 +301,10 @@ fn_fastdl_completed(){ # Finished message fn_printok "Congratulations, it's done" fn_scriptlog "FastDL job done" -echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl" echo -en "\n" +echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl" if [ "$bzip2installed" == "0" ]; then -echo "By the way, you'd better install bzip2 an re-run this command" +echo "By the way, you'd better install bzip2 an re-run this command !" fi } From fac14231876f55f4b811ed41e4694139cb5c312f Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:20:41 +0100 Subject: [PATCH 25/55] user experience + major fix --- functions/command_fastdl.sh | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index c22a8f9f1..350bddcf4 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -152,15 +152,15 @@ fn_printdots "Gathering all needed files..." echo -en "\n" sleep 1 # No choice to cd to the directory, as find can't then display relative folder -cd "${addonsdir}" +cd "${systemdir}" # Map Files fn_printdots "Copying map files..." fn_scriptlog "Copying map files" sleep 1 find . -name '*.bsp' | cpio --quiet -updm "${fastdldir}" fn_printok "Map files copied" -echo -en "\n" sleep 1 +echo -en "\n" # Materials fn_printdots "Copying materials..." @@ -169,8 +169,8 @@ sleep 1 find . -name '*.vtf' | cpio --quiet -updm "${fastdldir}" find . -name '*.vmt' | cpio --quiet -updm "${fastdldir}" fn_printok "Materials copied" -echo -en "\n" sleep 1 +echo -en "\n" # Models fn_printdots "Copying models..." @@ -181,8 +181,8 @@ find . -name '*.vvd' | cpio --quiet -updm "${fastdldir}" find . -name '*.mdl' | cpio --quiet -updm "${fastdldir}" find . -name '*.phy' | cpio --quiet -updm "${fastdldir}" fn_printok "Models copied" -echo -en "\n" sleep 1 +echo -en "\n" # Particles fn_printdots "Copying particles..." @@ -190,8 +190,8 @@ fn_scriptlog "Copying particles" sleep 1 find . -name '*.pcf' | cpio --quiet -updm "${fastdldir}" fn_printok "Particles copied" -echo -en "\n" sleep 1 +echo -en "\n" # Sounds fn_printdots "Copying sounds..." @@ -201,8 +201,8 @@ find . -name '*.wav' | cpio --quiet -updm "${fastdldir}" find . -name '*.mp3' | cpio --quiet -updm "${fastdldir}" find . -name '*.ogg' | cpio --quiet -updm "${fastdldir}" fn_printok "Sounds copied" -echo -en "\n" sleep 1 +echo -en "\n" # Resources (mostly fonts) fn_printdots "Copying fonts and png..." @@ -212,22 +212,20 @@ find . -name '*.otf' | cpio --quiet -updm "${fastdldir}" find . -name '*.ttf' | cpio --quiet -updm "${fastdldir}" find . -name '*.png' | cpio --quiet -updm "${fastdldir}" fn_printok "Fonts and png copied" -echo -en "\n" sleep 1 -# Going back to rootdir in order to prevent crap from happening +echo -en "\n" + +# Going back to rootdir in order to prevent mistakes cd "${rootdir}" -# Correct addons folder structure +# Correct addons folder structure for FastDL if [ -d "${fastdldir}/addons" ]; then - fn_printinfo "Correcting file structure" - fn_scriptlog "Correcting file structure" - sleep 2 - echo "Copying those files to their correct folder" + fn_printinfo "Adjusting addons' file structure" + fn_scriptlog "Adjusting addon's file structure" sleep 2 cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}" - # As we're not sure about the correct file structure, duplicate instead of remove - # rm -R "${fastdldir}/addons" - fn_printok "Corrected file structure" + rm -R "${fastdldir}/addons" + fn_printok "Adjusted addon's file structure" echo -en "\n" sleep 1 fi @@ -306,6 +304,7 @@ echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl if [ "$bzip2installed" == "0" ]; then echo "By the way, you'd better install bzip2 an re-run this command !" fi +echo "Credits : UltimateByte" } # Game checking and functions running From 196aef4dd3584541e2a6c01c44cedc1a8ba77b2b Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:27:00 +0100 Subject: [PATCH 26/55] updated darkrp and user exp --- functions/command_fastdl.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 350bddcf4..9b8ebde86 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -40,9 +40,9 @@ fi fn_fastdl_init(){ # User confirmation fn_printok "Welcome to LGSM's FastDL generator" +sleep 1 echo -en "\n" fn_scriptlog "Started FastDL creation" -sleep 1 while true; do read -p "Continue? [y/N]" yn case $yn in @@ -224,7 +224,7 @@ if [ -d "${fastdldir}/addons" ]; then fn_scriptlog "Adjusting addon's file structure" sleep 2 cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}" - rm -R "${fastdldir}/addons" +#Don't remove yet rm -R "${fastdldir}/addons" fn_printok "Adjusted addon's file structure" echo -en "\n" sleep 1 @@ -232,12 +232,15 @@ fi # Correct content that may be into a lua folder by mistake like some darkrpmodification addons if [ -d "${fastdldir}/lua" ]; then - fn_printdots "Stupid file structure fix" - sleep 1 + fn_printwarn "Typical DarkRP shit detected" + sleep 2 + echo -en "\n" + fn_printdots "Fixing DarkRP file structure..." + sleep 2 cp -Rf "${fastdldir}/lua/"* "${fastdldir}" fn_printok "Stupid file structure fixed" - echo -en "\n" sleep 2 + echo -en "\n" fi } From 77178ed1a87839f6085027c024882bbacd6e087d Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:31:09 +0100 Subject: [PATCH 27/55] user experience... --- functions/command_fastdl.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 9b8ebde86..1fb3f4393 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -147,12 +147,19 @@ fi } fn_gmod_fastdl(){ -# Copy all needed files for fastDL -fn_printdots "Gathering all needed files..." +# Copy all needed files for FastDL +echo "" +fn_printinfo "Starting..." +fn_scriptlog "Starting FastFL job" +sleep 2 echo -en "\n" +fn_printdots "Gathering all needed files..." sleep 1 +echo -en "\n" + # No choice to cd to the directory, as find can't then display relative folder cd "${systemdir}" + # Map Files fn_printdots "Copying map files..." fn_scriptlog "Copying map files" From acc948a077ce34604368288482c48a92663c7a50 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:34:24 +0100 Subject: [PATCH 28/55] user experience again --- functions/command_fastdl.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 1fb3f4393..cd75d15af 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -307,10 +307,12 @@ fi fn_fastdl_completed(){ # Finished message -fn_printok "Congratulations, it's done" +fn_printok "Congratulations, it's done !" fn_scriptlog "FastDL job done" +sleep 2 +echo -en "\n" +fn_printinfo "Need more doc ? See https://github.com/dgibbs64/linuxgsm/wiki/Fastdl" echo -en "\n" -echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl" if [ "$bzip2installed" == "0" ]; then echo "By the way, you'd better install bzip2 an re-run this command !" fi From 53113c865d261629f6d8ab5167b2d5f5a168f0d4 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:35:55 +0100 Subject: [PATCH 29/55] user experience again --- functions/command_fastdl.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index cd75d15af..2091ab3e7 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -58,9 +58,10 @@ if [ ! -d "${webdir}" ]; then fn_printinfo "Creating FastDL directories..." echo -en "\n" sleep 1 - fn_printdots "Creating ${webdir} directory." + fn_printdots "Creating ${webdir} directory" + sleep 1 mkdir "${webdir}" - fn_printok + fn_printok "Created ${webdir} directory" fn_scriptlog "FastDL created ${webdir}" sleep 1 echo -en "\n" From 4f83029df1f639fd46aae7f29219ba9d6aa94c2a Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:38:16 +0100 Subject: [PATCH 30/55] user experience --- functions/command_fastdl.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 2091ab3e7..8cdc0d231 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -69,11 +69,11 @@ fi if [ ! -d "${fastdldir}" ]; then # No folder, won't ask for removing old ones newfastdl=1 - fn_printdots "Creating FastDL directory..." + fn_printdots "Creating FastDL ${fastdldir} directory" sleep 1 mkdir "${fastdldir}" fn_scriptlog "FastDL created ${fastdldir}" - fn_printok "Folders created" + fn_printok "Created ${fastdldir} directory" sleep 1 echo -en "\n" else From bd28d8fe6effa98e1c5a6bf4c1b76d9e2f3c4afe Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:43:15 +0100 Subject: [PATCH 31/55] appearance --- functions/command_fastdl.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 8cdc0d231..079fa37d6 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -55,25 +55,26 @@ fn_scriptlog "Initiating FastDL creation" # Check and create folders if [ ! -d "${webdir}" ]; then - fn_printinfo "Creating FastDL directories..." + echo "" + fn_printinfo "Creating FastDL directories" echo -en "\n" sleep 1 - fn_printdots "Creating ${webdir} directory" + fn_printdots "Creating www directory" sleep 1 mkdir "${webdir}" - fn_printok "Created ${webdir} directory" - fn_scriptlog "FastDL created ${webdir}" + fn_printok "Created www directory" + fn_scriptlog "FastDL created www directory" sleep 1 echo -en "\n" fi if [ ! -d "${fastdldir}" ]; then # No folder, won't ask for removing old ones newfastdl=1 - fn_printdots "Creating FastDL ${fastdldir} directory" + fn_printdots "Creating FastDL fastdl directory" sleep 1 mkdir "${fastdldir}" - fn_scriptlog "FastDL created ${fastdldir}" - fn_printok "Created ${fastdldir} directory" + fn_printok "Created fastdl directory" + fn_scriptlog "FastDL created fastdl directory" sleep 1 echo -en "\n" else From 52b9e0dfe329bc83d41b99c83b952b51787b11a0 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:45:14 +0100 Subject: [PATCH 32/55] fixed shitty syntax --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 079fa37d6..583c5c55d 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -110,7 +110,7 @@ if [ ${bzip2installed} == 1 ]; then read -p "Enable file compression using bzip2? [Y/n]" Yn case $yn in [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; fn_printok "bzip2 Enabled"; break;; - [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled"; fn_printok "bzip2 Disabled;" break;; + [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled"; fn_printok "bzip2 Disabled"; break;; * ) echo "Please answer yes or no.";; esac done From 4fc0176160e2f361f966fd772e51cd28453ab8e0 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:58:48 +0100 Subject: [PATCH 33/55] fixed prompts --- functions/command_fastdl.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 583c5c55d..6826ce97a 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -44,7 +44,7 @@ sleep 1 echo -en "\n" fn_scriptlog "Started FastDL creation" while true; do - read -p "Continue? [y/N]" yn + read -e -i "y" -p "Continue? [Y/n]" yn case $yn in [Yy]* ) break;; [Nn]* ) exit;; @@ -93,7 +93,7 @@ echo -en "\n" if [ ${newfastdl} == 0 ]; then fn_printdots while true; do - read -p "Clear old FastDL files? [y/N]" yN + read -e -i "y" -p "Clear old FastDL files? [Y/n]" yn case $yn in [Yy]* ) clearoldfastdl="on"; fn_scriptlog "clearoldfastdl enabled"; fn_printok "Clearing Enabled"; break;; [Nn]* ) clearoldfastdl="off"; fn_scriptlog "clearoldfastdl disabled"; fn_printok "Clearing Disabled"; break;; @@ -107,7 +107,7 @@ fi if [ ${bzip2installed} == 1 ]; then fn_printdots while true; do - read -p "Enable file compression using bzip2? [Y/n]" Yn + read -e -i "y"-p "Enable file compression using bzip2? [Y/n]" yn case $yn in [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; fn_printok "bzip2 Enabled"; break;; [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled"; fn_printok "bzip2 Disabled"; break;; @@ -123,7 +123,7 @@ fn_fastdl_gmod_config(){ # Prompt for download enforcer, that is using a .lua addfile resource generator fn_printdots while true; do - read -p "Use client download enforcer? [Y/n]" Yn + read -e -i "y" -p "Use client download enforcer? [Y/n]" yn case $yn in [Yy]* ) luaressource="on"; fn_scriptlog "DL enforcer Enabled"; fn_printok "Enforcer Enabled"; break;; [Nn]* ) luaressource="off"; "DL enforcer Disabled"; fn_printok "Enforcer Disabled"; break;; From 62b05cf3d1f4ae6c39825a025b940766ec81ac90 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 06:59:46 +0100 Subject: [PATCH 34/55] missing space --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 6826ce97a..bf377cb68 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -107,7 +107,7 @@ fi if [ ${bzip2installed} == 1 ]; then fn_printdots while true; do - read -e -i "y"-p "Enable file compression using bzip2? [Y/n]" yn + read -e -i "y" -p "Enable file compression using bzip2? [Y/n]" yn case $yn in [Yy]* ) bzip2enable="on"; fn_scriptlog "bzip2 enabled"; fn_printok "bzip2 Enabled"; break;; [Nn]* ) bzip2enable="off"; fn_scriptlog "bzip2 disabled"; fn_printok "bzip2 Disabled"; break;; From dfad528cfbd765e62c35097003362b5864e9fe76 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 07:06:48 +0100 Subject: [PATCH 35/55] Don't try to empty an empty folder please --- functions/command_fastdl.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index bf377cb68..f9d6332e7 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -77,8 +77,8 @@ if [ ! -d "${fastdldir}" ]; then fn_scriptlog "FastDL created fastdl directory" sleep 1 echo -en "\n" -else - # Used to prompt for removing old files +# Used to prompt for removing old files if folder is not empty +elif [ "$(ls -A ${fastdldir)" ]; then newfastdl=0 fi } From d2cd659391dfb84120be3d170ebaeed0d857f38f Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 07:15:19 +0100 Subject: [PATCH 36/55] syntax --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index f9d6332e7..ae98990cf 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -78,7 +78,7 @@ if [ ! -d "${fastdldir}" ]; then sleep 1 echo -en "\n" # Used to prompt for removing old files if folder is not empty -elif [ "$(ls -A ${fastdldir)" ]; then +elif [ "$(ls -A "${fastdldir}")" ]; then newfastdl=0 fi } From 0ecb6b037b5b8e48b62cf490b77937abccf23d45 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 07:23:00 +0100 Subject: [PATCH 37/55] test check unexisting variable --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index ae98990cf..c0afb2612 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -90,7 +90,7 @@ fn_scriptlog "Configuration" sleep 2 echo -en "\n" # Prompt for clearing old files if folder was already here -if [ ${newfastdl} == 0 ]; then +if [ -z "${newfastdl}" ] && [ "${newfastdl}" == "0" ]; then fn_printdots while true; do read -e -i "y" -p "Clear old FastDL files? [Y/n]" yn From 6c7d52fc681fb3caf76fae11644f6701e1e81527 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 07:25:55 +0100 Subject: [PATCH 38/55] missing set variable --- functions/command_fastdl.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index c0afb2612..8cd58a700 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -80,6 +80,7 @@ if [ ! -d "${fastdldir}" ]; then # Used to prompt for removing old files if folder is not empty elif [ "$(ls -A "${fastdldir}")" ]; then newfastdl=0 + clearoldfastdl="off" fi } From f36e422e432075b94e65a3c24cc5d264dbdfa7ca Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 07:31:21 +0100 Subject: [PATCH 39/55] safety fix + syntax --- functions/command_fastdl.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 8cd58a700..3be952bd7 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -137,11 +137,11 @@ done fn_clear_old_fastdl(){ # Clearing old FastDL if user answered yes -if [ ${clearoldfastdl} == "on" ]; then +if [ "${clearoldfastdl}" == "on" ]; then fn_printinfo "Clearing existing FastDL folder" fn_scriptlog "Clearing existing FastDL folder" sleep 1 - rm -R "${fastdldir}"/* + rm -R "${fastdldir:?}"/* fn_printok "Old FastDL folder cleared" fn_scriptlog "Old FastDL folder cleared" sleep 1 @@ -234,7 +234,7 @@ if [ -d "${fastdldir}/addons" ]; then fn_scriptlog "Adjusting addon's file structure" sleep 2 cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}" -#Don't remove yet rm -R "${fastdldir}/addons" +#Don't remove yet rm -R "${fastdldir:?}/addons" fn_printok "Adjusted addon's file structure" echo -en "\n" sleep 1 @@ -261,7 +261,7 @@ if [ "${luaressource}" == "off" ]; then if [ -f "${luafastdlfullpath}" ]; then fn_printdots "Removing download enforcer" sleep 1 - rm -R "${luafastdlfullpath}" + rm -R "${luafastdlfullpath:?}" fn_printok "Removed download enforcer" fn_scriptlog "Removed old download inforcer" echo -en "\n" From 213a0d93aec3284a5b6f57127e46eb9f22f16364 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 07:34:32 +0100 Subject: [PATCH 40/55] updated darkrp message --- functions/command_fastdl.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 3be952bd7..cff4689eb 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -242,13 +242,10 @@ fi # Correct content that may be into a lua folder by mistake like some darkrpmodification addons if [ -d "${fastdldir}/lua" ]; then - fn_printwarn "Typical DarkRP shit detected" - sleep 2 - echo -en "\n" - fn_printdots "Fixing DarkRP file structure..." + fn_printdots "Typical DarkRP shit detected, fixing" sleep 2 cp -Rf "${fastdldir}/lua/"* "${fastdldir}" - fn_printok "Stupid file structure fixed" + fn_printok "Stupid DarkRP file structure fixed" sleep 2 echo -en "\n" fi From 1eaacbb1e97d9a4cc9c51b041318b1f7793f6525 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 07:43:55 +0100 Subject: [PATCH 41/55] fix lua generator, hopefully --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index cff4689eb..9680b7297 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -280,7 +280,7 @@ if [ "${luaressource}" == "on" ]; then fn_scriptlog "Generating new download enforcer" sleep 1 # Read all filenames and put them into a lua file at the right path - find "${fastdldir}" \( -name "." ! -name "*.bz2" \) -printf '%P\n' | while read line; do + find "${fastdldir}" \( -name "*.*" ! -name "*.bz2" \) -printf '%P\n' | while read line; do echo "resource.AddFile("\""${line}"\"")" >> ${luafastdlfullpath} done fn_printok "Download enforcer generated" From 93db23892c755d4184d73535f8a118ad7c4ae774 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 07:49:24 +0100 Subject: [PATCH 42/55] touch lua file before --- functions/command_fastdl.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 9680b7297..97c0bc32e 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -13,13 +13,7 @@ function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" check.sh # Directories -webdir="${rootdir}/www" -fastdldir="${webdir}/fastdl" -addonsdir="${systemdir}/addons" -# Server lua autorun dir, used to autorun lua on client connect to the server -luasvautorundir="${systemdir}/lua/audoturn/server" -luafastdlfile="lgsm_cl_force_fastdl.lua" -luafastdlfullpath="${luasvautorundir}/${luafastdlfile}" +luafastdlfullpath fn_check_bzip2(){ # Returns true if not installed @@ -279,6 +273,8 @@ if [ "${luaressource}" == "on" ]; then fn_printdots "Generating new download enforcer" fn_scriptlog "Generating new download enforcer" sleep 1 + # Create the lua file + touch "${luafastdlfullpath}" # Read all filenames and put them into a lua file at the right path find "${fastdldir}" \( -name "*.*" ! -name "*.bz2" \) -printf '%P\n' | while read line; do echo "resource.AddFile("\""${line}"\"")" >> ${luafastdlfullpath} From 5a881f5352682bb8eaa046af117ff40cbbec874b Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 07:52:23 +0100 Subject: [PATCH 43/55] putting back directories... --- functions/command_fastdl.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 97c0bc32e..bed50584b 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -13,7 +13,13 @@ function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" check.sh # Directories -luafastdlfullpath +webdir="${rootdir}/www" +fastdldir="${webdir}/fastdl" +addonsdir="${systemdir}/addons" +# Server lua autorun dir, used to autorun lua on client connect to the server +luasvautorundir="${systemdir}/lua/audoturn/server" +luafastdlfile="lgsm_cl_force_fastdl.lua" +luafastdlfullpath="${luasvautorundir}/${luafastdlfile}" fn_check_bzip2(){ # Returns true if not installed From 969bb25c92da149f732e2b51fa76ed7bdeedff01 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 07:56:43 +0100 Subject: [PATCH 44/55] clearoldfastdl fix --- functions/command_fastdl.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index bed50584b..da2ee537b 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -77,10 +77,9 @@ if [ ! -d "${fastdldir}" ]; then fn_scriptlog "FastDL created fastdl directory" sleep 1 echo -en "\n" -# Used to prompt for removing old files if folder is not empty + clearoldfastdl="off" # Nothing to clear elif [ "$(ls -A "${fastdldir}")" ]; then newfastdl=0 - clearoldfastdl="off" fi } From b3a43c07a61ab9a6ddf84cbdef790e6ae5a6024b Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 07:59:42 +0100 Subject: [PATCH 45/55] audoturn... sure ! --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index da2ee537b..af29c101e 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -17,7 +17,7 @@ webdir="${rootdir}/www" fastdldir="${webdir}/fastdl" addonsdir="${systemdir}/addons" # Server lua autorun dir, used to autorun lua on client connect to the server -luasvautorundir="${systemdir}/lua/audoturn/server" +luasvautorundir="${systemdir}/lua/autorun/server" luafastdlfile="lgsm_cl_force_fastdl.lua" luafastdlfullpath="${luasvautorundir}/${luafastdlfile}" From e45588398e6148d543eb7df6f63a1b3f6adac6ba Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 08:03:52 +0100 Subject: [PATCH 46/55] "touch" not needed + adjusting AddFile --- functions/command_fastdl.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index af29c101e..425a9e7f7 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -278,11 +278,9 @@ if [ "${luaressource}" == "on" ]; then fn_printdots "Generating new download enforcer" fn_scriptlog "Generating new download enforcer" sleep 1 - # Create the lua file - touch "${luafastdlfullpath}" # Read all filenames and put them into a lua file at the right path find "${fastdldir}" \( -name "*.*" ! -name "*.bz2" \) -printf '%P\n' | while read line; do - echo "resource.AddFile("\""${line}"\"")" >> ${luafastdlfullpath} + echo "resource.AddFile( "\""${line}"\"" )" >> ${luafastdlfullpath} done fn_printok "Download enforcer generated" fn_scriptlog "Download enforcer generated" @@ -312,6 +310,7 @@ fn_printok "Congratulations, it's done !" fn_scriptlog "FastDL job done" sleep 2 echo -en "\n" +echo "" fn_printinfo "Need more doc ? See https://github.com/dgibbs64/linuxgsm/wiki/Fastdl" echo -en "\n" if [ "$bzip2installed" == "0" ]; then From 18707efe0af154d9f98ee874a574ed1143e7bcc1 Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 08:41:08 +0100 Subject: [PATCH 47/55] proper check for fastdl --- functions/command_fastdl.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 425a9e7f7..f313c04d9 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -70,7 +70,7 @@ fi if [ ! -d "${fastdldir}" ]; then # No folder, won't ask for removing old ones newfastdl=1 - fn_printdots "Creating FastDL fastdl directory" + fn_printdots "Creating fastdl directory" sleep 1 mkdir "${fastdldir}" fn_printok "Created fastdl directory" @@ -90,7 +90,7 @@ fn_scriptlog "Configuration" sleep 2 echo -en "\n" # Prompt for clearing old files if folder was already here -if [ -z "${newfastdl}" ] && [ "${newfastdl}" == "0" ]; then +if [ -d "${newfastdl}" ] && [ "${newfastdl}" == "0" ]; then fn_printdots while true; do read -e -i "y" -p "Clear old FastDL files? [Y/n]" yn From 9733ab6fcb7bebb23d6367d40d554dd82d55083d Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 08:59:30 +0100 Subject: [PATCH 48/55] not -d ! -n ! --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index f313c04d9..969e8e289 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -90,7 +90,7 @@ fn_scriptlog "Configuration" sleep 2 echo -en "\n" # Prompt for clearing old files if folder was already here -if [ -d "${newfastdl}" ] && [ "${newfastdl}" == "0" ]; then +if [ -n "${newfastdl}" ] && [ "${newfastdl}" == "0" ]; then fn_printdots while true; do read -e -i "y" -p "Clear old FastDL files? [Y/n]" yn From 29442a057050bad5384c60d7203103686ff9867b Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 10:06:07 +0100 Subject: [PATCH 49/55] Better find ! Better display ! --- functions/command_fastdl.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 969e8e289..10fc68a4f 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -279,7 +279,7 @@ if [ "${luaressource}" == "on" ]; then fn_scriptlog "Generating new download enforcer" sleep 1 # Read all filenames and put them into a lua file at the right path - find "${fastdldir}" \( -name "*.*" ! -name "*.bz2" \) -printf '%P\n' | while read line; do + find "${fastdldir}" \( -type f ! -name "*.bz2" \) -printf '%P\n' | while read line; do echo "resource.AddFile( "\""${line}"\"" )" >> ${luafastdlfullpath} done fn_printok "Download enforcer generated" @@ -293,12 +293,13 @@ fi fn_fastdl_bzip2(){ # Compressing using bzip2 if user said yes if [ ${bzip2enable} == "on" ]; then + fn_printinfo "Have a break, this step could take a while..." fn_printdots "Compressing files using bzip2..." fn_scriptlog "Compressing files using bzip2..." sleep 2 # bzip2 all files that are not already compressed (keeping original files) - find "${fastdldir}" -not -name \*.bz2 -exec bzip2 -qk \{\} \; - fn_printinfo "bzip2 compression done" + find "${fastdldir}" \( -type f ! -name "*.bz2" \) -exec bzip2 -qk \{\} \; + fn_printok "bzip2 compression done" fn_scriptlog "bzip2 compression done" sleep 1 fi @@ -306,6 +307,7 @@ fi fn_fastdl_completed(){ # Finished message +echo "" fn_printok "Congratulations, it's done !" fn_scriptlog "FastDL job done" sleep 2 From c9550f02efdf089f65fefcb6216d667fade113ea Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 10:16:37 +0100 Subject: [PATCH 50/55] more spacing, less sleep --- functions/command_fastdl.sh | 46 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 10fc68a4f..ea899db90 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -60,7 +60,7 @@ if [ ! -d "${webdir}" ]; then echo -en "\n" sleep 1 fn_printdots "Creating www directory" - sleep 1 + sleep 0.5 mkdir "${webdir}" fn_printok "Created www directory" fn_scriptlog "FastDL created www directory" @@ -71,7 +71,7 @@ if [ ! -d "${fastdldir}" ]; then # No folder, won't ask for removing old ones newfastdl=1 fn_printdots "Creating fastdl directory" - sleep 1 + sleep 0.5 mkdir "${fastdldir}" fn_printok "Created fastdl directory" fn_scriptlog "FastDL created fastdl directory" @@ -100,7 +100,6 @@ if [ -n "${newfastdl}" ] && [ "${newfastdl}" == "0" ]; then * ) echo "Please answer yes or no.";; esac done - sleep 1 echo -en "\n" fi # Prompt for using bzip2 if it's installed @@ -114,7 +113,6 @@ if [ ${bzip2installed} == 1 ]; then * ) echo "Please answer yes or no.";; esac done - sleep 1 echo -en "\n" fi } @@ -129,7 +127,6 @@ while true; do [Nn]* ) luaressource="off"; "DL enforcer Disabled"; fn_printok "Enforcer Disabled"; break;; * ) echo "Please answer yes or no.";; esac - sleep 1 echo -en "\n" done } @@ -139,7 +136,7 @@ fn_clear_old_fastdl(){ if [ "${clearoldfastdl}" == "on" ]; then fn_printinfo "Clearing existing FastDL folder" fn_scriptlog "Clearing existing FastDL folder" - sleep 1 + sleep 0.5 rm -R "${fastdldir:?}"/* fn_printok "Old FastDL folder cleared" fn_scriptlog "Old FastDL folder cleared" @@ -151,11 +148,8 @@ fi fn_gmod_fastdl(){ # Copy all needed files for FastDL echo "" -fn_printinfo "Starting..." -fn_scriptlog "Starting FastFL job" -sleep 2 -echo -en "\n" -fn_printdots "Gathering all needed files..." +fn_printdots "Starting gathering all needed files" +fn_scriptlog "Starting gathering all needed files" sleep 1 echo -en "\n" @@ -165,20 +159,20 @@ cd "${systemdir}" # Map Files fn_printdots "Copying map files..." fn_scriptlog "Copying map files" -sleep 1 +sleep 0.5 find . -name '*.bsp' | cpio --quiet -updm "${fastdldir}" fn_printok "Map files copied" -sleep 1 +sleep 0.5 echo -en "\n" # Materials fn_printdots "Copying materials..." fn_scriptlog "Copying materials" -sleep 1 +sleep 0.5 find . -name '*.vtf' | cpio --quiet -updm "${fastdldir}" find . -name '*.vmt' | cpio --quiet -updm "${fastdldir}" fn_printok "Materials copied" -sleep 1 +sleep 0.5 echo -en "\n" # Models @@ -190,27 +184,27 @@ find . -name '*.vvd' | cpio --quiet -updm "${fastdldir}" find . -name '*.mdl' | cpio --quiet -updm "${fastdldir}" find . -name '*.phy' | cpio --quiet -updm "${fastdldir}" fn_printok "Models copied" -sleep 1 +sleep 0.5 echo -en "\n" # Particles fn_printdots "Copying particles..." fn_scriptlog "Copying particles" -sleep 1 +sleep 0.5 find . -name '*.pcf' | cpio --quiet -updm "${fastdldir}" fn_printok "Particles copied" -sleep 1 +sleep 0.5 echo -en "\n" # Sounds fn_printdots "Copying sounds..." fn_scriptlog "Copying sounds" -sleep 1 +sleep 0.5 find . -name '*.wav' | cpio --quiet -updm "${fastdldir}" find . -name '*.mp3' | cpio --quiet -updm "${fastdldir}" find . -name '*.ogg' | cpio --quiet -updm "${fastdldir}" fn_printok "Sounds copied" -sleep 1 +sleep 0.5 echo -en "\n" # Resources (mostly fonts) @@ -221,7 +215,7 @@ find . -name '*.otf' | cpio --quiet -updm "${fastdldir}" find . -name '*.ttf' | cpio --quiet -updm "${fastdldir}" find . -name '*.png' | cpio --quiet -updm "${fastdldir}" fn_printok "Fonts and png copied" -sleep 1 +sleep 0.5 echo -en "\n" # Going back to rootdir in order to prevent mistakes @@ -231,12 +225,12 @@ cd "${rootdir}" if [ -d "${fastdldir}/addons" ]; then fn_printinfo "Adjusting addons' file structure" fn_scriptlog "Adjusting addon's file structure" - sleep 2 + sleep 1 cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}" #Don't remove yet rm -R "${fastdldir:?}/addons" fn_printok "Adjusted addon's file structure" - echo -en "\n" sleep 1 + echo -en "\n" fi # Correct content that may be into a lua folder by mistake like some darkrpmodification addons @@ -253,6 +247,7 @@ fi # Generate lua file that will force download any file into the FastDL folder fn_lua_fastdl(){ # Remove lua file if luaressource is turned off and file exists +echo "" if [ "${luaressource}" == "off" ]; then if [ -f "${luafastdlfullpath}" ]; then fn_printdots "Removing download enforcer" @@ -292,16 +287,19 @@ fi fn_fastdl_bzip2(){ # Compressing using bzip2 if user said yes +echo "" if [ ${bzip2enable} == "on" ]; then fn_printinfo "Have a break, this step could take a while..." + echo -en "\n" + echo "" fn_printdots "Compressing files using bzip2..." fn_scriptlog "Compressing files using bzip2..." - sleep 2 # bzip2 all files that are not already compressed (keeping original files) find "${fastdldir}" \( -type f ! -name "*.bz2" \) -exec bzip2 -qk \{\} \; fn_printok "bzip2 compression done" fn_scriptlog "bzip2 compression done" sleep 1 + echo -en "\n" fi } From 1ce0fbbd6efa25c93e74939cc2758f78c22ce61e Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 12:57:00 +0100 Subject: [PATCH 51/55] Missing scriptlog --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index ea899db90..ab9230035 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -124,7 +124,7 @@ while true; do read -e -i "y" -p "Use client download enforcer? [Y/n]" yn case $yn in [Yy]* ) luaressource="on"; fn_scriptlog "DL enforcer Enabled"; fn_printok "Enforcer Enabled"; break;; - [Nn]* ) luaressource="off"; "DL enforcer Disabled"; fn_printok "Enforcer Disabled"; break;; + [Nn]* ) luaressource="off"; fn_scriptlog "DL enforcer Disabled"; fn_printok "Enforcer Disabled"; break;; * ) echo "Please answer yes or no.";; esac echo -en "\n" From 58873551bd915b5c0a41629394eb6e1d6efbf01a Mon Sep 17 00:00:00 2001 From: lrob Date: Fri, 19 Feb 2016 12:59:26 +0100 Subject: [PATCH 52/55] wrong place of echo -en "\n" --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index ab9230035..77e02be45 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -127,8 +127,8 @@ while true; do [Nn]* ) luaressource="off"; fn_scriptlog "DL enforcer Disabled"; fn_printok "Enforcer Disabled"; break;; * ) echo "Please answer yes or no.";; esac - echo -en "\n" done +echo -en "\n" } fn_clear_old_fastdl(){ From 6dc71d61480f8cc36593adf53f357ecc77ad7d5b Mon Sep 17 00:00:00 2001 From: lrob Date: Sat, 20 Feb 2016 12:05:43 +0100 Subject: [PATCH 53/55] Update core_getopt.sh --- functions/core_getopt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/core_getopt.sh b/functions/core_getopt.sh index c5b6916c3..c9c875656 100644 --- a/functions/core_getopt.sh +++ b/functions/core_getopt.sh @@ -230,6 +230,7 @@ case "$getopt" in echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." echo -e "\e[34minstall\t\e[0mInstall the server." echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts." + echo -e "\e[34mfastdl\t\e[0mGenerates or update a FastDL folder for your server." } | column -s $'\t' -t esac exit From 52ac61aea124d60ab26182e112fff18e7409bb6c Mon Sep 17 00:00:00 2001 From: lrob Date: Sat, 20 Feb 2016 22:09:56 +0100 Subject: [PATCH 54/55] Updated wiki address --- functions/command_fastdl.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 77e02be45..63b7e2b6d 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -30,7 +30,7 @@ if [ -z "$(command -v bzip2)" ]; then echo -en "\n" sleep 1 echo "We advise using it" - echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/Fastdl#bzip2-compression" + echo "For more information, see https://github.com/dgibbs64/linuxgsm/wiki/FastDL#bzip2-compression" sleep 2 else bzip2installed="1" @@ -311,7 +311,7 @@ fn_scriptlog "FastDL job done" sleep 2 echo -en "\n" echo "" -fn_printinfo "Need more doc ? See https://github.com/dgibbs64/linuxgsm/wiki/Fastdl" +fn_printinfo "Need more doc ? See https://github.com/dgibbs64/linuxgsm/wiki/FastDL" echo -en "\n" if [ "$bzip2installed" == "0" ]; then echo "By the way, you'd better install bzip2 an re-run this command !" From 0effc04d65ac1e57ed5fdecbeadcff2e462338e0 Mon Sep 17 00:00:00 2001 From: lrob Date: Sun, 21 Feb 2016 12:18:19 +0100 Subject: [PATCH 55/55] Version, Will travis work ? --- functions/command_fastdl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_fastdl.sh b/functions/command_fastdl.sh index 63b7e2b6d..a509a14ae 100644 --- a/functions/command_fastdl.sh +++ b/functions/command_fastdl.sh @@ -3,7 +3,7 @@ # Author: Daniel Gibbs # Contributor: UltimateByte # Website: http://gameservermanagers.com -lgsm_version="190216" +lgsm_version="210216" # Description: Creates a FastDL folder