From 9fec39ad5150620414a9fed92617703e1002f906 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Mon, 18 May 2020 15:09:53 -0400 Subject: Template rc scripts with %%PREFIX%% The way that the ports tree does it. --- .gitignore | 2 ++ Makefile | 7 ++++++- rc.d/calico | 30 ---------------------------- rc.d/calico.in | 30 ++++++++++++++++++++++++++++ rc.d/pounce | 63 ---------------------------------------------------------- rc.d/pounce.in | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 101 insertions(+), 94 deletions(-) delete mode 100644 rc.d/calico create mode 100644 rc.d/calico.in delete mode 100644 rc.d/pounce create mode 100644 rc.d/pounce.in diff --git a/.gitignore b/.gitignore index c7ce8fe..9d34433 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ config.mk localhost.crt localhost.key +rc.d/calico +rc.d/pounce tags diff --git a/Makefile b/Makefile index 23053ff..e6e5849 100644 --- a/Makefile +++ b/Makefile @@ -34,11 +34,16 @@ ${OBJS}: bounce.h compat.h dispatch.o: compat.h +.SUFFIXES: .in + +.in: + sed -e 's|%%PREFIX%%|${PREFIX}|g' $< > $@ + tags: *.c *.h ctags -w *.c *.h clean: - rm -f tags ${BINS} ${OBJS} dispatch.o + rm -f tags ${BINS} ${RCS} ${OBJS} dispatch.o install: ${BINS} ${MANS} ${RCS} install -d ${PREFIX}/bin ${MANDIR}/man1 diff --git a/rc.d/calico b/rc.d/calico deleted file mode 100644 index 32c21d8..0000000 --- a/rc.d/calico +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -# PROVIDE: calico -# REQUIRE: LOGIN -# KEYWORD: shutdown - -. /etc/rc.subr - -name='calico' -rcvar='calico_enable' - -load_rc_config "${name}" - -: ${calico_enable:='NO'} -: ${calico_path:="/var/run/${name}"} -calico_flags="${calico_flags} ${calico_path}" - -command='/usr/sbin/daemon' -procname='/usr/local/bin/calico' -pidfile="/var/run/${name}.pid" -required_dirs=$calico_path - -child_flags=$calico_flags -child_user=$calico_user -unset calico_flags calico_user -command_args="\ - -p ${pidfile} -T ${name} ${child_user:+-u ${child_user}} \ - -- ${procname} ${child_flags}" - -run_rc_command "$1" diff --git a/rc.d/calico.in b/rc.d/calico.in new file mode 100644 index 0000000..a54658a --- /dev/null +++ b/rc.d/calico.in @@ -0,0 +1,30 @@ +#!/bin/sh + +# PROVIDE: calico +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name='calico' +rcvar='calico_enable' + +load_rc_config "${name}" + +: ${calico_enable:='NO'} +: ${calico_path:="/var/run/${name}"} +calico_flags="${calico_flags} ${calico_path}" + +command='/usr/sbin/daemon' +procname='%%PREFIX%%/bin/calico' +pidfile="/var/run/${name}.pid" +required_dirs=$calico_path + +child_flags=$calico_flags +child_user=$calico_user +unset calico_flags calico_user +command_args="\ + -p ${pidfile} -T ${name} ${child_user:+-u ${child_user}} \ + -- ${procname} ${child_flags}" + +run_rc_command "$1" diff --git a/rc.d/pounce b/rc.d/pounce deleted file mode 100644 index 9777fda..0000000 --- a/rc.d/pounce +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -# PROVIDE: pounce -# REQUIRE: LOGIN -# KEYWORD: shutdown - -. /etc/rc.subr - -name='pounce' -rcvar='pounce_enable' -extra_commands='reload' -sig_reload='USR1' - -load_rc_config "${name}" - -: ${pounce_enable:='NO'} -: ${pounce_chdir:="/usr/local/etc/${name}"} - -command='/usr/sbin/daemon' -pidprefix="/var/run/${name}" -pidfile="${pidprefix}.pid" -required_dirs=$pounce_chdir - -child_command='/usr/local/bin/pounce' -child_pidfile="${pidprefix}.child.pid" - -if [ -n "$2" ]; then - profile=$2 - if [ -n "${pounce_profiles}" ]; then - pidfile="${pidprefix}.${profile}.pid" - child_pidfile="${pidprefix}.${profile}.child.pid" - eval pounce_enable="\${pounce_${profile}_enable:-${pounce_enable}}" - eval pounce_flags="\${pounce_${profile}_flags:-${pounce_flags}}" - eval pounce_chdir="\${pounce_${profile}_chdir:-${pounce_chdir}}" - eval pounce_user="\${pounce_${profile}_user:-${pounce_user}}" - else - echo "$0: extra argument ignored" - fi -else - if [ -n "${pounce_profiles}" -a -n "$1" ]; then - for profile in ${pounce_profiles}; do - echo "===> ${name} profile: ${profile}" - /usr/local/etc/rc.d/${name} "$1" "${profile}" || exit "$?" - done - exit - fi -fi - -child_flags=$pounce_flags -child_user=$pounce_user -unset pounce_flags pounce_user -command_args="\ - -r -P ${pidfile} -p ${child_pidfile} -T ${name}${profile:+/${profile}} \ - ${child_user:+-u ${child_user}} \ - -- ${child_command} ${child_flags}" - -pounce_reload() { - rc_pid=$(check_pidfile "$child_pidfile" "$child_command") - kill "-$sig_reload" "$rc_pid" -} -reload_cmd='pounce_reload' - -run_rc_command "$1" diff --git a/rc.d/pounce.in b/rc.d/pounce.in new file mode 100644 index 0000000..99ed016 --- /dev/null +++ b/rc.d/pounce.in @@ -0,0 +1,63 @@ +#!/bin/sh + +# PROVIDE: pounce +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name='pounce' +rcvar='pounce_enable' +extra_commands='reload' +sig_reload='USR1' + +load_rc_config "${name}" + +: ${pounce_enable:='NO'} +: ${pounce_chdir:="%%PREFIX%%/etc/${name}"} + +command='/usr/sbin/daemon' +pidprefix="/var/run/${name}" +pidfile="${pidprefix}.pid" +required_dirs=$pounce_chdir + +child_command='%%PREFIX%%/bin/pounce' +child_pidfile="${pidprefix}.child.pid" + +if [ -n "$2" ]; then + profile=$2 + if [ -n "${pounce_profiles}" ]; then + pidfile="${pidprefix}.${profile}.pid" + child_pidfile="${pidprefix}.${profile}.child.pid" + eval pounce_enable="\${pounce_${profile}_enable:-${pounce_enable}}" + eval pounce_flags="\${pounce_${profile}_flags:-${pounce_flags}}" + eval pounce_chdir="\${pounce_${profile}_chdir:-${pounce_chdir}}" + eval pounce_user="\${pounce_${profile}_user:-${pounce_user}}" + else + echo "$0: extra argument ignored" + fi +else + if [ -n "${pounce_profiles}" -a -n "$1" ]; then + for profile in ${pounce_profiles}; do + echo "===> ${name} profile: ${profile}" + %%PREFIX%%/etc/rc.d/${name} "$1" "${profile}" || exit "$?" + done + exit + fi +fi + +child_flags=$pounce_flags +child_user=$pounce_user +unset pounce_flags pounce_user +command_args="\ + -r -P ${pidfile} -p ${child_pidfile} -T ${name}${profile:+/${profile}} \ + ${child_user:+-u ${child_user}} \ + -- ${child_command} ${child_flags}" + +pounce_reload() { + rc_pid=$(check_pidfile "$child_pidfile" "$child_command") + kill "-$sig_reload" "$rc_pid" +} +reload_cmd='pounce_reload' + +run_rc_command "$1" -- cgit 1.4.1 a8d29f991ac906139eb922827f&follow=1'>Add gzdopen to gzopen.3June McEnroe 2018-11-12Add gzopen.3June McEnroe 2018-11-12Add inflateBackEnd.3June McEnroe 2018-11-12Add inflateBack.3June McEnroe 2018-11-12Add inflateBackInit.3June McEnroe 2018-11-11Add inflateGetHeader.3June McEnroe 2018-11-11Add inflateMark.3June McEnroe 2018-11-11Add inflatePrime.3June McEnroe 2018-11-11Add inflateReset.3June McEnroe 2018-11-11Add inflateCopy.3June McEnroe 2018-11-11Add inflateSync.3June McEnroe 2018-11-11Add inflateGetDictionary.3June McEnroe 2018-11-11Add inflateSetDictionary.3June McEnroe 2018-11-11Add inflateInit2.3June McEnroe