]> TLD Linux GIT Repositories - packages/dracut.git/blobdiff - proc_sys_remount.patch
- remount /proc and /sys with options from fstab before init
[packages/dracut.git] / proc_sys_remount.patch
diff --git a/proc_sys_remount.patch b/proc_sys_remount.patch
new file mode 100644 (file)
index 0000000..496f20b
--- /dev/null
@@ -0,0 +1,30 @@
+diff -urN dracut-037.orig/modules.d/99base/init.sh dracut-037/modules.d/99base/init.sh
+--- dracut-037.orig/modules.d/99base/init.sh   2014-03-19 16:16:08.000000000 +0000
++++ dracut-037/modules.d/99base/init.sh        2014-05-17 15:55:22.273000000 +0000
+@@ -258,6 +258,26 @@
+ source_hook cleanup
+ # By the time we get here, the root filesystem should be mounted.
++
++# Remount /proc and /sys with options from $NEWROOT/etc/fstab,
++# keep defaults just in case.
++procopts="nosuid,noexec,nodev,"
++sysopts="nosuid,noexec,nodev,"
++if [ -f "$NEWROOT/etc/fstab" ] \
++    && ! [ -L "$NEWROOT/etc/fstab" ]; then
++    while read dev mp fs opts dump fsck; do
++        # skip comments
++        [ "${dev%%#*}" != "$dev" ] && continue
++        if [ "$mp" = "/proc" ]; then
++            procopts=$opts
++        elif [ "$mp" = "/sys" ]; then
++            sysopts=$opts
++        fi
++    done < "$NEWROOT/etc/fstab"
++fi
++mount -o remount,$procopts /proc 2>&1
++mount -o remount,$sysopts /sys 2>&1
++
+ # Try to find init. 
+ for i in "$(getarg real_init=)" "$(getarg init=)" $(getargs rd.distroinit=) /sbin/init; do
+     [ -n "$i" ] || continue