summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiancarlo Razzolini <grazzolini@archlinux.org>2019-10-09 19:48:42 +0200
committerGiancarlo Razzolini <grazzolini@archlinux.org>2019-10-09 19:48:42 +0200
commitdfcdcf483c1b27dbb9fb91bc53f745cedba709cb (patch)
treec5b932ed6381e1b6c2cda49ed6c09ecb85a276a2
parent2adc98944dfe0c40da44b6a2d8877af68b1f2bbe (diff)
downloadmkinitcpio-dfcdcf483c1b27dbb9fb91bc53f745cedba709cb.tar.gz
mkinitcpio-dfcdcf483c1b27dbb9fb91bc53f745cedba709cb.tar.xz
Rework the script to create the preset and install the actual kernel to /boot
The script now will use a prepared preset to create presets when new kernels are installed. It will also always copy the vmlinuz kernel to /boot.
-rw-r--r--libalpm/scripts/mkinitcpio-install19
1 files changed, 19 insertions, 0 deletions
diff --git a/libalpm/scripts/mkinitcpio-install b/libalpm/scripts/mkinitcpio-install
new file mode 100644
index 0000000..88876e2
--- /dev/null
+++ b/libalpm/scripts/mkinitcpio-install
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+args=('-p')
+
+while read -r line; do
+ if [[ $line = usr/lib/modules/+([^/])/pkgbase ]]; then
+ pkgbase=$(< "/$line")
+ if [[ ! -e /etc/mkinitcpio.d/"${pkgbase}".preset ]]; then
+ sed "s|%PKGBASE%|${pkgbase}|g" /usr/share/mkinitcpio/hook.preset | install -Dm644 /dev/stdin \
+ /etc/mkinitcpio.d/"${pkgbase}".preset
+ fi
+ install -Dm644 $(dirname $line)/vmlinuz /boot/vmlinuz-"${pkgbase}"
+ else
+ args=('-P') # all presets
+ break
+ fi
+done
+
+mkinitcpio "${args[@]}" "${pkgbase}"