From: Victor Lowther Date: Thu, 19 Mar 2009 14:31:28 +0000 (-0500) Subject: Move processing root options into a pre-udev hook. X-Git-Tag: 0.1~282^2~12^2~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f81a894eb030456f8f7a0c6612f6a6227a8ca3db;p=thirdparty%2Fdracut.git Move processing root options into a pre-udev hook. Also make changes that will make it easier to udevify resuming from hibernate and mounting root. --- diff --git a/modules.d/99base/mount-root.sh b/modules.d/99base/mount-root.sh index b0c825085..8acd3c5f6 100755 --- a/modules.d/99base/mount-root.sh +++ b/modules.d/99base/mount-root.sh @@ -1,3 +1,4 @@ #!/bin/sh -[ "$root" ] && mount $fstype -o "$rflags" "$root" "$NEWROOT" && \ - ROOTFS_MOUNTED=yes +if [ ! -s /.resume -a "$root" ]; then + mount $fstype -o "$rflags" "$root" "$NEWROOT" && ROOTFS_MOUNTED=yes +fi diff --git a/modules.d/99base/parse-root-opts.sh b/modules.d/99base/parse-root-opts.sh index 799c95650..473c34dc1 100755 --- a/modules.d/99base/parse-root-opts.sh +++ b/modules.d/99base/parse-root-opts.sh @@ -1,24 +1,27 @@ #!/bin/sh -[ "$root" ] || { - root=$(getarg root=) - case $root in - LABEL=*) root=${root#LABEL=} - root="$(echo $root |sed 's,/,\\x2f,g')" - root="/dev/disk/by-label/${root}" ;; - UUID=*) root="/dev/disk/by-uuid/${root#UUID=}" ;; - '') echo "Warning: no root specified" - root="/dev/sda1" ;; - esac -} +if resume=$(getarg resume=) && ! getarg noresume; then + export resume + echo "$resume" >/.resume +else + unset resume +fi -[ "$rflags" ] || { - if rflags="$(getarg rootflags=)"; then - getarg rw && rflags="${rflags},rw" || rflags="${rflags},ro" - else - getarg rw && rflags=rw || rflags=ro - fi -} +root=$(getarg root=) +case $root in + LABEL=*) root=${root#LABEL=} + root="$(echo $root |sed 's,/,\\x2f,g')" + root="/dev/disk/by-label/${root}" ;; + UUID=*) root="/dev/disk/by-uuid/${root#UUID=}" ;; + '') echo "Warning: no root specified" + root="/dev/sda1" ;; +esac -[ "$fstype" ] || { - fstype="$(getarg rootfstype=)" && fstype="-t ${fstype}" -} +if rflags="$(getarg rootflags=)"; then + getarg rw && rflags="${rflags},rw" || rflags="${rflags},ro" +else + getarg rw && rflags=rw || rflags=ro +fi + +fstype="$(getarg rootfstype=)" && fstype="-t ${fstype}" + +export fstype rflags root diff --git a/modules.d/99base/resume.sh b/modules.d/99base/resume.sh index a01a61319..8bb4114f5 100755 --- a/modules.d/99base/resume.sh +++ b/modules.d/99base/resume.sh @@ -1,7 +1,8 @@ #!/bin/sh -resume=$(getarg resume=) && ! getarg noresume && [ -b "$resume" ] && { +[ -s /.resume -a -b "$resume" ] && { # parsing the output of ls is Bad, but until there is a better way... ls -lH "$resume" | ( read x x x x maj min x; echo "${maj%,}:$min"> /sys/power/resume) + >/.resume }