]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
arch: Drop pacman kernel install hooks
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 7 Jul 2022 13:34:53 +0000 (15:34 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 12 Jul 2022 22:38:59 +0000 (00:38 +0200)
We shouldn't special case updates Arch if we don't do so on other
distros either. We don't guarantee availability of a package
manager in generated images, and the only reason Arch images ship
with pacman is because it's part of the base group. This might
change in the future and as such, there's no guarantee that Arch
images will always have pacman. Hence, let's remove the pacman hooks
we install for Arch to bring it more in line with the other distros.

NEWS.md
mkosi/__init__.py
mkosi/resources/arch/60_kernel_remove.hook [deleted file]
mkosi/resources/arch/60_vmlinuz_remove.hook [deleted file]
mkosi/resources/arch/90_kernel_add.hook [deleted file]
mkosi/resources/arch/90_vmlinuz_add.hook [deleted file]
mkosi/resources/arch/91_bootctl_update.hook [deleted file]
mkosi/resources/arch/__init__.py [deleted file]
mkosi/resources/arch/kernel_add.sh [deleted file]
mkosi/resources/arch/kernel_remove.sh [deleted file]

diff --git a/NEWS.md b/NEWS.md
index 02068007d3c5f4fc100958b61ea20c3cf4ca1f98..c57bd48e4a9b3c22933e23ba374c6b21ff7df1ba 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,6 +4,10 @@
 
 - Support for Clear Linux was dropped. See https://github.com/systemd/mkosi/pull/1037
 for more information.
+- The Arch kernel/bootloader pacman hooks were removed. For anyone that still
+wants to use them, they can be found [here](https://github.com/systemd/mkosi/tree/v13/mkosi/resources/arch).
+When building a bios image, /boot/vmlinuz-kver and /boot/initramfs-kver.img are
+now symlinks to the actual files as installed by kernel-install.
 
 ## v13
 
index ad6d5bf3d80c31c243da3e82004d2754fcc7698c..0ad632a7507e9a6b29158d5680c6b208705fe082 100644 (file)
@@ -3020,31 +3020,6 @@ def install_arch(args: MkosiArgs, root: Path, do_run_build_script: bool) -> None
                     )
                 )
 
-    if not do_run_build_script and args.bootable:
-        hooks_dir = root / "etc/pacman.d/hooks"
-        scripts_dir = root / "etc/pacman.d/scripts"
-
-        os.makedirs(hooks_dir, 0o755, exist_ok=True)
-        os.makedirs(scripts_dir, 0o755, exist_ok=True)
-
-        # Disable depmod pacman hook as depmod is handled by kernel-install as well.
-        hooks_dir.joinpath("60-depmod.hook").symlink_to("/dev/null")
-
-        write_resource(hooks_dir / "90-mkosi-kernel-add.hook", "mkosi.resources.arch", "90_kernel_add.hook")
-        write_resource(scripts_dir / "mkosi-kernel-add", "mkosi.resources.arch", "kernel_add.sh",
-                       executable=True)
-
-        write_resource(hooks_dir / "60-mkosi-kernel-remove.hook", "mkosi.resources.arch", "60_kernel_remove.hook")
-        write_resource(scripts_dir / "mkosi-kernel-remove", "mkosi.resources.arch", "kernel_remove.sh",
-                       executable=True)
-
-        if args.get_partition(PartitionIdentifier.esp):
-            write_resource(hooks_dir / "91-mkosi-bootctl-update.hook", "mkosi.resources.arch", "91_bootctl_update.hook")
-
-        if args.get_partition(PartitionIdentifier.bios):
-            write_resource(hooks_dir / "90-mkosi-vmlinuz-add.hook", "mkosi.resources.arch", "90_vmlinuz_add.hook")
-            write_resource(hooks_dir / "60-mkosi-vmlinuz-remove.hook", "mkosi.resources.arch", "60_vmlinuz_remove.hook")
-
     keyring = "archlinux"
     if platform.machine() == "aarch64":
         keyring += "arm"
