Browse Source

attempt to fix

thanks @cedar :D
pull/1255/head
UltimateByte 8 years ago
committed by GitHub
parent
commit
ff583d565c
  1. 34
      lgsm/functions/mods_core.sh

34
lgsm/functions/mods_core.sh

@ -188,26 +188,22 @@ fn_postinstall_tasks(){
# Prevent addons folder from being removed by clearing them in: ${modsdatadir}/${modcommand}-files.list # Prevent addons folder from being removed by clearing them in: ${modsdatadir}/${modcommand}-files.list
fn_check_files_list fn_check_files_list
# Output to the user # Output to the user
fn_print_information_nl "Rearranging ${modcommand}-files.list" fn_print_dots "Rearranging ${modcommand}-files.list"
fn_script_log_info "Rearranging ${modcommand}-files.list" fn_script_log_info "Rearranging ${modcommand}-files.list"
smremovefromlist="cfg;addons;" removefromlist="cfg;addons;"
# Loop through every single line to find any of the files to remove from the list # Loop through files to remove and remove them from file list
# that way these files won't get removed upon update or uninstall # that way these files won't get removed upon update or uninstall
fileslistline=1 # How many elements to remove from list
while [ $fileslistline -le $modsfilelistsize ]; do removefromlistamount="$(echo "${removefromlist}" | awk -F ';' '{ print NF }')"
testline="$(sed "${fileslistline}q;d" "${modsdatadir}/${modcommand}-files.list")" # Test all subvalue of "removefromlist" using the ";" separator
# How many elements to remove from list for ((filesindex=1; filesindex < ${removefromlistamount}; filesindex++)); do
smremoveamount="$(echo "${smremovefromlist}" | awk -F ';' '{ print NF }')" # Put current file into test variable
# Test all subvalue of "modkeepfiles" using the ";" separator removefilevar="$( echo "${removefromlist}" | awk -F ';' -v x=${filesindex} '{ print $x }' )"
for ((filesindex=1; filesindex < ${smremoveamount}; filesindex++)); do # If it matches
# Put current file into test variable if [ "${testline}" == "${removefilevar}" ]; then
smremovetestvar="$( echo "${smremovefromlist}" | awk -F ';' -v x=${filesindex} '{ print $x }' )" # Then delete matching line(s)!
# If it matches sed -i "/^${testline}$/d" "${modsdatadir}/${modcommand}-files.list"
if [ "${testline}" == "${smremovetestvar}" ]; then fi
# Then delete the line!
sed -i "${testline}d" "${modsdatadir}/${modcommand}-files.list"
fi
done
let fileslistline=fileslistline+1
done done
fn_print_ok "Rearranging ${modcommand}-files.list"
} }

Loading…
Cancel
Save