From 3679609923fb552a40a7dd9f1740d7787cefd909 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 2 Aug 2025 03:59:52 -0400 Subject: [PATCH] Keep settings files when cleaning. My bad that actually got removed in the first place. --- clean-local.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/clean-local.sh b/clean-local.sh index 1e83eec..2efe478 100755 --- a/clean-local.sh +++ b/clean-local.sh @@ -57,8 +57,28 @@ uninstall_local() { # Remove Python modules rm -rf "${LOCAL_PREFIX}/lib/python"*/site-packages/cthulhu* - # Remove data files - rm -rf "${LOCAL_PREFIX}/share/cthulhu" + # Remove data files but preserve user settings + if [[ -d "${LOCAL_PREFIX}/share/cthulhu" ]]; then + # Backup user settings if they exist + if [[ -f "${LOCAL_PREFIX}/share/cthulhu/user-settings.conf" ]]; then + cp "${LOCAL_PREFIX}/share/cthulhu/user-settings.conf" /tmp/cthulhu-user-settings.backup + fi + if [[ -f "${LOCAL_PREFIX}/share/cthulhu/cthulhu-customizations.py" ]]; then + cp "${LOCAL_PREFIX}/share/cthulhu/cthulhu-customizations.py" /tmp/cthulhu-customizations.backup + fi + + # Remove the directory + rm -rf "${LOCAL_PREFIX}/share/cthulhu" + + # Recreate directory and restore user files + mkdir -p "${LOCAL_PREFIX}/share/cthulhu" + if [[ -f /tmp/cthulhu-user-settings.backup ]]; then + mv /tmp/cthulhu-user-settings.backup "${LOCAL_PREFIX}/share/cthulhu/user-settings.conf" + fi + if [[ -f /tmp/cthulhu-customizations.backup ]]; then + mv /tmp/cthulhu-customizations.backup "${LOCAL_PREFIX}/share/cthulhu/cthulhu-customizations.py" + fi + fi # Remove docs rm -rf "${LOCAL_PREFIX}/share/help/*/cthulhu"