Change the way /sysroot is mounted in dracut with systemd. OBS-URL: https://build.opensuse.org/request/show/330513 OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=225
58 lines
2.4 KiB
Diff
58 lines
2.4 KiB
Diff
From: Fabian Vogt <fvogt@suse.com>
|
|
Subject: dracut.sh: Support --mount with just mountpoint as parameter
|
|
|
|
Right now the --mount parameter of dracut expects a rather long fstab-like
|
|
line. This makes it possible to invoke dracut with e.g. --mount /boot.
|
|
|
|
Index: dracut-043/dracut.8.asc
|
|
===================================================================
|
|
--- dracut-043.orig/dracut.8.asc
|
|
+++ dracut-043/dracut.8.asc
|
|
@@ -338,6 +338,10 @@ provide a valid _/etc/fstab_.
|
|
The default _<dump frequency>_ is "0".
|
|
the default _<fsck order>_ is "2".
|
|
|
|
+**--mount** "_<mountpoint>_"::
|
|
+ Like above, but _<device>_, _<filesystem type>_ and _<filesystem options>_
|
|
+ are determined by looking at the current mounts.
|
|
+
|
|
**--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
|
|
Index: dracut-043/dracut.sh
|
|
===================================================================
|
|
--- dracut-043.orig/dracut.sh
|
|
+++ dracut-043/dracut.sh
|
|
@@ -152,6 +152,8 @@ Creates initial ramdisk images for prelo
|
|
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
|
|
Mount device [DEV] on mountpoint [MP] with filesystem
|
|
[FSTYPE] and options [FSOPTS] in the initramfs
|
|
+ --mount "[MP]" Same as above, but [DEV], [FSTYPE] and [FSOPTS] are
|
|
+ determined by looking at the current mounts.
|
|
--add-device "[DEV]" Bring up [DEV] in initramfs
|
|
-i, --include [SOURCE] [TARGET]
|
|
Include the files in the SOURCE directory into the
|
|
@@ -1536,9 +1538,21 @@ if [[ $kernel_only != yes ]]; then
|
|
|
|
while pop fstab_lines line; do
|
|
line=($line)
|
|
- [ -z "${line[3]}" ] && line[3]="defaults"
|
|
+
|
|
+ if [ -z "${line[1]}" ]; then
|
|
+ # Determine device and mount options from current system
|
|
+ mountpoint -q "${line[0]}" || derror "${line[0]} is not a mount point!"
|
|
+ line=($(findmnt --raw -n --target "${line[0]}" --output=source,target,fstype,options))
|
|
+ dinfo "Line for ${line[1]}: ${line[@]}"
|
|
+ else
|
|
+ # Use default options
|
|
+ [ -z "${line[3]}" ] && line[3]="defaults"
|
|
+ fi
|
|
+
|
|
+ # Default options for freq and passno
|
|
[ -z "${line[4]}" ] && line[4]="0"
|
|
[ -z "${line[5]}" ] && line[5]="2"
|
|
+
|
|
strstr "${line[2]}" "nfs" && line[5]="0"
|
|
echo "${line[@]}" >> "${initdir}/etc/fstab"
|
|
done
|