[PATCH] Extend 52f1b041 to allow devices to be specified in config files as well as cmdline.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
 dracut.8.asc      |  7 +++++--
 dracut.conf.5.asc |  5 +++++
 dracut.sh         | 15 +++++++++++++--
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/dracut.8.asc b/dracut.8.asc
index 6300055..da7f327 100644
--- a/dracut.8.asc
+++ b/dracut.8.asc
@@ -332,8 +332,11 @@ provide a valid _/etc/fstab_.
     Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
     options>_ in the initramfs
 
-**--device** _<device>_ ::
-    Bring up _<device>_ in initramfs, _<device>_ should be the device name
+**--add-device** _<device>_ ::
+    Bring up _<device>_ in initramfs, _<device>_ 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** _<SOURCE>_ _<TARGET>_::
     include the files in the SOURCE directory into the
diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc
index 68bd9eb..e545451 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+=*" __<filename>__ "::
     Add entries of __<filename>__ to the initramfs /etc/fstab.
 
+*add_device+=*" __<device>__ "::
+    Bring up _<device>_ in initramfs, _<device>_ 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 469f408..23ffaa4 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
-- 
1.8.1

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux