4 changed files with 133 additions and 0 deletions
@ -0,0 +1,55 @@ |
|||||||
|
# vim: set ft=sh: |
||||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||||
|
# |
||||||
|
# Filename: package/.../runit/overlay.d/runit/D%libdir_runit-run.in.txt |
||||||
|
# Copyright (C) 2010 The OpenSDE Project |
||||||
|
# |
||||||
|
# More information can be found in the files COPYING and README. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License as published by |
||||||
|
# the Free Software Foundation; version 2 of the License. A copy of the |
||||||
|
# GNU General Public License can be found in the file COPYING. |
||||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||||
|
|
||||||
|
usage() { |
||||||
|
cat <<EOT >&2 |
||||||
|
usage: $0 <run_script> |
||||||
|
ln -s $0 <run_script>; <run_script> |
||||||
|
EOT |
||||||
|
exit 1 |
||||||
|
} |
||||||
|
|
||||||
|
progname() { |
||||||
|
case "$1" in |
||||||
|
/*) echo "$1" ;; |
||||||
|
*/*) echo "$(cd "${1%/*}"; pwd)/${1##*/}" ;; |
||||||
|
*) if [ "$PWD" = / ]; then |
||||||
|
echo "/$1" |
||||||
|
else |
||||||
|
echo "$PWD/$1" |
||||||
|
fi ;; |
||||||
|
esac |
||||||
|
} |
||||||
|
|
||||||
|
case "$0" in |
||||||
|
D_sbindir/${TEMPLATE:-runit-run}) |
||||||
|
# Sha-Bang'ed |
||||||
|
[ $# -gt 0 ] || usage |
||||||
|
|
||||||
|
if [ -s "$1" ] && ${SHELL:-sh} -n "$1"; then |
||||||
|
PROGNAME="$(progname "$1")"; shift |
||||||
|
SCRIPT=yes |
||||||
|
else |
||||||
|
echo "$PROGNAME: invalid script" >&2 |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
;; |
||||||
|
*) |
||||||
|
# symlinked |
||||||
|
PROGNAME="$(progname "$0")" |
||||||
|
SCRIPT= |
||||||
|
esac |
||||||
|
|
||||||
|
cd "${PROGNAME%/*}" |
@ -0,0 +1,42 @@ |
|||||||
|
#!/bin/sh |
||||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||||
|
# |
||||||
|
# Filename: package/.../runit/overlay.d/runit/D%sbindir_runit-log-run.sh |
||||||
|
# Copyright (C) 2010 The OpenSDE Project |
||||||
|
# |
||||||
|
# More information can be found in the files COPYING and README. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License as published by |
||||||
|
# the Free Software Foundation; version 2 of the License. A copy of the |
||||||
|
# GNU General Public License can be found in the file COPYING. |
||||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||||
|
|
||||||
|
TEMPLATE=log-run |
||||||
|
. D_libdir/runit-run.in |
||||||
|
|
||||||
|
set -e |
||||||
|
|
||||||
|
# Variables to override |
||||||
|
# |
||||||
|
SVID="$(pwd | sed -ne 's|.*/\([^/]\+\)/log$|\1|p')" |
||||||
|
LOGUSER=log |
||||||
|
LOGDIR="${SVID:+/var/log/$SVID}" |
||||||
|
|
||||||
|
SVLOGD_OPT=-t |
||||||
|
|
||||||
|
[ -z "$SCRIPT" ] || . "$PROGNAME" |
||||||
|
|
||||||
|
# Detect SVID if needed |
||||||
|
[ -n "$SVID" ] || die "$PWD: invalid log/run dir" |
||||||
|
|
||||||
|
# Detect LOGDIR if needed |
||||||
|
[ -n "$LOGDIR" ] || LOGDIR="/var/log/$SVID" |
||||||
|
[ -d "$LOGDIR/" ] || mkdir -p "$LOGDIR" |
||||||
|
chown "${LOGUSER:-log}" "$LOGDIR" |
||||||
|
|
||||||
|
# ./main -> $LOGDIR |
||||||
|
[ -d "main/" ] || ln -s "$LOGDIR" "main" |
||||||
|
|
||||||
|
exec setuidgid "${LOGUSER:-log}" svlogd ${SVLOGD_OPT} main/ |
@ -0,0 +1,34 @@ |
|||||||
|
#!/bin/sh |
||||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||||
|
# |
||||||
|
# Filename: package/.../runit/overlay.d/runit/D%sbindir_runit-run.sh |
||||||
|
# Copyright (C) 2010 The OpenSDE Project |
||||||
|
# |
||||||
|
# More information can be found in the files COPYING and README. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License as published by |
||||||
|
# the Free Software Foundation; version 2 of the License. A copy of the |
||||||
|
# GNU General Public License can be found in the file COPYING. |
||||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||||
|
# |
||||||
|
# to be used as symlink to /etc/runit/runit-run or #!/etc/runit/runit-run |
||||||
|
|
||||||
|
exec 2>&1 |
||||||
|
|
||||||
|
. D_libdir/runit-run.in |
||||||
|
|
||||||
|
set -e |
||||||
|
|
||||||
|
SVID="${PWD##*/}" |
||||||
|
RUN= |
||||||
|
|
||||||
|
[ -z "$SCRIPT" ] || . "$PROGNAME" |
||||||
|
|
||||||
|
if [ -n "$RUN" ]; then |
||||||
|
exec "$RUN" |
||||||
|
else |
||||||
|
echo "$PROGNAME: no daemon to RUN defined" >&2 |
||||||
|
exit 1 |
||||||
|
fi |
Loading…
Reference in new issue