X-Git-Url: https://git.ao2.it/kboot-utils.git/blobdiff_plain/2b05654e1fc39b3860b171783a4d7305c1ee2c7d..ddd8cdab241adf9cdad525fc88afac9e82a0af5b:/kboot-mkconfig_lib?ds=sidebyside diff --git a/kboot-mkconfig_lib b/kboot-mkconfig_lib index ef31905..080edf7 100644 --- a/kboot-mkconfig_lib +++ b/kboot-mkconfig_lib @@ -21,7 +21,9 @@ exec_prefix=${prefix} bindir=${exec_prefix}/bin libdir=${exec_prefix}/lib -LINUX_ROOT_DEVICE="$(readlink -f $(mount | grep ' / ' | cut -d ' ' -f 1))" +# TODO: remove this if the following find_linux_root_device() +# is found to be reliable enough +#LINUX_ROOT_DEVICE="$(readlink -f $(mount | grep ' / ' | cut -d ' ' -f 1))" if $(which gettext >/dev/null 2>/dev/null) ; then gettext="gettext" @@ -87,6 +89,23 @@ version_find_latest () echo "$a" } +linux_find_root_device() { + ROOT_DEVICE=$(mountpoint -d /) + + for devnode in $(find /dev); + do + # Get major and minor in decimal + CURRENT_DEVICE=$(printf "%d:%d" $(stat --printf="0x%t 0x%T" "$devnode")) + if [ $CURRENT_DEVICE = $ROOT_DEVICE ]; + then + ROOT_NODE="$devnode" + break + fi + done + + echo "$ROOT_NODE" +} + linux_entry () { os="$1" @@ -125,7 +144,9 @@ list_kernels () version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` alt_version=`echo $version | sed -e "s,\.old$,,g"` - linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" + # TODO: remove this too + #linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" + linux_root_device_thisversion=`linux_find_root_device` initrd= for i in "initrd.img-${version}" "initrd-${version}.img" \