Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- #
- # generate.sh - Called by bootmap to generate, sign and install an EFI image.
- #
- kernel="$1" # Name of the kernel e.g. linux
- subvol="$2" # Subvolume the image should boot into e.g. /bootmap/linux-123
- output="$3" # Where the image should be placed e.g. $esp/EFI/Linux/linux-123.efi
- shopt -s extglob nullglob
- rootdev=/dev/disk/by-uuid/"$(findmnt / -no UUID)" || exit
- cmdline="$(ROOTDEV="$rootdev" SUBVOL="$subvol" perl -p -e 's/\$ROOTDEV/$ENV{ROOTDEV}/g; s/\$SUBVOL/$ENV{SUBVOL}/g; chomp if eof' /etc/kernel/cmdline)" || exit
- tmp=$(mktemp) || exit
- args=()
- args+=(--linux=/boot/vmlinuz-"$kernel")
- args+=(--initrd=/boot/*-ucode.img)
- args+=(--initrd=/boot/initramfs-"$kernel".img)
- args+=(--cmdline="$cmdline")
- args+=(--os-release=@/usr/lib/os-release)
- args+=(--splash=/usr/share/systemd/bootctl/splash-arch.bmp)
- args+=(--output="$tmp")
- /usr/lib/systemd/ukify build "${args[@]}" || exit 1
- sbctl sign -s "$tmp" || { rm "$tmp"; exit 1; }
- mv "$tmp" "$output" || { rm -f "$output"; rm -f "$tmp"; exit 1; }
Advertisement
Add Comment
Please, Sign In to add comment