2012-12-11 02:10:38 +08:00
|
|
|
post_install() {
|
|
|
|
getent group ntp &>/dev/null || groupadd -g 87 ntp >/dev/null
|
|
|
|
getent passwd ntp &>/dev/null || useradd -u 87 -g ntp -d /var/lib/ntp -c 'Network Time Protocol' -s /bin/false ntp >/dev/null
|
|
|
|
true
|
2013-01-14 03:06:22 +08:00
|
|
|
|
|
|
|
echo "Enabling systemd service"
|
|
|
|
systemctl enable ntpd.service
|
2012-12-11 02:10:38 +08:00
|
|
|
}
|
2011-10-06 23:01:44 +08:00
|
|
|
|
2012-12-11 02:10:38 +08:00
|
|
|
post_upgrade() {
|
|
|
|
if [[ $(vercmp $2 4.2.6.p4-4) -le 0 ]]; then
|
|
|
|
post_install
|
|
|
|
fi
|
|
|
|
if [[ $(vercmp $2 4.2.6.p5-5) -le 0 ]]; then
|
|
|
|
chown -R ntp /var/lib/ntp
|
2011-10-06 23:01:44 +08:00
|
|
|
fi
|
2013-01-14 03:06:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
pre_remove() {
|
|
|
|
echo "Disabling systemd service"
|
|
|
|
systemctl disable ntpd.service
|
2011-10-06 23:01:44 +08:00
|
|
|
}
|
2012-12-11 02:10:38 +08:00
|
|
|
|
|
|
|
post_remove() {
|
|
|
|
getent passwd ntp &>/dev/null && userdel ntp >/dev/null
|
|
|
|
getent group ntp &>/dev/null && groupdel ntp >/dev/null
|
|
|
|
true
|
|
|
|
}
|