diff options
author | Harald Hoyer <harald@redhat.com> | 2013-03-13 14:47:24 +0100 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2013-03-13 14:49:20 +0100 |
commit | 83bb0893edc1c12bbaca20267134b01df2836e1c (patch) | |
tree | 04a0448504aad1aa9d954854b582a39174f65370 /50-dracut.install | |
parent | 8fdcc1a9b1371b2b1d5c4e4b3ae077546f169459 (diff) | |
download | dracut-83bb0893edc1c12bbaca20267134b01df2836e1c.tar.gz dracut-83bb0893edc1c12bbaca20267134b01df2836e1c.tar.bz2 dracut-83bb0893edc1c12bbaca20267134b01df2836e1c.zip |
dracut.sh: Add --noimageifnotneeded parameter
Do not create an image in host-only mode, if no kernel driver is needed
and no $initdir/etc/cmdline/*.conf is generated.
Diffstat (limited to '50-dracut.install')
-rwxr-xr-x | 50-dracut.install | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/50-dracut.install b/50-dracut.install index 9e998998..6b63da93 100755 --- a/50-dracut.install +++ b/50-dracut.install @@ -2,10 +2,27 @@ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh +if [[ -f /etc/kernel/cmdline ]]; then + readarray -t BOOT_OPTIONS < /etc/kernel/cmdline +fi + +if ! [[ "${BOOT_OPTIONS[@]}" ]]; then + readarray -t BOOT_OPTIONS < /proc/cmdline +fi + +unset noimageifnotneeded + +for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do + if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then + noimageifnotneeded="yes" + break + fi +done + ret=0 case "$1" in add) - dracut "$3"/initrd "$2" + dracut ${noimageifnotneeded+--noimageifnotneeded} "$3"/initrd "$2" ret=$? ;; remove) |