summaryrefslogtreecommitdiff
path: root/net/chrony/files
diff options
context:
space:
mode:
authortron <tron@pkgsrc.org>2002-03-22 23:01:52 +0000
committertron <tron@pkgsrc.org>2002-03-22 23:01:52 +0000
commitbafd05dacd0d142267fd393dd6016f2abe79dddb (patch)
treeb11a0f6ae6e094dce09135016e5261e71906b860 /net/chrony/files
parent818e061eb00f3d94945a49be142e7a833a1caee2 (diff)
downloadpkgsrc-bafd05dacd0d142267fd393dd6016f2abe79dddb.tar.gz
Import new "chrony" package:
Daemon for maintaining the accuracy of computer clocks This packages was supplied by Juergen Hannken-Illjes in PR pkg/15729.
Diffstat (limited to 'net/chrony/files')
-rw-r--r--net/chrony/files/chronyd47
1 files changed, 47 insertions, 0 deletions
diff --git a/net/chrony/files/chronyd b/net/chrony/files/chronyd
new file mode 100644
index 00000000000..5a5937c95eb
--- /dev/null
+++ b/net/chrony/files/chronyd
@@ -0,0 +1,47 @@
+# PROVIDE: chronyd
+# REQUIRE: DAEMON
+
+. /etc/rc.subr
+
+name="chronyd"
+command="@PREFIX@/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="@PREFIX@/etc/chrony.conf"
+extra_commands="online offline"
+online_cmd="chronyd_online"
+online_precmd="chronyd_precmd"
+offline_cmd="chronyd_offline"
+offline_precmd="chronyd_precmd"
+
+chronyd_precmd()
+{
+ local id kfile
+ id=`awk '$1 == "commandkey" { print $2 }' @PREFIX@/etc/chrony.conf`
+ if [ -z "$id" ]; then
+ echo "ERROR: no commandkey in @PREFIX@/etc/chrony.conf!"
+ exit 1
+ fi
+ kfile=`awk '$1 == "keyfile" { print $2 }' @PREFIX@/etc/chrony.conf`
+ if [ -z "$kfile" ]; then
+ echo "ERROR: no keyfile in @PREFIX@/etc/chrony.conf!"
+ exit 1
+ fi
+ chronyd_password=`awk '$1 == "'$id'" { print $2 }' $kfile`
+ if [ -z "$chronyd_password" ]; then
+ echo "ERROR: no key #$id in $kfile!"
+ exit 1
+ fi
+}
+
+chronyd_online()
+{
+ printf "password %s\nonline\n" $chronyd_password | @PREFIX@/bin/chronyc
+}
+
+chronyd_offline()
+{
+ printf "password %s\noffline\n" $chronyd_password | @PREFIX@/bin/chronyc
+}
+
+load_rc_config $name
+run_rc_command "$1"