Add virtualbox-iso target
Lots of other, small quality of life improvements to build process Output of build serial console to artifacts upon failure Reducing verbosity of Packer, now that serial output is captured Fixed sizing problems with the boot partitions of Ubuntu versions Use of Mac builders for Virtualbox targets Updating Ubuntu builders to 22.04, as well
This commit is contained in:
+18
-25
@@ -7,39 +7,32 @@ distro="${1}"
|
||||
url="$(cat "${distro}" | grep url | cut -f2 -d'"')"
|
||||
curl -C - -O "${url}"
|
||||
|
||||
# Mount and copy
|
||||
# Mount and extract
|
||||
file=$(printf "${url}" | sed -E -e 's#.*/(.*)$#\1#')
|
||||
old=$(mktemp -d)
|
||||
new=$(mktemp -d)
|
||||
sudo mount -t iso9660 -o loop "${file}" "${old}"
|
||||
{
|
||||
cd "${old}"
|
||||
tar -cvf - . | (cd "${new}" && tar -xf -)
|
||||
cd -
|
||||
}
|
||||
work="$(mktemp -d)"
|
||||
xorriso -osirrox on -indev "${file}" -extract / "${work}"
|
||||
|
||||
# Modify timeout
|
||||
chmod +w "${new}/boot/grub" "${new}/boot/grub/grub.cfg"
|
||||
chmod +w "${new}/isolinux" "${new}/isolinux/isolinux.cfg"
|
||||
sed -i -e 's/set timeout=.*/set timeout=30/' "${new}/boot/grub/grub.cfg"
|
||||
sed -i -e 's/timeout.*/timeout 300/' "${new}/isolinux/isolinux.cfg" # Uses 10ths of a second
|
||||
chmod -w "${new}/boot/grub" "${new}/boot/grub/grub.cfg"
|
||||
chmod -w "${new}/isolinux" "${new}/isolinux/isolinux.cfg"
|
||||
cat "${new}/boot/grub/grub.cfg"
|
||||
cat "${new}/isolinux/isolinux.cfg"
|
||||
chmod -R +w "${work}"
|
||||
sed -i -e 's/set timeout=.*/set timeout=30/' "${work}/boot/grub/grub.cfg"
|
||||
sed -i -e 's/timeout.*/timeout 300/' "${work}/isolinux/isolinux.cfg" # Uses 10ths of a second
|
||||
chmod -R -w "${work}"
|
||||
|
||||
# Create new ISO file
|
||||
sudo umount "${old}"
|
||||
rm "${file}"
|
||||
chmod +w "${new}/isolinux/isolinux.bin"
|
||||
mkisofs -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V "Boot" -r -iso-level 4 -chrp-boot -o "${file}" "${new}"
|
||||
chmod +w "${work}/ubuntu" "${work}/isolinux/isolinux.bin"
|
||||
mkisofs -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V "Boot" -r -iso-level 3 -chrp-boot -o "${file}" "${work}"
|
||||
new_sum=$(sha256sum "${file}" | cut -f1 -d' ')
|
||||
|
||||
# Update distro file
|
||||
sed -i "${distro}" -e "s/checksum = \".*\"/checksum = \"${new_sum}\"/"
|
||||
sed -i "${distro}" -e "s/url = \".*\"/url = \"${file}\"/"
|
||||
sed -i "${distro}" -e "s/boot_wait = \".*\"/boot_wait = \"15s\"/"
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
SED=$(which gsed)
|
||||
else
|
||||
SED=$(which sed)
|
||||
fi
|
||||
"${SED}" -i -e "s/checksum = \".*\"/checksum = \"${new_sum}\"/" "${distro}"
|
||||
"${SED}" -i -e "s/url = \".*\"/url = \"${file}\"/" "${distro}"
|
||||
"${SED}" -i -e "s/boot_wait = \".*\"/boot_wait = \"15s\"/" "${distro}"
|
||||
|
||||
# Cleanup remaining directories
|
||||
rm -r "${old}"
|
||||
#sudo rm -r "${new}"
|
||||
rm -r "${work}" || true
|
||||
|
||||
Reference in New Issue
Block a user