summaryrefslogtreecommitdiffstats
path: root/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'libalpm')
-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}"