Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for NVMe devices #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions bootinfoscript
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
VERSION='0.77';
RELEASE_DATE='10 June 2018';
VERSION='0.79';
RELEASE_DATE='12 February 2019';
LAST_GIT_COMMIT_SHORTLOG='';
LAST_GIT_COMMIT_DATE='';
################################################################################
Expand Down Expand Up @@ -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. ##
Expand Down Expand Up @@ -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}]};
Expand Down Expand Up @@ -1142,16 +1143,19 @@ 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$LinuxIndexExt"
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};
Expand All @@ -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;
Expand Down Expand Up @@ -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));
Expand Down