Fix to skip uninstall when package is replaced by rename

*Note: This is to support clean upgrade and replacement of wbm-* → webmin-* modules
This commit is contained in:
Ilia Ross
2025-12-28 19:39:52 +02:00
parent f3dda46138
commit db4f5b5e9c

View File

@@ -551,6 +551,9 @@ if [ "$istheme" = "1" -a "\$1" = "0" ]; then
fi fi
# Run the pre-uninstall script, if we are not upgrading # Run the pre-uninstall script, if we are not upgrading
if [ "$prog" = "webmin" -a "\$1" = "0" -a -r "/usr/libexec/$prog/$mod/uninstall.pl" ]; then if [ "$prog" = "webmin" -a "\$1" = "0" -a -r "/usr/libexec/$prog/$mod/uninstall.pl" ]; then
# Skip if replaced by a different package (wbm-foo - webmin-foo)
owner=\$(rpm -qf --qf '%%{NAME}\\n' "/usr/libexec/$prog/$mod/uninstall.pl" 2>/dev/null || true)
[ -n "\$owner" -a "\$owner" != "%{name}" ] && exit 0
cd /usr/libexec/$prog cd /usr/libexec/$prog
WEBMIN_CONFIG=/etc/$prog WEBMIN_VAR=/var/$prog /usr/libexec/$prog/run-uninstalls.pl $mod WEBMIN_CONFIG=/etc/$prog WEBMIN_VAR=/var/$prog /usr/libexec/$prog/run-uninstalls.pl $mod
fi fi