PREIN
/bin/sh
if /usr/bin/getgid ntp > /dev/null 2>&1; then
if [ "`/usr/bin/getgid ntp`" != "246" ]; then
echo "Error: group ntp doesn't have gid=246. Correct this before installing ntp." 1>&2
exit 1
fi
else
echo "Adding group ntp GID=246."
/usr/sbin/groupadd -g 246 -r ntp 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || :
fi;
if [ -n "`/bin/id -u ntp 2>/dev/null`" ]; then
if [ "`/bin/id -u ntp`" != "246" ]; then
echo "Error: user ntp doesn't have uid=246. Correct this before installing ntp." 1>&2
exit 1
fi
else
echo "Adding user ntp UID=246."
/usr/sbin/useradd \
\
-u 246 \
-r \
-d /etc/ntp \
-s /bin/false \
-c "NTP Daemon"\
-g ntp \
\
\
ntp 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || :
fi;
PREUN
/bin/sh
if [ "$1" = "0" ]; then
{
if [ ! -x /bin/systemd_booted ] || ! /bin/systemd_booted; then
if [ -f /var/lock/subsys/ntpdate ]; then
/sbin/service ntpdate stop 1>&2 || :;
fi
fi };
/sbin/chkconfig --del ntpdate
fi
if [ $1 -eq 0 ]; then
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
/bin/systemd_booted && /bin/systemctl stop ntpdate.service || :
/bin/systemctl --quiet disable ntpdate.service || :
fi
POSTIN
/bin/sh
/sbin/chkconfig --add ntpdate
{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/ntpdate ] && . /etc/sysconfig/ntpdate
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ ! -x /bin/systemd_booted ] || ! /bin/systemd_booted; then
if [ -f /var/lock/subsys/ntpdate ]; then
/sbin/service ntpdate restart 1>&2 || :;
else
echo 'Run "/sbin/service ntpdate start" to start NTP Date.'
fi
fi
else
if [ ! -x /bin/systemd_booted ] || ! /bin/systemd_booted; then
if [ -f /var/lock/subsys/ntpdate ]; then
echo 'Run "/sbin/service ntpdate restart" to restart NTP Date.'
fi
else NORESTART=1 # for %%systemd_post if called after
fi
fi };
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
/bin/systemd_booted && /bin/systemctl daemon-reload || :
if [ $1 -eq 1 ]; then
/bin/systemctl preset --preset-mode=enable-only ntpdate.service >/dev/null || :
/bin/systemd_booted && echo 'Run "/bin/systemctl start ntpdate.service" to start ntpdate.service.' || :
elif [ -z "$NORESTART" ]; then
/bin/systemd_booted && /bin/systemctl try-restart ntpdate.service || :
else
/bin/systemd_booted && echo 'Run "/bin/systemctl restart ntpdate.service" to restart ntpdate.service.' || :
fi
POSTUN
/bin/sh
if [ "$1" = "0" ]; then
/usr/lib/rpm/user_group.sh user del ntp
/usr/lib/rpm/user_group.sh group del ntp
fi
/bin/systemd_booted && SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog /bin/systemctl daemon-reload || :
Triggers
ntp-client <
4.2.4p8-3.2
/bin/sh
if [ -f /etc/sysconfig/ntp.rpmsave ]; then
cp -f /etc/sysconfig/ntpdate{,.rpmnew}
mv -f /etc/sysconfig/ntp.rpmsave /etc/sysconfig/ntpdate
fi
want_enable_service() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ ${RPM_ENABLE_SYSTEMD_SERVICE:-yes} = no ] && return 1
[ "$(echo /etc/rc.d/rc[0-6].d/S[0-9][0-9]${1%.service})" = "/etc/rc.d/rc[0-6].d/S[0-9][0-9]${1%.service}" ] && return 1
return 0
}
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
for s in ntpdate.service; do
if want_enable_service $s; then
/bin/systemctl enable $s || :
fi
done
ntpdate <
4.2.6p5-2
/bin/sh
want_enable_service() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ ${RPM_ENABLE_SYSTEMD_SERVICE:-yes} = no ] && return 1
[ "$(echo /etc/rc.d/rc[0-6].d/S[0-9][0-9]${1%.service})" = "/etc/rc.d/rc[0-6].d/S[0-9][0-9]${1%.service}" ] && return 1
return 0
}
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
for s in ntpdate.service; do
if want_enable_service $s; then
/bin/systemctl enable $s || :
fi
done