summaryrefslogtreecommitdiff
path: root/50-dracut.install
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-03-13 14:47:24 +0100
committerHarald Hoyer <harald@redhat.com>2013-03-13 14:49:20 +0100
commit83bb0893edc1c12bbaca20267134b01df2836e1c (patch)
tree04a0448504aad1aa9d954854b582a39174f65370 /50-dracut.install
parent8fdcc1a9b1371b2b1d5c4e4b3ae077546f169459 (diff)
downloaddracut-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-x50-dracut.install19
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)