fix: uninstall correctly reindexes (fix #21)
This commit is contained in:
@@ -837,6 +837,13 @@ function mod_uninstall() {
|
|||||||
|
|
||||||
# remove entry from database
|
# remove entry from database
|
||||||
sed -i "/^$mod_index,/d" "$DB_FILE"
|
sed -i "/^$mod_index,/d" "$DB_FILE"
|
||||||
|
|
||||||
|
# reindex the database
|
||||||
|
mods_to_reindex=($(awk -F, -v idx=$mod_index 'NR > 1 && $1 > idx {print $1}' "$DB_FILE"))
|
||||||
|
for idx in "${mods_to_reindex[@]}"; do
|
||||||
|
sed -i "s/^$idx,/$(($idx - 1)),/" "$DB_FILE"
|
||||||
|
done
|
||||||
|
|
||||||
log INFO "Mod $mod_name ${ORANGE}uninstalled${NC} successfully."
|
log INFO "Mod $mod_name ${ORANGE}uninstalled${NC} successfully."
|
||||||
|
|
||||||
# disable any modpack
|
# disable any modpack
|
||||||
|
|||||||
Reference in New Issue
Block a user