add "--install-optional" and install_optional_items

master
Harald Hoyer 2014-07-22 14:09:06 +02:00
parent 7b46244bb9
commit 54b68829b6
5 changed files with 23 additions and 3 deletions

View File

@ -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
;;

View File

@ -349,6 +349,9 @@ example:
----
===============================

**--install-optional** _<file 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. Equivalent to

View File

@ -66,6 +66,10 @@ Configuration files must have the extension .conf; other extensions are ignored.
*install_items+=*" __<file>__[ __<file>__ ...] "::
Specify additional files to include in the initramfs, separated by spaces.

*install_optional_items+=*" __<file>__[ __<file>__ ...] "::
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)


View File

@ -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

View File

@ -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: \
@ -469,6 +472,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;;
@ -716,6 +722,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=''
@ -1317,6 +1329,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"