summaryrefslogtreecommitdiff
path: root/scripts/build/binary_hdd
diff options
context:
space:
mode:
authorAdrian Gibanel Lopez <adrian.gibanel@btactic.com>2015-08-21 23:54:46 +0200
committerAdrian Gibanel Lopez <adrian.gibanel@btactic.com>2015-08-29 23:56:41 +0200
commitd515ae56842f9420ff4c629eac18904f7beef2e8 (patch)
tree54303ab985d71ee280562b7ed75413c56a63ee93 /scripts/build/binary_hdd
parentd43874c405ca468fc72158da6280c6b11755a3e6 (diff)
downloadvyos-live-build-d515ae56842f9420ff4c629eac18904f7beef2e8.tar.gz
vyos-live-build-d515ae56842f9420ff4c629eac18904f7beef2e8.zip
Multi bootloader support
Note: OLDIFS use makes IFS to be reset to "" instead to it being unset. Either we need to detect if old IFS was unset to unset it or we need a proper way of setting it as a local variable. Even more IFS it's not currently used in Check_package (which it's called from: binary_hdd). we should have a clean way of resetting/unsetting IFS when calling Check_package. The other approach it's to explicitly define IFS with its default value in the places inside live-build code where we implicitly suppose that it's going to have its default value.
Diffstat (limited to 'scripts/build/binary_hdd')
-rwxr-xr-xscripts/build/binary_hdd54
1 files changed, 31 insertions, 23 deletions
diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd
index 6758c5678..c958aff9a 100755
--- a/scripts/build/binary_hdd
+++ b/scripts/build/binary_hdd
@@ -57,26 +57,34 @@ esac
Check_package chroot /usr/share/doc/mtools mtools
Check_package chroot /sbin/parted parted
-case "${LB_BOOTLOADER}" in
- grub)
- Check_package chroot /usr/sbin/grub grub
- ;;
-
- syslinux)
- case ${LB_BINARY_FILESYSTEM} in
- fat*|ntfs)
- _BOOTLOADER=syslinux
- ;;
- ext[234]|btrfs)
- _BOOTLOADER=extlinux
- ;;
- *)
- Echo_error "syslinux/extlinux doesn't support ${LB_BINARY_FILESYSTEM}"
- exit 1
- ;;
- esac
- Check_package chroot /usr/bin/${_BOOTLOADER} ${_BOOTLOADER}
- ;;
+echo "${LB_BOOTLOADERS}" | \
+while IFS="," read -r BOOTLOADER
+do
+ case "${BOOTLOADER}" in
+ grub)
+ Check_package chroot /usr/sbin/grub grub
+ ;;
+ esac
+done
+
+LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
+
+case ${LB_PRIMARY_BOOTLOADER} in
+ syslinux)
+ case ${LB_BINARY_FILESYSTEM} in
+ fat*|ntfs)
+ _BOOTLOADER=syslinux
+ ;;
+ ext[234]|btrfs)
+ _BOOTLOADER=extlinux
+ ;;
+ *)
+ Echo_error "syslinux/extlinux doesn't support ${LB_BINARY_FILESYSTEM}"
+ exit 1
+ ;;
+ esac
+ Check_package chroot /usr/bin/${_BOOTLOADER} ${_BOOTLOADER}
+ ;;
esac
# Restoring cache
@@ -168,7 +176,7 @@ case "${LB_BUILD_WITH_CHROOT}" in
Chroot chroot "parted -s ${FREELO} set 1 boot on" || true
Chroot chroot "parted -s ${FREELO} set 1 lba off" || true
- if [ "${LB_BOOTLOADER}" = "syslinux" ]
+ if [ "${LB_PRIMARY_BOOTLOADER}" = "syslinux" ]
then
dd if=chroot/usr/lib/SYSLINUX/mbr.bin of=${FREELO} bs=440 count=1
fi
@@ -180,7 +188,7 @@ case "${LB_BUILD_WITH_CHROOT}" in
parted -s "${FREELO}" set 1 boot on || true
parted -s "${FREELO}" set 1 lba off || true
- if [ "${LB_BOOTLOADER}" = "syslinux" ]
+ if [ "${LB_PRIMARY_BOOTLOADER}" = "syslinux" ]
then
dd if=/usr/lib/SYSLINUX/mbr.bin of=${FREELO} bs=440 count=1
fi
@@ -246,7 +254,7 @@ cp -T ${CP_OPTIONS} binary/ chroot/binary.tmp
FIXME()
{
-if [ "${LB_BOOTLOADER}" = "grub" ]
+if [ "${LB_PRIMARY_BOOTLOADER}" = "grub" ]
then
cat > chroot/grub.sh << EOF