summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-10-27 19:46:51 +0200
committerGitHub <noreply@github.com>2022-10-27 19:46:51 +0200
commitc4b740ba50b8a1f810c360061d199a7928fd3c4d (patch)
tree3c62d17e72c46453b88f600ec0a08e31c84b25fc
parentc196da35164f87268522ab1ba97d507f446e4ed6 (diff)
parent0bee6e9f95d36250e6df3a705c0142b216079104 (diff)
downloadvyatta-cfg-system-c4b740ba50b8a1f810c360061d199a7928fd3c4d.tar.gz
vyatta-cfg-system-c4b740ba50b8a1f810c360061d199a7928fd3c4d.zip
Merge pull request #188 from zdc/T4776-sagitta
nvme: T4776: Fixed installation to NVME
-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=$?