'stat' returns the major and minor numbers in hexadecimal, while
'mountpoint' returns them in decimal; convert the ones from 'stat' so
comparison actually work.
Rename variables to reflect better the difference between the DEVICE
representation (major:minor) and the NODE representation (a path of a
file under /dev).
Finally fix the invocation of linux_find_root_device as well.
}
linux_find_root_device() {
}
linux_find_root_device() {
- RDEV=$(mountpoint -d /)
+ ROOT_DEVICE=$(mountpoint -d /)
for devnode in $(find /dev);
do
for devnode in $(find /dev);
do
- if [ $(stat --printf="%t:%T" "$devnode") = $RDEV ];
+ # Get major and minor in decimal
+ CURRENT_DEVICE=$(printf "%d:%d" $(stat --printf="0x%t 0x%T" "$devnode"))
+ if [ $CURRENT_DEVICE = $ROOT_DEVICE ];
alt_version=`echo $version | sed -e "s,\.old$,,g"`
# TODO: remove this too
#linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
alt_version=`echo $version | sed -e "s,\.old$,,g"`
# TODO: remove this too
#linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
- linux_root_device_thisversion=linux_find_root_device
+ linux_root_device_thisversion=`linux_find_root_device`
initrd=
for i in "initrd.img-${version}" "initrd-${version}.img" \
initrd=
for i in "initrd.img-${version}" "initrd-${version}.img" \