move grub-pc specific code to actual grub-pc script

the grub-pc image creation code has no business being in binary_iso, it
should be in binary_grub-pc.

it should be noted that the binary_iso script did not even have the
necessary package check for grub-mkimage, while binary_grub-pc did have
it, pointlessly.

Gbp-Dch: Short
This commit is contained in:
Lyndon Brown 2020-04-08 20:27:41 +01:00 committed by Raphaël Hertzog
parent 49794f118f
commit bf63762721
2 changed files with 34 additions and 22 deletions

View File

@ -74,6 +74,40 @@ fi
# Copying grub
cp ${FILES} binary/boot/grub/i386-pc
# Create eltorito image for ISO cases
if [ "${LIVE_IMAGE_TYPE}" = "iso" ] || [ "${LIVE_IMAGE_TYPE}" = "iso-hybrid" ]; then
cat > binary.sh << EOF
#!/bin/sh
INPUT_DIR="/usr/lib/grub/i386-pc"
# build core.img
CORE_IMG=\$(mktemp)
grub-mkimage -d \${INPUT_DIR} -o \${CORE_IMG} -O i386-pc --prefix=/boot/grub biosdisk iso9660
# build grub_eltorito image
cat \${INPUT_DIR}/cdboot.img \${CORE_IMG} > grub_eltorito
rm -f \${CORE_IMG}
EOF
case "${LB_BUILD_WITH_CHROOT}" in
true)
mv binary.sh chroot
Chroot chroot "sh binary.sh"
mv chroot/grub_eltorito binary/boot/grub/grub_eltorito
rm -f chroot/binary.sh
;;
false)
sh binary.sh
mv grub_eltorito binary/boot/grub/grub_eltorito
rm -f binary.sh
;;
esac
fi
# Saving cache
Save_package_cache binary

View File

@ -160,30 +160,8 @@ done
# XORRISO_OPTIONS="${XORRISO_OPTIONS} -m ${XORRISO_EXCLUDE}"
#fi
if [ "${LB_FIRST_BOOTLOADER}" = "grub-pc" ]
then
cat > binary.sh << EOF
#!/bin/sh
input_dir=/usr/lib/grub/i386-pc
# build core.img
core_img=\$(mktemp)
grub-mkimage -d \${input_dir} -o \${core_img} -O i386-pc --prefix=/boot/grub biosdisk iso9660
# build grub_eltorito image
cat \${input_dir}/cdboot.img \${core_img} > binary/boot/grub/grub_eltorito
rm -f \${core_img}
EOF
else
echo "#!/bin/sh" > binary.sh
fi
cat >> binary.sh << EOF
mkdir -p binary/.disk
xorriso -as mkisofs ${XORRISO_OPTIONS} -o ${IMAGE} binary
EOF