Guest User

bootmap sbctl

a guest
Aug 26th, 2024
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.04 KB | Source Code | 0 0
  1. #! /bin/bash
  2. #
  3. # generate.sh - Called by bootmap to generate, sign and install an EFI image.
  4. #
  5.  
  6. kernel="$1" # Name of the kernel                   e.g. linux
  7. subvol="$2" # Subvolume the image should boot into e.g. /bootmap/linux-123
  8. output="$3" # Where the image should be placed     e.g. $esp/EFI/Linux/linux-123.efi
  9.  
  10. shopt -s extglob nullglob
  11.  
  12. rootdev=/dev/disk/by-uuid/"$(findmnt / -no UUID)" || exit
  13. 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
  14.  
  15. tmp=$(mktemp) || exit
  16.  
  17. args=()
  18. args+=(--linux=/boot/vmlinuz-"$kernel")
  19. args+=(--initrd=/boot/*-ucode.img)
  20. args+=(--initrd=/boot/initramfs-"$kernel".img)
  21. args+=(--cmdline="$cmdline")
  22. args+=(--os-release=@/usr/lib/os-release)
  23. args+=(--splash=/usr/share/systemd/bootctl/splash-arch.bmp)
  24. args+=(--output="$tmp")
  25.  
  26. /usr/lib/systemd/ukify build "${args[@]}" || exit 1
  27.  
  28. sbctl sign -s "$tmp" || { rm "$tmp"; exit 1; }
  29.  
  30. mv "$tmp" "$output" || { rm -f "$output"; rm -f "$tmp"; exit 1; }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment