commit 3a0bc0aa7ce89d7f7fea53a142552eba8a84d5ec
parent b5def6d743263f1f9e1b8eb6fb5af58fa040b907
Author: Morel BĂ©renger <berenger.morel@neutralite.org>
Date: Thu, 14 Nov 2019 17:44:52 +0100
use install to create directories with correct rights
Diffstat:
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/etc/runit/2 b/etc/runit/2
@@ -5,15 +5,14 @@ SVDIR=/var/lib/runit/service
busybox ip link set up lo
-mkdir -p /var/log/fsck $SVDIR
-chown root:adm -R /var/log/fsck
-chmod 750 -R /var/log/fsck
+install -d -m 0750 -o root -g adm $SVDIR
+install -d -m 0750 -o root -g adm /var/log/fsck
# network interfaces
busybox ip link set up lo
for i in $(busybox ip -o link | cut -f2 -d: | grep -v '\<lo\>')
do
- mkdir $SVDIR/$i/log -p
+ install -d -m 0750 -o root -g adm $SVDIR/$i/log
ln -s /etc/runit/log.run $SVDIR/$i/log/run
ln -s /etc/busybox/run/dhcpc.run $SVDIR/$i/run
done
@@ -21,17 +20,17 @@ done
# gettys
for i in $(seq 1 6)
do
- mkdir $SVDIR/tty$i -p
+ install -d -m 0750 -o root -g adm $SVDIR/tty$i
ln -s /etc/busybox/run/getty.run $SVDIR/tty$i/run
done
# sshd (dropbear)
-mkdir $SVDIR/sshd/log -p
+install -d -m 0750 -o root -g adm $SVDIR/sshd/log
ln -s /etc/runit/log.run $SVDIR/sshd/log/run
ln -s /etc/dropbear/run/dropbear.run $SVDIR/sshd/run
# klogd (svlogd)
-mkdir $SVDIR/klogd
+install -d -m 0750 -o root -g adm $SVDIR/klogd
ln -s /etc/runit/klogd.run $SVDIR/klogd/run
# This script is also invoked in runit-systemd and runit-sysv packages.
diff --git a/etc/runit/log.run b/etc/runit/log.run
@@ -2,7 +2,5 @@
SVLOG="$(basename $(dirname $(pwd)))"
LOG_PATH="/var/log/$SVLOG"
-mkdir -p "$LOG_PATH"
-chown root:adm -R "$LOG_PATH"
-chmod 750 -R "$LOG_PATH"
+install -d -m 0750 -o root -g adm "$LOG_PATH"
exec svlogd -tt "$LOG_PATH"