init.sh: rework the /run setup for linux xystems

- fix mount options for /run.
- run restorecon after everything is set up.

X-Gentoo-Bug: 740576
X-Gentoo-Bug-URL: https://bugs.gentoo.org/740576
This commit is contained in:
William Hubbs 2021-03-22 15:47:21 -05:00
parent ef76a663bc
commit 5f890ee8ab

View File

@ -71,20 +71,17 @@ if [ "$sys" = VSERVER ]; then
rm -rf /run/* rm -rf /run/*
elif ! mountinfo -q /run; then elif ! mountinfo -q /run; then
ebegin "Mounting /run" ebegin "Mounting /run"
rc=0 run_mount_opts="mode=0755,nosuid,nodev,nr_inodes=800k,size=20%,strictatime"
if ! fstabinfo --mount /run; then if ! fstabinfo --mount /run; then
mount -t tmpfs -o mode=0755,nodev,size=10% tmpfs /run if ! mount -t tmpfs -o ${run_mount_opts} tmpfs /run; then
rc=$?
fi
if [ $rc != 0 ]; then
eerror "Unable to mount tmpfs on /run." eerror "Unable to mount tmpfs on /run."
eerror "Can't continue." eerror "Can't continue."
exit 1 exit 1
fi fi
fi fi
fi
[ -x /sbin/restorecon ] && /sbin/restorecon -rF /run checkpath -d "$RC_SVCDIR"
checkpath -d $RC_SVCDIR
checkpath -d -m 0775 -o root:uucp /run/lock checkpath -d -m 0775 -o root:uucp /run/lock
# Try to mount xenfs as early as possible, otherwise rc_sys() will always # Try to mount xenfs as early as possible, otherwise rc_sys() will always
@ -102,4 +99,5 @@ if [ -e "$RC_LIBEXECDIR"/cache/softlevel ]; then
fi fi
echo sysinit >"$RC_SVCDIR"/softlevel echo sysinit >"$RC_SVCDIR"/softlevel
[ -x /sbin/restorecon ] && /sbin/restorecon -rF /run
exit 0 exit 0