
Renamed the postrm script to prerm since it is executed before uninstallation. Silenced the output of the systemctl disable commands and added a conditional restart of MaxScale if a MaxScale instance is running. Use getent instead of grep to detect if the maxscale user needs to be created.
38 lines
1.0 KiB
Bash
Executable File
38 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# The first argument is the number of packages left after
|
|
# this one has been removed. If it is 0 then the package is being
|
|
# removed from the system.
|
|
if [ "$1" = "0" ] || [ "$1" = "remove" ]
|
|
then
|
|
if [ -f /etc/init.d/maxscale ]
|
|
then
|
|
/etc/init.d/maxscale stop
|
|
rm /etc/init.d/maxscale
|
|
fi
|
|
|
|
if [ -f /etc/ld.so.conf.d/maxscale.conf ]
|
|
then
|
|
rm /etc/ld.so.conf.d/maxscale.conf
|
|
fi
|
|
|
|
if [ -f /usr/lib/systemd/system/maxscale.service ]
|
|
then
|
|
systemctl stop maxscale.service
|
|
systemctl disable maxscale.service > /dev/null
|
|
rm /usr/lib/systemd/system/maxscale.service
|
|
systemctl daemon-reload
|
|
elif [ -f /lib/systemd/system/maxscale.service ]
|
|
then
|
|
systemctl stop maxscale.service
|
|
systemctl disable maxscale.service > /dev/null
|
|
rm /lib/systemd/system/maxscale.service
|
|
systemctl daemon-reload
|
|
fi
|
|
|
|
if [ -f /etc/logrotate.d/maxscale_logrotate ]
|
|
then
|
|
rm /etc/logrotate.d/maxscale_logrotate
|
|
fi
|
|
fi
|