void-packages/srcpkgs/clockspeed/files/clockctl
classabbyamp 9ab1405894
*: remove unnecessary execute permissions
* INSTALL scripts don't need to be executable
* anything installed by vbin is set to 755
* many of these files were otherwise marked executable in the template
  (vinstall, chmod, etc)
* some had no business being executable, like the smattering of patches
  and other files
* remove files from chroot-distcc no longer used in the template
  (46ce787b63)
2024-08-02 13:24:47 -04:00

69 lines
1.6 KiB
Bash

#!/bin/sh
# clockctl
# interface to djb clockspeed (0.62)
# ===
# from http://thedjbway.b0llix.net/clockspeed/clockctl.html
# read configuration:
if [ -r /etc/clockspeed/clockspeed.conf ] ; then
. /etc/clockspeed/clockspeed.conf
else
echo "$0: configuration error: unable to read clockspeed.conf"
exit 1
fi
# clock_pick function:
clock_pick()
{
case ${CLOCK_TYPE} in
ntp|NTP)
${CLOCKSPEED_BIN}/sntpclock "${CLOCK_IP}"
;;
tai|TAI)
${CLOCKSPEED_BIN}/taiclock "${CLOCK_IP}"
;;
*)
echo "$0: configuration error: CLOCK_TYPE not recognized"
exit 1;
;;
esac
}
# process command:
case $1 in
a|atto)
echo "Viewing current attoseconds in hardware tick:"
${CLOCKSPEED_BIN}/clockview < ${CLOCKSPEED_HOME}/etc/atto
;;
m|mark)
echo "Obtaining new calibration mark from master server at ${CLOCK_IP}:"
clock_pick | tee ${CLOCKSPEED_HOME}/adjust | ${CLOCKSPEED_BIN}/clockview
;;
s|sync)
echo "Setting system clock with master server at ${CLOCK_IP}:"
clock_pick | ${CLOCKSPEED_BIN}/clockadd && \
clock_pick | ${CLOCKSPEED_BIN}/clockview
;;
v|view)
echo "Checking system clock against master server at ${CLOCK_IP} (clockview):"
clock_pick | ${CLOCKSPEED_BIN}/clockview
;;
h|help)
cat <<END_HELP
clockspeed control:
atto -- inspect current "attoseconds"
mark -- obtain new calibration mark for clockspeed
sync -- set the system clock with master time server
view -- check system clock against master time server
help -- this screen
END_HELP
;;
*)
echo "Usage: $0 [ a|atto | m|mark | s|sync | v|view | h|help ]"
exit 1
;;
esac
exit 0