summaryrefslogtreecommitdiff
path: root/scripts/install/install-get-partition
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/install/install-get-partition')
-rwxr-xr-xscripts/install/install-get-partition7
1 files changed, 4 insertions, 3 deletions
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=$?