diff --git a/init.sh b/init.sh index 186befa..5e429f5 100755 --- a/init.sh +++ b/init.sh @@ -2316,6 +2316,37 @@ runFullUninstall() isHeader "LibrePortal uninstalled" isNotice "Left in place: docker engine, docker-compose, apt deps, SSH config." + + # App data on an ADDITIONAL storage location is not removed, while the data + # on the primary root went with that root. Both are defensible on their own — + # deleting a user's data off a separate disk unasked is worse than leaving it + # — but doing one silently and the other silently is the one option nobody + # can predict. So say exactly what is still there. + # + # It also stops being obvious: the directories are owned by a uid that no + # longer maps to a user once the container account is gone, and each location + # keeps its .libreportal-storage marker, which a later install will recognise + # and adopt. + local _reg="/usr/local/lib/libreportal/storage.roots" + [[ -r "$_reg" ]] || _reg="${lp_lib_dir:-/usr/local/lib/libreportal}/storage.roots" + if [[ -r "$_reg" ]]; then + local _id _path _rest _left=0 + while IFS=$'\t' read -r _id _path _rest || [[ -n "$_id" ]]; do + [[ -z "$_path" || "$_id" == \#* ]] && continue + [[ -d "$_path" ]] || continue + local _n; _n=$(find "$_path" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l) + (( _n > 0 )) || continue + (( _left == 0 )) && { echo ""; isNotice "App data left on these storage locations — nothing here was deleted:"; } + printf ' %-40s %s app director%s\n' "$_path" "$_n" "$( (( _n == 1 )) && echo y || echo ies )" + _left=1 + done < "$_reg" + if (( _left )); then + echo "" + printf ' %s\n' "Remove them by hand if you meant to, or leave them — a reinstall can adopt" + printf ' %s\n' "the location again and the apps restore back onto it." + echo "" + fi + fi } # Only run the installer entrypoint (root check + init flow) when init.sh is