Last active
June 1, 2023 17:35
-
-
Save pmartycz/74da258f6d876862b88caa9b4026b1c2 to your computer and use it in GitHub Desktop.
Ubuntu mini.iso with UEFI support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -eu | |
# Downloads, verifies and unpacks Ubuntu mini.iso fixing lack of UEFI support | |
# See https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/1429030 | |
# Thanks to https://www.nemotos.net/?p=2057 | |
require() { | |
hash "$@" || die "Some of the required commands are missing" | |
} | |
download() { | |
echo "Downloading image" | |
curl -f --fail-early --create-dirs -o "$image" -OO \ | |
"$image_url" "$checksums_url" "$checksums_url".gpg | |
} | |
verify() { | |
echo "Verifying image" | |
gpg --verify "$checksums".gpg "$checksums" || die "Signature verification failed" \ | |
"See https://ubuntu.com/tutorials/how-to-verify-ubuntu#4-retrieve-the-correct-signature-key" | |
sha256sum -c --ignore-missing "$checksums" || die "Checksum verfication failed" | |
} | |
unpack() { | |
echo "Unpacking image to $dist/" | |
7z x -o"$dist" "$tempdir/$image" | |
7z x -o"$dist" "$dist/boot/grub/efi.img" | |
} | |
die() { | |
printf >&2 '%s\n' "$@" | |
exit 1 | |
} | |
! [ $# -eq 1 ] && die "Usage: $0 <dist>" | |
require 7z curl gpg sha256sum | |
dist=$1 | |
base_url=http://archive.ubuntu.com/ubuntu/dists/$dist/main/installer-amd64/current | |
case $dist in | |
precise|trusty|xenial|bionic|eoan) | |
base_url=$base_url/images | |
;; | |
*) | |
base_url=$base_url/legacy-images | |
esac | |
image=netboot/mini.iso | |
image_url=$base_url/$image | |
checksums=SHA256SUMS | |
checksums_url=$base_url/$checksums | |
tempdir=$(mktemp -d mini.iso.XXXXXXXXXX) && trap 'rm -rf "$tempdir"' EXIT | |
(cd "$tempdir" && download && verify) && unpack |
Need to use this for focal
:
base_url=http://archive.ubuntu.com/ubuntu/dists/${dist}/main/installer-amd64/current/legacy-images
@BLuFeNiX Thanks, I've updated the URL in the script
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Cpatrick08 you need to import signing keys from the Ubuntu keyserver
See https://ubuntu.com/tutorials/tutorial-how-to-verify-ubuntu#4-retrieve-the-correct-signature-key