autoinst

scripts to make installation of custom debian easier and more automated
git clone git://deadbeef.fr/autoinst.git
Log | Files | Refs | README | LICENSE

commit 5e10c68ca5152a7e3a4ac4ece866db6972394d13
parent 756f3a23c59c3d5e01bedba34e6547afd6145d15
Author: Morel BĂ©renger <berengermorel76@gmail.com>
Date:   Thu, 19 Nov 2020 10:38:13 +0100

improved generic's runit/common

Diffstat:
Mtemplates/generic/root/etc/runit/common | 17+++++++++--------
Mtemplates/generic/root/etc/runit/log.run | 10+++-------
Mtemplates/generic/root/etc/sv/nslcd/run | 2+-
Mtemplates/generic/root/etc/sv/slapd/run | 2+-
Mtemplates/generic/root/etc/sv/udev/run | 5++---
5 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/templates/generic/root/etc/runit/common b/templates/generic/root/etc/runit/common @@ -8,17 +8,18 @@ badconf() exit 1 } -rundir() +make_dir() { - RUNDIR="${1:?"RUNDIR not provided"}" - shift - USER="${1:-"$SVNAME"}" - GROUP="${2:-"$SVNAME"}" + UPDIR="${1:?"UPDIR not provided"}" + DIR="${2:?"DIR not provided"}" + USER="${3:-"$SVNAME"}" + GROUP="${4:-"$SVNAME"}" - if test ! -d "/run/$RUNDIR" + test -d "/$UPDIR" || badconf "$UPDIR is not a directory" + + if test ! -d "/$UPDIR/$DIR" then - mkdir "/run/$RUNDIR" - chown "$USER:$GROUP" "/run/$RUNDIR" + install -d -m 0750 -o ${USER:-root} -g ${GROUP:-adm} "/$UPDIR/$DIR" fi } diff --git a/templates/generic/root/etc/runit/log.run b/templates/generic/root/etc/runit/log.run @@ -1,11 +1,7 @@ #!/bin/sh -# not using cut because ps prints a header, and option to -# avoid that "feature" is not standard. Other alternative -# would be to not print 1st line, but it would require 2 -# pipes (ps | tail | cut) and would be similarly random. -SERVICE="$(ps -oargs $PPID | sed -n '/runsv/ s/runsv // p')" +. /etc/runit/common + +make_dir "/var/log/" "$SVNAME" root adm -LOG_PATH="/var/log/$SERVICE" -install -d -m 0750 -o root -g adm "$LOG_PATH" exec svlogd -tt "$LOG_PATH" diff --git a/templates/generic/root/etc/sv/nslcd/run b/templates/generic/root/etc/sv/nslcd/run @@ -2,7 +2,7 @@ . /etc/runit/common -rundir nslcd nslcd nslcd +make_dir "/run/" nslcd nslcd nslcd echo Starting $SVNAME... exec nslcd -d diff --git a/templates/generic/root/etc/sv/slapd/run b/templates/generic/root/etc/sv/slapd/run @@ -2,7 +2,7 @@ . /etc/runit/common -rundir slapd openldap openldap +make_dir "/run/" slapd openldap openldap echo Starting $SVNAME... exec slapd -d 0 -g openldap -u openldap diff --git a/templates/generic/root/etc/sv/udev/run b/templates/generic/root/etc/sv/udev/run @@ -15,7 +15,7 @@ need() exec 2>&1 set -ex -mkdir -p /run/udev +make_dir "/run/" udev root root rm -f /run/udev/control # just in case rm -f /run/udevd_ready # just in case ( @@ -29,5 +29,4 @@ rm -f /run/udevd_ready # just in case ) & echo "* Starting systemd-udevd[$$]" -#exec env - PATH="$PATH" /usr/lib/systemd/systemd-udevd -exec env - PATH="$PATH" /lib/systemd/systemd-udevd -N late +exec env - PATH="$PATH" /lib/systemd/systemd-udevd