summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk von Suchodoletz2006-10-29 16:56:42 +0100
committerDirk von Suchodoletz2006-10-29 16:56:42 +0100
commit6235099689a961eecf9f72af847c6d5b7c962fd7 (patch)
treeddb25c06fe73e5a9addd0cca623b3549d84f3b6e
parent* improved error-handling in case of problems with the db-backend. (diff)
downloadcore-6235099689a961eecf9f72af847c6d5b7c962fd7.tar.gz
core-6235099689a961eecf9f72af847c6d5b7c962fd7.tar.xz
core-6235099689a961eecf9f72af847c6d5b7c962fd7.zip
Changed init for using a variable @@@serverip@@@ instead of fixed
defined server ip, introduced a function checkip to translate @@@serverip@@@ into the serverip the client determined itself. That helps in more dynamic environments with servers using more than one ip address. Added a special slx specific configuration file read in stage3 - /etc/sysconfig/slxconfig. For the (deprecated) mkdxsinitrd an ugly hack for creating a general slx config file instead of "patching" the stage3 init is implemented ... git-svn-id: http://svn.openslx.org/svn/openslx/trunk@487 95ad53e4-c205-0410-b2fa-d234c58c8868
-rw-r--r--initramfs/initrd-stuff/etc/functions15
-rw-r--r--initramfs/initrd-stuff/etc/messages6
-rwxr-xr-xinitramfs/initrd-stuff/init58
-rwxr-xr-xinitramfs/mkdxsinitrd3
-rwxr-xr-xinitramfs/mkdxsinitrd.64bit3
5 files changed, 51 insertions, 34 deletions
diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions
index 558c7fbb..95de2ac7 100644
--- a/initramfs/initrd-stuff/etc/functions
+++ b/initramfs/initrd-stuff/etc/functions
@@ -274,6 +274,17 @@ case $ipcfg in
esac
}
#######################################################################
+# replace @@@serverip@@@ with real serverip
+checkip ()
+{
+if [ "@@@serverip@@@" = "$1" -a -n "$serverip" ] ; then
+ echo $serverip
+else
+ echo $1
+fi
+}
+
+#######################################################################
# nfs mounter for root filesystem and other sources
nfsmnt ()
{
@@ -557,10 +568,12 @@ waitfor /tmp/file-done 10000 || error "$error_errfcfg" nonfatal
waitfor /tmp/ldap-done 10000 || error "$error_errlcfg" nonfatal
# concat the different files now into the central config file, order
# matters - ldap data has highest priority
-if ! [ -f /tmp/cfgcomplete ] ; then
+if ! test -f /tmp/cfgcomplete ; then
for config in /tmp/confviadhcp /tmp/confviafile /tmp/confvialdap
do test -f $config && cat $config >> /etc/machine-setup
done
+# check if serverip is set as variable @@@serverip@@@
+sed "s,@@@serverip@@@,$serverip," -i /etc/machine-setup
echo "config completed" > /tmp/cfgcomplete
fi
}
diff --git a/initramfs/initrd-stuff/etc/messages b/initramfs/initrd-stuff/etc/messages
index b1338776..2136cc0f 100644
--- a/initramfs/initrd-stuff/etc/messages
+++ b/initramfs/initrd-stuff/etc/messages
@@ -2,7 +2,7 @@
# bootup (within initialramfs) for OpenSLX linux diskless clients version 4
# this file could be used for localization of error messages
#
-# Dirk von Suchodoletz <dvs@openslx.com>, 05-09-2006
+# Dirk von Suchodoletz <dvs@openslx.com>, 29-10-2006
#
# (c) 2006 - RZ Universitaet Freiburg
# (c) 2006 - OpenSLX.org
@@ -12,7 +12,9 @@ init_errmsg="functions file contains a lot of script \
functionality. Without this\ninit script will not run."
init_mff="The main $init_errmsg"
init_dff="The distro $init_errmsg"
-init_dscf="The distribution specific configuration file could not be found"
+init_dscf="The distribution specific configuration file could not be found."
+init_sscf="The slx configuration variables could not be found. Please
+provide the slxconfig file."
init_errip=" Unable to setup at \
least basic functionality, because no IP configuration\n available. You \
might pass that information via kernel command line\n through setting of \
diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init
index 0c08813a..36594f84 100755
--- a/initramfs/initrd-stuff/init
+++ b/initramfs/initrd-stuff/init
@@ -2,27 +2,30 @@
# main script for new type of initial ramdisk for OpenSLX linux diskless
# clients version 4
#
-# Dirk von Suchodoletz <dirk@goe.net>, 15-10-2006
+# Dirk von Suchodoletz <dirk@goe.net>, 29-10-2006
# <mj0@uni-freiburg.de> (xenbr), 27-09-2006
#
# (c) 2006 - RZ Universitaet Freiburg
# (c) 2006 - OpenSLX.ORG project
# functions common for all distros, messages contains all error and info
-# output
+# output (for some reason the error output is not produced properly - crash)
. /etc/messages
-. /etc/functions || ( echo -e $init_mff && exit 1 )
-. /etc/distro-functions || ( echo -e $init_dff && exit 1 )
+. /etc/functions || ( echo -e $init_mff && usleep 10000 )
+. /etc/distro-functions || ( echo -e $init_dff && usleep 10000 )
# configuration settings (several file and directory variables)
-. /etc/sysconfig/config || ( echo -e $init_dscf && exit 1 )
+. /etc/sysconfig/config || ( echo -e $init_dscf && usleep 10000 )
+# configuration settings for slx environment
+. /etc/sysconfig/slxconfig 2>/dev/null || ( echo -e $init_sscf && \
+ usleep 10000 )
export PATH=/bin:/sbin:/usr/bin/:/usr/sbin
-export date="@@@DATE@@@"
+export date="$slxconf_date"
export DEBUGLEVEL=0
-export KERNEL="@@@KERNVER@@@"
-export NWMODULES="@@@NWMODULES@@@"
-export DISTRO="@@@DISTRO@@@"
+export KERNEL="$slxconf_kernver"
+export NWMODULES="$slxconf_listnwmod"
+export DISTRO="$slxconf_distro"
# do not use dnbd cache file
nodnbdcache="yes"
@@ -39,7 +42,6 @@ mkdir -p ${DEVDIR}/.udevdb
# mount the important standard directories
[ ! -f /proc/cpuinfo ] && mount -n -t proc proc /proc
-echo 256 > /proc/sys/kernel/real-root-dev
[ ! -d /sys/class ] && mount -n -t sysfs sysfs /sys
# redirect console (after /dev/console is available, and /dev mounted)
@@ -139,9 +141,9 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup
srvproto=$(uri_token $ROOTFS prot)
case $srvproto in
nfs)
- NFSROOT=$(uri_token $ROOTFS server)":/"$(uri_token $ROOTFS path)
+ nfsroot=$(uri_token $ROOTFS server)":/"$(uri_token $ROOTFS path)
echo -e "\n# nfs root information gotten via kernel command \
-line in $0\nnfsroot=\"${NFSROOT}\"\n" >> /etc/machine-setup
+line in $0\nnfsroot=\"${nfsroot}\"\n" >> /etc/machine-setup
;;
*nbd)
nbdmod=$srvproto
@@ -170,9 +172,9 @@ line in $0\nnfsroot=\"${NFSROOT}\"\n" >> /etc/machine-setup
IPINFO=${opts#ip=};;
# deprecated: nfs server and path (will be removed soon)
nfsroot=*)
- NFSROOT=${opts#nfsroot=}
+ nfsroot=${opts#nfsroot=}
echo -e "\n# nfs root information gotten via kernel command line in $0\n\
-nfsroot=\"${NFSROOT}\"\n" >> /etc/machine-setup
+nfsroot=\"${nfsroot}\"\n" >> /etc/machine-setup
;;
# size of tempfs if not max. 50% of RAM should be used
tmpfssize=*)
@@ -276,6 +278,7 @@ if [ -n "${nbdmod}" ] ; then
# load block device driver if needed
modprobe ${MODPRV} ${nbdmod} || error "$init_errnbd"
[ -z "$nbdrfst" ] && nbdrfst=ext2
+ nbdhost=$(checkip $nbdhost)
echo "Diskless client using ${nbdmod} on $nbdhost:$nbdport with $nbdrfst"
# fixme: check for fs in /proc/filesystems before trying to load the module
modprobe ${MODPRV} ${nbdrfst} || error "$init_errnbd" nonfatal
@@ -295,7 +298,6 @@ if [ -n "${nbdmod}" ] ; then
# dnbd by Thorsten Zitterell
dnbd)
# quickhack
-
if [ -z $nodnbdcache ] ; then # variable not really used yet
mkdir /dnbd
mount -n -o 'size=10%' -t tmpfs tmpfs /dnbd
@@ -345,7 +347,8 @@ if [ -n "${nbdmod}" ] ; then
elif [ -n ${iscsiserver} ] ; then
:
#if [ -n ${iscsitarget} ] ; then
- # echo "InitiatorName=${iscsitarget}">/etc/initiatorname.iscsi
+ # echo "InitiatorName=${iscsitarget}"|sed "s,@@@serverip@@@,$serverip," \
+ # >/etc/initiatorname.iscsi
#else
# discovery
#fi
@@ -357,24 +360,17 @@ fi
# if no type of root filesystem is passed via kernel command line try
# information gathered from dhcp process
-if [ -z "${nbdmod}" -a -z "${nbdhost}" -a -z "${NFSROOT}" ] ; then
- # information has to be read from dhcp configuration
- if [ -z "$noipyet" ] ; then
- waitfor /tmp/dhcp-done 20000
- fi
- waitfor /tmp/ldap-done 20000
- . /etc/machine-setup
- NFSROOT=${serverip}:${root_path}
+if [ -z "${nbdmod}" -a -z "${nbdhost}" -a -z "${nfsroot}" ] ; then
+ # information has to be read from dhcp and ldap configuration
+ cfgcomplete
fi
# call function for nfs mounts
if [ -z "${nbdmod}" -a -z "${nbdserver}" ] ; then
- case "$NFSROOT" in
- # replace '@@@server_ip@@@' with real IP of server:
- *@@@server_ip@@@*)
- NFSROOT=$(echo $NFSROOT | sed s/@@@server_ip@@@/$serverip/)
- ;;
- esac
- nfsmnt ${NFSROOT} || error "$init_nfs"
+ . /etc/machine-setup
+ # check if serverip is set as variable @@@serverip@@@
+ serverip=$(checkip $serverip)
+ nfsroot=${serverip}:${root_path}
+ nfsmnt ${nfsroot} || error "$init_nfs"
fi
# get the complete collection of kernel modules available
diff --git a/initramfs/mkdxsinitrd b/initramfs/mkdxsinitrd
index df701573..6d3dbc60 100755
--- a/initramfs/mkdxsinitrd
+++ b/initramfs/mkdxsinitrd
@@ -171,6 +171,9 @@ else
-e "s,@@@COMETCEXCL@@@,${COMETCEXCL},g" \
-e "s,@@@DATE@@@,${DATE},g;/^#[^!].*/d" \
initrd-stuff/${FILENAME} >> ${INSTDIR}/${FILENAME}
+ # ugly hack for creating a general slx config file instead of "patching"
+ # the stage3 init
+ echo -e "slxconf_date=${DATE}\nslxconf_kernver=${KERNVER}\nslxconf_listnwmod=\"${NWMODULES}\"\nslxconf_distro=${DISTRO}-${DISTRO_VER}" > ${INSTDIR}/etc/sysconfig/slxconfig
[ -x busybox -a "$use_busybox" = 1 ] && sed -e "s,^#!/bin/sh,#!/bin/ash," \
-i ${INSTDIR}/${FILENAME}
fi
diff --git a/initramfs/mkdxsinitrd.64bit b/initramfs/mkdxsinitrd.64bit
index 010657e3..f15bda03 100755
--- a/initramfs/mkdxsinitrd.64bit
+++ b/initramfs/mkdxsinitrd.64bit
@@ -171,6 +171,9 @@ else
-e "s,@@@COMETCEXCL@@@,${COMETCEXCL},g" \
-e "s,@@@DATE@@@,${DATE},g;/^#[^!].*/d" \
initrd-stuff/${FILENAME} >> ${INSTDIR}/${FILENAME}
+# ugly hack for creating a general slx config file instead of "patching"
+ # the stage3 init
+ echo -e "slxconf_date=${DATE}\nslxconf_kernver=${KERNVER}\nslxconf_listnwmod=\"${NWMODULES}\"\nslxconf_distro=${DISTRO}-${DISTRO_VER}" > ${INSTDIR}/etc/sysconfig/slxconfig
[ -x busybox -a "$use_busybox" = 1 ] && sed -e "s,^#!/bin/sh,#!/bin/ash," \
-i ${INSTDIR}/${FILENAME}
fi