1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
# figure out what sort if init|systemctl|... we're using to
# launch daemons and services
do_systemctl=false
do_systemd_helper=false
do_update_rc=false
do_invoke_rc=false
if which systemctl >/dev/null 2>&1
then
# we have a systemctl executable, but it might be disabled,
# e.g. on MX Linux
systemctl -q is-active local-fs.target >/dev/null 2>&1 && do_systemctl=true
fi
if $do_systemctl
then
which deb-systemd-helper >/dev/null 2>&1 && do_systemd_helper=true
else
# not using systemctl(1), maybe need to install System-V style
# init script links with update-rc.d(1) and start/stop with
# invoke-rc.d(1)
which update-rc.d >/dev/null 2>&1 && do_update_rc=true
which invoke-rc.d >/dev/null 2>&1 && do_invoke_rc=true
fi
# only need to check pmcd.service, if it is here they will all
# be here ... the real service files may have already been removed
# by now, so check the "dangling" symlinks
#
if [ -L /etc/systemd/system/multi-user.target.wants/pmcd.service ]
then
:
else
do_systemd_helper=false
do_systemctl=false
fi
# ditto for the System-V variant for pmlogger
if [ -f /etc/init.d/pmlogger ]
then
:
else
do_update_rc=false
do_invoke_rc=false
fi
systemd_units='
pcp-geolocate.service
pcp-reboot-init.service
pmproxy.service
pmlogger_farm_check.timer pmlogger_farm_check.service
pmlogger_farm.service
pmlogger_daily.timer pmlogger_daily.service
pmlogger_check.timer pmlogger_check.service
pmlogger.service
pmie_farm_check.timer pmie_farm_check.service
pmie_daily.timer pmie_daily.service
pmie_check.timer pmie_check.service
pmie.service
pmfind.timer pmfind.service
pmcd.service'
if [ "$1" = remove ]
then
if $do_systemd_helper
then
for unit in $systemd_units
do
deb-systemd-helper remove $unit >/dev/null
done
elif $do_update_rc
then
update-rc.d pmproxy remove >/dev/null
update-rc.d pmie remove >/dev/null
update-rc.d pmlogger remove >/dev/null
update-rc.d pmcd remove >/dev/null
fi
fi
if [ "$1" = purge ]
then
if $do_systemd_helper
then
for unit in $systemd_units
do
deb-systemd-helper purge $unit >/dev/null
done
fi
fi
|