diff --git a/mkosi/resources/arch/60_kernel_remove.hook b/mkosi/resources/arch/60_kernel_remove.hook
deleted file mode 100644 (file)
index fce00df..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-[Trigger]
-Operation = Upgrade
-Operation = Remove
-Type = Path
-Target = usr/lib/modules/*/vmlinuz
-
-[Action]
-Description = Removing kernel and initramfs images from /boot...
-When = PreTransaction
-Exec = /etc/pacman.d/mkosi-kernel-remove
-NeedsTargets
diff --git a/mkosi/resources/arch/60_vmlinuz_remove.hook b/mkosi/resources/arch/60_vmlinuz_remove.hook
deleted file mode 100644 (file)
index b53e19c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-[Trigger]
-Operation = Upgrade
-Operation = Remove
-Type = Path
-Target = usr/lib/modules/*/vmlinuz
-
-[Action]
-Description = Removing vmlinuz from /boot...
-When = PreTransaction
-Exec = /bin/bash -c 'while read -r f; do rm -f "/boot/vmlinuz-$(basename "$(dirname "$f")")"; done'
-NeedsTargets
diff --git a/mkosi/resources/arch/90_kernel_add.hook b/mkosi/resources/arch/90_kernel_add.hook
deleted file mode 100644 (file)
index 40511be..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-[Trigger]
-Operation = Install
-Operation = Upgrade
-Type = Path
-Target = usr/lib/modules/*/vmlinuz
-Target = usr/lib/kernel/install.d/*
-Target = boot/*-ucode.img
-
-[Trigger]
-Operation = Install
-Operation = Upgrade
-Type = Package
-Target = systemd
-
-[Action]
-Description = Adding kernel and initramfs images to /boot...
-When = PostTransaction
-Exec = /etc/pacman.d/scripts/mkosi-kernel-add
-NeedsTargets
diff --git a/mkosi/resources/arch/90_vmlinuz_add.hook b/mkosi/resources/arch/90_vmlinuz_add.hook
deleted file mode 100644 (file)
index b5ddca3..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-[Trigger]
-Operation = Install
-Operation = Upgrade
-Type = Path
-Target = usr/lib/modules/*/vmlinuz
-
-[Action]
-Description = Adding vmlinuz to /boot...
-When = PostTransaction
-Exec = /bin/bash -c 'while read -r f; do install -Dm644 "$f" "/boot/vmlinuz-$(basename "$(dirname "$f")")"; done'
-NeedsTargets
diff --git a/mkosi/resources/arch/91_bootctl_update.hook b/mkosi/resources/arch/91_bootctl_update.hook
deleted file mode 100644 (file)
index c562c04..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-[Trigger]
-Operation = Upgrade
-Type = Package
-Target = systemd
-
-[Action]
-Description = Updating systemd-boot...
-When = PostTransaction
-Exec = /usr/bin/bootctl update
diff --git a/mkosi/resources/arch/__init__.py b/mkosi/resources/arch/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/mkosi/resources/arch/kernel_add.sh b/mkosi/resources/arch/kernel_add.sh
deleted file mode 100755 (executable)
index 7ea71f4..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash -e
-shopt -s nullglob
-
-declare -a kernel_version
-
-# Check the targets passed by the pacman hook.
-while read -r line
-do
-    if [[ "$line" =~ usr/lib/modules/([^/]+)/vmlinuz ]]
-    then
-        kernel_version+=( "${BASH_REMATCH[1]}" )
-    else
-        # If a non-matching line is passed, just rebuild all kernels.
-        kernel_version=()
-        for f in /usr/lib/modules/*/vmlinuz
-        do
-            kernel_version+=( "$(basename "$(dirname "$f")")" )
-        done
-        break
-    fi
-done
-
-# (re)build the kernel images.
-for kv in "${kernel_version[@]}"
-do
-    kernel-install add "$kv" "/usr/lib/modules/${kv}/vmlinuz"
-done
diff --git a/mkosi/resources/arch/kernel_remove.sh b/mkosi/resources/arch/kernel_remove.sh
deleted file mode 100755 (executable)
index fdd01d8..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash -e
-
-while read -r f; do
-    kernel-install remove "$(basename "$(dirname "$f")")"
-done