From: Colin Guthrie Date: Mon, 21 Jan 2013 11:23:19 +0000 (+0000) Subject: Extend 52f1b041 to allow devices to be specified in config files as well as cmdline. X-Git-Tag: 025~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c586b033a710ed9d2bf6dd5c99505385e101163b;p=thirdparty%2Fdracut.git Extend 52f1b041 to allow devices to be specified in config files as well as cmdline. This also changes the command line switch to be --add-device and the config directive is set to add_device. This was chosen as device= in the config file seems too generic and not quite as consistent with other directives (i.e. drivers/add_drivers) The --device command line is still supported but it should be considered deprecated in favour of --add-device. --- diff --git a/dracut.8.asc b/dracut.8.asc index 630005515..da7f32719 100644 --- a/dracut.8.asc +++ b/dracut.8.asc @@ -332,8 +332,11 @@ provide a valid _/etc/fstab_. Mount __ on __ with __ and __ in the initramfs -**--device** __ :: - Bring up __ in initramfs, __ should be the device name +**--add-device** __ :: + Bring up __ in initramfs, __ should be the device name. + This can be useful in hostonly mode for resume support when your swap is on + LVM or an encrypted partition. + [NB --device can be used for compatibility with earlier releases] **-i, --include** __ __:: include the files in the SOURCE directory into the diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc index 68bd9eb35..e54545145 100644 --- a/dracut.conf.5.asc +++ b/dracut.conf.5.asc @@ -82,6 +82,11 @@ If chrooted to another root other than the real root device, use --fstab and pro *add_fstab+=*" ____ ":: Add entries of ____ to the initramfs /etc/fstab. +*add_device+=*" ____ ":: + Bring up __ in initramfs, __ should be the device name. + This can be useful in hostonly mode for resume support when your swap is on + LVM an encrypted partition. + *mdadmconf=*"__{yes|no}__":: Include local _/etc/mdadm.conf_ (default=yes) diff --git a/dracut.sh b/dracut.sh index 469f40872..23ffaa4b0 100755 --- a/dracut.sh +++ b/dracut.sh @@ -134,7 +134,7 @@ Creates initial ramdisk images for preloading modules --mount "[DEV] [MP] [FSTYPE] [FSOPTS]" Mount device [DEV] on mountpoint [MP] with filesystem [FSTYPE] and options [FSOPTS] in the initramfs - --device "[DEV]" Bring up [DEV] in initramfs + --add-device "[DEV]" Bring up [DEV] in initramfs -i, --include [SOURCE] [TARGET] Include the files in the SOURCE directory into the Target directory in the final initramfs. @@ -331,7 +331,8 @@ while :; do --fscks) push fscks_l "$2"; shift;; --add-fstab) push add_fstab_l "$2"; shift;; --mount) push fstab_lines "$2"; shift;; - --device) push host_devs "$2"; shift;; + --add-device|--device) + push add_device_l "$2"; shift;; --kernel-cmdline) push kernel_cmdline_l "$2"; shift;; --nofscks) nofscks_l="yes";; --ro-mnt) ro_mnt_l="yes";; @@ -734,6 +735,16 @@ for f in $add_fstab; do done < $f done +if (( ${#add_device_l[@]} )); then + while pop add_device_l val; do + add_device+=" $val " + done +fi + +for dev in $add_device; do + push host_devs $dev +done + if [[ $hostonly ]]; then # in hostonly mode, determine all devices, which have to be accessed # and examine them for filesystem types