Browse Source

rollback to fix

pull/1255/head
UltimateByte 8 years ago
committed by GitHub
parent
commit
4e79f341e5
  1. 26
      lgsm/functions/mods_core.sh

26
lgsm/functions/mods_core.sh

@ -190,16 +190,24 @@ fn_postinstall_tasks(){
# Output to the user # Output to the user
fn_print_information_nl "Rearranging ${modcommand}-files.list" fn_print_information_nl "Rearranging ${modcommand}-files.list"
fn_script_log_info "Rearranging ${modcommand}-files.list" fn_script_log_info "Rearranging ${modcommand}-files.list"
removefromlist="cfg;addons;" smremovefromlist="cfg;addons;"
# Loop through every single line to find any of the files to remove from the list # Loop through every single line to find any of the files to remove from the 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
# How many elements to remove from list fileslistline=1
smremoveamount="$(echo "${removefromlist}" | awk -F ';' '{ print NF }')" while [ $fileslistline -le $modsfilelistsize ]; do
# Test all subvalue of "modkeepfiles" using the ";" separator testline="$(sed "${fileslistline}q;d" "${modsdatadir}/${modcommand}-files.list")"
for ((filesindex=1; filesindex < ${smremoveamount}; filesindex++)); do # How many elements to remove from list
# Put current file into test variable smremoveamount="$(echo "${smremovefromlist}" | awk -F ';' '{ print NF }')"
rmtestvar="$( echo "${removefromlist}" | awk -F ';' -v x=${filesindex} '{ print $x }' )" # Test all subvalue of "modkeepfiles" using the ";" separator
# Remove matches for ((filesindex=1; filesindex < ${smremoveamount}; filesindex++)); do
grep -vFf ${modsdatadir}/${modcommand}-files.list "${rmtestvar}" > ${modsdatadir}/${modcommand}-files.list # Put current file into test variable
smremovetestvar="$( echo "${smremovefromlist}" | awk -F ';' -v x=${filesindex} '{ print $x }' )"
# If it matches
if [ "${testline}" == "${smremovetestvar}" ]; then
# Then delete the line!
sed -i "${testline}d" "${modsdatadir}/${modcommand}-files.list"
fi
done
let fileslistline=fileslistline+1
done done
} }

Loading…
Cancel
Save