diff options
author | Alex Harpin <development@landsofshadow.co.uk> | 2015-02-28 14:50:58 +0000 |
---|---|---|
committer | Alex Harpin <development@landsofshadow.co.uk> | 2015-02-28 14:50:58 +0000 |
commit | cf27c200c4010fc8085b49f1160b552d5970d684 (patch) | |
tree | 8299bde41c3f8c5c33069dba9ac9d69c1e041844 | |
parent | 3c4d5948eb949ff9cb89de3519f9f7b49154d5ca (diff) | |
download | vyatta-cfg-system-cf27c200c4010fc8085b49f1160b552d5970d684.tar.gz vyatta-cfg-system-cf27c200c4010fc8085b49f1160b552d5970d684.zip |
vyatta-cfg-system: ensure grub is installed to the raid slave members
When the system is installed in a raid configuration, grub is installed
to the raid device instead of to the individual slave drives, resulting
in a failure to boot after installation. This commit identifies the
slave drives and ensures grub is installed to all of them (rather than
just the primary), resulting in a system that will boot following a
primary drive failure.
Bug #106 http://bugzilla.vyos.net/show_bug.cgi?id=106
-rwxr-xr-x | scripts/install/install-postinst-new | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/scripts/install/install-postinst-new b/scripts/install/install-postinst-new index e8a84c5e..11cf788e 100755 --- a/scripts/install/install-postinst-new +++ b/scripts/install/install-postinst-new @@ -105,8 +105,11 @@ copy_config () { # setup grub on the boot sector of a user selected drive install_grub () { grub_inst_drv='' + raid_slaves='' + if [ ${INSTALL_DRIVE:0:2} == "md" ]; then - grub_inst_drv=$INSTALL_DRIVE + raid_slaves=`ls /sys/block/${INSTALL_DRIVE}/slaves` + grub_inst_drv="md raid" fi mkdir -p $grub_root/boot/grub @@ -123,11 +126,25 @@ install_grub () { echo -n "Setting up grub: " lecho "Setting up grub..." - # Install grub in the boot sector of the primary drive + # Install grub in the boot sector of the primary drive, or if the installation + # target is a raid setup, then install it into the boot sector of all slave + # members. + progress_indicator start - output=$(grub-install --no-floppy --recheck --root-directory=$grub_root \ - /dev/$grub_inst_drv 2>&1) - lecho "$output" + + if [[ $grub_inst_drv == "md raid" ]]; then + for slave in $raid_slaves; do + grub_inst_drv=${slave:0:3} + output=$(grub-install --no-floppy --recheck --root-directory=$grub_root \ + /dev/$grub_inst_drv 2>&1) + lecho "$output" + done + else + output=$(grub-install --no-floppy --recheck --root-directory=$grub_root \ + /dev/$grub_inst_drv 2>&1) + lecho "$output" + fi + progress_indicator stop output=$(/opt/vyatta/sbin/vyatta-grub-setup $grub_setup_args \ |