forked from porcupie/rbd-docker-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostremove
executable file
·35 lines (30 loc) · 863 Bytes
/
postremove
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
#!/bin/bash
set -e
set -u
# rbd-docker-plugin postremove
SYSTEMD_SVC=rbd-docker-plugin.service
UPSTART_INIT=/etc/init/rbd-docker-plugin.conf
LOGROTATE_CONF=/etc/logrotate.d/rbd-docker-plugin_logrotate
CRON_JOB=/etc/cron.d/rbd-docker-plugin-checks
# remove cron check
if test -f "$CRON_JOB" ; then
rm -vf "$CRON_JOB"
fi
# centos 7.x / systemd
if UNIT_DIR=$(pkg-config systemd --variable=systemdsystemunitdir); then
# stop and disable system service unit
systemctl stop ${SYSTEMD_SVC}
systemctl disable ${SYSTEMD_SVC}
# unlink the tpkg .service file
rm -vf "${UNIT_DIR}/${SYSTEMD_SVC}"
else
# centos 6 / remove the upstart softlink
if test -L "$UPSTART_INIT" ; then
stop rbd-docker-plugin
rm -f "$UPSTART_INIT"
fi
fi
# remove log config
if test -f "$LOGROTATE_CONF" ; then
rm -vf "$LOGROTATE_CONF"
fi