Risk 1/5 · Low
pi-hole-core.install
Result #5598
Comment
The change is low risk. It only alters the package uninstall hook to stop deleting /etc/pihole contents and to stop removing the pihole user, replacing that behavior with a best-effort rmdir check and informational messages. There is no new network access, privilege escalation, persistence mechanism, or execution of untrusted code. The only security-relevant effect is that package removal now leaves configuration/data behind, which is a retention/privacy concern rather than a vulnerability in the package itself.
@@ -25,8 +25,15 @@ post_upgrade() {
}
post_remove() {
- # delete all temp files except those modified the user
- # TODO - make this more intelligent to save *.pacsave.# where # is a number
- find /etc/pihole -type f ! -name '*.pacsave' ! -name 'pihole-FTL.conf' ! -name 'pihole-FTL.db' ! -name 'gravity.db' -delete
- id -u pihole > /dev/null 2>&1 && userdel -f pihole
+ # Do not delete anything in /etc/pihole and do not touch the pihole user:
+ # the config/data in there may have been created or changed by the user and
+ # the user itself is managed by the pi-hole-ftl package (sysusers).
+ if ! rmdir /etc/pihole 2>/dev/null && [[ -d /etc/pihole ]]; then
+ echo -e "\e[1;33m==>\e[0m Your Pi-hole configuration and databases were left untouched in \e[1;36m/etc/pihole\e[0m."
+ echo -e "\e[1;33m==>\e[0m Remove them manually if you no longer need them:"
+ echo -e " \e[1;36mrm -rf /etc/pihole\e[0m"
+ fi
+
+ # keep pacman from throwing errors should none them be on the filesystem
+ return 0
}