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 |
@Cpatrick08 you need to import signing keys from the Ubuntu keyserver
gpg --keyid-format long --keyserver hkp://keyserver.ubuntu.com --recv-keys 0x3B4FE6ACC0B21F32 0x871920D1991BC93C
See https://ubuntu.com/tutorials/tutorial-how-to-verify-ubuntu#4-retrieve-the-correct-signature-key
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
I get the following error message.
100 1554 100 1554 0 0 28777 0 --:--:-- --:--:-- --:--:-- 28777
gpg: Signature made Tue 10 Mar 2020 10:38:21 AM CDT
gpg: using RSA key 3B4FE6ACC0B21F32
gpg: Can't check signature: No public key
gpg: Signature made Tue 10 Mar 2020 10:38:21 AM CDT
gpg: using RSA key 871920D1991BC93C
gpg: Can't check signature: No public key