aboutsummaryrefslogtreecommitdiff
path: root/rc.sysinit
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2011-04-22 23:50:59 +0200
committerTom Gundersen <teg@jklm.no>2011-04-23 21:44:03 +0200
commiteda191cf78365cc3d15c0b8c0d8f571c69cd059e (patch)
tree64e77a1b264dae968b5005d013f9e47ffbe710a6 /rc.sysinit
parenta5bdefd41f8ce9ec1be567fcdf8eea20f39fda48 (diff)
downloadinitscripts-eda191cf78365cc3d15c0b8c0d8f571c69cd059e.tar.xz
create /run/lock
This allows /var/run and /var/lock to be symlinked to /run and /run/lock, respectively. This would be the final step in fixing FS#18157. With /run/lock created early in boot it would be possible for tools like mdadm and lvm2 to use this directory for their locking, and maybe avoid the --sysinit parameter. This would have to be implemented in the respective packages though. Finally, /run/lock is created 1777 just like /var/lock is now. For the future, it might make sense to follow systemd's lead and make it 0755, and then create a subdir /run/lock/lockdev owned by root:lock with permissions 0755. This would improve security and fend agains DoS attacks, but we would have to check carefully what packages are affected. Signed-off-by: Tom Gundersen <teg@jklm.no>
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-xrc.sysinit12
1 files changed, 8 insertions, 4 deletions
diff --git a/rc.sysinit b/rc.sysinit
index 0dcd76b..497caae 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -16,7 +16,10 @@ run_hook sysinit_start
# export standard PATH (will be overridden later when /etc/profile is sourced, but is usefull for UDev)
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-# mount /proc, /sys, /dev, /dev/pts and /dev/shm (the api filesystems)
+# mount /proc, /sys, /run, /dev, /run/lock, /dev/pts, /dev/shm (the api filesystems)
+/bin/mountpoint -q /proc || /bin/mount -n -t proc proc /proc -o nosuid,noexec,nodev
+/bin/mountpoint -q /sys || /bin/mount -n -t sysfs sysfs /sys -o nosuid,noexec,nodev
+/bin/mountpoint -q /run || /bin/mount -n -t tmpfs tmpfs /run -o mode=755,size=10M,nosuid,noexec,nodev
if ! /bin/mountpoint -q /dev; then
if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
/bin/mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid
@@ -307,9 +310,10 @@ if [[ -f $RANDOM_SEED ]]; then
fi
stat_busy "Removing Leftover Files"
-/bin/rm -f /etc/{nologin,shutdownpid} /var/lock/* /forcefsck &>/dev/null
-/bin/rm -rf /tmp/* /tmp/.* &>/dev/null
-[[ -d /var/run ]] && /usr/bin/find /var/run/ \! -type d -delete
+/bin/rm -rf /etc/{nologin,shutdownpid} /forcefsck &>/dev/null
+/bin/mountpoint -q /tmp || /bin/rm -rf /tmp/* /tmp/.* &>/dev/null
+[[ ! -L /var/lock ]] && /bin/rm -rf /var/lock/*
+[[ ! -L /var/run && -d /var/run ]] && /usr/bin/find /var/run/ \! -type d -delete
: >| /var/run/utmp
/bin/chmod 0664 /var/run/utmp
/bin/chown root:utmp /var/run/utmp