From: Ulrich Dangel Date: Sun, 11 Mar 2012 15:11:54 +0000 (+0100) Subject: Check if the appropiate grub packages are installed in GRMLBASE/45-grub-images and... X-Git-Url: https://git.grml.org/?p=grml-live.git;a=commitdiff_plain;h=refs%2Fheads%2Fmru%2Frelax-grub-gen Check if the appropiate grub packages are installed in GRMLBASE/45-grub-images and don't fail if they are missing. --- diff --git a/etc/grml/fai/config/scripts/GRMLBASE/45-grub-images b/etc/grml/fai/config/scripts/GRMLBASE/45-grub-images index d6fdb5c..5aace74 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/45-grub-images +++ b/etc/grml/fai/config/scripts/GRMLBASE/45-grub-images @@ -29,10 +29,14 @@ BOOTX64="${BOOTX64##${target}}" EFI_IMG="${EFI_IMG##${target}}" TMP_CONFIG="${TMP_CONFIG##${target}}" -ARCHS=(i386-pc) declare -A ADDITIONAL_MODULES -ADDITIONAL_MODULES[i386-pc]="biosdisk" +ARCHS=() + +if [ -r "${target}"/usr/lib/grub/i386-pc/moddep.lst ] ; then + ARCHS+=(i386-pc) + ADDITIONAL_MODULES[i386-pc]="biosdisk" +fi if ifclass AMD64 ; then if [ -r "${target}"/usr/lib/grub/x86_64-efi/moddep.lst ] ; then @@ -48,6 +52,12 @@ BOOTX64="${BOOTX64##${target}}" EFI_IMG="${EFI_IMG##${target}}" TMP_CONFIG="${TMP_CONFIG##${target}}" + +if [ -z "$ARCHS" ] ; then + echo "WARNING: No grub modules found, exiting" >&2 + exit 0 +fi + for arch in ${ARCHS[@]} ; do $ROOTCMD grub-mkimage -O $arch -o /boot/$arch.img --prefix=/boot/grub/ --config="$TMP_CONFIG" \ bitmap boot btrfs cat chain cmp configfile cpio echo elf ext2 \ @@ -68,7 +78,7 @@ fi if ifclass AMD64 ; then if ! [ -r "${target}/${BOOTX64}" ] ; then echo "Can not access grub efi image." >&2 - exit 1 + exit 0 fi SIZE=$(du -sk "${target}/${BOOTX64}" | awk -F" " '{print $1'})