summaryrefslogtreecommitdiff
path: root/scripts/install
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-09-21 19:17:00 -0500
committerGitHub <noreply@github.com>2023-09-21 19:17:00 -0500
commita768aa58a12071452402f32345141f46d059ae71 (patch)
treecfb9c23e1979f9f68bae5ef7084b5ee9392a5377 /scripts/install
parentd72aabf2fe33b9a158f93eea04ff619b694ed213 (diff)
parent4e5d53ce0b5a367be3399b102186dbcd4615ab3f (diff)
downloadvyatta-cfg-system-a768aa58a12071452402f32345141f46d059ae71.tar.gz
vyatta-cfg-system-a768aa58a12071452402f32345141f46d059ae71.zip
Merge pull request #203 from zdc/T4776-sagitta
installer: T4776: Fixed installation on NVME in RAID-1 mode
Diffstat (limited to 'scripts/install')
-rwxr-xr-xscripts/install/install-get-partition22
-rwxr-xr-xscripts/install/install-postinst-new2
2 files changed, 15 insertions, 9 deletions
diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition
index 138088e6..bb8d8c11 100755
--- a/scripts/install/install-get-partition
+++ b/scripts/install/install-get-partition
@@ -100,8 +100,10 @@ check_for_new_raid () {
driveName=()
driveSize=()
driveNameSize=()
- drives=$(cat /proc/partitions | awk '{ if ($4!="name") { print $4 } }' \
- | egrep -v "[0-9]$" | egrep -v "^$")
+ 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 -v "^$" | sort)
for instdrv in $drives
do
@@ -235,9 +237,9 @@ check_for_new_raid () {
if [ -d /sys/firmware/efi ]; then
#EFI moves the data parition on RAID to 3
data_dev=3
- echo "Create data partition: /dev/${drive}${data_dev}"
+ echo "Create data partition: ${data_dev} on /dev/${drive}"
else
- echo "Creating data partition: /dev/${drive}${data_dev}"
+ echo "Creating data partition: ${data_dev} on /dev/${drive}"
sfdisk --part-type /dev/$drive $data_dev 0xfd >/dev/null 2>&1
# mark data partition as bootable
lecho "Marking /dev/$drive partition $data_dev bootable"
@@ -251,15 +253,19 @@ check_for_new_raid () {
echo
for drive in $drives; do
- echo "Erasing any previous RAID metadata that may exist on /dev/${drive}${data_dev}"
- mdadm --zero-superblock /dev/${drive}${data_dev}
+ # add "p" suffix for partitions on storages like eMMC, NVME
+ if [[ -n $(echo ${drive} | egrep "c[0-9]d[0-9]$|nvme[0-9]n[0-9]$|mmcblk[0-9]") ]]; then
+ partprefix="p"
+ fi
+ echo "Erasing any previous RAID metadata that may exist on /dev/${drive}${partprefix}${data_dev}"
+ mdadm --zero-superblock /dev/${drive}${partprefix}${data_dev}
done
- echo "Creating RAID-1 group on partitions: /dev/${drive1}${data_dev} /dev/${drive2}${data_dev}"
+ echo "Creating RAID-1 group on partitions: /dev/${drive1}${partprefix}${data_dev} /dev/${drive2}${partprefix}${data_dev}"
raid_dev=md0
yes|mdadm --create /dev/$raid_dev --level=1 --raid-disks=2 --metadata=0.90 \
- /dev/${drive1}${data_dev} /dev/${drive2}${data_dev}
+ /dev/${drive1}${partprefix}${data_dev} /dev/${drive2}${partprefix}${data_dev}
if [ $? = 0 -a -e /dev/$raid_dev ]; then
echo "RAID-1 group created successfully:"
diff --git a/scripts/install/install-postinst-new b/scripts/install/install-postinst-new
index 8bb7c8bd..14148045 100755
--- a/scripts/install/install-postinst-new
+++ b/scripts/install/install-postinst-new
@@ -157,7 +157,7 @@ install_grub () {
else
if [[ $grub_inst_drv == "md raid" ]]; then
for slave in $raid_slaves; do
- grub_inst_drv=${slave:0:3}
+ grub_inst_drv=$(lsblk --noempty --dedup PKNAME --nodeps --noheadings --output PKNAME /dev/${slave})
output=$(grub-install --no-floppy --recheck --root-directory=$grub_root \
/dev/$grub_inst_drv 2>&1)
lecho "$output"