for x in $(cat /proc/cmdline); do
case ${x} in
root=*)
case ${x} in
UUID=*)
ROOTDEVPATH=$ROOTDEVPATH/disk/by-uuid/${x#UUID=} ;;
*) ROOTDEVPATH=$ROOTDEVPATH/$x ;;
esac
;;
...
done
ROOTDEVPATH=$(readlink -f "/dev/$ROOTDEVPATH")
[...]
This supports the root=<device node> case. Hackers will thank you (I know I
will)
Extending it to support LABEL= would be easy too.
(Extra case statement used to avoid sed (slow) and ${//} (bash-specific))
How about:
for x in $(cat /proc/cmdline); do $ROOTDEVPATH/ disk/by- uuid/${ x#UUID= } ;; $ROOTDEVPATH/ $x ;;
case ${x} in
root=*)
case ${x} in
UUID=*)
ROOTDEVPATH=
*) ROOTDEVPATH=
esac
;;
...
done
ROOTDEVPATH= $(readlink -f "/dev/$ ROOTDEVPATH" )
[...]
This supports the root=<device node> case. Hackers will thank you (I know I
will)
Extending it to support LABEL= would be easy too.
(Extra case statement used to avoid sed (slow) and ${//} (bash-specific))