summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerdinand Bachmann2024-03-11 17:20:03 +0100
committerFerdinand Bachmann2024-03-11 17:20:03 +0100
commit5d1199ca0cf500863e54ff7906abbad819323fc6 (patch)
tree844fae04bf5182ecc49ec2836d1b0c132651e8a1
downloadaur-shim-systemd-boot-update.tar.gz
initial commit
-rw-r--r--.SRCINFO13
-rw-r--r--PKGBUILD18
-rw-r--r--shim-systemd-boot-update.service17
-rw-r--r--shim-systemd-boot-update.sh15
4 files changed, 63 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..818b9e4141bd
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,13 @@
+pkgbase = shim-systemd-boot-update
+ pkgdesc = Automatically update grubx64.efi with systemd-boot-update.service for shim
+ pkgver = 1.0.0
+ pkgrel = 1
+ arch = any
+ license = GPL
+ depends = systemd
+ source = shim-systemd-boot-update.service
+ source = shim-systemd-boot-update.sh
+ sha256sums = a5d21649fc0b7a2ebf6df617fe1eeffd64a97860963956b6259935e0d8c40340
+ sha256sums = acf9c282d4fa43c310a7402028de5d4ae02ad523fe82c6b91d5641ddb2d228d1
+
+pkgname = shim-systemd-boot-update
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..85e7cc4d879c
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,18 @@
+# Maintainer: Ferdinand Bachmann <ferdinand dot bachmann at yrlf dot at>
+
+pkgname=shim-systemd-boot-update
+pkgver=1.0.0
+pkgrel=1
+pkgdesc='Automatically update grubx64.efi with systemd-boot-update.service for shim'
+arch=('any')
+license=('GPL')
+depends=('systemd')
+source=('shim-systemd-boot-update.service'
+ 'shim-systemd-boot-update.sh')
+sha256sums=('a5d21649fc0b7a2ebf6df617fe1eeffd64a97860963956b6259935e0d8c40340'
+ 'acf9c282d4fa43c310a7402028de5d4ae02ad523fe82c6b91d5641ddb2d228d1')
+
+package() {
+ install -Dm644 "$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
+ install -Dm755 "$pkgname.sh" "$pkgdir/usr/lib/$pkgname/$pkgname.sh"
+}
diff --git a/shim-systemd-boot-update.service b/shim-systemd-boot-update.service
new file mode 100644
index 000000000000..336fce4af3d1
--- /dev/null
+++ b/shim-systemd-boot-update.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Automatic Boot Loader Update (for EFI shim)
+ConditionPathExists=!/etc/initrd-release
+
+DefaultDependencies=no
+After=systemd-boot-update.service
+Before=sysinit.target systemd-update-done.service
+Conflicts=shutdown.target
+Before=shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/lib/shim-systemd-boot-update/shim-systemd-boot-update.sh
+
+[Install]
+WantedBy=sysinit.target
diff --git a/shim-systemd-boot-update.sh b/shim-systemd-boot-update.sh
new file mode 100644
index 000000000000..9d50537625c6
--- /dev/null
+++ b/shim-systemd-boot-update.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+ESP_DIR="$(bootctl -p)"
+BOOT_LOADER_EFI="$ESP_DIR/EFI/systemd/systemd-bootx64.efi"
+SHIM_TARGET_EFI="$ESP_DIR/EFI/BOOT/grubx64.efi"
+
+if diff -q "$BOOT_LOADER_EFI" "$SHIM_TARGET_EFI"; then
+ echo "info: no changes, nothing to do"
+ exit 0
+fi
+
+if cp "$BOOT_LOADER_EFI" "$SHIM_TARGET_EFI"; then
+ echo "info: bootloader installed as EFI shim target"
+ exit 0
+fi