]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fstab-sys: also include the module, if --add-fstab was specified
authorHarald Hoyer <harald@redhat.com>
Thu, 29 Mar 2012 10:54:27 +0000 (12:54 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 29 Mar 2012 10:54:50 +0000 (12:54 +0200)
also fixup the logic what and when to mount.

first initramfs/etc/fstab is mounted

$NEWROOT/etc/fstab.sys takes precendence over initramfs/etc/fstab.sys

dracut.sh
modules.d/95fstab-sys/module-setup.sh
modules.d/95fstab-sys/mount-sys.sh

index d68e563381ee4295061c572911012972b7d6e5c9..ff5079c111c1001abb12be46b8d2e2534965e1f0 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -632,7 +632,7 @@ export initdir dracutbasedir dracutmodules drivers \
     add_drivers omit_drivers mdadmconf lvmconf filesystems \
     use_fstab fstab_lines libdir usrlibdir fscks nofscks \
     stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
-    debug host_fs_types host_devs sshkey
+    debug host_fs_types host_devs sshkey add_fstab
 
 # Create some directory structure first
 [[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
index 0dc12f3e9bf886367dd0ec1b2bf1c2766cbf3784..7589d743d813718bfe4c044b261105b2b8f11ac8 100755 (executable)
@@ -3,7 +3,7 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 check() {
-    test -f /etc/fstab.sys || [[ -n $use_fstab  ||  -n $fstab_lines ]]
+    test -f /etc/fstab.sys || [[ -n $add_fstab  ||  -n $fstab_lines ]]
 }
 
 depends() {
@@ -11,6 +11,6 @@ depends() {
 }
 
 install() {
-    inst /etc/fstab.sys /etc/fstab
+    [ -f /etc/fstab.sys ] && inst /etc/fstab.sys
     inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
 }
index 54415d1c21954e1bc53406b762cab3eae249e067..895eb58ec17a52090f4b664cf21ee32688db5afd 100755 (executable)
@@ -19,13 +19,18 @@ fstab_mount() {
         if [ -d "$NEWROOT/$_mp" ]; then
             mount -v -t $_fs -o $_opts $_dev "$NEWROOT/$_mp" 2>&1 | vinfo
         else
-            mkdir -p "$_mp"
+            [ -d "$_mp" ] || mkdir -p "$_mp"
             mount -v -t $_fs -o $_opts $_dev $_mp 2>&1 | vinfo
         fi
     done < $1
     return 0
 }
 
-for r in $NEWROOT/etc/fstab.sys /etc/fstab; do
-    fstab_mount $r && break
-done
+[ -f /etc/fstab ] && fstab_mount /etc/fstab
+
+# prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
+if [ -f $NEWROOT/etc/fstab.sys ]; then
+    fstab_mount $NEWROOT/etc/fstab.sys
+elif [ -f /etc/fstab.sys ]; then
+    fstab_mount /etc/fstab.sys
+fi