~whynothugo/dotfiles

ref: a161f8c207adea1fb51092ffa4bb65ae258088d9 dotfiles/packages/whynothugo-bootloader/PKGBUILD -rw-r--r-- 1.9 KiB
a161f8c2 — Hugo Osvaldo Barrera Stop tracking checksum for repo-local files 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Maintainer: Hugo Osvaldo Barrera <hugo@whynothugo.nl>

pkgname=whynothugo-bootloader
pkgver=7
pkgrel=1
pkgdesc="Set up bootloader with secureboot."
arch=("x86_64" "aarch64")
depends=("systemd" "sbctl" "systemd-boot-pacman-hook")
source=(
  "gencmdline"
  "70-sign-bootctl.hook"
  "linux.conf"
  "linux.preset"
  "linux-asahi.conf"
  "linux-asahi.preset"
  "arch.conf"
  "loader.conf"
  "bundles.db"
)
sha256sums=(
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
)
install="whynothugo-bootloader.install"

package() {
  install -dm 0755 "$pkgdir/etc/kernel/cmdline.d/"
  install -Dm 0744 "$srcdir/gencmdline" "$pkgdir/usr/bin/gencmdline"
  install -Dm 0644 "$srcdir/70-sign-bootctl.hook" "$pkgdir/usr/share/libalpm/hooks/70-sign-bootctl.hook"

  if [ $CARCH = "x86_64" ]; then
    install -Dm 0644 "$srcdir/linux.conf" "$pkgdir/etc/mkinitcpio.d/linux.conf"
    install -Dm 0644 "$srcdir/linux.preset" "$pkgdir/etc/mkinitcpio.d/linux.preset"

    # Configure sbctl(8) to generate signed UEFI bundles.
    install -Dm 0644 "$srcdir/bundles.db" "$pkgdir/usr/share/secureboot/bundles.db"
  elif [ $CARCH = "aarch64" ]; then
    install -Dm 0644 "$srcdir/linux-asahi.conf" "$pkgdir/etc/mkinitcpio.d/linux-asahi.conf"
    install -Dm 0644 "$srcdir/linux-asahi.preset" "$pkgdir/etc/mkinitcpio.d/linux-asahi.preset"

    # XXX: Can't get UEFI bundles to work on this architecture yet.
    # The bundle on this platform MUST specify rd.luks.uuid= and root=, but
    # there's something else that makes that process fail. In the meantime, use
    # a config file in the ESP. The bundle is not critical until there's
    # SecureBoot support anyway.
    install -Dm 644 "$srcdir/arch.conf" "$pkgdir/boot/efi/loader/entries/arch.conf"
    install -Dm 644 "$srcdir/loader.conf" "$pkgdir/boot/efi/loader/loader.conf"
  else
    print "Unsupported architecture"
    exit 2
  fi
}