summaryrefslogtreecommitdiffstats
path: root/initrd/initrd-stuff
diff options
context:
space:
mode:
authorDirk von Suchodoletz2006-01-20 20:56:11 +0100
committerDirk von Suchodoletz2006-01-20 20:56:11 +0100
commit20dc751c0cc775e6098d9b4d324efa428803047e (patch)
tree18c97cfbb71a47d7270899ec5592dba395fc6df7 /initrd/initrd-stuff
parenteinige fixes - repco funktioniert allerdings noch nicht (diff)
downloadcore-20dc751c0cc775e6098d9b4d324efa428803047e.tar.gz
core-20dc751c0cc775e6098d9b4d324efa428803047e.tar.xz
core-20dc751c0cc775e6098d9b4d324efa428803047e.zip
Heftiges Bugfixing in mkdxsinitrd ... intensiv gecheckt mit SuSE 10.0 -
wieder funktionsfähig. git-svn-id: http://svn.openslx.org/svn/openslx/dxs/ld4@29 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd/initrd-stuff')
-rwxr-xr-xinitrd/initrd-stuff/bin/hwautocfg7
-rwxr-xr-xinitrd/initrd-stuff/bin/servconfig11
-rw-r--r--initrd/initrd-stuff/etc/functions33
-rwxr-xr-xinitrd/initrd-stuff/init72
4 files changed, 87 insertions, 36 deletions
diff --git a/initrd/initrd-stuff/bin/hwautocfg b/initrd/initrd-stuff/bin/hwautocfg
index 8630dfb3..e19f533a 100755
--- a/initrd/initrd-stuff/bin/hwautocfg
+++ b/initrd/initrd-stuff/bin/hwautocfg
@@ -369,7 +369,8 @@ data via dhcp until now ..." nonfatal
waitfor /tmp/ldap-done 10000 || error " Did not get any configuration \
data via ldap until now ..." nonfatal
. /etc/machine-setup
-waitfor /tmp/fscmpl 20000
+# wait for completion of clients root filesystem in /mnt
+waitfor /tmp/fscmpl 40000
# run localizator and configure keyboard and console fonts
DEFKEYTABLE="de-latin1-nodeadkeys"
localization $country
@@ -378,9 +379,9 @@ if [ -z "${KEYTABLE}" ] ; then
'${DEFKEYTABLE}' defined\nin $0."
KEYTABLE=${DEFKEYTABLE}
fi
-echo -e "# entry added by $0: $date" \
+echo -e "\t# entry added by $0: $date" \
>>/mnt/etc/${D_INITDIR}/boot.ld
-echo -e "loadkeys -q ${KEYTABLE}\n" >>/mnt/etc/${D_INITDIR}/boot.ld
+echo -e "\tloadkeys -q ${KEYTABLE}\n" >>/mnt/etc/${D_INITDIR}/boot.ld
[ -n "${CONSOLE_FONT}" ] && consolefont
# run X11 / Xorg configurator
. /etc/sysconfig/xserver >/dev/null 2>&1 || error " The xserver \
diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig
index bff7518e..5f782bc5 100755
--- a/initrd/initrd-stuff/bin/servconfig
+++ b/initrd/initrd-stuff/bin/servconfig
@@ -10,7 +10,7 @@
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
#
-# Version: 0.0.1b
+# Version: 0.0.2a
# check for configuration files to source
@@ -89,11 +89,6 @@ test -n "$domain_name_servers" && {
# delete and create runlevel links for initial booting (SuSE, Debian,
# ...)
case ${DISTRO} in
- suse*)
- ${SUSESPECIFICSUBDIR} = "boot.d/"
- ;;
-esac
-case ${DISTRO} in
suse*|debian*|ubuntu*)
for i in ${D_RCDIRS} ${D_INITBOOTD} ; do
rm -f /mnt/etc/$i/*
@@ -104,8 +99,8 @@ case ${DISTRO} in
for i in boot.ld ${D_INITSCRIPTS}; do
count=`expr $count + 1`
revcnt=`expr 41 - $count`
- ln -sf /etc${D_INITDIR}/$i /mnt/etc/init.d/${SUSESPECIFICSUBDIR}S${count}$i
- ln -sf /etc${D_INITDIR}/$i /mnt/etc/init.d/${SUSESPECIFICSUBDIR}K${revcnt}$i
+ ln -sf /etc${D_INITDIR}/$i /mnt/etc/${D_INITBOOTD}/S${count}$i
+ ln -sf /etc${D_INITDIR}/$i /mnt/etc/${D_INITBOOTD}/K${revcnt}$i
done
;;
gentoo*)
diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions
index e0e3bfbd..9418b637 100644
--- a/initrd/initrd-stuff/etc/functions
+++ b/initrd/initrd-stuff/etc/functions
@@ -1,18 +1,35 @@
+# Description: common function script for the configuration of
+# linux diskless clients (included by init, hwautocfg,
+# servconfig, ... within initial ramdisk)
+#
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 20-01-2006
+# Blabla
+# Blub
+#
+# Copyright: (c) 2006 - RZ Universitaet Freiburg
+#
+# Version: 0.4.1b
+
+
+
#######################################################################
# produce error message and if $2 is empty run (debug) shell
error() {
local message="An error occured during execution of $0 script:\n\n$1\n"
-# check if LOGFILE is already defined
-[ -z "${LOGFILE}" ] && LOGFILE="/dev/null"
# check if LOGFILE is really writeable
-[ -n "${LOGFILE}" ] && [ -w /mnt/${LOGFILE} ] || LOGFILE="/dev/null"
+if [ -n "${LOGFILE}" ] ; then
+ [ "${LOGFILE}" != "/dev/null" ] && \
+ [ -w /mnt/${LOGFILE} ] || LOGFILE="/dev/null"
+else LOGFILE="/dev/null"
+fi
# if nonfatal error else fatal error message and shell
if [ -n "$2" ] ; then
-[ "$DEBUGLEVEL" -ge 1 ] && \
- echo -e "{$message} This error is not fatal - continuing ...\n" \
- >> /mnt/${LOGFILE}
-[ "$DEBUGLEVEL" -gt 1 ] && \
- echo -e "{$message} This error is not fatal - continuing ...\n"
+ [ "$DEBUGLEVEL" -ge 1 ] && \
+ echo -e "$message This error is not fatal - continuing ...\n" \
+ >> ${LOGFILE}
+ [ "$DEBUGLEVEL" -gt 1 ] && \
+ echo -e "$message This error is not fatal - continuing ...\n"
+ [ "$DEBUGLEVEL" -gt 2 ] && usleep 20
else
echo -e "Running shell for debugging purposes now ...\n"
/bin/sh
diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init
index 9247e539..0e3111f6 100755
--- a/initrd/initrd-stuff/init
+++ b/initrd/initrd-stuff/init
@@ -1,6 +1,20 @@
+#!/bin/sh
+# Description: main script for new type of initial ramdisk for
+# linux diskless clients version 4
+#
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 20-01-2006
+# Bla
+# Blub
+#
+# Copyright: (c) 2006 - RZ Universitaet Freiburg
+#
+# Version: 0.2.1a
+
# functions common for all distros
-. /etc/functions || ( echo -e "The functions file contains a lot of script \
-functionality. Without this\ninit script will not run." && exit 1 )
+errmsg="functions file contains a lot of script \
+functionality. Without this\ninit script will not run."
+. /etc/functions || ( echo -e "The main $errmsg" && exit 1 )
+. /etc/distro-functions || ( echo "The distro $errmsg" && exit 1 )
# configuration settings (several file and directory variables)
. /etc/sysconfig/config || ( echo -e " The distribution \
specific configuration file could not be found" && exit 1 )
@@ -81,9 +95,11 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup
UNIONFS=1;;
# dnbd server:port
dnbdroot=*)
- DNBDOPT=${opts#dnbdroot=};;
+ NBD=dnbd # name of kernel module
+ NBDOPT=${opts#dnbdroot=};;
# nbd server:port,filesystem (filesystem is optional)
nbdroot=*)
+ NBD=nbd # name of kernel module
NBDOPT=${opts#nbdroot=};;
# ip configuration client-ip:server-ip:gateway:netmask
ip=*)
@@ -178,23 +194,41 @@ if [ -n "$noipyet" ] ; then
fi
[ -n "$LDAP" ] && ldapconf &
-# if root filesystem should be imported via traditional network block device
-if [ -n "${NBDOPT}" ] ; then
- modprobe ${MODPRV} nbd || error " Failed to load module nbd.ko. It is \
-needed if you intend to use\n network block device (NBD) for the client \
+# if root filesystem should be imported via (d) network block device
+if [ -n "${NBD}" ] ; then
+ modprobe ${MODPRV} ${NBD} || error " Failed to load module ${NBD}.ko. It \
+is needed if you intend to use\n network block device (D)NBD for the client \
as root filesystem."
nbdhost=${NBDOPT%:*}
nbdopt=${NBDOPT#*:}
nbdport=${NBDOPT%,*}
nbdfs=${NBDOPT#*,}
- echo "Diskless client using nbd server $nbdhost:$nbdport,$nbdfs"
- nbd-client $nbdhost $nbdport /dev/nbd0
+ echo "Diskless client using ${NBD} server $nbdhost:$nbdport,$nbdfs"
if [ -z "$nbdfs" ]; then
RFST=ext2;
else
RFST=$nbdfs;
- modprobe ${MODPRV} ${RFST}
+ modprobe ${MODPRV} ${RFST} || error " Failed to load the requested \
+filesystem module for the client root\n filesystem ontop of the (D)NBD."
fi
+ case "${NBD}" in
+ # network block device present in standard kernel
+ nbd)
+ nbd-client $nbdhost $nbdport /dev/nbd0
+ RDEV=/dev/nbd0
+ ;;
+ # dnbd by Thorsten Zitterell
+ dnbd)
+ mkdir /dnbd
+ mount -t tmpfs tmpfs /dnbd
+ while ! dnbd-client -b $dnbdhost -d /dev/dnbd0; do # -c /dnbd/cache
+ usleep 10
+ done
+ echo $?
+ RDEV=/dev/dnbd0
+ usleep 20
+ ;;
+ esac
fi
# if root filesystem should be imported via udp based distributed network
@@ -242,23 +276,27 @@ module\n does not match the running kernel. If you do not want to see this \
UNIONFS=""; }
fi
+# setup of client root filesystem dependent on the availability of UnionFS
+msg="Starting ldconfig - switch it off via kernel cmdline option 'noldsc'"
if [ -n "${UNIONFS}" ] ; then
- echo -n "Using UnionFS for rw access"
+ echo "Using UnionFS for rw access"
mkdir -p ${RWDIR}/union ${RWDIR}/uniontmp
mount -n -t tmpfs none ${RWDIR}/uniontmp
mount -n --move /mnt /root
mount -n -t unionfs -o dirs=${RWDIR}/uniontmp=rw:/root=ro none /mnt
mkdir -p /mnt/uniontmp
mount -n --move ${RWDIR}/uniontmp /mnt/uniontmp
- [ -z "${NOLDSC}" ] && ldconfig /etc/ld.so.cache &
+ # run ldconfig if not switched off via kernel command line
+ [ -z "${NOLDSC}" ] && echo $msg && ldconfig /etc/ld.so.cache &
else
- echo -n "Using bind mounts to ramdisk for rw access"
+ echo "Using bind mounts to ramdisk for rw access"
mount -n -t tmpfs -o size=${TMPFSSIZE} ramfs ${RWDIR}
for path in ${D_BINDMPTS} ; do
mkdir -p ${RWDIR}/${path} >/dev/null 2>&1
mount -n --bind ${RWDIR}/${path} /mnt/${path}
done
- [ -z "${NOLDSC}" ] && ldconfig /tmp/ld.so.cache &
+ # see above ...
+ [ -z "${NOLDSC}" ] && echo $msg && ldconfig /tmp/ld.so.cache &
for path in ${D_RODIRSINRW}; do
if [ -d /mnt/${path} ] ; then
LIST=${path}" "$LIST
@@ -334,9 +372,9 @@ if [ -z "${NOLDSC}" ] ; then
ld.so.cache did not finish in time."
fi
else
- [ "${DEBUGLEVEL}" -gt 0 ] && echo -e "You decided not to recreate \
-/etc/ld.so.cache file. That might cause errors\nif libraries are installed \
-after this file was created on server." >> /mnt/${LOGFILE}
+ error " You decided not to recreate \
+/etc/ld.so.cache file. That might cause errors\n if libraries are installed \
+after this file was created on server." nonfatal
fi
# save machine configuration
cp /etc/machine-setup /mnt/etc