summaryrefslogtreecommitdiffstats
path: root/initrd/initrd-stuff/init
diff options
context:
space:
mode:
authorDirk von Suchodoletz2006-04-03 16:52:12 +0200
committerDirk von Suchodoletz2006-04-03 16:52:12 +0200
commit1e83b5df834a2629aaabaee7f21560d9e28bf7d9 (patch)
tree4224605f3e1a447e084d2fec461fefef7f35f935 /initrd/initrd-stuff/init
parentminifix and comment for installer ... (diff)
downloadcore-1e83b5df834a2629aaabaee7f21560d9e28bf7d9.tar.gz
core-1e83b5df834a2629aaabaee7f21560d9e28bf7d9.tar.xz
core-1e83b5df834a2629aaabaee7f21560d9e28bf7d9.zip
added cowdev (for cowloop device activation) to mkdxsinitrd,
generalized nfsmnt function ... git-svn-id: http://svn.openslx.org/svn/openslx/ld4@146 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd/initrd-stuff/init')
-rwxr-xr-xinitrd/initrd-stuff/init47
1 files changed, 29 insertions, 18 deletions
diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init
index 18cc1583..02133c30 100755
--- a/initrd/initrd-stuff/init
+++ b/initrd/initrd-stuff/init
@@ -2,11 +2,11 @@
# Description: main script for new type of initial ramdisk for
# linux diskless clients version 4
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 02-04-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 03-04-2006
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
#
-# Version: 0.2.4a
+# Version: 0.2.4b
# functions common for all distros, messages contains all error and info
# output
@@ -46,11 +46,14 @@ exec < /dev/console > /dev/console 2>&1
preinit
# start device auto discovery service - distro specific function
udev_hotplug
-# read kernel commandline
+# set defaults and create waitfor files
TMPFSSIZE="50%"
+COWSIZE="50%"
+RWDIR=/dev/shm
echo "noldap" > /tmp/ldap-done
echo "nodhcp" > /tmp/dhcp-done
echo "nofile" > /tmp/file-done
+# read kernel commandline
read KCMDLINE < /proc/cmdline
export KCMDLINE
for opts in ${KCMDLINE} ; do
@@ -247,8 +250,28 @@ if [ -n "${NBD}" ] ; then
;;
esac
usleep 20
- mount -n -t $RFST -o ro $RDEV /mnt
+ RWRO="ro"
+ if [ -n "${COWLOOP}" -a -x /bin/cowdev ] ; then
+ modprobe ${MODPRV} cowloop || {
+ error "$init_loadcow" nonfatal
+ COWLOOP=""; }
+ fi
+ if [ -n "${COWLOOP}" ] ; then
+ if [ -n "${UNIONFS}" ] ; then
+ error "$init_cownonbd"
+ UNIONFS="";
+ fi
+ echo "Using Copy-on-Write block device for rw access"
+ mount -n -t tmpfs -o size=${COWSIZE} ramfs ${RWDIR}
+ cowdev -a /dev/nbd0 ${RWDIR}/nbd.cow
+ RWRO="rw"
+ RDEV=/dev/cow/0
+ # run ldconfig if not switched off via kernel command line
+ [ -z "${NOLDSC}" ] && echo $init_ldcfg && ldconfig /etc/ld.so.cache &
+ fi
+ mount -n -t $RFST -o $RWRO $RDEV /mnt
fi
+
# if no type of root filesystem is passed via kernel command line try
# information gathered from dhcp process
if [ -z "${DNBDOPT}" -a -z "${NBDOPT}" -a -z "${NFSROOT}" ] ; then
@@ -262,7 +285,7 @@ if [ -z "${DNBDOPT}" -a -z "${NBDOPT}" -a -z "${NFSROOT}" ] ; then
fi
# call function for nfs mounts
if [ -z "${DNBDOPT}" -a -z "${NBDOPT}" ] ; then
- nfsmnt ${NFSROOT} ${MODPRV}
+ nfsmnt ${NFSROOT}
fi
# get the complete collection of kernel modules available
@@ -272,21 +295,11 @@ mount -n --bind /mnt/lib/modules/${KERNEL} /lib/modules/${KERNEL} || \
hwautocfg &
# try to use unionfs for rw access if available
-RWDIR=/dev/shm
if [ -n "${UNIONFS}" -o -n "${UNION}" ] ; then
modprobe ${MODPRV} unionfs || {
error "$init_loadufs" nonfatal
UNIONFS=""; }
fi
-if [ -n "${COWLOOP}" ] ; then
- modprobe ${MODPRV} cowloop || {
- error "$init_loadcow" nonfatal
- COWLOOP=""; }
- if [ -z "${NBD}" -o -n "${UNIONFS}" ] ; then
- error "$init_cownonbd"
- COWLOOP="";
- fi
-fi
# if additional sources should be used for a combined root filesystem
# probably more sources should be merged into union (${UNION} is defined)
@@ -308,9 +321,7 @@ if [ -n "${UNIONFS}" ] ; then
mount -n --move ${RWDIR}/uniontmp /mnt/uniontmp
# run ldconfig if not switched off via kernel command line
[ -z "${NOLDSC}" ] && echo $init_ldcfg && ldconfig /etc/ld.so.cache &
-elif [ -n "${COWLOOP}" -a -n "${NBD}" ] ; then
- :
-else
+elif [ -z "$COWLOOP" ] ; then
echo "Using bind mounts to ramdisk for rw access"
mount -n -t tmpfs -o size=${TMPFSSIZE} ramfs ${RWDIR}
for path in ${D_BINDMPTS} ; do