summaryrefslogtreecommitdiffstats
path: root/libalpm/scripts
diff options
context:
space:
mode:
authorGiancarlo Razzolini <grazzolini@archlinux.org>2019-10-09 05:08:21 +0200
committerGiancarlo Razzolini <grazzolini@archlinux.org>2019-10-09 05:08:21 +0200
commite8106a8e24588c1ba65f4c563d55a4275b0e4b70 (patch)
tree0f426587499ac955bb6b0e773376909f0388cf1c /libalpm/scripts
parentb85056e0096172d01ff6ce5f7c14c3ca5664a939 (diff)
downloadmkinitcpio-e8106a8e24588c1ba65f4c563d55a4275b0e4b70.tar.gz
mkinitcpio-e8106a8e24588c1ba65f4c563d55a4275b0e4b70.tar.xz
Add a mkinitcpio pacman script
This script runs on mkinitcpio package updates as well as on kernel updates that have the pkgbase file on their modules directory. It will use the contents of that file to determine which preset to run or, in case not pkgbase file is passed to it, it will run all presets with -P.
Diffstat (limited to 'libalpm/scripts')
-rw-r--r--libalpm/scripts/mkinitcpio.script14
1 files changed, 14 insertions, 0 deletions
diff --git a/libalpm/scripts/mkinitcpio.script b/libalpm/scripts/mkinitcpio.script
new file mode 100644
index 0000000..70c9784
--- /dev/null
+++ b/libalpm/scripts/mkinitcpio.script
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+args=('-p')
+
+while read -r line; do
+ if [[ $line = usr/lib/modules/+([^/])/pkgbase ]]; then
+ mapfile -O ${#targets[@]} -t targets < "/$line"
+ else
+ args=('-P') # all presets
+ break
+ fi
+done
+
+mkinitcpio "${args[@]}" "${targets[@]}"