From 8994ff166a2b1754f265781d88896c0491ddcad4 Mon Sep 17 00:00:00 2001 From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Thu, 19 May 2022 20:28:31 +0100 Subject: [PATCH] Add an experimental FreeBSD service file and the automake and configure stuff. --- Makefile.am | 7 +++++++ configure.ac | 4 ++++ nqptp.freebsd | 20 ++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 nqptp.freebsd diff --git a/Makefile.am b/Makefile.am index ed4c275..b00d78e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,4 +26,11 @@ if INSTALL_SYSTEMD_STARTUP endif endif # no installer for FreeBSD yet +if BUILD_FOR_FREEBSD +if INSTALL_FREEBSD_STARTUP + [ -e /usr/local/etc/rc.d/nqptp ] || cp nqptp.freebsd /usr/local/etc/rc.d/nqptp + chmod 555 /usr/local/etc/rc.d/nqptp +endif +endif + diff --git a/configure.ac b/configure.ac index 92e597e..e8d1eee 100644 --- a/configure.ac +++ b/configure.ac @@ -44,6 +44,10 @@ AM_CONDITIONAL([USE_GIT_VERSION], [test -n "$GIT" && test -e ".git/index" ]) AC_ARG_WITH([systemd-startup],[AS_HELP_STRING([--with-systemd-startup],[install a systemd startup script during a make install])]) AM_CONDITIONAL([INSTALL_SYSTEMD_STARTUP], [test "x$with_systemd_startup" = "xyes"]) +# Check to see if we should include the systemd stuff to define it as a service +AC_ARG_WITH([freebsd-startup],[AS_HELP_STRING([--with-freebsd-startup],[install a FreeBSD startup script during a make install])]) +AM_CONDITIONAL([INSTALL_FREEBSD_STARTUP], [test "x$with_freebsd_startup" = "xyes"]) + AC_CONFIG_SRCDIR([nqptp.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/nqptp.freebsd b/nqptp.freebsd new file mode 100644 index 0000000..679a78a --- /dev/null +++ b/nqptp.freebsd @@ -0,0 +1,20 @@ +#!/bin/sh +# + +# PROVIDE: nqptp +# REQUIRE: FILESYSTEMS DAEMON hostname + +. /etc/rc.subr + +name="nqptp" +rcvar="nqptp_enable" +pidfile="/var/run/${name}.pid" +apptodaemonise="/usr/local/bin/nqptp" + +command="/usr/sbin/daemon" +# -S log to syslog; -P store the supervisor PID +command_args="-S -P ${pidfile} ${apptodaemonise}" + +load_rc_config $name +run_rc_command "$1" + -- 2.47.2