summaryrefslogtreecommitdiffstats
path: root/libalpm/scripts/mkinitcpio-install
blob: 88876e245a7ceb40c601c88856f37c4612e74f1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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}"