~ salmonella-environment-setup (master) 716be1f1483df399b38c002fadeeda7d2bd6f453
commit 716be1f1483df399b38c002fadeeda7d2bd6f453 Author: Peter Bex <peter.bex@xs4all.nl> AuthorDate: Thu Feb 20 17:20:39 2014 +0100 Commit: Peter Bex <peter.bex@xs4all.nl> CommitDate: Thu Feb 20 17:20:39 2014 +0100 Add very ugly initial init-script for FreeBSD diff --git a/awful/init-scripts/awful-wrapper b/awful/init-scripts/awful-wrapper new file mode 100755 index 0000000..75ff815 --- /dev/null +++ b/awful/init-scripts/awful-wrapper @@ -0,0 +1,22 @@ +#!/bin/sh +# Awful wrapper script because it has no daemonize feature +# First argument is the PID file and second argument is the logfile +# It expects to find the awful binary in /home/chicken/chickens/use-this/bin/awful + +PIDFILE=$1 +LOGFILE=$2 + +args="" +[ -e "/usr/local/etc/awful/awful.conf" ] && args="/usr/local/etc/awful/awful.conf $args" +[ -e "/usr/local/etc/awful/privileged.conf" ] && args="--privileged-code=/usr/local/etc/awful/privileged.conf $args" + +rm -f $PIDFILE +/home/chicken/chickens/use-this/bin/awful $args 2>&1 > $LOGFILE & +pid=$! +exit_code=$? +if [ "$exit_code" = "0" ]; then + echo $pid > $PIDFILE + return 0 +else + return 2 +fi diff --git a/awful/init-scripts/freebsd b/awful/init-scripts/freebsd new file mode 100755 index 0000000..826b557 --- /dev/null +++ b/awful/init-scripts/freebsd @@ -0,0 +1,35 @@ +#! /bin/sh +# + +# PROVIDE: awful +# REQUIRE: DAEMON +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable awful: +# +#awful_enable="YES" + +. /etc/rc.subr + +name="awful" +rcvar="awful_enable" + +load_rc_config $name + +# Privileges are dropped in the wrapper-script +#: ${awful_user:=awful} +#: ${awful_group:=awful} +: ${awful_enable:=NO} + +procname="awful" +logfile="/var/log/awful/init.log" +# Unfortunately, pidfile handling of rc.subr doesn't seem to work... +pidfile="/var/run/awful.pid" + +#... so we have to work with a wrapper script +command="/home/chicken/bin/awful-wrapper" +command_args="${pidfile} ${logfile}" + + +run_rc_command "$1"Trap