summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-02-28 14:50:58 +0000
committerDaniil Baturin <daniil@baturin.org>2017-09-14 14:01:29 +0200
commit0e52d7cc7cf0b4bead4b7e250f514e1501ed627e (patch)
tree1bec3cec54036517f0e30527279e34abe838d746
parent177f1274b91736c28a577a99786188195dd90848 (diff)
downloadvyatta-cfg-system-0e52d7cc7cf0b4bead4b7e250f514e1501ed627e.tar.gz
vyatta-cfg-system-0e52d7cc7cf0b4bead4b7e250f514e1501ed627e.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-xscripts/install/install-postinst-new27
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 \