> This, with a fallback to the old behavior if /proc is not mounted, seems > reasonable. >
Perhaps something like this: if [ $(mount | grep -o "^proc") ] && [ -e /proc/cmdline ]; then rootpart=$(grep -o "root=[^ ]*" /proc/cmdline | cut -d = -f 2) else which rdev >/dev/null && rootpart=$(rdev | cut -d ' ' -f 1) fi