summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Spruit <bitbucket@incitem.nl>2022-11-25 17:40:21 +0100
committerMarc Spruit <bitbucket@incitem.nl>2022-11-25 17:40:21 +0100
commit057e167fa84e0aec59f10301fd065c58c7cebfb1 (patch)
tree321edd8fd5bb88d997ee6212ec45678fd75002c9
parent4072b81833be0476c8244e13f3fc6d27a01c708c (diff)
downloadvyatta-cfg-system-057e167fa84e0aec59f10301fd065c58c7cebfb1.tar.gz
vyatta-cfg-system-057e167fa84e0aec59f10301fd065c58c7cebfb1.zip
nvme: T4776: Fixed installation to NVME (equuleus backport of fix by zdc)
-rwxr-xr-xscripts/install/install-functions2
-rwxr-xr-xscripts/install/install-get-partition7
2 files changed, 5 insertions, 4 deletions
diff --git a/scripts/install/install-functions b/scripts/install/install-functions
index 458d2e63..b3ec42c1 100755
--- a/scripts/install/install-functions
+++ b/scripts/install/install-functions
@@ -176,7 +176,7 @@ select_drive () {
# the first grep pattern looks for devices named c0d0, hda, and sda.
drives=$(cat /proc/partitions | \
awk '{ if ($4!="name") { print $4 } }' | \
- egrep "c[0-9]d[0-9]$|[hsv]d[a-z]$|nvme[0-9]n[0-9]|mmcblk[0-9]" | \
+ egrep "c[0-9]d[0-9]$|[hsv]d[a-z]$|nvme[0-9]n[0-9]$|mmcblk[0-9]" | \
egrep -v "^$" | sort)
#this needs more testing to decide if better than above
diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition
index c5c7c268..138088e6 100755
--- a/scripts/install/install-get-partition
+++ b/scripts/install/install-get-partition
@@ -571,9 +571,7 @@ delete_partitions () {
# get the partitions on the drive
# in the first grep below we add the optional [p] in order to
# accomdate cciss drives
- partitions=$(cat /proc/partitions | grep $ldrive[p]*[0-9] \
- | awk '{ print $4 }' | sed 's/\(.*\)\([0-9]$\)/\2/g' \
- | grep -v "^$")
+ partitions=$(awk '/'$ldrive'p?[0-9]+$/ { sub(/'$ldrive'/, "") ; print $NF }' /proc/partitions)
mkdir -p /mnt/tmp
# now for each part, blow it away
@@ -592,6 +590,9 @@ delete_partitions () {
umount /mnt/tmp
fi
+ # we must remove possible suffixes from a partition number before passing it to parted
+ lpart="$(echo $lpart | sed 's/[^0-9]//')"
+
lecho "Removing partition $lpart on /dev/$ldrive"
output=$(parted -s /dev/$ldrive rm $lpart)
status=$?