core/ntp/install
2014-04-07 00:29:53 +02:00

37 lines
946 B
Plaintext

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
echo "Enabling systemd service"
systemctl enable ntpd.service
}
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
fi
if [[ $(vercmp $2 4.2.6.p5-6) -le 0 ]]; then
cat <<EOF
==> The PID file /var/run/ntpd.pid has been renamed /run/ntpd.pid
==> and the new systemd service only takes the latter into account.
==> To stop your old ntpd process, please kill it manually.
EOF
fi
}
pre_remove() {
echo "Disabling systemd service"
systemctl disable ntpd.service
}
post_remove() {
getent passwd ntp &>/dev/null && userdel ntp >/dev/null
getent group ntp &>/dev/null && groupdel ntp >/dev/null
true
}