From b6d43e1acad12a573d08d9c35ecc51ff327f415b Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Tue, 13 Mar 2012 13:17:43 +0000
Subject: [PATCH] * Fix Amazon image generation (broken by r32913).

svn path=/nixos/trunk/; revision=33032
---
 .../activation/switch-to-configuration.sh     | 25 +++++++++----------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/modules/system/activation/switch-to-configuration.sh b/modules/system/activation/switch-to-configuration.sh
index 75e004d7738..d24bf484824 100644
--- a/modules/system/activation/switch-to-configuration.sh
+++ b/modules/system/activation/switch-to-configuration.sh
@@ -26,23 +26,22 @@ if [ "$action" = "switch" -o "$action" = "boot" ]; then
     
     if [ "@bootLoader@" = "grub" ]; then
         
-      if [ -n "@grubDevice@" ]; then
+      if [ -n "@grubDevices@" ]; then
           mkdir -m 0700 -p /boot/grub
           @menuBuilder@ @out@
 
-          if [ "@grubDevice@" != nodev ]; then
-              
-              # If the GRUB version has changed, then force a reinstall.
-              oldGrubVersion="$(cat /boot/grub/version 2>/dev/null || true)"
-              newGrubVersion="@grubVersion@"
+          # If the GRUB version has changed, then force a reinstall.
+          oldGrubVersion="$(cat /boot/grub/version 2>/dev/null || true)"
+          newGrubVersion="@grubVersion@"
 
-              if [ "$NIXOS_INSTALL_GRUB" = 1 -o "$oldGrubVersion" != "$newGrubVersion" ]; then
-                  echo "installing the GRUB bootloader..."
-                  for a in @grubDevices@; do
-                    @grub@/sbin/grub-install "$(readlink -f "$a")" --no-floppy
-                  done
-                  echo "$newGrubVersion" > /boot/grub/version
-              fi
+          if [ "$NIXOS_INSTALL_GRUB" = 1 -o "$oldGrubVersion" != "$newGrubVersion" ]; then
+              for dev in @grubDevices@; do
+                  if [ "$dev" != nodev ]; then
+                      echo "installing the GRUB bootloader on $dev..."
+                      @grub@/sbin/grub-install "$(readlink -f "$dev")" --no-floppy
+                  fi
+              done
+              echo "$newGrubVersion" > /boot/grub/version
           fi
           
       else