Updated postrm script

Pre-1.2.0 configuration scripts are no longer copied and renamed.
Init scripts, ldconfig files and systemd service files are only removed if
they are found.
This commit is contained in:
Markus Makela 2015-12-11 06:22:07 +02:00
parent f0c66232b5
commit 5266f1f125

View File

@ -1,13 +1,25 @@
#!/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" -eq 0 ]
then
rm -f /etc/init.d/maxscale
rm -f /etc/ld.so.conf.d/maxscale.conf
rm -f /usr/lib/systemd/system/maxscale.service
else
# Copy and rename config from old location
if [ -f "/usr/local/mariadb-maxscale/etc/MaxScale.cnf" -a ! -f "/etc/maxscale.cnf" ]
if [ -f /etc/init.d/maxscale ]
then
cp "/usr/local/mariadb-maxscale/etc/MaxScale.cnf" "/etc/maxscale.cnf"
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
rm /usr/lib/systemd/system/maxscale.service
elif [ -f /lib/systemd/system/maxscale.service ]
then
rm /lib/systemd/system/maxscale.service
fi
fi