Browse Source

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.
master
Victor Lowther 16 years ago
parent
commit
f81a894eb0
  1. 5
      modules.d/99base/mount-root.sh
  2. 45
      modules.d/99base/parse-root-opts.sh
  3. 3
      modules.d/99base/resume.sh

5
modules.d/99base/mount-root.sh

@ -1,3 +1,4 @@
#!/bin/sh #!/bin/sh
[ "$root" ] && mount $fstype -o "$rflags" "$root" "$NEWROOT" && \ if [ ! -s /.resume -a "$root" ]; then
ROOTFS_MOUNTED=yes mount $fstype -o "$rflags" "$root" "$NEWROOT" && ROOTFS_MOUNTED=yes
fi

45
modules.d/99base/parse-root-opts.sh

@ -1,24 +1,27 @@
#!/bin/sh #!/bin/sh
[ "$root" ] || { if resume=$(getarg resume=) && ! getarg noresume; then
root=$(getarg root=) export resume
case $root in echo "$resume" >/.resume
LABEL=*) root=${root#LABEL=} else
root="$(echo $root |sed 's,/,\\x2f,g')" unset resume
root="/dev/disk/by-label/${root}" ;; fi
UUID=*) root="/dev/disk/by-uuid/${root#UUID=}" ;;
'') echo "Warning: no root specified"
root="/dev/sda1" ;;
esac
}


[ "$rflags" ] || { root=$(getarg root=)
if rflags="$(getarg rootflags=)"; then case $root in
getarg rw && rflags="${rflags},rw" || rflags="${rflags},ro" LABEL=*) root=${root#LABEL=}
else root="$(echo $root |sed 's,/,\\x2f,g')"
getarg rw && rflags=rw || rflags=ro root="/dev/disk/by-label/${root}" ;;
fi UUID=*) root="/dev/disk/by-uuid/${root#UUID=}" ;;
} '') echo "Warning: no root specified"
root="/dev/sda1" ;;
esac


[ "$fstype" ] || { if rflags="$(getarg rootflags=)"; then
fstype="$(getarg rootfstype=)" && fstype="-t ${fstype}" 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

3
modules.d/99base/resume.sh

@ -1,7 +1,8 @@
#!/bin/sh #!/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... # parsing the output of ls is Bad, but until there is a better way...
ls -lH "$resume" | ( ls -lH "$resume" | (
read x x x x maj min x; read x x x x maj min x;
echo "${maj%,}:$min"> /sys/power/resume) echo "${maj%,}:$min"> /sys/power/resume)
>/.resume
} }

Loading…
Cancel
Save