@ -12,7 +12,9 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh
# Directories
webdir = " ${ rootdir } /public_html "
if [ -z " ${ webdir } " ] ; then
webdir = " ${ rootdir } /public_html "
fi
fastdldir = " ${ webdir } /fastdl "
addonsdir = " ${ systemdir } /addons "
# Server lua autorun dir, used to autorun lua on client connect to the server
@ -20,302 +22,412 @@ luasvautorundir="${systemdir}/lua/autorun/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_print_info "bzip2 is not installed !"
fn_script_log_info "bzip2 is not installed"
echo -en "\n"
sleep 1
echo "We advise using it"
echo "For more information, see https://github.com/GameServerManagers/LinuxGSM/wiki/FastDL#bzip2-compression"
sleep 2
# Check if bzip2 is installed
if [ -z " $( command -v bzip2) " ] ; then
fn_print_fail "bzip2 is not installed"
fn_script_log_fatal "bzip2 is not installed"
core_exit.sh
fi
# Header
fn_print_header
echo "More info: https://git.io/vyk9a"
echo ""
# Prompts user for FastDL creation settings
echo " ${ commandaction } setup "
echo "================================="
# Prompt for clearing old files if directory was already here
if [ -d " ${ fastdldir } " ] ; then
fn_print_warning_nl "FastDL directory already exists."
echo " ${ fastdldir } "
echo ""
if fn_prompt_yn "Overwrite existing directory?" Y; then
fn_script_log_info "Overwrite existing directory: YES"
else
bzip2installed = "1"
core_exit.sh
fi
}
fi
fn_fastdl_init( ) {
# User confirmation
fn_print_ok "Welcome to LGSM's FastDL generator"
sleep 1
echo -en "\n"
fn_script_log "Started FastDL creation"
if ! fn_prompt_yn "Continue?" Y; then
exit
# Garry's Mod Specific
if [ " ${ gamename } " = = "Garry's Mod" ] ; then
# Prompt for download enforcer, which is using a .lua addfile resource generator
if fn_prompt_yn "Force clients to download files?" Y; then
luaresource = "on"
fn_script_log_info "Force clients to download files: YES"
else
luaresource = "off"
fn_script_log_info "Force clients to download filesr: NO"
fi
fn_script_log "Initiating FastDL creation"
fi
# Check and create directories
if [ ! -d " ${ webdir } " ] ; then
echo ""
fn_print_info "Creating FastDL directories"
echo -en "\n"
sleep 1
fn_print_dots " Creating ${ webdir } directory "
# Clears any fastdl directory content
fn_clear_old_fastdl( ) {
# Clearing old FastDL
if [ -d " ${ fastdldir } " ] ; then
echo -en " clearing existing FastDL directory ${ fastdldir } ... "
rm -R " ${ fastdldir : ? } "
exitcode = $?
if [ " ${ exitcode } " -ne 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal " Clearing existing FastDL directory ${ fastdldir } "
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass " Clearing existing FastDL directory ${ fastdldir } "
fi
sleep 0.5
mkdir " ${ webdir } "
fn_print_ok " Created ${ webdir } directory "
fn_script_log " FastDL created ${ webdir } directory "
sleep 1
echo -en "\n"
fi
if [ ! -d " ${ fastdldir } " ] ; then
# No directory, won't ask for removing old ones
newfastdl = 1
fn_print_dots "Creating fastdl directory"
sleep 0.5
mkdir " ${ fastdldir } "
fn_print_ok "Created fastdl directory"
fn_script_log "FastDL created fastdl directory"
sleep 1
echo -en "\n"
clearoldfastdl = "off" # Nothing to clear
elif [ " $( ls -A " ${ fastdldir } " ) " ] ; then
newfastdl = 0
fi
}
fn_fastdl_config( ) {
# Global settings for FastDL creation
fn_print_info "Entering configuration"
fn_script_log "Configuration"
sleep 2
echo -en "\n"
# Prompt for clearing old files if directory was already here
if [ -n " ${ newfastdl } " ] && [ " ${ newfastdl } " = = "0" ] ; then
fn_print_dots
if fn_prompt_yn "Clear old FastDL files?" Y; then
clearoldfastdl = "on" ; fn_script_log "clearoldfastdl enabled" ; fn_print_ok "Clearing Enabled"
fn_fastdl_dirs( ) {
# Check and create directories
if [ ! -d " ${ webdir } " ] ; then
echo -en " creating web directory ${ webdir } ... "
mkdir -p " ${ webdir } "
exitcode = $?
if [ ${ exitcode } -ne 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal " Creating web directory ${ webdir } "
core_exit.sh
else
clearoldfastdl = "off" ; fn_script_log "clearoldfastdl disabled" ; fn_print_ok "Clearing Disabled"
fn_print_ok_eol_nl
fn_script_log_pass " Creating web directory ${ webdir } "
fi
echo -en "\n"
sleep 0.5
fi
# Prompt for using bzip2 if it's installed
if [ ${ bzip2installed } = = 1 ] ; then
fn_print_dots
if fn_prompt_yn "Enable file compression using bzip2?" Y; then
bzip2enable = "on" ; fn_script_log "bzip2 enabled" ; fn_print_ok "bzip2 Enabled"
if [ ! -d " ${ fastdldir } " ] ; then
echo -en " creating fastdl directory ${ fastdldir } ... "
mkdir -p " ${ fastdldir } "
exitcode = $?
if [ ${ exitcode } -ne 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal " Creating fastdl directory ${ fastdldir } "
core_exit.sh
else
bzip2enable = "off" ; fn_script_log "bzip2 disabled" ; fn_print_ok "bzip2 Disabled"
fn_print_ok_eol_nl
fn_script_log_pass " Creating fastdl directory ${ fastdldir } "
fi
echo -en "\n"
sleep 0.5
fi
}
fn_fastdl_gmod_config( ) {
# Prompt for download enforcer, that is using a .lua addfile resource generator
fn_print_dots
if fn_prompt_yn "Use client download enforcer?" Y; then
luaressource = "on" ; fn_script_log "DL enforcer Enabled" ; fn_print_ok "Enforcer Enabled"
else
luaressource = "off" ; fn_script_log "DL enforcer Disabled" ; fn_print_ok "Enforcer Disabled"
fi
echo -en "\n"
# Using this gist https://gist.github.com/agunnerson-ibm/efca449565a3e7356906
fn_human_readable_file_size( ) {
local abbrevs = (
$(( 1 << 60 )) :ZB
$(( 1 << 50 )) :EB
$(( 1 << 40 )) :TB
$(( 1 << 30 )) :GB
$(( 1 << 20 )) :MB
$(( 1 << 10 )) :KB
$(( 1 )) :bytes
)
local bytes = " ${ 1 } "
local precision = " ${ 2 } "
if [ [ " ${ bytes } " = = "1" ] ] ; then
echo "1 byte"
else
for item in " ${ abbrevs [@] } " ; do
local factor = " ${ item % : * } "
local abbrev = " ${ item #* : } "
if [ [ " ${ bytes } " -ge " ${ factor } " ] ] ; then
local size = " $( bc -l <<< " ${ bytes } / ${ factor } " ) "
printf "%.*f %s\n" " ${ precision } " " ${ size } " " ${ abbrev } "
break
fi
done
fi
}
fn_clear_old_fastdl( ) {
# Clearing old FastDL if user answered yes
if [ " ${ clearoldfastdl } " = = "on" ] ; then
fn_print_info "Clearing existing FastDL directory"
fn_script_log "Clearing existing FastDL directory"
# Provides info about the fastdl directory content and prompts for confirmation
fn_fastdl_preview( ) {
# Remove any file list
if [ -f " ${ tmpdir } /fastdl_files_to_compress.txt " ] ; then
rm -f " ${ tmpdir } /fastdl_files_to_compress.txt "
fi
echo -e "analysing required files"
fn_script_log_info "Analysing required files"
# Garry's Mod
if [ " ${ gamename } " = = "Garry's Mod" ] ; then
cd " ${ systemdir } " || exit
allowed_extentions_array = ( "*.ain" "*.bsp" "*.mdl" "*.mp3" "*.ogg" "*.otf" "*.pcf" "*.phy" "*.png" "*.vtf" "*.vmt" "*.vtx" "*.vvd" "*.ttf" "*.wav" )
for allowed_extention in " ${ allowed_extentions_array [@] } " ; do
fileswc = 0
tput sc
while read -r ext; do
( ( fileswc++) )
tput rc; tput el
printf " gathering ${ allowed_extention } : ${ fileswc } ... "
echo " ${ ext } " >> " ${ tmpdir } /fastdl_files_to_compress.txt "
done < <( find . -type f -iname ${ allowed_extention } )
if [ ${ fileswc } != 0 ] ; then
fn_print_ok_eol_nl
fi
done
# Source engine
else
fastdl_directories_array = ( "maps" "materials" "models" "particles" "sounds" "resources" )
for directory in " ${ fastdl_directories_array [@] } " ; do
if [ -d " ${ systemdir } / ${ directory } " ] ; then
if [ " ${ directory } " = = "maps" ] ; then
local allowed_extentions_array = ( "*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt" )
elif [ " ${ directory } " = = "materials" ] ; then
local allowed_extentions_array = ( "*.vtf" "*.vmt" "*.vbf" )
elif [ " ${ directory } " = = "models" ] ; then
local allowed_extentions_array = ( "*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" )
elif [ " ${ directory } " = = "particles" ] ; then
local allowed_extentions_array = ( "*.pcf" )
elif [ " ${ directory } " = = "sounds" ] ; then
local allowed_extentions_array = ( "*.wav" "*.mp3" "*.ogg" )
fi
for allowed_extention in " ${ allowed_extentions_array [@] } " ; do
fileswc = 0
tput sc
while read -r ext; do
( ( fileswc++) )
tput rc; tput el
printf " gathering ${ directory } ${ allowed_extention } : ${ fileswc } ... "
echo " ${ ext } " >> " ${ tmpdir } /fastdl_files_to_compress.txt "
done < <( find " ${ systemdir } / ${ directory } " -type f -iname ${ allowed_extention } )
tput rc; tput el
printf " gathering ${ directory } ${ allowed_extention } : ${ fileswc } ... "
if [ ${ fileswc } != 0 ] ; then
fn_print_ok_eol_nl
fi
done
fi
done
fi
if [ -f " ${ tmpdir } /fastdl_files_to_compress.txt " ] ; then
echo "calculating total file size..."
sleep 0.5
rm -R " ${ fastdldir : ? } " /*
fn_print_ok "Old FastDL directory cleared"
fn_script_log "Old FastDL directory cleared"
sleep 1
echo -en "\n"
totalfiles = $( wc -l < " ${ tmpdir } /fastdl_files_to_compress.txt " )
# Calculates total file size
while read dufile; do
filesize = $( stat -c %s " ${ dufile } " )
filesizetotal = $(( ${ filesizetotal } + ${ filesize } ))
exitcode = $?
if [ " ${ exitcode } " != 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal "Calculating total file size."
core_exit.sh
fi
done <" ${ tmpdir } /fastdl_files_to_compress.txt "
else
fn_print_fail_eol_nl "generating file list"
fn_script_log_fatal "Generating file list."
core_exit.sh
fi
echo " about to compress ${ totalfiles } files, total size $( fn_human_readable_file_size ${ filesizetotal } 0) "
fn_script_log_info " ${ totalfiles } files, total size $( fn_human_readable_file_size ${ filesizetotal } 0) "
rm " ${ tmpdir } /fastdl_files_to_compress.txt "
if ! fn_prompt_yn "Continue?" Y; then
fn_script_log "User exited"
core_exit.sh
fi
}
fn_gmod_fastdl( ) {
# Copy all needed files for FastDL
echo ""
fn_print_dots "Starting gathering all needed files"
fn_script_log "Starting gathering all needed files"
sleep 1
echo -en "\n"
# No choice to cd to the directory, as find can't then display relative directory
cd " ${ systemdir } "
# Map Files
fn_print_dots "Copying map files..."
fn_script_log "Copying map files"
sleep 0.5
find . -name '*.bsp' | cpio --quiet -updm " ${ fastdldir } "
find . -name '*.ain' | cpio --quiet -updm " ${ fastdldir } "
fn_print_ok "Map files copied"
sleep 0.5
echo -en "\n"
# Materials
fn_print_dots "Copying materials..."
fn_script_log "Copying materials"
sleep 0.5
find . -name '*.vtf' | cpio --quiet -updm " ${ fastdldir } "
find . -name '*.vmt' | cpio --quiet -updm " ${ fastdldir } "
fn_print_ok "Materials copied"
sleep 0.5
echo -en "\n"
# Models
fn_print_dots "Copying models..."
fn_script_log "Copying models"
sleep 1
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_print_ok "Models copied"
sleep 0.5
echo -en "\n"
# Particles
fn_print_dots "Copying particles..."
fn_script_log "Copying particles"
sleep 0.5
find . -name '*.pcf' | cpio --quiet -updm " ${ fastdldir } "
fn_print_ok "Particles copied"
sleep 0.5
echo -en "\n"
# Sounds
fn_print_dots "Copying sounds..."
fn_script_log "Copying sounds"
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_print_ok "Sounds copied"
sleep 0.5
echo -en "\n"
# Resources (mostly fonts)
fn_print_dots "Copying fonts and png..."
fn_script_log "Copying fonts and png"
sleep 1
find . -name '*.otf' | cpio --quiet -updm " ${ fastdldir } "
find . -name '*.ttf' | cpio --quiet -updm " ${ fastdldir } "
find . -name '*.png' | cpio --quiet -updm " ${ fastdldir } "
fn_print_ok "Fonts and png copied"
sleep 0.5
echo -en "\n"
# Going back to rootdir in order to prevent mistakes
cd " ${ rootdir } "
# Builds Garry's Mod fastdl directory content
fn_fastdl_gmod( ) {
cd " ${ systemdir } " || exit
for allowed_extention in " ${ allowed_extentions_array [@] } "
do
fileswc = 0
tput sc
while read -r fastdlfile; do
( ( fileswc++) )
tput rc; tput el
printf " copying ${ allowed_extention } : ${ fileswc } ... "
cp --parents " ${ fastdlfile } " " ${ fastdldir } "
exitcode = $?
if [ ${ exitcode } -ne 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal " Copying ${ fastdlfile } > ${ fastdldir } "
core_exit.sh
else
fn_script_log_pass " Copying ${ fastdlfile } > ${ fastdldir } "
fi
done < <( find . -type f -iname ${ allowed_extention } )
if [ ${ fileswc } != 0 ] ; then
fn_print_ok_eol_nl
fi
done
# Correct addons directory structure for FastDL
if [ -d " ${ fastdldir } /addons " ] ; then
fn_print_info "Adjusting addons' file structure"
fn_script_log "Adjusting addon's file structure"
sleep 1
echo -en "updating addons file structure..."
cp -Rf " ${ fastdldir } " /addons/*/* " ${ fastdldir } "
#Don't remove yet rm -R "${fastdldir:?}/addons"
fn_print_ok "Adjusted addon's file structure"
exitcode = $?
if [ ${ exitcode } -ne 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal "Updating addons file structure"
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass "Updating addons file structure"
fi
# Clear addons directory in fastdl
echo -en "clearing addons dir from fastdl dir..."
sleep 1
echo -en "\n"
rm -R " ${ fastdldir : ? } /addons "
exitcode = $?
if [ ${ exitcode } -ne 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal "Clearing addons dir from fastdl dir"
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass "Clearing addons dir from fastdl dir"
fi
fi
# Correct content that may be into a lua directory by mistake like some darkrpmodification addons
if [ -d " ${ fastdldir } /lua " ] ; then
fn_print_dots "Typical DarkRP shit detected, fixing"
echo -en "correcting DarkRP files..."
sleep 2
cp -Rf " ${ fastdldir } /lua/ " * " ${ fastdldir } "
fn_print_ok "Stupid DarkRP file structure fixed"
sleep 2
echo -en "\n"
exitcode = $?
if [ ${ exitcode } -ne 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal "Correcting DarkRP files"
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass "Correcting DarkRP files"
fi
fi
if [ -f " ${ tmpdir } /fastdl_files_to_compress.txt " ] ; then
totalfiles = $( wc -l < " ${ tmpdir } /fastdl_files_to_compress.txt " )
# Calculates total file size
while read dufile; do
filesize = $( du -b " ${ dufile } " | awk '{ print $1 }' )
filesizetotal = $(( ${ filesizetotal } + ${ filesize } ))
done <" ${ tmpdir } /fastdl_files_to_compress.txt "
fi
}
# Generate lua file that will force download any file into the FastDL directory
fn_lua_fastdl( ) {
# Remove lua file if luaressource is turned off and file exists
echo ""
if [ " ${ luaressource } " = = "off" ] ; then
if [ -f " ${ luafastdlfullpath } " ] ; then
fn_print_dots "Removing download enforcer"
sleep 1
rm -R " ${ luafastdlfullpath : ? } "
fn_print_ok "Removed download enforcer"
fn_script_log "Removed old download inforcer"
echo -en "\n"
sleep 2
fn_fastdl_source( ) {
for directory in " ${ fastdl_directories_array [@] } "
do
if [ -d " ${ systemdir } / ${ directory } " ] ; then
if [ " ${ directory } " = = "maps" ] ; then
local allowed_extentions_array = ( "*.bsp" "*.ain" "*.nav" "*.jpg" "*.txt" )
elif [ " ${ directory } " = = "materials" ] ; then
local allowed_extentions_array = ( "*.vtf" "*.vmt" "*.vbf" )
elif [ " ${ directory } " = = "models" ] ; then
local allowed_extentions_array = ( "*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" )
elif [ " ${ directory } " = = "particles" ] ; then
local allowed_extentions_array = ( "*.pcf" )
elif [ " ${ directory } " = = "sounds" ] ; then
local allowed_extentions_array = ( "*.wav" "*.mp3" "*.ogg" )
fi
for allowed_extention in " ${ allowed_extentions_array [@] } "
do
fileswc = 0
tput sc
while read -r fastdlfile; do
( ( fileswc++) )
tput rc; tput el
printf " copying ${ directory } ${ allowed_extention } : ${ fileswc } ... "
sleep 0.01
if [ ! -d " ${ fastdldir } / ${ directory } " ] ; then
mkdir " ${ fastdldir } / ${ directory } "
fi
cp " ${ fastdlfile } " " ${ fastdldir } / ${ directory } "
exitcode = $?
if [ " ${ exitcode } " -ne 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal " Copying ${ fastdlfile } > ${ fastdldir } / ${ directory } "
core_exit.sh
else
fn_script_log_pass " Copying ${ fastdlfile } > ${ fastdldir } / ${ directory } "
fi
done < <( find " ${ systemdir } / ${ directory } " -type f -iname ${ allowed_extention } )
if [ ${ fileswc } != 0 ] ; then
fn_print_ok_eol_nl
fi
done
fi
done
}
# Builds the fastdl directory content
fn_fastdl_build( ) {
# Copy all needed files for FastDL
echo -e " copying files to ${ fastdldir } "
fn_script_log_info " Copying files to ${ fastdldir } "
if [ " ${ gamename } " = = "Garry's Mod" ] ; then
fn_fastdl_gmod
fn_fastdl_gmod_dl_enforcer
else
fn_fastdl_source
fi
# Remove old lua file and generate a new one if user said yes
if [ " ${ luaressource } " = = "on" ] ; then
if [ -f " ${ luafastdlfullpath } " ] ; then
fn_print_dots "Removing old download enforcer"
sleep 1
rm " ${ luafastdlfullpath } "
fn_print_ok "Removed old download enforcer"
fn_script_log "Removed old download enforcer"
echo -en "\n"
sleep 1
}
# Generate lua file that will force download any file into the FastDL directory
fn_fastdl_gmod_dl_enforcer( ) {
# Clear old lua file
if [ -f " ${ luafastdlfullpath } " ] ; then
echo -en " removing existing download enforcer: ${ luafastdlfile } ... "
rm " ${ luafastdlfullpath : ? } "
exitcode = $?
if [ " ${ exitcode } " -ne 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal " Removing existing download enforcer ${ luafastdlfullpath } "
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass " Removing existing download enforcer ${ luafastdlfullpath } "
fi
fn_print_dots "Generating new download enforcer"
fn_script_log "Generating new download enforcer"
sleep 1
fi
# Generate new one if user said yes
if [ " ${ luaresource } " = = "on" ] ; then
echo -en " creating new download enforcer: ${ luafastdlfile } ... "
touch " ${ luafastdlfullpath } "
# Read all filenames and put them into a lua file at the right path
find " ${ fastdldir } " \( -type f ! -name "*.bz2" \) -printf '%P\n' | while read line; do
echo "resource.AddFile( " \" " ${ line } " \" " )" >> ${ luafastdlfullpath }
done
fn_print_ok "Download enforcer generated"
fn_script_log "Download enforcer generated"
echo -en "\n"
echo ""
sleep 2
while read line; do
echo " resource.AddFile( \" ${ line } \" ) " >> " ${ luafastdlfullpath } "
done < <( find " ${ fastdldir : ? } " \( -type f ! -name "*.bz2" \) -printf '%P\n' )
exitcode = $?
if [ " ${ exitcode } " -ne 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal " Creating new download enforcer ${ luafastdlfullpath } "
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass " Creating new download enforcer ${ luafastdlfullpath } "
fi
fi
}
# Compresses FastDL files using bzip2
fn_fastdl_bzip2( ) {
# Compressing using bzip2 if user said yes
echo ""
if [ ${ bzip2enable } = = "on" ] ; then
fn_print_info "Have a break, this step could take a while..."
echo -en "\n"
echo ""
fn_print_dots "Compressing files using bzip2..."
fn_script_log "Compressing files using bzip2..."
# bzip2 all files that are not already compressed (keeping original files)
find " ${ fastdldir } " \( -type f ! -name "*.bz2" \) -exec bzip2 -qk \{ \} \;
fn_print_ok "bzip2 compression done"
fn_script_log "bzip2 compression done"
sleep 1
echo -en "\n"
fi
}
fn_fastdl_completed( ) {
# Finished message
echo ""
fn_print_ok "Congratulations, it's done!"
fn_script_log "FastDL job done"
sleep 2
echo -en "\n"
echo ""
fn_print_info "Need more documentation? See https://github.com/GameServerManagers/LinuxGSM/wiki/FastDL"
echo -en "\n"
if [ " $bzip2installed " = = "0" ] ; then
echo "By the way, you'd better install bzip2 and re-run this command!"
fi
echo "Credits : UltimateByte"
while read -r filetocompress; do
echo -en " \r\033[Kcompressing ${ filetocompress } ... "
bzip2 -f " ${ filetocompress } "
exitcode = $?
if [ " ${ exitcode } " -ne 0 ] ; then
fn_print_fail_eol_nl
fn_script_log_fatal " Compressing ${ filetocompress } "
core_exit.sh
else
fn_script_log_pass " Compressing ${ filetocompress } "
fi
done < <( find " ${ fastdldir : ? } " \( -type f ! -name "*.bz2" \) )
fn_print_ok_eol_nl
}
# Game checking and functions running
# Garry's Mod
if [ " ${ gamename } " = = "Garry's Mod" ] ; then
fn_check_bzip2
fn_fastdl_init
fn_fastdl_config
fn_fastdl_gmod_config
fn_clear_old_fastdl
fn_gmod_fastdl
fn_lua_fastdl
fn_fastdl_bzip2
fn_fastdl_completed
exit
fi
# Run functions
fn_fastdl_preview
fn_clear_old_fastdl
fn_fastdl_dirs
fn_fastdl_build
fn_fastdl_bzip2
# Finished message
echo "FastDL files are located in:"
echo " ${ fastdldir } "
echo "FastDL completed"
fn_script_log_info "FastDL completed"
core_exit.sh