]>
Commit | Line | Data |
---|---|---|
9dd9d81f HH |
1 | #!/bin/sh |
2 | # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- | |
3 | # ex: ts=8 sw=4 sts=4 et filetype=sh | |
4 | ||
83bb0893 HH |
5 | if [[ -f /etc/kernel/cmdline ]]; then |
6 | readarray -t BOOT_OPTIONS < /etc/kernel/cmdline | |
7 | fi | |
8 | ||
9 | if ! [[ "${BOOT_OPTIONS[@]}" ]]; then | |
10 | readarray -t BOOT_OPTIONS < /proc/cmdline | |
11 | fi | |
12 | ||
13 | unset noimageifnotneeded | |
14 | ||
15 | for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do | |
16 | if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then | |
17 | noimageifnotneeded="yes" | |
18 | break | |
19 | fi | |
20 | done | |
21 | ||
9dd9d81f HH |
22 | ret=0 |
23 | case "$1" in | |
24 | add) | |
ffc68f35 | 25 | dracut ${noimageifnotneeded:+--noimageifnotneeded} "$3"/initrd "$2" |
9dd9d81f HH |
26 | ret=$? |
27 | ;; | |
28 | remove) | |
32bd2fbb | 29 | rm -f -- "$3"/initrd |
9dd9d81f HH |
30 | ret=$? |
31 | ;; | |
32 | esac | |
33 | exit $ret |