Clean up /run/ at startup and move the directory creation logic to each service

This commit is contained in:
Héctor Molinero Fernández
2024-07-22 17:27:13 +02:00
parent f70e8725c0
commit 4f81948637
4 changed files with 13 additions and 20 deletions

View File

@@ -3,7 +3,7 @@
set -eu
# Remove leftover files
find /tmp/ -mindepth 1 -delete ||:
find /tmp/ /run/ -mindepth 1 -delete ||:
# Add GPU devices groups to additional groups
for dev in /dev/dri/*; do
@@ -60,25 +60,6 @@ if [ -w "${UNPRIVILEGED_USER_HOME:?}" ]; then
fi
fi
# Create /run/dbus/ directory if it does not exist
if [ ! -d /run/dbus/ ]; then
mkdir -p /run/dbus/
chmod 755 /run/dbus/
chown messagebus: /run/dbus/
fi
# Create /run/sshd/ directory if it does not exist
if [ ! -d /run/sshd/ ]; then
mkdir -p /run/sshd/
chmod 755 /run/sshd/
fi
# Create /run/udev/ directory if it does not exist
if [ ! -d /run/udev/ ]; then
mkdir -p /run/udev/
chmod 755 /run/udev/
fi
# Create /run/user/${UNPRIVILEGED_USER_UID}/ directory if it does not exist
if [ ! -d /run/user/"${UNPRIVILEGED_USER_UID:?}"/ ]; then
mkdir -p /run/user/"${UNPRIVILEGED_USER_UID:?}"/

View File

@@ -2,5 +2,9 @@
set -eu
if [ ! -d /run/dbus/ ]; then
install -m 755 -o messagebus -g messagebus -d /run/dbus/
fi
exec 2>&1
exec chpst -u messagebus dbus-daemon --system --nofork --nopidfile

View File

@@ -2,5 +2,9 @@
set -eu
if [ ! -d /run/sshd/ ]; then
install -m 755 -o root -g root -d /run/sshd/
fi
exec 2>&1
exec /usr/sbin/sshd -D

View File

@@ -2,5 +2,9 @@
set -eu
if [ ! -d /run/udev/ ]; then
install -m 755 -o root -g root -d /run/udev/
fi
exec 2>&1
exec /lib/systemd/systemd-udevd