forked from yp-engineering/rbd-docker-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postinstall
executable file
·31 lines (25 loc) · 904 Bytes
/
postinstall
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
#!/bin/bash
set -e
set -u
# rbd-docker-plugin postinstall
SYSTEMD_SERVICE=rbd-docker-plugin.service
SYSTEMD_CONF=$TPKG_HOME/etc/systemd/system/$SYSTEMD_SERVICE
UPSTART_CONF=$TPKG_HOME/etc/init/rbd-docker-plugin.conf
LOGROTATE_CONF=$TPKG_HOME/etc/logrotate.d/rbd-docker-plugin_logrotate
# centos 7.x / systemd
if UNIT_DIR=$(pkg-config systemd --variable=systemdsystemunitdir); then
# copy the systemd .service (symlink won't work here)
install -m 0644 -v "$SYSTEMD_CONF" "${UNIT_DIR}/${SYSTEMD_SERVICE}"
# enable and start it
systemctl enable ${SYSTEMD_SERVICE}
systemctl start ${SYSTEMD_SERVICE}
else
# centos 6 / upstart
# link the /etc/init configuration file
ln -s "$UPSTART_CONF" /etc/init/rbd-docker-plugin.conf
start rbd-docker-plugin
fi
# logrotate config
if test -d /etc/logrotate.d ; then
install -m 0644 -v "$LOGROTATE_CONF" /etc/logrotate.d/.
fi