]> TLD Linux GIT Repositories - packages/dracut.git/commitdiff
- remount /proc and /sys with options from fstab before init
authorMarcin Krol <hawk@tld-linux.org>
Sat, 17 May 2014 15:58:42 +0000 (15:58 +0000)
committerMarcin Krol <hawk@tld-linux.org>
Sat, 17 May 2014 15:58:42 +0000 (15:58 +0000)
dracut.spec
proc_sys_remount.patch [new file with mode: 0644]

index bdc6f12894c883e5aafaaafbc1bc3e9f426d3665..2941723ea1cb2bbd5373e608c91ea3f3e65a4d2d 100644 (file)
@@ -16,7 +16,8 @@ Patch5:               systemd-paths.patch
 Patch6:                prelink-libs.patch
 Patch7:                config.patch
 Patch8:                xz_compressor.patch
-Patch9:                misc_fixes.patch
+Patch9:                proc_sys_remount.patch
+Patch10:       misc_fixes.patch
 Patch100:      git.patch
 URL:           https://dracut.wiki.kernel.org/
 BuildRequires: asciidoc
@@ -201,6 +202,7 @@ Bashowe dopeÅ‚nianie skÅ‚adni dla polecenia dracut.
 %patch7 -p1
 %patch8 -p1
 %patch9 -p1
+%patch10 -p1
 %patch100 -p1
 
 %{__sed} -i -e 's,@lib@,%{_lib},g' modules.d/50plymouth/module-setup.sh
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