From 0d186afccd8ad113f21757642c7903d1956200cd Mon Sep 17 00:00:00 2001 From: Ian Dall <ian@beware.dropbear.id.au> Date: Wed, 22 Sep 2010 16:49:19 +0200 Subject: [PATCH 129/133] 95fstab-sys: mount all /etc/fstab.sys volumes before switch_root A new dracut module to implement fstab.sys handling This module implements fstab.sys handling. This has to happen after the root mount and before the nfsroot-cleanup pre-pivot at least. I've made to happen at the beginning of the pre-pivot scripts, although it should maybe be at the end of the mount scripts. This latter would be harder to do because the actual mount is currently done by 99mount-root.sh and there is no 2 digit integer higher than 99 :-( There are perhaps other ways of achieving this end, such as having the nfsroot-cleanup trawl through the newroot's /etc/fstab and auto-magically figure out if there are any mounts which are pre-requisites for the /var/lib/nfs/rpc_pipefs mount and do them first. Likewise post pivot, /etc/rc.sysinit could figure out of there are any pre-requisite mounts for /var/lib/stateless/{writeable,state} before doing those mounts. In short, make it the responsibility of anything doing a mount to check if there are any pre-requisites in /etc/fstab and mount them first. However, this spreads the changes needed over more places, so I favour the fstab.sys approach. Also, who knows what other uses administartors may have put fstab.sys to? and this undoes a regression caused by the move from mkinitrd to dracut. --- modules.d/95fstab-sys/check | 2 ++ modules.d/95fstab-sys/install | 3 +++ modules.d/95fstab-sys/mount-sys.sh | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 0 deletions(-) create mode 100755 modules.d/95fstab-sys/check create mode 100755 modules.d/95fstab-sys/install create mode 100755 modules.d/95fstab-sys/mount-sys.sh diff --git a/modules.d/95fstab-sys/check b/modules.d/95fstab-sys/check new file mode 100755 index 0000000..f5e2f55 --- /dev/null +++ b/modules.d/95fstab-sys/check @@ -0,0 +1,2 @@ +#!/bin/sh +test -f /etc/fstab.sys diff --git a/modules.d/95fstab-sys/install b/modules.d/95fstab-sys/install new file mode 100755 index 0000000..a42ee25 --- /dev/null +++ b/modules.d/95fstab-sys/install @@ -0,0 +1,3 @@ +#!/bin/sh +dracut_install /etc/fstab.sys +inst_hook pre-pivot 00 "$moddir/mount-sys.sh" diff --git a/modules.d/95fstab-sys/mount-sys.sh b/modules.d/95fstab-sys/mount-sys.sh new file mode 100755 index 0000000..e8260da --- /dev/null +++ b/modules.d/95fstab-sys/mount-sys.sh @@ -0,0 +1,15 @@ +#!/bin/sh +fstab_mount(){ + local dev mp type opts rest + test -e "$1" || return 1 + info "Mounting from $1" + while read dev mp type opts rest; do + [ -z "${dev%%#*}" ]&& continue # Skip comment lines + mount -v -t $type -o $opts $dev $NEWROOT/$mp + done < $1 | vinfo + return 0 +} + +for r in $NEWROOT /; do + fstab_mount "$r/etc/fstab.sys" && break +done -- 1.7.3