From 4a7f446edd23f8268876d6a535c65f9ccf58b4f4 Mon Sep 17 00:00:00 2001 From: Peter Maier Date: Fri, 25 Jan 2019 06:46:50 +0100 Subject: [PATCH 1/3] Support for NVMe devices Signed-off-by: Peter Maier --- bootinfoscript | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bootinfoscript b/bootinfoscript index 099d1eb..0066e57 100755 --- a/bootinfoscript +++ b/bootinfoscript @@ -1,6 +1,6 @@ #!/bin/bash -VERSION='0.77'; -RELEASE_DATE='10 June 2018'; +VERSION='0.78'; +RELEASE_DATE='25 January 2019'; LAST_GIT_COMMIT_SHORTLOG=''; LAST_GIT_COMMIT_DATE=''; ################################################################################ @@ -626,7 +626,7 @@ exec 2> ${Error_Log}; # # Support more than 26 drives. -All_Hard_Drives=$(ls /dev/hd[a-z] /dev/hd[a-z][a-z] /dev/sd[a-z] /dev/sd[a-z][a-z] /dev/xvd[a-z] /dev/vd[a-z] /dev/vd[a-z][a-z] 2>> ${Trash}); +All_Hard_Drives=$(ls /dev/hd[a-z] /dev/hd[a-z][a-z] /dev/sd[a-z] /dev/sd[a-z][a-z] /dev/xvd[a-z] /dev/vd[a-z] /dev/vd[a-z][a-z] /dev/nvme[0-9]n[0-9] /dev/nvme[0-9]n[0-9][0-9] /dev/nvme[0-9][0-9]n[0-9] /dev/nvme[0-9][0-9]n[0-9][0-9] 2>> ${Trash}); ## Add found RAID disks to list of hard drives. ## @@ -1090,6 +1090,7 @@ ReadPT () { local HI=$1 StartEx=$2 N=$3 PT_file=$4 format=$5 EPI=$6 Base_Sector; local LinuxIndex=$7 boot size start end type drive system; local i=0 boot_hex label limit MBRSig; + local LinuxIndexExt; drive=${HDName[${HI}]}; limit=${HDSize[${HI}]}; @@ -1143,15 +1144,18 @@ ReadPT () { fi LinuxIndex=$((${LinuxIndex}+1)); + if [ "${drive:0:9}" = "/dev/nvme" ]; then + LinuxIndexExt="p$LinuxIndex" + fi end=$((${start}+${size}-1)); [[ "${HDPT[${HI}]}" = 'BootIt' ]] && label="${NamesArray[${EPI}]}_" || label=${drive}; system=$(HexToSystem ${type}); - printf "${format}" "${label}${LinuxIndex}" "${boot}" $(InsertComma ${start}) "$(InsertComma ${end})" "$(InsertComma ${size})" "${type}" "${system}" >> ${PT_file}; + printf "${format}" "${label}${LinuxIndexExt}" "${boot}" $(InsertComma ${start}) "$(InsertComma ${end})" "$(InsertComma ${size})" "${type}" "${system}" >> ${PT_file}; - NamesArray[${PI}]="${label}${LinuxIndex}"; + NamesArray[${PI}]="${label}${LinuxIndexExt}"; StartArray[${PI}]=${start}; EndArray[${PI}]=${end}; TypeArray[${PI}]=${type}; @@ -1161,7 +1165,7 @@ ReadPT () { DriveArray[${PI}]=${HI}; ParentArray[${PI}]=${EPI}; - ( [[ x"${EPI}" = x'' ]] || [[ x"${DeviceArray[${EPI}]}" != x'' ]] ) && DeviceArray[${PI}]=${drive}${LinuxIndex}; + ( [[ x"${EPI}" = x'' ]] || [[ x"${DeviceArray[${EPI}]}" != x'' ]] ) && DeviceArray[${PI}]=${drive}${LinuxIndexExt}; if [[ "${type}" = '5' || "${type}" = 'f' ]] ; then ReadPT ${HI} ${start} 2 ${PT_file} "${format}" ${PI} 4; @@ -3196,7 +3200,7 @@ for drive in ${All_Hard_Drives} ; do PrintBlkid ${drive}; if [ 0 -lt ${size} 2>> ${Trash} ] ; then - if [ x"$(blkid ${drive})" = x'' ] || [ x"$(blkid | grep ${drive}:)" = x'' ] ; then + if [ x"$(blkid ${drive})" = x'' ] || [ x"$(blkid -p -s USAGE ${drive})" = x'' ] ; then # Drive is not a filesytem. size=$((2*size)); From 0a8cd825d1e5ac6877d44ccfef2ae83fb708a207 Mon Sep 17 00:00:00 2001 From: Peter Maier Date: Wed, 13 Feb 2019 12:19:27 +0100 Subject: [PATCH 2/3] fix for non NVMe drives --- bootinfoscript | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootinfoscript b/bootinfoscript index 0066e57..eda3565 100755 --- a/bootinfoscript +++ b/bootinfoscript @@ -1,6 +1,6 @@ #!/bin/bash -VERSION='0.78'; -RELEASE_DATE='25 January 2019'; +VERSION='0.79'; +RELEASE_DATE='12 February 2019'; LAST_GIT_COMMIT_SHORTLOG=''; LAST_GIT_COMMIT_DATE=''; ################################################################################ @@ -1143,9 +1143,9 @@ ReadPT () { [[ ${Base_Sector} -eq 0 ]] && KindArray[${PI}]='P' || KindArray[${PI}]='L'; fi - LinuxIndex=$((${LinuxIndex}+1)); + LinuxIndexExt=$((${LinuxIndex}+1)); if [ "${drive:0:9}" = "/dev/nvme" ]; then - LinuxIndexExt="p$LinuxIndex" + LinuxIndexExt="p$LinuxIndexExt" fi end=$((${start}+${size}-1)); From 3a846e443b1e556a75cf4a82897550b09d02699f Mon Sep 17 00:00:00 2001 From: Peter Maier Date: Wed, 13 Feb 2019 12:19:27 +0100 Subject: [PATCH 3/3] fix for non NVMe devices Signed-off-by: Peter Maier --- bootinfoscript | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootinfoscript b/bootinfoscript index 0066e57..eda3565 100755 --- a/bootinfoscript +++ b/bootinfoscript @@ -1,6 +1,6 @@ #!/bin/bash -VERSION='0.78'; -RELEASE_DATE='25 January 2019'; +VERSION='0.79'; +RELEASE_DATE='12 February 2019'; LAST_GIT_COMMIT_SHORTLOG=''; LAST_GIT_COMMIT_DATE=''; ################################################################################ @@ -1143,9 +1143,9 @@ ReadPT () { [[ ${Base_Sector} -eq 0 ]] && KindArray[${PI}]='P' || KindArray[${PI}]='L'; fi - LinuxIndex=$((${LinuxIndex}+1)); + LinuxIndexExt=$((${LinuxIndex}+1)); if [ "${drive:0:9}" = "/dev/nvme" ]; then - LinuxIndexExt="p$LinuxIndex" + LinuxIndexExt="p$LinuxIndexExt" fi end=$((${start}+${size}-1));