summaryrefslogtreecommitdiff
path: root/net-misc/ptpd/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-misc/ptpd/files
reinit the tree, so we can have metadata
Diffstat (limited to 'net-misc/ptpd/files')
-rw-r--r--net-misc/ptpd/files/ptpd2.confd4
-rw-r--r--net-misc/ptpd/files/ptpd2.rc56
-rw-r--r--net-misc/ptpd/files/ptpd2.service11
3 files changed, 71 insertions, 0 deletions
diff --git a/net-misc/ptpd/files/ptpd2.confd b/net-misc/ptpd/files/ptpd2.confd
new file mode 100644
index 000000000000..22fe2d49285f
--- /dev/null
+++ b/net-misc/ptpd/files/ptpd2.confd
@@ -0,0 +1,4 @@
+# /etc/conf.d/ptpd2
+
+# Options to pass to ptpd2
+PTPD_OPTS=""
diff --git a/net-misc/ptpd/files/ptpd2.rc b/net-misc/ptpd/files/ptpd2.rc
new file mode 100644
index 000000000000..bf8e14332298
--- /dev/null
+++ b/net-misc/ptpd/files/ptpd2.rc
@@ -0,0 +1,56 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+PTPD_CONFIGFILE=${PTPD_CONFIGFILE:-/etc/${RC_SVCNAME}.conf}
+PTPD_STATEFILE_DIR=${PTPD_STATEFILE_DIR:-/var/run}
+PTPD_STATEFILE=${PTPD_STATEFILE:-${PTPD_STATEFILE_DIR}/${RC_SVCNAME}.status}
+PTPD_PIDFILE_DIR=${PTPD_PIDFILE_DIR:-/var/run}
+PTPD_PIDFILE=${PTPD_PIDFILE:-${PTPD_PIDFILE_DIR}/${RC_SVCNAME}.pid}
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+command="/usr/sbin/ptpd2"
+command_args="--global:lock_file=$PTPD_PIDFILE --global:status_file=$PTPD_STATEFILE -c $PTPD_CONFIGFILE $PTPD_OPTS"
+pidfile="${PTPD_PIDFILE}"
+description="Precise Time Protocol daemon"
+
+
+depend() {
+ use net dns logger
+}
+
+checkconfig() {
+ ebegin "Checking ${SVCNAME} configuration"
+ msgout="$($command -k $command_args 2>&1)"
+ RETVAL=$?
+
+ # colorize output
+ echo "$msgout" | while read ln; do
+ if [[ "$ln" == *ignored* ]]; then
+ ewarn "$ln"
+ elif [[ "$ln" != "Configuration OK" ]]; then
+ eerror "$ln"
+ fi
+ done
+
+ eend $RETVAL
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --exec ${command} \
+ --pidfile ${pidfile} \
+ -- ${command_args}
+ eend $?
+}
+
+reload() {
+ checkconfig || return 1
+
+ ebegin "Reloading ${SVCNAME} configuration"
+ start-stop-daemon --signal HUP --pidfile "${pidfile}"
+ eend $?
+}
diff --git a/net-misc/ptpd/files/ptpd2.service b/net-misc/ptpd/files/ptpd2.service
new file mode 100644
index 000000000000..35fb34fd6897
--- /dev/null
+++ b/net-misc/ptpd/files/ptpd2.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Precise Time Protocol daemon
+Documentation=man:ptpd2(8)
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/ptpd2 -C -c /etc/ptpd2.conf
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target