From: Harald Hoyer Date: Tue, 22 Jul 2014 12:09:06 +0000 (+0200) Subject: add "--install-optional" and install_optional_items X-Git-Tag: 033-502~90 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc7d2eeb36a0472ec76b44caa41ebd68fb40b11c;p=thirdparty%2Fdracut.git add "--install-optional" and install_optional_items (cherry picked from commit 54b68829b60bc3f4c28cfca1ab0336584fe1e74c) --- diff --git a/dracut-bash-completion.sh b/dracut-bash-completion.sh index 9f359c6e8..feced605a 100644 --- a/dracut-bash-completion.sh +++ b/dracut-bash-completion.sh @@ -40,7 +40,7 @@ _dracut() { --omit-drivers --modules --omit --drivers --filesystems --install --fwdir --libdirs --fscks --add-fstab --mount --device --nofscks --kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix - --kernel-cmdline --sshkey --persistent-policy' + --kernel-cmdline --sshkey --persistent-policy --install-optional' ) if __contains_word "$prev" ${OPTS[ARG]}; then @@ -49,7 +49,7 @@ _dracut() { comps=$(compgen -d -- "$cur") compopt -o filenames ;; - -c|--conf|--sshkey|--add-fstab|--add-device|-I|--install) + -c|--conf|--sshkey|--add-fstab|--add-device|-I|--install|--install-optional) comps=$(compgen -f -- "$cur") compopt -o filenames ;; diff --git a/dracut.8.asc b/dracut.8.asc index 5f68d16af..8fd863b92 100644 --- a/dracut.8.asc +++ b/dracut.8.asc @@ -355,6 +355,9 @@ example: ---- =============================== +**--install-optional** __:: + install the space separated list of files into the initramfs, if they exist. + **--gzip**:: Compress the generated initramfs using gzip. This will be done by default, unless another compression option or --no-compress is passed. Equivalent to diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc index 99f70fff2..c20a341dc 100644 --- a/dracut.conf.5.asc +++ b/dracut.conf.5.asc @@ -66,6 +66,10 @@ Configuration files must have the extension .conf; other extensions are ignored. *install_items+=*" ____[ ____ ...] ":: Specify additional files to include in the initramfs, separated by spaces. +*install_optional_items+=*" ____[ ____ ...] ":: + Specify additional files to include in the initramfs, separated by spaces, + if they exist. + *do_strip=*"__{yes|no}__":: Strip binaries in the initramfs (default=yes) diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example index ff4e3b271..d69c943b5 100644 --- a/dracut.conf.d/fedora.conf.example +++ b/dracut.conf.d/fedora.conf.example @@ -6,7 +6,7 @@ i18n_default_font="latarcyrheb-sun16" i18n_install_all="yes" stdloglvl=3 sysloglvl=5 -install_items+=" vi /etc/virc ps grep cat rm " +install_optional_items+=" vi /etc/virc ps grep cat rm " prefix="/" systemdutildir=/usr/lib/systemd systemdsystemunitdir=/usr/lib/systemd/system diff --git a/dracut.sh b/dracut.sh index 789767923..fefdefd53 100755 --- a/dracut.sh +++ b/dracut.sh @@ -158,6 +158,8 @@ Creates initial ramdisk images for preloading modules in the final initramfs. -I, --install [LIST] Install the space separated list of files into the initramfs. + --install-optional [LIST] Install the space separated list of files into the + initramfs, if they exist. --gzip Compress the generated initramfs using gzip. This will be done by default, unless another compression option or --no-compress is passed. @@ -305,6 +307,7 @@ rearrange_params() --long drivers: \ --long filesystems: \ --long install: \ + --long install-optional: \ --long fwdir: \ --long libdirs: \ --long fscks: \ @@ -471,6 +474,9 @@ while :; do -d|--drivers) push drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;; --filesystems) push filesystems_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;; -I|--install) push install_items_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;; + --install-optional) + push install_optional_items_l \ + "$2"; PARMS_TO_STORE+=" '$2'"; shift;; --fwdir) push fw_dir_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;; --libdirs) push libdirs_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;; --fscks) push fscks_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;; @@ -722,6 +728,12 @@ if (( ${#install_items_l[@]} )); then done fi +if (( ${#install_optional_items_l[@]} )); then + while pop install_optional_items_l val; do + install_optional_items+=" $val " + done +fi + # these options override the stuff in the config file if (( ${#dracutmodules_l[@]} )); then dracutmodules='' @@ -1361,6 +1373,7 @@ fi if [[ $kernel_only != yes ]]; then (( ${#install_items[@]} > 0 )) && inst_multiple ${install_items[@]} + (( ${#install_optional_items[@]} > 0 )) && inst_multiple -o ${install_optional_items[@]} [[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"