summaryrefslogtreecommitdiffstats
path: root/initramfs/stage3-stuff/init
diff options
context:
space:
mode:
authorDirk von Suchodoletz2009-03-10 17:11:41 +0100
committerDirk von Suchodoletz2009-03-10 17:11:41 +0100
commit0f7891a57138fa33aa15e6617d224266f94495e1 (patch)
tree60c5832c4231323deb5315ff7375995fe80ce5f7 /initramfs/stage3-stuff/init
parent* pxe_prefix_ip support (diff)
downloadcore-0f7891a57138fa33aa15e6617d224266f94495e1.tar.gz
core-0f7891a57138fa33aa15e6617d224266f94495e1.tar.xz
core-0f7891a57138fa33aa15e6617d224266f94495e1.zip
Changing the default behaviour of unionfs/aufs usage:
* use aufs/unionfs (in this order) if available * disable the functionality via kernel cmdline with noaufs/nounionfs git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2707 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs/stage3-stuff/init')
-rwxr-xr-xinitramfs/stage3-stuff/init48
1 files changed, 20 insertions, 28 deletions
diff --git a/initramfs/stage3-stuff/init b/initramfs/stage3-stuff/init
index d7866ead..81b4d155 100755
--- a/initramfs/stage3-stuff/init
+++ b/initramfs/stage3-stuff/init
@@ -96,6 +96,8 @@ tmpfssize="$(expr $(grep -i "memtotal" /proc/meminfo | awk '{print $2}') \
cowsize="50%"
rwdir=/dev/shm
nfsro="nfs"
+aufs=1
+unionfs=1
runinithook '00-started'
@@ -198,8 +200,8 @@ in $0\ncountry=\"${COUNTRY}\"" >>/etc/initramfs-setup
ldsc)
ldsc="yes";;
# simple union of base ro rootdir with tempfs on top
- unionfs)
- unionfs=1;;
+ nounionfs)
+ unionfs=0;;
# additional source to unify root filesystem with; the top layer will be
# the tempfs
unionfs=*)
@@ -209,8 +211,8 @@ in $0\ncountry=\"${COUNTRY}\"" >>/etc/initramfs-setup
ldsc="yes"
;;
# same for AUFS; alternative to unionfs
- aufs)
- aufs=1;;
+ noaufs)
+ aufs=0;;
aufs=*)
aufs=1
uniondirs=${opts#aufs=}
@@ -660,8 +662,7 @@ fi
runinithook '35-have-network-root'
# get the complete collection of kernel modules available
-mount -n --bind /mnt/lib/modules/${KERNEL} /lib/modules/${KERNEL} || \
- error "$init_moddir"
+mount -n --bind /mnt/lib/modules /lib/modules || error "$init_moddir"
# start hardware configuration as background process if not a special
# debuglevel (21) is used for the option of manual hwautocfg start
if [ ${DEBUGLEVEL} = 21 ] ; then
@@ -676,29 +677,20 @@ fi
runinithook '40-started-hw-config'
union_type=""
-# try to use unionfs for rw access if available
-if [ -n "${unionfs}" ]; then
- modprobe ${MODPRV} unionfs && union_type="UnionFS"
- if [ -z "$union_type" ]; then
- error "$init_loadufs" nonfatal
- unset unionfs
- # if unionfs is not available, check for aufs and inform user
- modprobe ${MODPRV} -n aufs && error $init_noufs_butaufs
- fi
-fi
# try to use aufs for rw access if available
-if [ -n "${aufs}" ]; then
- modprobe ${MODPRV} aufs && union_type="AUFS"
- if [ -z "$union_type" ]; then
- error "$init_loadaufs" nonfatal
- unset aufs
- # if aufs is not available, check for unionfs and inform user
- modprobe ${MODPRV} -n unionfs && error $init_noaufs_butufs
- fi
+if [ ${aufs} -eq 1 ] && \
+ modprobe ${MODPRV} aufs 2>/dev/null && \
+ lsmod | grep -qe "^aufs" ; then union_type="AUFS"
+elif [ ${unionfs} -eq 1 ] && \
+ modprobe ${MODPRV} unionfs 2>/dev/null && \
+ lsmod | grep -qe "^unionfs" ; then union_type="UnionFS"
+else
+ error "$init_loadaufs" nonfatal
+ unset aufs unionfs
fi
# setup of client root filesystem dependent on the availability of UnionFS
-if [ -n "${unionfs}" -o -n "${aufs}" ] ; then
+if [ -n "${union_type}" ] ; then
echo "Using ${union_type} for rw access"
mkdir -p ${rwdir}/union ${rwdir}/uniontmp /rorootfs
mount -n -t tmpfs none ${rwdir}/uniontmp
@@ -815,7 +807,7 @@ if [ -n "${ldsc}" ] ; then
error "$init_errldcfg"
fi
else
- error "$init_infldcfg" nonfatal
+ [ $DEBUGLEVEL -gt 2 ] && error "$init_infldcfg" nonfatal
fi
runinithook '60-have-servconfig'
@@ -905,7 +897,7 @@ runinithook '90-postinit-done'
# unmount the bind mounted modules directory and nfs /tmp/scratch (if present)
export ticks
for ticks in 0 1 2 5 10 20 30; do
- sleep $ticks && umount -n /lib/modules/${KERNEL} 2>/dev/null && break
+ sleep $ticks && umount -n /lib/modules 2>/dev/null && break
error "$init_wait" nonfatal
done
mount 2>/dev/null | grep -q "/tmp/scratch type nfs" && \
@@ -913,7 +905,7 @@ mount 2>/dev/null | grep -q "/tmp/scratch type nfs" && \
sleep $ticks && umount -n /tmp/scratch 2>/dev/null && break
done
-mount 2>/dev/null | grep -q /lib/modules/${KERNEL} && error "$init_errumnt"
+mount 2>/dev/null | grep -q /lib/modules && error "$init_errumnt"
# check for inittab file (might fail for new style init -> upstart)
test -f /mnt/etc/inittab || test -d /mnt/etc/event.d || error "$init_erritab"
# close runlevel script for stuff to execute during early bootup