Changeset View
Changeset View
Standalone View
Standalone View
etc/rc.d/ntpd
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | ntpd_precmd() | ||||
# are made in run_rc_command(), we can safely assume ${ntpd_chrootdir} | # are made in run_rc_command(), we can safely assume ${ntpd_chrootdir} | ||||
# exists and ntpd isn't running at this point (unless forcestart | # exists and ntpd isn't running at this point (unless forcestart | ||||
# is used). | # is used). | ||||
# | # | ||||
if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then | if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then | ||||
rm -f "${ntpd_chrootdir}/dev/clockctl" | rm -f "${ntpd_chrootdir}/dev/clockctl" | ||||
( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" ) | ( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" ) | ||||
fi | fi | ||||
ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift | |||||
ln -fs "${ntpd_chrootdir}${ntp_tmp_leapfile}" ${ntp_tmp_leapfile} | ln -fs "${ntpd_chrootdir}${ntp_tmp_leapfile}" ${ntp_tmp_leapfile} | ||||
# For each ntpd cmdline option that takes a file or dir as an argument, | |||||
# create a symlink into the cage at the corresponding outside location, | |||||
# if there isn't a file or symlink at that location already. Silently | |||||
# ignore errors (there might be a readonly filesystem involved) since | |||||
# this is only a convenience and not required for operation. | |||||
set -- $rc_flags | |||||
while [ $# -gt 1 ]; do | |||||
case "$1" in | |||||
-c | --configfile | \ | |||||
-f | --driftfile | \ | |||||
-k | --keyfile | \ | |||||
-l | --logfile | \ | |||||
-s | --statsdir ) | |||||
if [ ! -e "$2" ]; then | |||||
ln -fhs "${ntpd_chrootdir}/$2" "$2" 2>/dev/null | |||||
fi | |||||
shift | |||||
;; | |||||
esac | |||||
shift | |||||
done | |||||
# Change run_rc_commands()'s internal copy of $ntpd_flags | # Change run_rc_commands()'s internal copy of $ntpd_flags | ||||
# | # | ||||
rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags" | rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags" | ||||
} | } | ||||
current_ntp_ts() { | current_ntp_ts() { | ||||
# Seconds between 1900-01-01 and 1970-01-01 | # Seconds between 1900-01-01 and 1970-01-01 | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |