|
Harald Hoyer |
6adbc8 |
From 70cb8a686f710b237c6f7c7524b47d2649f6751a Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
6adbc8 |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
6adbc8 |
Date: Thu, 15 Dec 2011 14:36:37 +0100
|
|
Harald Hoyer |
6adbc8 |
Subject: [PATCH] dracut: add --add-fstab and --mount option
|
|
Harald Hoyer |
6adbc8 |
|
|
Harald Hoyer |
6adbc8 |
--add-fstab [FILE] Add file to the initramfs fstab
|
|
Harald Hoyer |
6adbc8 |
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
|
|
Harald Hoyer |
6adbc8 |
Mount device [DEV] on mountpoint [MP] with filesystem
|
|
Harald Hoyer |
6adbc8 |
[FSTYPE] and options [FSOPTS] in the initramfs
|
|
Harald Hoyer |
6adbc8 |
---
|
|
Harald Hoyer |
6adbc8 |
dracut | 40 ++++++++++++++++++++++++++++++++++++
|
|
Harald Hoyer |
6adbc8 |
modules.d/95fstab-sys/mount-sys.sh | 4 +-
|
|
Harald Hoyer |
6adbc8 |
2 files changed, 42 insertions(+), 2 deletions(-)
|
|
Harald Hoyer |
6adbc8 |
|
|
Harald Hoyer |
6adbc8 |
diff --git a/dracut b/dracut
|
|
Harald Hoyer |
6adbc8 |
index 46694f8..8449fc1 100755
|
|
Harald Hoyer |
6adbc8 |
--- a/dracut
|
|
Harald Hoyer |
6adbc8 |
+++ b/dracut
|
|
Harald Hoyer |
6adbc8 |
@@ -85,6 +85,10 @@ Creates initial ramdisk images for preloading modules
|
|
Harald Hoyer |
6adbc8 |
-H, --hostonly Host-Only mode: Install only what is needed for
|
|
Harald Hoyer |
6adbc8 |
booting the local host instead of a generic host.
|
|
Harald Hoyer |
6adbc8 |
--fstab Use /etc/fstab to determine the root device.
|
|
Harald Hoyer |
6adbc8 |
+ --add-fstab [FILE] Add file to the initramfs fstab
|
|
Harald Hoyer |
6adbc8 |
+ --mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
|
|
Harald Hoyer |
6adbc8 |
+ Mount device [DEV] on mountpoint [MP] with filesystem
|
|
Harald Hoyer |
6adbc8 |
+ [FSTYPE] and options [FSOPTS] in the initramfs
|
|
Harald Hoyer |
6adbc8 |
-i, --include [SOURCE] [TARGET]
|
|
Harald Hoyer |
6adbc8 |
Include the files in the SOURCE directory into the
|
|
Harald Hoyer |
6adbc8 |
Target directory in the final initramfs.
|
|
Harald Hoyer |
6adbc8 |
@@ -207,6 +211,8 @@ while (($# > 0)); do
|
|
Harald Hoyer |
6adbc8 |
-I|--install) push_arg install_items_l "$@" || shift;;
|
|
Harald Hoyer |
6adbc8 |
--fwdir) push_arg fw_dir_l "$@" || shift;;
|
|
Harald Hoyer |
6adbc8 |
--fscks) push_arg fscks_l "$@" || shift;;
|
|
Harald Hoyer |
6adbc8 |
+ --add-fstab) push_arg add_fstab_l "$@" || shift;;
|
|
Harald Hoyer |
6adbc8 |
+ --mount) push_arg fstab_lines "$@" || shift;;
|
|
Harald Hoyer |
6adbc8 |
--nofscks) nofscks_l="yes";;
|
|
Harald Hoyer |
6adbc8 |
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
|
|
Harald Hoyer |
6adbc8 |
-c|--conf) read_arg conffile "$@" || shift;;
|
|
Harald Hoyer |
6adbc8 |
@@ -332,6 +338,18 @@ if (( ${#fscks_l[@]} )); then
|
|
Harald Hoyer |
6adbc8 |
done
|
|
Harald Hoyer |
6adbc8 |
fi
|
|
Harald Hoyer |
6adbc8 |
|
|
Harald Hoyer |
6adbc8 |
+if (( ${#add_fstab_l[@]} )); then
|
|
Harald Hoyer |
6adbc8 |
+ while pop add_fstab_l val; do
|
|
Harald Hoyer |
6adbc8 |
+ add_fstab+=" $val "
|
|
Harald Hoyer |
6adbc8 |
+ done
|
|
Harald Hoyer |
6adbc8 |
+fi
|
|
Harald Hoyer |
6adbc8 |
+
|
|
Harald Hoyer |
6adbc8 |
+if (( ${#fstab_lines_l[@]} )); then
|
|
Harald Hoyer |
6adbc8 |
+ while pop fstab_lines_l val; do
|
|
Harald Hoyer |
6adbc8 |
+ push fstab_lines $val
|
|
Harald Hoyer |
6adbc8 |
+ done
|
|
Harald Hoyer |
6adbc8 |
+fi
|
|
Harald Hoyer |
6adbc8 |
+
|
|
Harald Hoyer |
6adbc8 |
if (( ${#install_items_l[@]} )); then
|
|
Harald Hoyer |
6adbc8 |
while pop install_items_l val; do
|
|
Harald Hoyer |
6adbc8 |
push install_items $val
|
|
Harald Hoyer |
6adbc8 |
@@ -526,6 +544,21 @@ if [[ $hostonly ]]; then
|
|
Harald Hoyer |
6adbc8 |
return 1
|
|
Harald Hoyer |
6adbc8 |
)
|
|
Harald Hoyer |
6adbc8 |
|
|
Harald Hoyer |
6adbc8 |
+ for line in "${fstab_lines[@]}"; do
|
|
Harald Hoyer |
6adbc8 |
+ set -- $line
|
|
Harald Hoyer |
6adbc8 |
+ #dev mp fs fsopts
|
|
Harald Hoyer |
6adbc8 |
+ dev="$(get_maj_min $1)"
|
|
Harald Hoyer |
6adbc8 |
+ push host_devs "${dev:-$1}"
|
|
Harald Hoyer |
6adbc8 |
+ push host_fs_types "$dev|$3"
|
|
Harald Hoyer |
6adbc8 |
+ done
|
|
Harald Hoyer |
6adbc8 |
+
|
|
Harald Hoyer |
6adbc8 |
+ for f in $add_fstab; do
|
|
Harald Hoyer |
6adbc8 |
+ [ -e $f ] || continue
|
|
Harald Hoyer |
6adbc8 |
+ while read dev rest; do
|
|
Harald Hoyer |
6adbc8 |
+ push host_devs $dev
|
|
Harald Hoyer |
6adbc8 |
+ done < $f
|
|
Harald Hoyer |
6adbc8 |
+ done
|
|
Harald Hoyer |
6adbc8 |
+
|
|
Harald Hoyer |
6adbc8 |
push host_mp \
|
|
Harald Hoyer |
6adbc8 |
"/" \
|
|
Harald Hoyer |
6adbc8 |
"/etc" \
|
|
Harald Hoyer |
6adbc8 |
@@ -668,6 +701,13 @@ while pop install_items items; do
|
|
Harald Hoyer |
6adbc8 |
done
|
|
Harald Hoyer |
6adbc8 |
unset item
|
|
Harald Hoyer |
6adbc8 |
|
|
Harald Hoyer |
6adbc8 |
+while pop fstab_lines line; do
|
|
Harald Hoyer |
6adbc8 |
+ echo "$line 0 0" >> "${initdir}/etc/fstab"
|
|
Harald Hoyer |
6adbc8 |
+done
|
|
Harald Hoyer |
6adbc8 |
+
|
|
Harald Hoyer |
6adbc8 |
+for f in $add_fstab; do
|
|
Harald Hoyer |
6adbc8 |
+ cat $f >> "${initdir}/etc/fstab"
|
|
Harald Hoyer |
6adbc8 |
+done
|
|
Harald Hoyer |
6adbc8 |
|
|
Harald Hoyer |
6adbc8 |
if [[ $kernel_only != yes ]]; then
|
|
Harald Hoyer |
6adbc8 |
# make sure that library links are correct and up to date
|
|
Harald Hoyer |
6adbc8 |
diff --git a/modules.d/95fstab-sys/mount-sys.sh b/modules.d/95fstab-sys/mount-sys.sh
|
|
Harald Hoyer |
6adbc8 |
index f44351d..a8fbd50 100755
|
|
Harald Hoyer |
6adbc8 |
--- a/modules.d/95fstab-sys/mount-sys.sh
|
|
Harald Hoyer |
6adbc8 |
+++ b/modules.d/95fstab-sys/mount-sys.sh
|
|
Harald Hoyer |
6adbc8 |
@@ -25,6 +25,6 @@ fstab_mount() {
|
|
Harald Hoyer |
6adbc8 |
return 0
|
|
Harald Hoyer |
6adbc8 |
}
|
|
Harald Hoyer |
6adbc8 |
|
|
Harald Hoyer |
6adbc8 |
-for r in $NEWROOT /; do
|
|
Harald Hoyer |
6adbc8 |
- fstab_mount "$r/etc/fstab.sys" && break
|
|
Harald Hoyer |
6adbc8 |
+for r in $NEWROOT/etc/fstab.sys /etc/fstab; do
|
|
Harald Hoyer |
6adbc8 |
+ fstab_mount $r && break
|
|
Harald Hoyer |
6adbc8 |
done
|