summaryrefslogtreecommitdiffstats
path: root/initramfs/stage3-stuff
diff options
context:
space:
mode:
authorOliver Tappe2008-08-20 14:20:07 +0200
committerOliver Tappe2008-08-20 14:20:07 +0200
commit0677328054a51160b79af3fb982b852294c5e175 (patch)
treeeecc8c2a1808aa61296dd50ebceef4b887f9dba4 /initramfs/stage3-stuff
parentThere is no working 64bit version of the old initramfs ... (diff)
downloadcore-0677328054a51160b79af3fb982b852294c5e175.tar.gz
core-0677328054a51160b79af3fb982b852294c5e175.tar.xz
core-0677328054a51160b79af3fb982b852294c5e175.zip
* merged branch 'initramfs-ng' back intro trunk - requires careful testing ...
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2055 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs/stage3-stuff')
-rwxr-xr-xinitramfs/stage3-stuff/bin/dhcpmkconfig31
-rwxr-xr-xinitramfs/stage3-stuff/bin/hwautocfg185
-rwxr-xr-xinitramfs/stage3-stuff/bin/servconfig304
-rw-r--r--initramfs/stage3-stuff/etc/functions941
-rw-r--r--initramfs/stage3-stuff/etc/ldap-functions75
-rw-r--r--initramfs/stage3-stuff/etc/messages205
-rw-r--r--initramfs/stage3-stuff/etc/messages.de216
-rwxr-xr-xinitramfs/stage3-stuff/init916
8 files changed, 2873 insertions, 0 deletions
diff --git a/initramfs/stage3-stuff/bin/dhcpmkconfig b/initramfs/stage3-stuff/bin/dhcpmkconfig
new file mode 100755
index 00000000..66f16371
--- /dev/null
+++ b/initramfs/stage3-stuff/bin/dhcpmkconfig
@@ -0,0 +1,31 @@
+#!/bin/ash
+# Copyright (c) 2003..2006 - RZ Uni Freiburg
+# Copyright (c) 2006..2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found under http://openslx.org
+#
+# Universal (distro independent) IP configuration writer for busybox udhcpc
+# applet used within OpenSLX initramfs. The result is written to the
+# /etc/initramfs-setup file
+
+# heavy debugging output in level 3 and above ... and on 13
+#FIXME: DEBUGLEVEL is not propagated to this file (at least for Ubuntu)
+[ -z "$DEBUGLEVEL" ] && DEBUGLEVEL=0
+[ $DEBUGLEVEL -gt 3 -a $DEBUGLEVEL -lt 8 -o $DEBUGLEVEL -eq 13 ] && \
+ set -x
+
+echo -e "# network configuration written by $0:" >/tmp/confviadhcp
+unset infomsg HOME IFS mask lease interface cfgmsg cfgfile DEBUGLEVEL
+set | sed \
+ -e "s,^P.*,,;s,ntpsrv,ntp_servers,;s,ip,clientip," \
+ -e "s,serverid,serverip,;s,subnet,subnet_mask," \
+ -e "s,router,gateway,;s,hostname,host_name," \
+ -e "s,domain,domain_name,;s,dns,domain_name_servers," \
+ -e "s,broadcast,broadcast_address,;s,dhc.*,,;/^$/d" \
+ -e "/OPTIND.*/d" >>/tmp/confviadhcp
diff --git a/initramfs/stage3-stuff/bin/hwautocfg b/initramfs/stage3-stuff/bin/hwautocfg
new file mode 100755
index 00000000..c83f17ac
--- /dev/null
+++ b/initramfs/stage3-stuff/bin/hwautocfg
@@ -0,0 +1,185 @@
+#!/bin/ash
+# Copyright (c) 2003..2006 - RZ Uni Freiburg
+# Copyright (c) 2006..2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found under http://openslx.org
+#
+# Universal (distro independent) hardware autoconfiguration script for
+# OpenSLX linux stateless clients, using SuSE hwinfo for configuration
+
+#############################################################################
+# pre part, load USB modules and start hardware detection pci
+base () {
+# avoid annoying error messages because of missing scripts
+for tool in /usr/sbin/acpidump \
+ /usr/bin/udevinfo \
+ /sbin/dmraid ; do
+ testmkd ${tool%/*}
+ echo -e "#!/bin/ash" >${tool}
+ chmod u+x ${tool}
+done
+# no kernel messages
+echo "0 0 0 0" >/proc/sys/kernel/printk
+modprobe ${MODPRV} usbhid &
+nwcardlist=$(echo ${slxconf_listnwmod}|sed "s/\ /|/g")
+hwinfo --netcard --usb-ctrl | grep modprobe | grep -E "$nwcardlist|hcd" | \
+ grep -v ehci | sed 's/.* Cmd: "//;s/"//' | sort -u >/etc/modprobe.base
+ash /etc/modprobe.base; mdev -s
+# optimization possible: exclude network and usb base drivers from the
+# following list (bios detection for non-hwautocfg component)
+( hwinfo --pci >/etc/hwinfo.data; hwinfo --bios >/etc/hwinfo.bios ) &
+return 0
+}
+
+#############################################################################
+# main part
+hwmain () {
+# activate the previously detected devices
+[ $DEBUGLEVEL -ge 2 ] || modloadbg=" >/dev/null 2>\&1"
+sed '/Driver Info #1/,/Config Status:/d' \
+ /etc/hwinfo.data | grep modprobe | sed "s|.* Cmd: \"||;s|\"|$modloadbg|" \
+ | sort -u >/etc/modprobe.pci
+ash /etc/modprobe.pci
+mdev -s
+
+# bluetooth setup (start it later if present, depends on firmware availa-
+# bility, interpreted by servconfig)
+#( hwinfo --bluetooth >/etc/hwinfo.bt ) &
+
+# load harddisk driver and check for harddisk
+( grep -q -E "IDE|SCSI" /etc/hwinfo.data && modprobe ${MODPRV} sd_mod
+ hwinfo --disk | sed -n "/Device File: /p" | sed "s|.*Device File: /dev/||" \
+ >/etc/hwinfo.disk; ) &
+[ $DEBUGLEVEL -eq 21 ] && echo "** finished 2nd hwdetection at $(sysup)"
+
+# load disk/optical high level drivers
+modprobe ${MODPRV} ide-cd
+modprobe ${MODPRV} sr_mod
+modprobe ${MODPRV} ide-floppy
+mdev -s
+
+# load kernel module for ps2 mice and map the mousehandler to /dev/input/mice
+( [ -f /lib/modules/${KERNEL}/kernel/drivers/input/mouse/psmouse.ko ] && \
+ modprobe ${MODPRV} psmouse
+ [ -f /lib/modules/${KERNEL}/kernel/drivers/input/mousedev.ko ] && \
+ modprobe ${MODPRV} mousedev
+ testmkd /dev/input
+ mknod /dev/input/mice c 13 63 2>/dev/null
+ hwinfo --mouse >/etc/hwinfo.mouse ) &
+
+# complete the audio configuration and load the dummy module if no audio
+# hardware is present in the machine
+grep -q -E "Audio|sound" /etc/hwinfo.data || modprobe snd-dummy
+modprobe ${MODPRV} snd-pcm-oss
+modprobe ${MODPRV} snd-mixer-oss
+
+[ $DEBUGLEVEL -eq 21 ] && echo "** finished most of module loading at $(sysup)"
+
+# get idea of availabe harddisk partitions, put swap partitions into
+# (/mnt)/etc/fstab and format and mount partitions of type 44 (unknown)
+[ $DEBUGLEVEL -eq 21 ] && echo "** starting hdd stuff at $(sysup)"
+waitfor /etc/hwinfo.disk 10000
+if [ -s /etc/hwinfo.disk ] ; then
+for hd in $(cat /etc/hwinfo.disk) ; do
+ fdisk -l /dev/$hd|sed -n "/^\/dev\//p" >/etc/disk.partition
+ for hdpartnr in $(cat /etc/disk.partition | \
+ sed -n -e "/ 82 /p"|sed -e "s/[[:space:]].*//") ; do
+ echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >>/tmp/fstab
+ done
+ # we use special non assigned partition type (id44) for harddisk scratch
+ # space, thus no normal filesystem will be incidentally deleted or
+ # corrupted
+ for hdpartnr in $(cat /etc/disk.partition | \
+ sed -n -e "/ 44 /p"|sed -e "s/[[:space:]].*//") ; do
+ # check for supported filesystem and formatter
+ ( if diskfm $hdpartnr ; then
+ echo "$hdpartnr is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready
+ echo -e "$hdpartnr\t/tmp\t\tauto\t\tdefaults\t 0 0" >>/tmp/fstab
+ else
+ echo "formatting failed for some reason ($(sysup))" >/tmp/tmpready
+ fi ) &
+ part44=yes
+ break
+ done
+ # put detected linux partitions into /etc/fstab with "noauto"
+ for hdpartnr in $(cat /etc/disk.partition | \
+ sed -n -e "/ 83 /p"|sed -e "s/[[:space:]].*//") ; do
+ mkdir -p /mnt/media/${hdpartnr#/dev/*} 2>/dev/null
+ echo -e "$hdpartnr\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto,\
+noexec\t 0 0" >>/tmp/fstab
+ done
+done
+# determine if tmp preparation should wait for format/mount or not
+[ -z "$part44" ] && echo "finished at $(sysup)" >/tmp/tmpready
+else
+ echo "no disk found ( $(sysup) )" >/tmp/tmpready
+fi
+[ $DEBUGLEVEL -eq 21 ] && echo "** finished hdd stuff at $(sysup)"
+
+# scanner setup (fixme: to be checked)
+hwinfo --scanner >/etc/hwinfo.scanner
+[ -f /tmp/scanner-udev ] && cat /tmp/scanner-udev \
+ >>/mnt/etc/udev/rules.d/04-scanner.rules
+
+# if any new device appeared up to now
+mdev -s
+return 0
+}
+
+#############################################################################
+# cleanup/finishing part
+finish () {
+# remove unneeded disk and mouse drivers
+[ ! -s /etc/hwinfo.disk ] && rmmod sd_mod 2>/dev/null
+grep -q -i "/dev/psaux" || rmmod psmouse 2>/dev/null
+# more sophistication possible :)
+return 0
+}
+
+#############################################################################
+# main script starts here
+
+# functions common for all distros
+. /etc/functions
+# functions common for all distros, messages contains all error and
+# info output
+. /etc/messages
+# load distro specific configuration variables and functions. distro
+# specific functions may overwrite functions defined in /etc/functions
+. /etc/distro-functions
+# source general slx settings
+. /etc/slxsystem.conf
+
+# script run timer
+[ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 21 ] && \
+ echo "** HW $1 setup started at $(sysup)"
+
+# heavy debugging output in level 3 and above and specific for 11
+[ $DEBUGLEVEL -gt 3 -a $DEBUGLEVEL -lt 8 -o $DEBUGLEVEL -eq 11 ] && \
+ set -x
+
+case $1 in
+ # pre initialization: loading USB base and network adaptor modules,
+ # detection of other pci bus modules
+ base)
+ base
+ ;;
+ # main part of hardware setup including Xorg
+ main)
+ hwmain
+ # main script run timer or debug information
+ [ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 21 ] && \
+ echo "** HW setup finished at $(sysup)"
+ echo "hwsetup finished at $(sysup)" >/tmp/hwcfg
+ ;;
+ # remove unneeded kernel modules
+ finish)
+ finish
+ ;;
+esac
diff --git a/initramfs/stage3-stuff/bin/servconfig b/initramfs/stage3-stuff/bin/servconfig
new file mode 100755
index 00000000..6885e687
--- /dev/null
+++ b/initramfs/stage3-stuff/bin/servconfig
@@ -0,0 +1,304 @@
+#!/bin/ash
+# Copyright (c) 2003..2006 - RZ Uni Freiburg
+# Copyright (c) 2006..2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found under http://openslx.org
+#
+# universal (distro independent) configuration script for OpenSLX linux
+# diskless clients (executed in stage3 within initial ramfs). The file-
+# system setup is completed when servconfig starts
+
+#############################################################################
+# check for configuration files to source
+
+# functions common for all distros, messages contains all error and
+# info output
+. /etc/messages
+. /etc/functions
+# load distro specific configuration functions. Distro specific functions may
+# overwrite functions defined in /etc/functions
+. /etc/distro-functions
+. /etc/slxsystem.conf
+
+# script run timer
+[ $DEBUGLEVEL -eq 8 ] && echo "** SW setup started at $(sysup)"
+
+# heavy debugging output in level 3 and below 8 ...
+[ $DEBUGLEVEL -gt 3 -a $DEBUGLEVEL -lt 8 -o $DEBUGLEVEL -eq 12 ] && \
+ set -x
+
+#############################################################################
+# read and unify configuration options - default configuration file, from
+# dhcp, ldap ...
+# wait for the appearance of configuration from several sources
+cfgcomplete
+. /etc/initramfs-setup
+[ $DEBUGLEVEL -eq 8 ] && echo "** Config info is complete at $(sysup)"
+
+# copy additional configuration and var files and directories
+# admins can place there files in /var/lib/openslx/config/...
+# to be packed during stage2 into (/srv/dxs)/tftpboot/client-config...)
+cp -a /rootfs/* /mnt 2>/dev/null
+
+# copy passwd file for temporarily (within stage3 configuration) use by chown
+cp /mnt/etc/passwd /etc
+
+# set greeting and add information on booted system
+len=$(expr length ${SLXVERSION}${SYSTEM_NAME})
+if [ $len -le 28 ] ; then
+ vdstr="Stateless Workstation (V${SLXVERSION}/${SYSTEM_NAME})"
+ smax=28
+else
+ vdstr="V${SLXVERSION}/${SYSTEM_NAME}"
+ smax=52
+fi
+while [ $len -le $smax ] ; do
+ vdstr="$vdstr "
+ len=$(($len + 1))
+done
+len=$(expr length ${host_name})
+while [ $len -le 30 ] ; do
+ space="$space "
+ len=$(($len + 1))
+done
+echo "
+ WELCOME TO $space \n (\l)
+ _____ ______ ______ __ __ _______ __ __ __
+ / _ | _ | ___| | | | | ____| | | | | |
+ | | | | |_| | |_ | | | | |___ | | / /
+ | | | | ___/| _| | | ____ | | | |
+ | |_| | | | |___| | | | ____| | |___ / /
+ _____/|__| |______|__| |__| |_______|______|__| |__|
+
+ $vdstr (c) <OpenSLX.ORG>
+" >/mnt/etc/issue
+
+#############################################################################
+# set localization and add entries to initialize keytable and consolefont to
+# boot.slx
+if [ -z "${country}" ] ; then
+ error "$scfg_country" nonfatal
+ country="us"
+fi
+# do localization (this functions starts a distro specific setup)
+localization "${country}"
+
+#############################################################################
+# setup passwd and shadow for local system users like root, bin, daemon and
+# nobody if no user/admin provided passwd exists ... fixme: see #206
+basepasswd $(sed "/+::0/d;s/root://;s/:.*//" /rootfs/etc/shadow)
+
+#############################################################################
+# dns and ip configuration
+# hostname of the machine
+echo "$host_name" >/proc/sys/kernel/hostname
+echo -e "# /etc/hosts - file generated by $0 during OpenSLX stage3\
+\n#\n# IP-Address Full-Qualified-Hostname Short-Hostname\n#\n\
+127.0.0.1\tlocalhost\n::1\t\tlocalhost ipv6-localhost ipv6-loopback\n\
+fe00::0\t\tipv6-localnet\nff00::0\t\tipv6-mcastprefix\nff02::1\
+\t\tipv6-allnodes\nff02::2\t\tipv6-allrouters\nff02::3\t\t\
+ipv6-allhosts\n" >/mnt/etc/hosts
+if [ -n "$domain_name" ]; then
+ echo -en "$clientip\t" >>/mnt/etc/hosts
+ for name in $domain_name; do
+ echo -en "$host_name.$name " >>/mnt/etc/hosts
+ done
+ echo -e "$host_name" >>/mnt/etc/hosts
+else
+ echo -e "$clientip\t$host_name" >>/mnt/etc/hosts
+fi
+# set up domainname and resolving
+rm -rf /mnt/etc/resolv.conf
+test -n "$domain_name" && \
+ echo -e "# /etc/resolv.conf - file generated by\n#\t$0:\n\
+#\t$date\n#options timeout:1 attempts:1 rotate\n\
+search "$domain_name >/mnt/etc/resolv.conf
+test -n "$domain_name_servers" && {
+ for name in $domain_name_servers; do
+ echo nameserver $name >>/mnt/etc/resolv.conf;
+ done; }
+
+#############################################################################
+# run distro specific configuration function
+config_distro
+
+#############################################################################
+# basic (non network) services
+
+# at daemon - calling distro specific function config_atd
+config_atd
+
+# configuration of cron services - calling distro specific function
+# config_cron (runlevel links, directories, ...)
+config_cron
+[ "x$crontab_entries" != "x" ] && \
+ echo -e "$crontab_entries" >> /mnt/etc/crontab
+
+# setup system log services - distro dependent function config_syslog
+config_syslog
+
+# acpi and powersave - distro dependent function config_acpi, these daemons
+# might require dbus
+config_acpi
+
+# configure dbus - distro dependent function config_dreshal - handle
+# all stuff regarding dependent services like dbus, resmgr, hal ...
+# (check for runlevel scripts, passwd entries, directories ...)
+config_dreshal
+
+# configure automounter (should be moved to plugin)
+if [ "x$automnt" != "xno" ] ; then
+ # check if there is some user provided configuration (only auto.master is
+ # important) and skip automatic setup
+ if [ ! -f /rootfs/etc/auto.master ] ; then
+ if [ -d /mnt/misc ] ; then
+ echo -e "# /etc/auto.master - file generated by $0:\n\
+/misc\t/etc/auto.misc" >/mnt/etc/auto.master
+ echo -e "# /etc/auto.misc - file generated by $0:" >/mnt/etc/auto.misc
+ else
+ echo -e "# /etc/auto.master - file generated by $0:\n\
+/misc\t#/etc/auto.misc" >/mnt/etc/auto.master
+ echo -e "# /etc/auto.misc - file generated by $0:\nautomount for \
+removable devices is mostly deprecated, so /misc is not\nactivated in \
+auto.master." >/mnt/etc/auto.misc
+ fi
+ if [ -n "${automnt_src}" ] ; then
+ # local directory and home directory server from initialramfs-setup
+ [ -z "${automnt_dir}" ] && automnt_dir="/home"
+ # remove leading and trailing slash
+ automnt_dir=${automnt_dir#/}
+ automnt_dir=${automnt_dir%/}
+ test -d /${automnt_dir} || error "$scfg_erradir" nonfatal
+ strinstr "/" ${automnt_dir} && error "$scfg_erratpld" nonfatal
+ amserv=$(uri_token $automnt_src server)
+ ampath=$(uri_token $automnt_src path)
+ echo -e "/${automnt_dir}\t/etc/auto.${automnt_dir}\n" \
+ >> /mnt/etc/auto.master
+ echo -e "# /etc/auto.${automnt_dir} created by $0:\n" \
+ > /mnt/etc/auto.${automnt_dir}
+ echo -e "*\t-rsize=32768,wsize=32768,rw\t${amserv}:${ampath}/&" \
+ >> /mnt/etc/auto.${automnt_dir}
+ # no tempfs needed if automounter operates on /home
+ [ "${automnt_dir}" = "home" ] && umount -t tmpfs /mnt/home 2>/dev/null
+ # portmapper is needed for remote NFS sources and local nfs directories
+ testmkd /mnt/var/lib/nfs/state
+ config_portmap
+ fi
+ fi
+ config_automount
+fi
+
+# configure print services / start requested printer daemon
+config_printer
+
+# configure bluetooth services
+#[ -s /etc/hwinfo.bt ] if existance of bt devices should play any role
+config_bt
+
+#############################################################################
+# network(ed) services
+
+# network time service (ntp) configuration file
+if [ -n "$ntp_servers" -a ! -f /rootfs/etc/ntp.conf ]; then
+ echo -e "# /etc/ntp.conf - file generated by $0: \
+$date\n" >/mnt/etc/ntp.conf
+ for name in $ntp_servers; do
+ echo server $name >>/mnt/etc/ntp.conf
+ done
+fi
+# copy timezone file defined with language settings
+[ -z "$TZ" ] && TZ="$timezone"
+ln -snf /usr/share/zoneinfo/${TZ} /mnt/etc/localtime || \
+ error "$scfg_ntptz" nonfatal
+config_ntp
+
+# secure shell server - at the moment all clients share one "secret"
+# key or the key has to be regenerated on every bootup or fetched on
+# every bootup from somewhere
+config_sshd
+
+# simple network management protocol agent
+config_snmp
+
+# setup afs client stuff
+config_afs
+
+# setup nfsv4/krb stuff
+config_nfsv4
+
+# configure samba service
+config_samba
+
+#############################################################################
+# NIS
+# setup nis configuration if needed
+if [ "x$nis_domain" != "x" ] && [ "x$nis_servers" != "x" ] ; then
+ echo $nis_domain >/mnt/etc/defaultdomain
+ echo -e "# /etc/yp.conf - file generated by $0:\n#\t\
+$date\n\nypserver "$nis_servers >/mnt/etc/yp.conf
+ config_nis
+fi
+
+#############################################################################
+# name service caching daemon if networked user database
+config_nscd
+
+#############################################################################
+# preparation of /tmp directory (partition 44, nfs scratch, ramdisk). there
+# might be the chance that we have a disk partition available, so wait for
+# completion of detection, setup process
+[ $DEBUGLEVEL -eq 8 ] && echo "** Waiting for /tmp completion at $(sysup)"
+waitfor /tmp/tmpready 40000
+[ $DEBUGLEVEL -eq 8 ] && echo "** Setup of /tmp completed at $(sysup)"
+# create some directories and correct permissions
+tmpisdisk=$(sed -n '/\/tmp/p' /tmp/fstab 2>/dev/null)
+# if there is no local disk partition for /tmp then try to mount a rw
+# scratch space (if defined in $scratch) and prepared on server
+if [ -n "$scratch" -a -z "$tmpisdisk" ] ; then
+ scrproto=$(uri_token $FILESRC prot)
+ scrpath=$(uri_token $FILESRC path)
+ testmkd /tmp/scratch
+ # exports have to be per client!!
+ case "$scrproto" in
+ nbd)
+ :
+ ;;
+ *)
+ tmpserv=$(uri_token $scratch server)
+ tmppath=$(uri_token $scratch path)
+ # check that nfs is available
+ nfsmod
+ # hanging mount processes might stop further setup - timeout
+ # should be configured ... it is possible to mount "nolock" only
+ mount -t nfs -o rw,tcp,nolock,intr,nodev,soft,timeo=2,nosuid \
+ ${tmpserv}:${tmppath} /tmp/scratch >/dev/null 2>&1 && {
+ testmkd /tmp/scratch/${clientip}
+ umount /tmp/scratch
+ # no need for tempfs there ...
+ umount /mnt/tmp >/dev/null 2>&1
+ mount -t nfs -o rw,tcp,nolock,intr,nodev,soft,timeo=2,nosuid \
+ ${tmpserv}:${tmppath}/${clientip} /mnt/tmp >/dev/null 2>&1
+ # somehow we need to move it to the vmware plugin. Any ideas
+ # how to handle the dependencies?
+ # create an empty container file for vmware *.vmem, it does not
+ # like to live on NFS exports
+ if [ "x$vmware" != "x" -a "x$vmware" != "xno" ] ; then
+ dd if=/dev/zero of=/mnt/tmp/vm-container count=1 seek=2048000
+ diskfm /mnt/tmp/vm-container /mnt/tmp/vmware
+ chmod a+rwxt /mnt/tmp/vmware
+ fi; }
+ ;;
+ esac
+fi
+
+# script run timer
+[ $DEBUGLEVEL -eq 8 ] && echo "** SW setup finished at $(sysup)"
+
+# servconfig finished successfully
+echo "servconfig finished at $(sysup)" > /tmp/svcfg
diff --git a/initramfs/stage3-stuff/etc/functions b/initramfs/stage3-stuff/etc/functions
new file mode 100644
index 00000000..c5c0dc1a
--- /dev/null
+++ b/initramfs/stage3-stuff/etc/functions
@@ -0,0 +1,941 @@
+# Copyright (c) 2003..2006 - RZ Uni Freiburg
+# Copyright (c) 2006..2008 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Common functions file for the configuration of linux diskless clients
+# (included by init, hwautocfg, servconfig, ... within OpenSLX initialramfs)
+
+#############################################################################
+# set of empty dummy functions (loaded before real functions in the
+# distro specific files - to have no undeclared function in init, serv-
+# config, hwautocfg, ...)
+
+# distro specific funtion called at the beginning of init script
+preinit () {
+:
+}
+# distro specific funtion called at the end of init script
+postinit () {
+:
+}
+# distro specific general function called from servconfig script
+config_distro () {
+:
+}
+
+#############################################################################
+# produce error message and if $2 is empty run (debug) shell
+error () {
+local e_msg="$1"
+# set LOGFILE if not defined
+[ -z "${LOGFILE}" ] && LOGFILE="/dev/null"
+# if nonfatal error else fatal error message and shell
+if [ -n "$2" ] ; then
+ [ "$DEBUGLEVEL" -ge 1 -a "$DEBUGLEVEL" != 8 ] && \
+ echo -e "${error_msg}${e_msg}${error_nfe}" >> ${LOGFILE}
+ [ "$DEBUGLEVEL" -gt 1 -a "$DEBUGLEVEL" != 8 ] && \
+ echo -e "${error_msg}${e_msg}${error_nfe}"
+ [ "$DEBUGLEVEL" -gt 2 -a "$DEBUGLEVEL" != 8 ] && usleep 10
+else
+ echo -e "${error_msg}${e_msg}${error_shell}"
+ /bin/ash
+ echo -n "Reboot now? [y] (nothing happens here at the moment)"
+ exec < /dev/console > /dev/console
+ #input="y"
+ #read input
+ #[ -z "$input" -o "$input" = "y" -o "$input" = "Y" ] && {
+ # sleep 4
+ # [ -f /proc/sysrq-trigger ] || mount -t proc none /proc
+ # echo "b" > /proc/sysrq-trigger
+ #}
+fi
+}
+#############################################################################
+# system uptime for performance analysis
+sysup () {
+uptime=$(sed -e "s, .*,," /proc/uptime)
+echo "${uptime} s."
+# if start times are kept, a summary of runtimes would be possible too
+}
+#############################################################################
+# (re)generate dynamic linked libraries cache from /etc/ld.so.conf
+ldcfg () {
+[ -n "${ldsc}" ] && echo -e "$init_ldcfg" && ldconfig /tmp/ld.so.cache &
+}
+#############################################################################
+# URI interpreter $1 variable to interprete, $2 type of token to return
+# prot: tftp, http, nbd, ... server: IP or FQDN
+uri_token () {
+local var=$1
+local prot
+local rest
+local server
+local path
+local port
+local tmpval
+local query=""
+# first check if URI starts with prot:// - URI scheme
+if strinstr "://" "$1" ; then
+ prot=${var%://*}
+ rest=${var#*://}
+else
+ rest="$var"
+ prot=""
+fi
+# get the server IP or name and port - URI authority
+# you get the path or other token without leading "/" - add it later if
+# needed (fixme: port might be broken)
+if strinstr ":" "$rest" ; then
+ server="${rest%:*}"
+ rest="${rest#*:}"
+ path="${rest#*/}"
+ port="${rest%/$path}"
+else
+ tmpval=$rest
+ rest="${rest#*/}"
+ server="$(echo $tmpval|sed 's,/.*,,')"
+ path="${tmpval#${server}}"
+ port=""
+fi
+# get path and query components - URI path, query
+if strinstr "\?" "$rest" ; then
+ path="${path%\?*}"
+ query="${rest#*\?}"
+fi
+# return the requested token
+case "$2" in
+ prot) echo "$prot" ;;
+ server) echo "$server" ;;
+ path) echo "$path" ;;
+ port) echo "$port" ;;
+ query) echo "$query" ;;
+esac
+}
+#############################################################################
+# load the kernel nfs module if not compiled in
+nfsmod () {
+cat /proc/filesystems | grep -q -E "[[:space:]]nfs" || \
+ { modprobe ${MODPRV} nfs 2>/dev/null || error "$error_nfsmod" nonfatal; }
+}
+#############################################################################
+# configure Xen bridge xenbr0
+xenbr_config () {
+modprobe ${MODPRV} netloop
+local ipls
+local vifnum="0"
+local bridge="xenbr${vifnum}"
+local netdev="eth${vifnum}"
+local pdev="p${netdev}"
+local vdev="veth${vifnum}"
+local vif0="vif0.${vifnum}"
+# fixme: that is the mac address of main ethernet device
+local mac=$macaddr
+
+brctl addbr ${bridge}
+brctl stp ${bridge} off
+brctl setfd ${bridge} 0
+brctl addif ${bridge} ${vif0}
+for ipls in "${netdev} name ${pdev}" "${vdev} name ${netdev}" \
+ "${pdev} down arp off" "${pdev} addr fe:ff:ff:ff:ff:ff" \
+ "${netdev} addr ${mac} arp on" "${netdev} addr ${mac} arp on" \
+ "${bridge} up" "${vif0} up" "${pdev} up" ; do
+ ip link set ${ipls}
+done
+brctl addif ${bridge} ${pdev}
+}
+#############################################################################
+# replace @@@serverip@@@ with real serverip. Allows the usage of a variable
+# for the server ip address (e.g. in machine-setup or kernel commandline)
+checkip ()
+{
+if [ "@@@serverip@@@" = "$1" -a -n "$serverip" ] ; then
+ echo $serverip
+else
+ echo $1
+fi
+}
+#############################################################################
+# definition of wlan interface name and wireless connect
+wlanlinksetup () {
+local wlanif=$(iwconfig 2>/dev/null|sed -n "/ESSID:/p"|sed "s/ .*//")
+if [ -n "$if" ] ; then
+ ip link set dev ${wlanif} up
+ if iwconfig ${wlanif} mode managed essid "${essid}"; then
+ nwif=${wlanif}
+ else
+ error "$init_nowlan"
+ fi
+else
+ error "$init_nowlan"
+fi
+}
+#############################################################################
+# replacement for which command to find executables inside stage4 rootfs
+binfinder()
+{
+local program="$1"
+local s4path
+local notfound=1
+for s4path in bin sbin usr/bin usr/sbin usr/local/bin \
+ usr/local/sbin usr/bin/X11; do
+ if [ -f "/mnt/$s4path/$program" ] && \
+ [ -x "/mnt/$s4path/$program" ]; then
+ printf '%s\n' "/$s4path/$program"
+ notfound=0
+ break
+ fi
+done
+return $notfound
+}
+#############################################################################
+# disk formatter and mounter. some proper error message output should be
+# added. It uses programs invoked from stage 4 root filesystem. First
+# argument is blockdev or file to be formatted, second mountpoint if not
+# /mnt/tmp (default)
+diskfm () {
+local target=$1
+local mntpnt=$2
+local fs
+local path
+for fs in xfs ext2 reiserfs ; do
+ if strinfile "$fs" /proc/filesystems || modprobe ${MODPRV} $fs ; then
+ unset $found
+ for path in /sbin /bin /usr/sbin /usr/bin ; do
+ if test -x /mnt/$path/mkfs.$fs ; then
+ found=yes
+ case mkfs.$fs in
+ mkfs.xfs)
+ fopt="-f"
+ mopt="-o noexec"
+ ;;
+ mkfs.ext2)
+ fopt="-Fq"
+ mopt="-o nocheck,noexec"
+ ;;
+ mkfs.reiserfs)
+ fopt="-f"
+ mopt="-o noexec"
+ ;;
+ esac
+ LD_LIBRARY_PATH=/mnt/lib /mnt/$path/mkfs.$fs $fopt $target \
+ >/dev/null 2>&1 #|| error
+ if [ -z $mntpnt ] ; then
+ umount /mnt/tmp 2>/dev/null
+ if mount -t $fs -n $mopt $target /mnt/tmp 2>/dev/null; then
+ return 0
+ else
+ mount -n -t tmpfs none /mnt/tmp
+ fi
+ else
+ testmkd $mntpnt
+ mount -t $fs -n -o loop $target $mntpnt 2>/dev/null
+ return 0
+ fi
+ fi
+ done
+ [ -z $found ] && break
+ else break
+ fi
+done
+}
+
+#############################################################################
+# dhcp client function
+rundhcp ()
+{
+local vci="$1"
+# ensure the interface is up - might produce conflicts - nbd could fail!!
+# fixme: really needed?
+# [ -n "$noipyet" ] && ip link set dev $nwif up
+[ -f /lib/modules/${KERNEL}/kernel/net/packet/af_packet.ko ] && \
+ modprobe ${MODPRV} af_packet
+echo "Starting udhcpc for IP configuration"
+mkdir /var/lib/dhcp >/dev/null 2>&1
+[ -n $vci ] && vci="-V $vci"
+testmkd /usr/share/udhcpc
+ln -sf /bin/dhcpmkconfig /usr/share/udhcpc/default.script
+# -b option is suboptimal here ...
+udhcpc -b -t 8 -q $vci -s /usr/share/udhcpc/default.script \
+ -i $nwif 2>/dev/null
+}
+
+#############################################################################
+# function for retrieving configuration file (machine-setup) via tftp from a
+# predefined server or given source (file=tftp-server:/path via kernel
+# command line)
+unpack () {
+# $1 is config file name to get, $2 IP of server to get file from
+local dst=$1
+if [ -s $dst ] ; then
+ # fixme: handle different types of packaging (gzip/bzip2)??
+ if ! tar -xpzf $dst 2> /tmp/ConfTGZ-tar-error ; then
+ cat /tmp/ConfTGZ-tar-error
+ error "$unpack_ConfTGZ" nonfatal
+ rm /tmp/ConfTGZ-tar-error
+ fi
+ [ "$DEBUGLEVEL" -le 2 -o "$DEBUGLEVEL" -eq 8 ] && rm $dst
+ return 0
+else
+ return 1
+fi
+}
+fileget () {
+# normally tftp would be used, alternatively use wget for ftp or http
+# if local device file is specified - mount and unmount after copying
+local cfgfile
+[ "x$fileprot" = "x" ] && fileprot=tftp
+if [ "x$filepath" != "x" ] ; then
+ cfgfile=${filepath}
+ [ "x$fileserv" = "x" ] && fileserv=$(checkip ${serverip})
+ [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\
+$filepath, fileserv:$fileserv" >>$LOGFILE
+ case "$fileprot" in
+ ftp|http)
+ wget $fileprot://$fileserv/$cfgfile -O /tmp/$(basename $cfgfile) \
+ 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; }
+ ;;
+ file)
+ local ldev=$fileserv
+ echo "Waiting for /mnt/etc ...."
+ waitfor /mnt/etc 10000
+ mkdir /tmp/$ldev
+ echo -e "ext2\nreiserfs\nvfat\nxfs" >/etc/filesystems
+ mount -o ro /dev/$ldev /tmp/$ldev || error "$init_errlfg"
+ unpack /tmp/$ldev/$cfgfile
+ umount /dev/$ldev
+ ;;
+ *)
+ tftp -g -r $cfgfile -l /tmp/$(basename $cfgfile) $fileserv \
+ && unpack /tmp/$(basename $cfgfile) 2>>$LOGFILE
+ ;;
+ esac
+else
+ # predefined value for OpenSLX environment; it is expected that this
+ # directory is just below the tftpboot (path to which the daemon is
+ # restricted to)
+ filepath="client-config"
+ [ "x$fileserv" = "x" ] && fileserv=$(checkip ${serverip})
+ [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\
+$filepath, fileserv:$fileserv" >>$LOGFILE
+ # try to get configuration files successively; start with distro client
+ # and try last distro default ...
+ echo -e "\n## Configuration via later fileget: Hierarchy is distro client \
+and as last\n# distro/default" >>/tmp/confviafile
+ mac=$(echo $macaddr|sed "s/:/-/g")
+ for cfgfile in ${filepath}/${SYSTEM_NAME}/01-$mac.tgz \
+ ${filepath}/${SYSTEM_NAME}/default.tgz ; do
+ case "$fileprot" in
+ ftp|http)
+ wget $fileprot://$fileserv/$cfgfile -O /tmp/$(basename $cfgfile) \
+ 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; }
+ ;;
+ tftp)
+ tftp -g -r $cfgfile -l /tmp/$(basename $cfgfile) $fileserv \
+ 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; }
+ ;;
+ esac
+ done
+fi
+cat /initramfs/machine-setup >>/tmp/confviafile
+echo "fileget via $fileprot from $fileserv/$cfgfile finished" >/tmp/file-done
+[ $DEBUGLEVEL -ge 1 ] && echo "fileget from $cfgfile finished" >>$LOGFILE
+}
+
+#############################################################################
+# function for creating directories after testing of their existance avoids
+# to recreate directories in union mounts. If second and/or third parameters
+# are given check for permission patterns
+testmkd () {
+ test -d $1 || mkdir -p $1 >/dev/null 2>&1
+ [ $# -ge 2 ] && for i in "$2" "$3" ; do
+ echo "$i" | grep -q -E "^[0-9]{3,4}$" && chmod "$i" $1 >/dev/null 2>&1
+ echo "$i" | grep -q -E ":." && chown "$i" $1 >/dev/null 2>&1
+ done
+}
+
+#############################################################################
+# function for writing a syslog-ng.conf file. First parameter is absolute
+# destination (incl. /mnt prefix)
+# sysngwriter $dest $start_syslog
+sysngwriter () {
+local mysyslogngcfg=$1
+# logging servers might be specified in $log_servers (from e.g. dhcp)
+# fixme!? only first logserver from dhcp variable is used
+[ -n "$log_servers" ] && start_syslog="syslog://${log_servers% *}:514/udp"
+echo -e "# File written by $0 within InitRamFS\n\
+source src {\n\tfile(\"/proc/kmsg\");\n\
+\tunix-dgram(\"/dev/log\");\n\tinternal();\n};\ndestination console_all {\
+\n\tfile(\"/dev/tty10\");\n};" >$mysyslogngcfg
+case "$start_syslog" in
+ yes|Yes|YES)
+ echo -e "\nlog {\n\tsource(src);\n\tdestination(console_all);\n};" \
+ >>$mysyslogngcfg
+ ;;
+ file)
+ echo -e "destination allmessages {\n\tfile(\"/var/log/allmessages\");\n};\
+\nlog {\n\tsource(src); destination(allmessages);\n};" >>$mysyslogngcfg
+ ;;
+ *)
+ syslogsrv=$(uri_token $start_syslog server)
+ syslogport=$(uri_token $start_syslog port)
+ syslogprot=$(uri_token $start_syslog path)
+ [ -z ${syslogport} ] && syslogport=514
+ [ -z ${syslogprot} ] && syslogprot=udp
+ echo -e "destination loghost {\n\t${syslogprot}(\"${syslogsrv}\" \
+port(${syslogport}));\n};\nlog {\n\tsource(src);\n\tdestination(loghost);\n};"\
+ >>$mysyslogngcfg
+ ;;
+esac
+}
+
+#############################################################################
+# simple string in string search
+strinstr () {
+ case "$2" in *$1*) return 0;; esac
+ return 1
+}
+
+#############################################################################
+# simple string in file search, for the future grep should be used instead
+strinfile () {
+ case "$(cat $2)" in *$1*) return 0;; esac
+ return 1
+}
+
+#############################################################################
+# wait for a file to appear and stop after maxwait counts
+waitfor () {
+local file=$1
+local maxwait=$2
+local count=0
+[ -z $file ] && return 0
+[ -z $maxwait ] && maxwait=5000
+while [ ! -e $file ] ; do
+ usleep 1000
+ count=$(($count + 1))
+ [ $count -gt $maxwait ] && return 1
+done
+return 0
+}
+
+#############################################################################
+# ldconfig is needed if rootfilesystem is composed of several parts. Search
+# for ldconfig and execute it (we expect ldconfig not to be a dynamically
+# linked tool)
+# check that /mnt/etc/ld.so.conf is never lost
+ldconfig () {
+local cachefile="$1"
+for ldcfg in /mnt/sbin/ldconfig \
+ /mnt/bin/ldconfig \
+ /mnt/usr/sbin/ldconfig; do
+ test -x $ldcfg && {
+ $ldcfg -r /mnt -C $cachefile; break; }
+done
+echo "finished at $(sysup)" >/tmp/ldcfg
+}
+
+#############################################################################
+# base passwd/shadow, the standard user present in every system. All other
+# system users should be generated within the service function
+basepasswd () {
+# hack (see Ticket #206)
+root_pw="$1"
+# strip every line with userid between 500 and 99999 from the passwd
+# file
+sed '/^[a-zA-Z0-9]*:[a-zA-Z0-9]*:[1-9][0-9]\{3,4\}:/d;/^+:*/d;/^+$/d;
+ /^[a-zA-Z0-9]*:[a-zA-Z0-9]*:[5-9][0-9]\{2\}:/d' /mnt/etc/passwd \
+ >/tmp/newpasswd
+# and add user nobody again (is there a more elegant way?)
+sed -n -e '/nobody/p' /mnt/etc/passwd >> /tmp/newpasswd
+# create the shadow from passwd file
+echo -e "root:"${root_pw}":12958:0:10000::::" > /mnt/etc/shadow
+sed 's/:.*/:!:13078:0:99999:7:::/;/^root.*/d' /tmp/newpasswd \
+ >>/mnt/etc/shadow
+mv /tmp/newpasswd /mnt/etc/passwd
+chmod 0640 /mnt/etc/shadow
+}
+
+#############################################################################
+# wait for the completion of configuration file (machine-setup). It is
+# composed from different sources
+cfgcomplete () {
+waitfor /tmp/dhcp-done 10000 || error "$error_errdcfg" nonfatal
+waitfor /tmp/file-done 10000 || error "$error_errfcfg" nonfatal
+waitfor /tmp/ldap-done 10000 || error "$error_errlcfg" nonfatal
+# concatenate the different files now into the central config file, order
+# matters - ldap (not implemented yet) data has highest priority
+if ! test -f /tmp/cfgcomplete ; then
+ echo "## Stage3 configuration via initial/early /etc/initramfs-setup" \
+ >/etc/ext-initramfs-setup
+ for config in /etc/initramfs-setup /tmp/confviadhcp /tmp/confviafile \
+ /tmp/confvialdap
+ do test -f $config && cat $config >>/etc/ext-initramfs-setup
+ done
+# check again and replace @@@serverip@@@ and produce a final version for
+# stage4 (no much use, just debugging)
+sed "s,@@@serverip@@@,$serverip," -i /etc/ext-initramfs-setup
+. /etc/ext-initramfs-setup
+cp /etc/ext-initramfs-setup /mnt/etc/machine-setup
+mv /etc/ext-initramfs-setup /etc/initramfs-setup
+echo "config completed" >/tmp/cfgcomplete
+fi
+}
+
+#############################################################################
+# execute all shell scripts in the given init-hook folder
+runinithook () {
+local hook=$1
+if [ -d /etc/init-hooks/$hook ]; then
+ for hook_script in /etc/init-hooks/$hook/*.sh; do
+ if [ -e $hook_script ]; then
+ . $hook_script
+ fi
+ done
+fi
+}
+
+#############################################################################
+# localization simply derived from $language variable set in machine-setup or
+# other sources - mostly taken from knoppix
+localization () {
+country="$1"
+CONSOLE_FONT="lat9w-16.psfu"
+case "$country" in
+ # German version
+ de*)
+ COUNTRY="de"
+ LANG="de_DE.UTF8"
+ KEYTABLE="de-latin1-nodeadkeys"
+ XKEYBOARD="de"
+ KDEKEYBOARD="de"
+ CHARSET="utf8"
+ KDEKEYBOARDS="us,fr"
+ TZ="Europe/Berlin"
+ ;;
+ # Belgian version
+ be*)
+ COUNTRY="be"
+ LANG="C"
+ KEYTABLE="be2-latin1"
+ XKEYBOARD="be"
+ KDEKEYBOARD="be"
+ CHARSET="iso8859-15"
+ KDEKEYBOARDS="us,de,fr"
+ TZ="Europe/Brussels"
+ ;;
+ # Bulgarian version
+ bg*)
+ COUNTRY="bg"
+ LANG="bg_BG"
+ KEYTABLE="bg"
+ XKEYBOARD="bg"
+ KDEKEYBOARD="bg"
+ CHARSET="microsoft-cp1251"
+ KDEKEYBOARDS="us,de,fr"
+ TZ="Europe/Sofia"
+ ;;
+ # Switzerland (basically de with some modifications)
+ ch)
+ LANGUAGE="de"
+ COUNTRY="ch"
+ LANG="de_CH"
+ KEYTABLE="sg-latin1"
+ XKEYBOARD="de_CH"
+ KDEKEYBOARD="de_CH"
+ CHARSET="iso8859-15"
+ KDEKEYBOARDS="de,us,fr"
+ TZ="Europe/Zurich"
+ ;;
+ # Simplified Chinese
+ cn)
+ COUNTRY="cn"
+ LANG="zh_CN.GB2312"
+ KEYTABLE="us"
+ XKEYBOARD="us"
+ KDEKEYBOARD="us"
+ CHARSET="gb2312.1980-0"
+ KDEKEYBOARDS="us,de,fr"
+ XMODIFIERS="@im=Chinput"
+ TZ="Asia/Shanghai"
+ ;;
+ # Czechoslovakia
+ cs|cz)
+ LANGUAGE="cs"
+ COUNTRY="cs"
+ LANG="cs_CZ"
+ KEYTABLE="cz-lat2"
+ XKEYBOARD="cs"
+ KDEKEYBOARD="cz"
+ CHARSET="iso8859-2"
+ KDEKEYBOARDS="us,de,fr"
+ TZ="Europe/Prague"
+ CONSOLE_FONT="iso02g"
+ ;;
+ # Denmark
+ dk|da)
+ COUNTRY="dk"
+ LANG="da_DK"
+ # Workaround: "dk" broken in gettext, use da:da_DK
+ LANGUAGE="da:da_DK"
+ KEYTABLE="dk"
+ XKEYBOARD="dk"
+ KDEKEYBOARD="dk"
+ CHARSET="iso8859-15"
+ KDEKEYBOARDS="dk,de,us,fr"
+ TZ="Europe/Copenhagen"
+ ;;
+ es)
+ # Spain
+ COUNTRY="es"
+ LANG="es_ES@euro"
+ KEYTABLE="es"
+ XKEYBOARD="es"
+ KDEKEYBOARD="es"
+ CHARSET="iso8859-15"
+ KDEKEYBOARDS="de,us,fr"
+ TZ="Europe/Madrid"
+ ;;
+ # Finland
+ fi)
+ COUNTRY="fi"
+ LANG="fi_FI@euro"
+ KEYTABLE="fi"
+ XKEYBOARD="fi"
+ KDEKEYBOARD="fi"
+ CHARSET="iso8859-15"
+ KDEKEYBOARDS="us"
+ TZ="Europe/Helsinki"
+ ;;
+ # France
+ fr*)
+ COUNTRY="fr"
+ LANG="fr_FR@euro"
+ KEYTABLE="fr"
+ XKEYBOARD="fr"
+ KDEKEYBOARD="fr"
+ CHARSET="iso8859-15"
+ KDEKEYBOARDS="de,us"
+ TZ="Europe/Paris"
+ ;;
+ he|il)
+ # Hebrew version
+ LANGUAGE="he"
+ COUNTRY="il"
+ LANG="he_IL"
+ KEYTABLE="us"
+ XKEYBOARD="us"
+ KDEKEYBOARD="il"
+ CHARSET="iso8859-8"
+ KDEKEYBOARDS="us,fr,de"
+ TZ="Asia/Jerusalem"
+ ;;
+ # Ireland
+ ie)
+ COUNTRY="ie"
+ LANG="en_IE@euro"
+ KEYTABLE="uk"
+ XKEYBOARD="uk"
+ KDEKEYBOARD="gb"
+ CHARSET="iso8859-15"
+ KDEKEYBOARDS="us,de,es,fr,it"
+ TZ="Europe/Dublin"
+ ;;
+ # Italy
+ it)
+ COUNTRY="it"
+ LANG="it_IT@euro"
+ KEYTABLE="it"
+ XKEYBOARD="it"
+ KDEKEYBOARD="it"
+ CHARSET="iso8859-15"
+ KDEKEYBOARDS="fr,us,de"
+ TZ="Europe/Rome"
+ ;;
+ # Japan
+ ja)
+ COUNTRY="jp"
+ LANG="ja_JP"
+ LANGUAGE="ja"
+ KEYTABLE="us"
+ XKEYBOARD="us"
+ KDEKEYBOARD="us"
+ CHARSET="iso8859-15"
+ KDEKEYBOARDS="fr,us,de"
+ TZ="Asia/Tokyo"
+ ;;
+ # The Netherlands
+ nl)
+ COUNTRY="nl"
+ LANG="nl_NL@euro"
+ KEYTABLE="us"
+ XKEYBOARD="us"
+ KDEKEYBOARD="en_US"
+ CHARSET="iso8859-15"
+ KDEKEYBOARDS="nl,de,fr"
+ TZ="Europe/Amsterdam"
+ ;;
+ # Poland
+ pl)
+ COUNTRY="pl"
+ LANG="pl_PL"
+ KEYTABLE="pl"
+ XKEYBOARD="pl"
+ KDEKEYBOARD="pl"
+ CHARSET="iso8859-2"
+ KDEKEYBOARDS="de,us,fr"
+ TZ="Europe/Warsaw"
+ CONSOLE_FONT="iso02g"
+ ;;
+ # Russia
+ ru)
+ COUNTRY="ru"
+ LANG="ru_RU.KOI8-R"
+ KEYTABLE="ru"
+ XKEYBOARD="ru"
+ KDEKEYBOARD="ru"
+ CHARSET="koi8-r"
+ CONSOLE_FONT="Cyr_a8x16"
+ KDEKEYBOARDS="de,us,fr"
+ TZ="Europe/Moscow"
+ ;;
+ # Slovakia
+ sk)
+ COUNTRY="sk"
+ LANG="sk"
+ KEYTABLE="sk-qwerty"
+ XKEYBOARD="sk"
+ KDEKEYBOARD="sk"
+ CHARSET="iso8859-2"
+ KDEKEYBOARDS="us,de"
+ TZ="Europe/Bratislava"
+ CONSOLE_FONT="iso02g"
+ ;;
+ # Slovenia
+ sl)
+ LANGUAGE="sl"
+ COUNTRY="si"
+ LANG="sl_SI"
+ KEYTABLE="slovene"
+ XKEYBOARD="sl"
+ KDEKEYBOARD="si"
+ CHARSET="iso8859-2"
+ KDEKEYBOARDS="us,de"
+ TZ="Europe/Ljubljana"
+ CONSOLE_FONT="iso02g"
+ ;;
+ tr)
+# Turkish version (guessed)
+ COUNTRY="tr"
+ LANG="tr_TR"
+ KEYTABLE="tr_q-latin5"
+ XKEYBOARD="tr"
+ KDEKEYBOARD="tr"
+ CHARSET="iso8859-9"
+ KDEKEYBOARDS="us,de,fr"
+ TZ="Europe/Istanbul"
+ ;;
+ # Taiwan - Traditional Chinese version
+ tw)
+ COUNTRY="tw"
+ LANG="zh_TW.Big5"
+ LANGUAGE="zh_TW.Big5"
+ KEYTABLE="us"
+ XKEYBOARD="us"
+ KDEKEYBOARD="us"
+ CHARSET="iso8859-1"
+ KDEKEYBOARDS="us"
+ XMODIFIERS="@im=xcin"
+ TZ="Asia/Taipei"
+ ;;
+ # Great Britian
+ uk)
+ COUNTRY="uk"
+ LANG="en_GB"
+ LANGUAGE="en"
+ KEYTABLE="uk"
+ XKEYBOARD="uk"
+ KDEKEYBOARD="gb"
+ CHARSET="iso8859-1"
+ KDEKEYBOARDS="us"
+ TZ="Europe/London"
+ ;;
+ # US and default configuration
+ *)
+ LANGUAGE="us"
+ COUNTRY="us"
+ LANG="C"
+ KEYTABLE="us"
+ XKEYBOARD="us"
+ KDEKEYBOARD="us"
+ CHARSET="iso8859-1"
+ KDEKEYBOARDS="de,fr"
+ TZ="America/New_York"
+ ;;
+esac
+# start distrospecific localization
+dlocale
+}
+
+#############################################################################
+# This function gets an uri or a comma separated list of uris as parameter.
+# It will then try to mount these uris and add them to the union at /
+include_in_fsroot_union () {
+ union_id=0 # used to have guarantee differing names for the unions mount point
+ union_type=$1
+ for ROOTFS in $(echo $2 |sed 's/,/ /g'); do
+ union_id=$(($union_id + 1))
+ srvproto=$(uri_token $ROOTFS prot)
+ case $srvproto in
+ nfs)
+ # activate kernel nfs if not present, nfsroot consists now of two
+ # different parts
+ nfsmod
+ root_path=$(uri_token $ROOTFS path)
+ nfsserver=$(uri_token $ROOTFS server)
+ mkdir -p /mnt/tmp/${root_path}_${union_id}
+ for proto in tcp udp fail; do
+ [ $proto = "fail" ] && { error "$scfg_nfs"; break; }
+ mount -n -t nfs -o ro,nolock,$proto $nfsserver:$root_path \
+ /mnt/tmp/${root_path}_${union_id} && break
+ done
+ ;;
+ *nbd)
+ echo "Not working yet"
+ nbdmod=$srvproto
+ # get settings for nbd-client, filesystem equals to path in URI
+ # notation
+ nbdhost=$(uri_token $ROOTFS server)
+ nbdport=$(uri_token $ROOTFS port)
+ nbdrfst=$(uri_token $ROOTFS path)
+ echo -e "(D)NBD $ROOTFS parsed to $srvproto - $nbdhost - \
+ $nbdport - $nbdrfst" >> /tmp/felixtestlog
+ #FIXME: mount durchführen
+ ;;
+ aoe)
+ echo "Not implemented yet"
+ ;;
+ iscsi)
+ echo "Not implemented yet"
+ #iscsiserver=$(uri_token $ROOTFS server)
+ #iscsiport=$(uri_token $ROOTFS port)
+ #iscsitarget=$(uri_token $ROOTFS path)
+ ;;
+ esac
+ if [ "X$union_type" == "XUnionFS" ]; then
+ [ "$DEBUGLEVEL" -gt 2 -a "$DEBUGLEVEL" != 8 ] && \
+ echo "Using unionctl to mount ${root_path}_${union_id} (type: \
+ $union_type)"
+ unionctl /mnt/ --add --after 1 --mode ro /mnt/tmp/${root_path}_${union_id}
+ elif [ "X$union_type" == "XAUFS" ]; then
+ # unionctl for aufs is a sh script needing tools not included in our
+ # initramfs
+ [ "$DEBUGLEVEL" -gt 2 -a "$DEBUGLEVEL" != 8 ] && \
+ echo "Using aufs-mount to mount ${root_path}_${union_id} (type: $union_type)"
+ mount -n -o remount,add:1:/mnt/tmp/${root_path}_${union_id}=ro none /mnt
+ else
+ error ${init_loadunions} nonfatal
+ fi
+ done
+}
+
+#############################################################################
+# dummy functions - avoid undefined functions in servconfig (functions are
+# normally overwritten by settings within distro-functions) - a file
+# generated by mkdxsinitrd from <distro>/functions-default & ~-version
+
+# setup initial boot scripts (for most standard distributions, gentoo is to
+# be handled differently)
+initial_boot () {
+:
+}
+# function for ntp configuration
+config_ntp () {
+:
+}
+# function for afs
+config_afs () {
+:
+}
+# function for atd
+config_atd () {
+:
+}
+# function for configuration of cron services
+config_cron () {
+:
+}
+# syslog service
+config_syslog () {
+:
+}
+# secure shell service
+config_sshd () {
+:
+}
+# snmp agent for remote monitoring
+config_snmp () {
+:
+}
+# consolefont
+consolefont () {
+:
+}
+# acpi and powersave
+config_acpi () {
+:
+}
+# configure hal, dbus, resmgr and services like that
+config_dreshal () {
+:
+}
+# configure automounter, simple NFSv3 imports only
+config_automount () {
+:
+}
+# configure print services / start requested printer daemon
+config_printer () {
+:
+}
+# configure bluetooth services
+config_bt () {
+:
+}
+# create a compliant runlevel script, needed for boot.slx and vmware-prep
+d_mkrlscript () {
+:
+}
+# start name service caching daemon
+config_nscd () {
+:
+}
+# configure automounter
+config_automount () {
+:
+}
+# configure samba service (not winbind, but nmbd, smbd)
+config_samba () {
+:
+}
+# start portmapper (needed at least for nfs and nis services)
+config_portmap () {
+:
+}
+# start nis/ypbind
+config_nis () {
+:
+}
+# configure nfsv4 stuff
+config_nfsv4 () {
+:
+}
+# configure keyboard layout
+keytable () {
+:
+}
diff --git a/initramfs/stage3-stuff/etc/ldap-functions b/initramfs/stage3-stuff/etc/ldap-functions
new file mode 100644
index 00000000..d2b6753e
--- /dev/null
+++ b/initramfs/stage3-stuff/etc/ldap-functions
@@ -0,0 +1,75 @@
+#######################################################################
+# configuration via ldap
+# get_timeranges: helper function for ldapconf, retrieving timeranges
+# of machineconfig-objects under search base $1 (Host,Group,Default)
+get_timeranges(){
+trquery=`ldapsearch -x -H ldap://$ldapserver -b $1 -D $user -w $pwd -LLL \
+"(objectclass=machineconfig)" Timerange|sed -n '/Tim*/p'|sed 's/TimeRange: /#/'`
+}
+# matching_timerange: helper function for ldapconf to get "most
+# specific timerange" matching actual time
+matching_timerange(){
+match=0
+lines=$[`echo $trquery | sed 's/#/\n#/g'|wc -l` -1]
+for ((i=0;i<$lines;i++)) ; do
+ timerange[$i]=`echo $trquery | cut -d "#" -f $[$i+2] | sed 's/ //g'`
+done
+while true ; do
+ for ((i=0;i<$lines;i++)) ; do
+ trday=`echo ${timerange[i]} | cut -d "_" -f 1`
+ trbegin=`echo ${timerange[i]} | cut -d "_" -f 2`
+ trend=`echo ${timerange[i]} | cut -d "_" -f 3`
+ if [ $trday == $wday ] && [ $trday != "X" ] && [ $trbegin != "X" ] && \
+ [ $trbegin -le $time ] && [ $time -le $trend ]; then
+ echo $wday $time "[D H H]match ->" ${timerange[i]}
+ tr=${timerange[i]}
+ match=1 && break
+ fi
+ done
+ if [ $match == 1 ] ; then break ; fi
+ for ((i=0;i<$lines;i++)) ; do
+ trday=`echo ${timerange[i]} | cut -d "_" -f 1`
+ trbegin=`echo ${timerange[i]} | cut -d "_" -f 2`
+ trend=`echo ${timerange[i]} | cut -d "_" -f 3`
+ if [ $trday == $wday ] && [ $trbegin == "X" ] && [ $trend == "X" ]; then
+ echo $wday $time "[D _ _]match ->" ${timerange[i]}
+ tr=${timerange[i]}
+ match=1 && break
+ fi
+ done
+ if [ $match == 1 ] ; then break ; fi
+ for ((i=0;i<$lines;i++)) ; do
+ trday=`echo ${timerange[i]} | cut -d "_" -f 1`
+ trbegin=`echo ${timerange[i]} | cut -d "_" -f 2`
+ trend=`echo ${timerange[i]} | cut -d "_" -f 3`
+ if [ $trday == "X" ] && [ $trbegin != "X" ] && [ $trbegin -le $time ] && \
+ [ $time -le $trend ]; then
+ echo $wday $time "[_ H H]match ->" ${timerange[i]}
+ tr=${timerange[i]}
+ match=1 && break
+ else
+ if [ ${timerange[$i]} == "X_X_X" ]; then
+ echo $wday $time "[_ _ _]match ->" ${timerange[i]}
+ tr="X_X_X" && match=1
+ else
+ match=0
+ fi
+ fi
+ done
+ if [ $match == 1 ] || [ $match == 0 ] ; then break ; fi
+done
+}
+# get_machineconfig: helper function for ldapconf, writing machine
+# config data of one timerange $tr into file "tmp/confvialdap/$tr"
+get_machineconfig(){
+ldapsearch -x -H ldap://$ldapserver -b $1 -D $user -w $pwd -LLL \
+"(&(objectclass=machineconfig)(timerange=$tr))"|sed '/dn:/d'|sed '/ou=/d'|\
+sed '/dc=/d'|sed '/objectC*/d'|sed '/Tim*/d'|sed '/cn:/d'|sed '/desc*/d'|sed \
+'s/: /=/g'|sed 's/-/_/g' > tmp/confvialdap/$tr
+}
+
+ldapconf () {
+local ldapserver=$1
+error "$error_ldapcfg"
+echo "not implemented" > /tmp/ldap-done
+}
diff --git a/initramfs/stage3-stuff/etc/messages b/initramfs/stage3-stuff/etc/messages
new file mode 100644
index 00000000..39d603ce
--- /dev/null
+++ b/initramfs/stage3-stuff/etc/messages
@@ -0,0 +1,205 @@
+# Copyright (c) 2003 - 2006 - RZ Uni Freiburg
+# Copyright (c) 2006 - 2008 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Messages file for all error and info messages generated during client
+# bootup (within initialramfs) for OpenSLX linux diskless clients version 4
+# this file could be used for localization of error messages
+
+# messages from (slx) init
+init_errmsg="The functions file contains a lot of slx scripts \
+functionality. Without this\ninit script will not run."
+init_mff="The main $init_errmsg"
+init_dff="The distro $init_errmsg"
+init_sscf="The slx configuration variables could not be found. Please
+provide the slxconfig file."
+init_noeth=" Unable to configure the ethernet device (eth0). Please check \
+for an\n appropriate kernel module."
+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 \
+'ipappend 1' in pxelinux.cfg/* or just enable dhcp\n or ldap. They are \
+enabled via tokens ('ldap' or 'dhcp') in kernel\n command line."
+init_errldap=" Unable to setup at \
+least basic functionality, because no IP configuration\n available. Please \
+beware - ldap works only in combination of either\n ipappend or similar or \
+with dhcp!"
+init_errnwad=" Failed to load the network \
+adaptor modules defined via mkdxsinitrd\n run. Please rerun and list the \
+appropriate modules (without .ko)."
+init_nowlan=" No wireless LAN capable interface found. Did you provide the \
+proper kernel\n modules?"
+init_wlanf=" Unable to configure the WLAN interface."
+init_bootmac=" If you have more than one ethernet adaptor present in your \
+machine or using\n a NVidia chipset then it would be advisable to switch on \
+passing of the\n boot MAC address via kernel commandline (IPAPPEND=3) in \
+your PXElinux\n configuration."
+init_nveth=" Your system uses a NVidia ethernet chip which might to fail to \
+get the\n original MAC address assigned. Use IPAPPEND=3 in your PXElinux \ configuration\n to get the boot MAC address passed on."
+init_errdhcp=" Did not get complete IP \
+configuration via DHCP. You may want to add\n a vendor code identifier \
+via kernel commandline (vci=VCI)."
+init_erripcfg=" Up to now no IP configuration is available. If there is any \
+local file config\n the system may work locally."
+init_errbld=" 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."
+init_nbdcl=" Failed to start the network block device client. Unable to \
+mount root\n filesystem."
+init_nbddev=" For some reason the network block device /dev/${NBD}0 never \
+appeared.\n You might want to check udev or your list of static device \
+files."
+init_dnbd2s=" After 100 retries, it was not possible to start the dnbd2 \
+service. Please\n check that at least one server is available. You might \
+use the\n /sys/block/vnbd0 interface for this."
+init_moddir=" The requested modules directory does not exist. That could \
+mean:\n * The kernel was updated but mkdxsinitrd was not run afterwards.\n\
+ * The mounted filesystem does not contain the modules directory at all.\n\
+ You might want to check the list of mounted filesystems and if /mnt is\n\
+ not empty run 'ls /mnt/lib/modules' to check."
+init_loadaufs=" Loading of AUFS failed - Either the module is not present or \
+does \n not match the running kernel. If you do not want to see this \
+\n message remove the token 'aufs' from kernel command line."
+init_noaufs_butufs=" AUFS was chosen as Unification FS but is not available. \
+However UnionFS seems to be available. To put it to use append 'unionfs' to the \
+kernel command line."
+init_noufs_butaufs=" UnionFS was chosen as Unification FS but is not available. \
+However\n AUFS seems to be available. To put it to use append 'aufs' to the\n \
+kernel command line."
+init_loadufs=" Loading of UnionFS failed - Either the module is not present or \
+does \n not match the running kernel. If you do not want to see this message\
+\n remove the token 'unionfs' from kernel command line."
+init_loadunions=" Stacking of directories failed, because UnionFS/AUFS is not \
+loaded."
+init_loadcow=" Loading of Copy On Write (COW - special block device) module \
+failed -\n Either module is not present or module does not match the \
+running\n kernel. If you do not want to see this message remove the token \
+'cowloop' from kernel command line."
+init_cownobld=" Loading of cow module is of no sense if no network/other block \
+device is used or\n UnionFS/AUFS was specified as read write layer too. Remove \
+UnionFS/AUFS token from\n kernel commandline if cowloop should be used instead."
+init_nfs=" Mount of root filesystem via NFS was requested via kernel command \
+line\nbut failed. There might be the following reasons for that:\n\
+* No nfs.ko module could be loaded and no NFS support was present in the\n\
+running kernel - see error messages above\n\
+* You tried to mount from wrong server or path ($nfsroot)\n\
+* No NFS server is running or you do not have permissions"
+init_ldcfg=" Starting ldconfig - normally switched off. Enable it via kernel \
+cmdline option\n 'noldsc'. You might have/want to add additional library \
+pathes to the\n ld.so.conf file."
+init_errlog=" Unable to create the logfile configuration in \
+/etc/${D_SYSCONFDIR}. That\n might indicate some severe error."
+init_fstab=" Failed to create /etc/fstab in the clients root filesystem. The\n\
+ noexistence of the file might produce some unexpected behaviour of\n\
+ mount commands."
+init_errldcfg=" For some reason the generation of ld.so.cache did not \
+finish in time."
+init_infldcfg=" 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."
+init_errlfg=" The ConfTGZ filesource was some local device which was not \
+mounted successfully.\n Either the wrong device was given or the filesystem \
+is not known to the kernel."
+init_errcfg="of this client did not finish in\n time. You might check the \
+process list and list the modules loaded until\n now."
+init_errhw=" For some reason the hardware autoconfig $init_errcfg"
+init_errxorg=" For some reason no xorg.conf appeared, check xconfig!"
+init_errsw=" For some reason the software configuration $init_errcfg"
+init_wait=" Waited $ticks ticks to unmount kernel module directory ..."
+init_errumnt=" Unmount of the kernel modules directory \
+failed for some reason. Some\n modprobe still active!?"
+init_erritab=" The file /etc/inittab does not exist or is no regular one. It \
+is needed\n for the bootup procedure to follow. If upstart is used instead no \
+inittab\n is needed any more, but a proper configured events.d."
+init_errsys=" Unmount of the kernel sys directory \
+failed for some\nreason. You will get some error messages that some files \
+could not be\n removed."
+init_runinit=" Could not execute \
+run-init due to missing command or wrong\n parameters given."
+init_picfg=" The plugin configuration directory is missing. This could be due \
+to failed\n config get process at the beginning of stage3 setup. Either \
+requested\n configuration file is missing in ~/client-config/<system> or a \
+general\n transmission error."
+
+# messages from functions
+error_msg="An error occured during execution of $0 script:\n\n"
+error_nfe="\n -> This error is not fatal - continuing ...\n"
+error_shell="\n -> Running shell for debugging purposes now ...\n"
+error_modload="Failed to load module "
+error_modnfs="needed for mounting rootfs"
+error_nodhcp=" You tried to configure system via dhcp, but no usable dhcp\n\
+ client could be found. Please check that you have some client from\n\
+ the following list installed: dhclient dhcpcd pump ipconfig."
+error_dhcp=" The following problems could produce that error:\n\
+ * The af_packet.ko module is either not loaded nor present in kernel.\n\
+ * No network device is present - either no module matching the hardware\n\
+ was loaded nor present in kernel.\n You might want to run 'lsmod'."
+error_dhclient=" Fatal error occured while trying to run dhclient.\n\
+$error_dhcp"
+error_ldapcfg=" The configuration via ldap is not implemented yet."
+error_errdcfg=" Did not get any configuration data via dhcp until now ..."
+error_errfcfg=" Did not get any configuration data via tftp until now ..."
+error_errlcfg=" Did not get any configuration data via ldap until now ..."
+unpack_ConfTGZ=" Error during unpacking of the ConfTGZ archive.\nAre you sure \
+it is in proper format?"
+
+
+# messages from distro functions
+df_errumod=" Failed to load the \"unix\" module. Problems with Hardware \
+detection\nwill probably arise."
+df_errserv="seems not to be installed or start script is\n not available\
+so requesting the start of service make no sense. Please\n disable service\
+or install the files/packages needed."
+df_errcron=" The cron start script $df_errserv"
+df_errsysl=" The syslog start script $df_errserv"
+df_errsshd=" The sshd start script $df_errserv"
+df_erryp=" The NIS client $df_errserv"
+df_erramnt=" Automounter $df_errserv"
+df_errnsc=" Name Service caching deamon $df_errserv\n This service might \
+be useful to take load from a ldap user directory."
+df_errafsd=" No afs directory present."
+df_errafsn=" AFS client service is not available."
+df_errkbd=" No non-english keyboard and console settings are installed. \
+Please add\n them to your stage1 to have them enabled."
+
+# messages from servconfig
+scfg_nfs=" Mount of some NFS source failed ..."
+scfg_ntptz=" No such timezone data file (needed for ntp time service \
+configuration)."
+scfg_evmlm=" Mounting of local device source for vmware directory failed \
+for some reason."
+scfg_vmdir=" For some reason the runvmware script is not available for \
+copying. That\n could be the result of failed mount or simply missing \
+file on\n server."
+scfg_vmchs=" The virtual machines lister/chooser is not available from \
+~/templates\n directory. Thus no default k/gdm menu entry is created."
+scfg_erradir=" Only one directory level is allowed to hook up automounter \
+to and the\n directory should exist (on the servers export) or should be \
+creatable\n (e.g. because of UnionFS writeable root directory)."
+scfg_erratpld=" Only toplevel directories \
+are allowed as mount points for user home\n directories. Please set the \
+variable \${automnt_dir} appropriately in\n machine-setup file."
+scfg_country=" No configuration for localization found in config file. \
+Using default\n country setting '${D_DEFAULTCOUNTRY}' defined in $0."
+
+# messages from hwautocfg
+hcfg_hwsetup=" The X server configuration file generated by hwautocfg could \
+not\n be found."
+gfx_msg="Please check your graphic adaptor settings ($hw_graphic)."
+hw_msg=" Please check your predefined monitor settings ($hw_monitor): \
+Automatic\n configuration of display"
+hcfg_res=" $hwmsg resolution was attempted but not established. Using \
+default resolutions (defined in xconfig)"
+hcfg_hwsetup=" Expected information from hwsetup to appear in \
+/tmp/hwsetup.info.\n Unable to configure parts of the systems hardware. \
+Please check that\n hwsetup is properly installed and executable."
+hcfg_keyb=" No settings found for keyboard, using default of '${XKEYBOARD}' \
+defined\n in $0."
+
diff --git a/initramfs/stage3-stuff/etc/messages.de b/initramfs/stage3-stuff/etc/messages.de
new file mode 100644
index 00000000..59a7568e
--- /dev/null
+++ b/initramfs/stage3-stuff/etc/messages.de
@@ -0,0 +1,216 @@
+# Copyright (c) 2003 - 2006 - RZ Uni Freiburg
+# Copyright (c) 2006 - 2008 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Messages file for all error and info messages generated during client
+# bootup (within initialramfs) for OpenSLX linux diskless clients version 4
+# this file could be used for localization of error messages
+
+# messages from (slx) init / Fehlermeldungen des SLX init
+init_errmsg=" ,,functions''-Datei beinhaltet viele Funktionen \
+der SLX Skripte. Ohne diese\n wird das Init-Skript nicht funktionieren."
+init_mff=" Die Haupt $init_errmsg"
+init_dff=" Die Distro $init_errmsg"
+init_sscf=" Die SLX Konfigurations-Variablen wurden nicht gefunden.
+Bitte stellen Sie die\n SLX Konfigurations-Datei zur Verfuegung."
+init_noeth=" Konnte die Netzwerk-Schnittstelle nicht konfigurieren (eth0).\
+ Bitte pruefen,\n ob das geeignete kernel-Modul vorhanden ist."
+init_errip=" Konnte die Grund-Funktionalitaet nicht einrichten, \
+da keine IP-Konfigurationen\n vorhanden sind. Sie koennten diese \
+Informationen ueber die Kernel-Command-Line\n durch die Einstellung \
+'ipappend 1' in pxelinux.cfg/* oder ldap\n aktivieren. Sie werden durch \
+Token ('ldap') in den Kernel Start Optionen\n eingeschaltet."
+init_errldap=" Konnte nicht wenigstens die Grund-Funktionalitaet einrichten, \
+da keine IP-Konfigurationen\n vorhanden sind. Achtung - ldap arbeitet nur in \
+Kombination mit IPAPPEND (PXE)\n o.ae. oder DHCP!"
+init_errnwad=" Konnte die Netzwerk-Adapter, die durch den slx/mkramfs bzw. \
+mkdxsinitrd-Aufruf definiert\n wurden, nicht laden. Bitte erneut aufrufen \
+und die passenden Module auflisten\n (ohne Endung .ko)."
+init_nowlan=" Kein brauchbares WLAN-Interface gefunden. Wurden alle \
+notwendigen Kernel-\n module ins InirRamFS eingebaut?"
+init_wlanf=" Das WLAN Interface konnte nicht konfiguriert werden."
+init_bootmac=" Es scheint mehr als eine Ethernet-Karte installiert und die \
+passenden\n Kernel-Module geladen zu sein. Das kann fuer Probleme sorgen, da \
+evtl.\n die nicht verbundene Netzwerkkarte als das erste Interface konfiguriert\
+ \n wurde. Durch die Uebergabe der MAC Adresse des Bootdevices (IPAPPEND=3 in
+der PXElinux-Konfiguration) laesst sich dieses vermeiden."
+init_nveth=" Ihr System benutzt anscheinend eine NVidia-Netzwerkkarte. Hier \
+kann es\n vorkommen, dass die MAC-Adresse nicht korrekt eingestellt wird. \
+Dieses laesst\n sich durch die Uebergabe der MAC Adresse des Bootdevices \
+(IPAPPEND=3 in der PXElinux-Konfiguration) vermeiden."
+init_errdhcp=" Keine komplette IP-Konfiguration ueber DHCP bekommen. \
+Eventuell sollten Sie\n ueber die Kernel Start Optionen eine Hersteller Code \
+ID (vendor code identifier)\n (VCI=vci) hinzufuegen."
+init_erripcfg=" Bis zu diesem Zeitpunkt konnte keine (gueltige) IP.\
+Konfiguration beschafft\n werden. Die Maschine kann funktionieren, wenn \
+lokale Konfiguration per\n Datei moeglich ist."
+init_errbld=" Konnte nicht das Modul ${NBD}.ko laden. Es wird gebraucht, \
+wenn Sie vorhaben, das\n Netzwerk Block Geraet (network block device) (D)NBD \
+fuer den Klienten als Wurzel-Dateisystem zu verwenden."
+init_nbdcl=" Konnte den Network Block Geraete-Dienst nicht starten und damit \
+das Wurzel-Dateisystem\n nicht einhaengen."
+init_nbddev=" Aus irgendeinem Grund ist /dev/${NBD}0 nie erschienen. Sie \
+sollten ihr udev-System\n nach Listen von statischen Geraeten untersuchen."
+init_dnbd2s=" Nach 100 Versuchen konnte das dnbd2 Blockdevice keinen laufenden \
+Server finden.\n Bitte ueberpruefen Sie die Erreichbarkeit."
+init_moddir=" Das angeforderte Modul-Verzeichnis existiert nicht. Das koennte \
+bedeuten:\n * Der Kernel wurde ausgetauscht/erneuert ohne einen neuen Aufruf \
+von slxmkramfs oder\n mkdxsinitrd.\n * Das eingehaengte Dateisystem \
+beinhaltet das Modul-Verzeichnis ueberhaupt nicht.\n Sie sollten die Liste \
+der eingehaengten Dateisysteme pruefen und wenn /mnt\n nicht leer ist, \
+'ls /mnt/lib/modules' ausfuehren."
+init_loadunions=" Stapeln mehrerer Verzeichnisse nicht moeglich, da kein \
+UnionFS/AUFS\n Modul geladen ist."
+init_loadaufs=" Laden von AUFS schlug fehl - entweder das Modul ist \
+nicht vorhanden, oder\n es passt nicht zum laufenden Kernel. Wenn Sie diese \
+Meldung nicht sehen\n wollen, entfernen Sie das Token 'aufs' von den Kernel \
+Start Optionen."
+init_noaufs_butufs=" AUFS wurde als Unification FS angegeben, ist jedoch nicht \
+vorhanden. UnionFS\n steht aber scheinbar zu Verfuegung. Wenn Sie dieses nutzen \
+moechten fuegen\n Sie bitte 'unionfs' zu den Kernel Start Optionen hinzu."
+init_noufs_butaufs=" UnionFS wurde als Unification FS angegeben, ist jedoch \
+nicht vorhanden. AUFS\n steht aber scheinbar zu Verfuegung. Wenn Sie dieses nutzen \
+moechten fuegen Sie\n bitte 'aufs' zu den Kernel Start Optionen hinzu."
+init_loadcow=" Laden von Copy On Write (COW - Spezielles Block Geraet) Modul \
+schlug fehl -\n entweder das Modul nicht praesent oder es passt nicht zum \
+laufenden\n Kernel. Wenn Sie diese Meldung nicht sehen wollen, entfernen sie \
+das Token 'cowloop' aus den Kernel Start Optionen."
+init_loadufs=" Laden von UnionFS schlug fehl - entweder das Modul ist \
+nicht vorhanden, oder\n es passt nicht zum laufenden Kernel. Wenn Sie diese Meldung \
+nicht sehen wollen,\n entfernen Sie das Token 'unionfs' von den Kernel Start \
+Optionen."
+init_cownonbd=" Laden des COW-Moduls ist sinnlos, wenn kein Netzwerk Block \
+Geraet benutzt wird oder\n UnionFS als Lese- Schreib-Schicht spezifiziert \
+wurde. Entfernen Sie das UnionFS Token aus\n den Kernel-Start-Optionen wenn \
+'cowloop' stattdessen verwendet werden soll."
+init_nfs=" Einhaengen des Wurzel Dateisystems ueber NFS wurde angefordert \
+durch die Kernel Start Optionen,\n aber schlug fehl. Die folgenden Gruende \
+koennten verantwortlich sein:\n\
+ * Kein nfs.ko (und weitere dafuer benoetigte) Modul konnte geladen werden und \
+keine NFS Unterstuetzung war im\n laufenden Kernel vorhanden - siehe \
+Fehlermeldungen darueber.\n\
+ * Sie versuchten, einen falschen Pfad einzuhaengen ($nfsroot).\n\
+ * Kein NFS-Server laeuft oder Sie haben nicht die Zugriffsberechtigungen auf \
+diesen."
+init_ldcfg=" Starte ldconfig - normalerweise ausgeschaltet. Wird mit der Kernel \
+Start Option\n 'noldsc' aktiviert. Eventuell sollten Sie zusaetzliche \
+Bibliothekspfade\n zur ld.so.conf hinzufuegen."
+init_errlog=" Konnte die Log-Datei Konfiguration nicht anlegen in \
+/etc/${D_SYSCONFDIR}. Das\n koennte auf schwerwiegende Fehler hindeuten."
+init_fstab="Das Erzeugen von /etc/fstab im Wurzel-Dateisystem des Clients \
+schlug fehl.\n Die Abwesenheit dieser Datei koennte unvorhergesehenes Verhalten \
+der mount-Befehle\n verursachen."
+init_errldcfg=" Aus irgendeinem Grund konnte die Erstellung von ld.so.cache \
+nicht rechtzeitig fertiggestellt\n werden."
+init_infldcfg=" Sie entschieden sich, die Datei /etc/ld.so.cache nicht neu \
+zu erstellen. Das koennte Fehler verursachen\n wenn Bibliotheken installiert \
+werden nachdem diese Datei auf dem Server erstellt wurde."
+init_errlfg=" Die ConfTGZ Quelle war ein lokales Device, welches nicht korrekt \
+eingebunden werden\n konnte. Entweder wurde das falsche Device/Partition \
+angegeben oder das\n Dateisystem ist dem Kernel nicht bekannt."
+init_errcfg="des Clients nicht rechtzeitig beendet\n Sie sollten die Prozess \
+Liste pruefen und die Module, die bis zum jetzigen Zeitpunkt geladen wurden."
+init_errhw=" Aus irgendeinem Grund wurde die Hardware Auto-Konfiguration \
+$init_errcfg"
+init_errsw=" Aus irgendeinem Grund wurde die Software Konfiguration $init_errcfg"
+init_wait=" Wartete $i Schlaege das Kernel Modul Verzeichnis auszuhaengen ..."
+init_errumnt=" Das Kernel Modul Verzeichnis auszuhaengen \
+scheiterte aus irgendeinem Grund. Sind einige\n ,,modprobe'' noch aktiv!?"
+init_erritab=" Die Datei /etc/inittab existiert nicht oder \
+ist keine regulaere. \nSie wird fuer den Boot-Process benoetigt."
+init_errsys=" Aushaengen des Kernel /sys Verzeichnisses schlug aus irgendeinem \
+Grund\n fehl. Sie werden einige Fehlermeldungen bekommen,\
+\ndass einige Dateien nicht entfernt werden konnten."
+init_runinit=" Konnte switch_root/run-init nicht ausfuehren, wegen fehlender \
+Befehle\n oder falsch angegebenen Parametern."
+init_picfg=" Das Plugin-Konfigurationsverzeichnis fehlt. Dieses könnte an einem \
+fehlgeschlagenen\n holen der Client-Konfiguration liegen, weil entweder die \
+Datei nicht auf\n dem Server verfuegbar ist oder der Transport nicht klappte."
+
+# messages from functions
+error_msg="Ein Fehler trat auf waehrend der Ausfuehrung des $0 Skripts:\n\n"
+error_nfe="\n -> Dieser Fehler ist nicht schwerwiegend - setze fort ...\n"
+error_shell="\n -> Fuehre Shell aus zum Debuggen ...\n"
+error_modload="Es schlug fehl, folgendes Modul zu laden:"
+error_modnfs="gebraucht zum einhaengen des Wurzel Dateisystems"
+error_nodhcp=" Sie versuchten ihr System mittels DHCP einzurichten, es wurde \
+aber kein brauchbarer DHCP\n Client gefunden. Bitte pruefen Sie, ob sie einen \
+der folgenden Clients\n installiert haben: dhclient dhcpcd pump udhcpc."
+error_dhcp=" Die folgenden Probleme koennten den Fehler verursachen:\n\
+ * Das af_packet.ko Modul ist weder geladen noch praesent im Kernel.\n\
+ * Kein Netzwerk Geraet ist praesent - weder ein passendes Modul\n\
+ wurde geladen noch ist praesent im laufenden Kernel.\n Sie sollten \
+'lsmod' ausfuehren."
+error_dhclient=" Schwerer Fehler aufgetreten beim Aufrufen von dhclient.\n\
+$error_dhcp"
+error_ldapcfg=" Die Konfiguration via ldap ist noch nicht implementiert."
+error_errdcfg=" Bis jetzt noch keine Konfigurationsdaten bekommen via dhcp .."
+error_errfcfg=" Bis jetzt noch keine Konfigurationsdaten bekommen via tftp ..."
+error_errlcfg=" Bis jetzt noch keine Konfigurationsdaten bekommen via ldap ..."
+unpack_ConfTGZ=" Fehler beim entpacken des ConfTGZ.\nSind Sie sicher, dass es im \
+richtigen Format ist?"
+
+
+# messages from distro functions
+df_errumod=" Das Laden des \"unix\" Moduls schlug fehl. \nWahrscheinlich \
+werden Probleme bei der Hardware-Erkennung auftreten."
+df_errserv="ist entweder nicht installiert oder das Start-Skript ist nicht \
+verfuegbar.\n Deswegen macht der Start des Dienstes keinen Sinn. Bitte \
+deaktivieren Sie den Start\n oder installieren Sie die benoetigten Dateien."
+df_errcron=" Das cron Start-Skript $df_errserv"
+df_errsysl=" Das syslog Start-Skript $df_errserv"
+df_errsshd=" Das sshd Start-Skript $df_errserv"
+df_erryp=" Der NIS-Klient $df_errserv"
+df_erramnt=" Der Automounter $df_errserv"
+df_errnsc=" Der Name Service Zwischenspeicherungs Daemon $df_errserv\n \
+Dieser Dienst koennte nuetzlich sein, um Daten von einem ldap Benutzer-\
+Verzeichnis zu bekommen."
+df_errafsd=" Kein AFS Verzeichnis erreichbar"
+df_errafsn=" Der AFS-Client Dienst ist nicht verfuegbar"
+df_errkbd=" Keine nicht-englische Tastatur und/oder Konsolenunterstuetzung \
+installiert.\n Falls gewuenscht/benoetigt diese im Stage1 nachinstallieren!"
+
+# messages from servconfig
+scfg_nfs=" Das Einhaengen einer NFS Quelle schlug fehl..."
+scfg_ntptz=" Die Zeitzonen-Datei wurde nicht gefunden (gebraucht fuer die \
+NTP-Zeit Dienst Konfiguration)."
+scfg_evmlm=" Das Einbinden der lokalen Festplatte(npartition) des VMware-\
+Image-Verzeichnisses\n schlug fehl."
+scfg_vmdir=" Aus irgendeinem Grund kann das runvmware Skript nicht \
+verfuegbar zu kopieren.\n Das koennte das Ergebnis eines fehlgeschlagenen \
+Mount-Versuchs sein\n oder die Datei fehlt auf dem Server."
+scfg_vmchs=" Das Auswahltool/menu fuer Virtuelle Machinen ist nicht im \
+~/templates\n Verzeichnis vorhanden. Deshalb wurde kein Default KDM Menu \
+Eintrag erzeugt."
+scfg_erradir=" Es wird nur eine Verzeichnis-Ebene erlaubt, den Automounter \
+zu installieren und das\n Verzeichnis sollte existieren (auf dem \
+Server-Export) oder sollte anlegbar sein\n (z.B. durch UnionFS beschreibbares \
+Wurzel-Verzeichnis)."
+scfg_erratpld=" Nur Verzeichnisse hoechster Ebene \
+als Einhaenge-Punkte fuer home\n Verzeichnisse. Bitte setzen Sie die \
+Variable \${automnt_dir} entsprechend in\n der machine-setup Datei."
+scfg_country=" Keine Konfiguration fuer die Lokalisierung gefunden in der \
+Konfigurations-Datei. Benutzer\n Standard Laender-Einstellung \
+'${D_DEFAULTCOUNTRY}' definiert in $0."
+
+# messages from hwautocfg
+hcfg_hwsetup=" Die xserver-Konfigurations-Datei, erstellt von hwsetup, konnte \
+nicht\n gefunden werden."
+gfx_msg="Bitte pruefen Sie ihre Grafik-Adapter-Einstellungen ($hw_graphic)."
+hw_msg=" Bitte pruefen Sie ihre vordefinierten Monitor-Einstellungen ($hw_monitor): \
+Automatische\n Konfiguration des Bildschirms."
+hcfg_res=" $hwmsg Aufloesung wurde versucht aber nicht eingerichtet. Benutze \
+Standard-Aufloesungen (defined in xconfig)"
+hcfg_hwsetup=" Erwartete Informationen von hwsetup in \
+/tmp/hwsetup.info.\n Teile des Systems koennen nicht eingerichtet werden. \
+Bitte pruefen, dass\n hwsetup richtig installiert und ausfuehrbar ist."
+hcfg_keyb=" Keine Einstellungen fuer ihre Tastatur gefunden, verwende den \
+Standard-Wert '${XKEYBOARD}' definiert\n in $0."
+
diff --git a/initramfs/stage3-stuff/init b/initramfs/stage3-stuff/init
new file mode 100755
index 00000000..5fb70550
--- /dev/null
+++ b/initramfs/stage3-stuff/init
@@ -0,0 +1,916 @@
+#!/bin/ash
+# Copyright (c) 2003..2006 - RZ Uni Freiburg
+# Copyright (c) 2006..2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Main script for new type of initial ramdisk for OpenSLX linux stateless
+# clients version 4
+#############################################################################
+
+# fixme: shut down if script fails - this does not really work in case of
+# script crash
+trap "exec (sleep 30; echo o>/proc/sysrq-trigger)" \
+ SIGHUP SIGINT SIGPIPE SIGTERM
+
+# device files get their own filesystem (to be move mounted later)
+devdir="/dev"
+mount -n -t tmpfs -o 'size=25%,mode=0755' initramfsdevs ${devdir}
+
+# mount the important standard directories
+[ ! -f /proc/cpuinfo ] && mount -n -t proc proc /proc
+[ ! -d /sys/class ] && mount -n -t sysfs sysfs /sys
+
+# create basic device files an directories (in dev - for most hardware related
+# devices mdev should handle that)
+for i in "/dev/mem c 1 1" "/dev/null c 1 3" "/dev/zero c 1 5" \
+ "/dev/urandom c 1 9" "/dev/kmsg c 1 11" "/dev/tty0 c 4 0" \
+ "/dev/tty1 c 4 1" "/dev/tty2 c 4 2" "/dev/tty3 c 4 3" \
+ "/dev/tty4 c 4 4" "/dev/tty5 c 4 5" "/dev/tty6 c 4 6" \
+ "/dev/tty7 c 4 7" "/dev/tty8 c 4 8" "/dev/tty9 c 4 9" \
+ "/dev/tty10 c 4 10" "/dev/tty c 5 0" "/dev/console c 5 1" \
+ "/dev/ptmx c 5 2" "/dev/psaux c 10 1" "/dev/agpgart c 10 175" \
+ "/dev/fb0 c 29 0" "/dev/xconsole p"; do
+ mknod $i
+done
+mkdir -p ${devdir}/pts ${devdir}/shm ${devdir}/.udevdb ${devdir}/.udev \
+ ${devdir}/.initramfs /var/log
+
+# start device auto discovery/setup service of busybox
+echo >/etc/mdev.conf
+mdev -s
+
+# source functions file common for all distros, messages contains all error
+# and info output (for some reason the error output is not produced properly
+# - crash)
+
+# how do the localization here? There is not yet a country-Variable
+. /etc/messages
+. /etc/functions || ( echo -e $init_mff && sleep 100 )
+. /etc/distro-functions || ( echo -e $init_dff && sleep 100 )
+
+# configuration settings for this slx system's environment
+. /etc/slxsystem.conf 2>/dev/null || ( echo -e ${init_sscf} && \
+ sleep 100 )
+# initramfs-setup configuration (common initial settings for all clients using
+# a certain InitRamFS generated by slxconfig-demuxer)
+[ -f /etc/initramfs-setup ] && . /etc/initramfs-setup 2>/dev/null
+
+export PATH=/bin:/sbin:/usr/bin/:/usr/sbin
+export date="${slxconf_date}"
+
+export DEBUGLEVEL=0
+export KERNEL="${slxconf_kernver}"
+export NWMODULES="${slxconf_listnwmod}"
+export DISTRO_NAME="${slxconf_distro_name}"
+export DISTRO_VER="${slxconf_distro_ver}"
+export SYSTEM_NAME="${slxconf_system_name}"
+export SLXVERSION="${slxconf_slxver}"
+
+# do not use dnbd cache file
+nodnbdcache="yes"
+
+# set a default LAN interface, might be modified for WLAN or on machines with
+# more than one ethernet card built in
+nwif="eth0"
+
+# load usb modules for keyboard (reenable usb keyboards, otherwise the
+# admin has to wait until second run of hwsetup late in stage3) and the
+# network adaptor modules, search for pci modules to load later on
+hwautocfg base
+
+# if no kernel version is set, try to get it directly from /proc
+if [ -z $KERNEL ] ; then
+ KERNEL=$(cat /proc/version)
+ KERNEL=${KERNEL#*version }
+ KERNEL=${KERNEL% (*) (*}
+fi
+
+# set defaults for some important variables, might be overwritten via
+# kernel commandline
+tmpfssize="50%"
+cowsize="50%"
+rwdir=/dev/shm
+nfsro="nfs"
+
+runinithook '00-started'
+
+# run pre init script and user defined preinit.local, copied by mkdxsinitrd
+# from /var/lib/openslx/config/... in stage2
+preinit
+[ -x /bin/preinit.local ] && /bin/preinit.local
+
+
+# switch off the several configuration methods, will be switched on
+# according to kernel commandline settings
+echo "noldap" > /tmp/ldap-done
+
+# external configuration file retrieval (per tftp) must be done, as otherwise
+# we will never get the initramfs-setup file. By default, we try a predefined
+# standard path (.../tftpboot/client-config/ ...)
+file="yes"
+
+# read kernel commandline
+read KCMDLINE < /proc/cmdline
+export KCMDLINE
+# read the system wide initramfs-setup and then the kernel commandline
+for opts in $(sed "s/#.*//" /etc/initramfs-setup) ${KCMDLINE} ; do
+ case ${opts} in
+ # from IPAPPEND
+ BOOTIF=*)
+ bootmac=$(echo ${opts} | sed "s/.*=01-//;s/-/:/g")
+ ;;
+ # localization
+ country=*)
+ COUNTRY=${opts#country=}
+ grep -q -E "country=" /etc/initramfs-setup &&
+ echo -e "\n# localization information gotten via kernel command line \
+in $0\ncountry=\"${COUNTRY}\"" >>/etc/initramfs-setup
+ ;;
+ # single token for debugging ...
+ debug)
+ DEBUGLEVEL=1
+ ;;
+ # ... or a specified debug level
+ debug=*)
+ DEBUGLEVEL=${opts#debug=}
+ [ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 20 ] && \
+ echo "** SLX init started near $(sysup)"
+ ;;
+ # essid for WLAN boot (experimental, might be moved to a module component
+ # in later versions
+ essid=*)
+ essid=${opts#essid=}
+ ;;
+ # if configuration should not be gathered by dhcp client
+ nodhcp)
+ nodhcp="yes"
+ echo "nodhcp" >/tmp/dhcp-done
+ ;;
+ nofile)
+ unset file
+ echo "nofile" >/tmp/file-done
+ ;;
+ # if ldap configuration should be triggered
+ ldap)
+ ldap="yes"
+ rm /tmp/ldap-done
+ ;;
+ # ldap configuration with host and port to contact (base)
+ ldap=*)
+ ldap="yes"
+ rm /tmp/ldap-done
+ ;;
+ # file source with tftp server and file location on the server
+ file=*|file)
+ if [ "${opts}" != "file" ] ; then
+ fileprot=$(uri_token ${opts#file=} prot)
+ fileserv=$(uri_token ${opts#file=} server)
+ filepath=$(uri_token ${opts#file=} path)
+ fi
+ ;;
+ # if ld.so.cache should be generated; should be switched on when composing
+ # rootfs from more than one source
+ ldsc)
+ ldsc="yes";;
+ # simple union of base ro rootdir with tempfs on top
+ unionfs)
+ unionfs=1;;
+ # additional source to unify root filesystem with; the top layer will be
+ # the tempfs
+ unionfs=*)
+ unionfs=1
+ uniondirs=${opts#unionfs=}
+ # most probably it is a good idea to run ldconfig, so enable it
+ ldsc="yes"
+ ;;
+ # same for AUFS; alternative to unionfs
+ aufs)
+ aufs=1;;
+ aufs=*)
+ aufs=1
+ uniondirs=${opts#aufs=}
+ # most probably it is a good idea to run ldconfig, so enable it
+ ldsc="yes"
+ ;;
+ # if cowloop should be used, only ontop of network block device and in
+ # combination with classical fs, like ext2 useful
+ cowloop=*)
+ cowloop=1
+ #cowsize=${opts#cowloop=}
+ ;;
+ # rootfs will void the variables (d)nbdroot, nfsroot ...
+ # fixme: allow multiple rootfs sources to be unioned!?
+ # if strinstr " " "$rootfs" ...
+ rootfs=*)
+ rootfs=${opts#rootfs=}
+ rootfs=${rootfs#\"}
+ rootfs=${rootfs%%\"}
+ srvproto=$(uri_token $rootfs prot)
+ case $srvproto in
+ nfs)
+ # nfsroot consists now of two different parts
+ nfspath=$(uri_token $rootfs path)
+ nfsserver=$(uri_token $rootfs server)
+ grep -q -E "nfsserver" /etc/initramfs-setup || \
+ echo -e "# nfs root information gotten via kernel command \
+line in $0\nnfsserver=\"${nfsserver}\"\nnfspath=\"${nfspath}\"" \
+ >>/etc/initramfs-setup
+ ;;
+ *nbd*)
+ bldmod=$srvproto
+ # get settings for nbd-client, filesystem equals to path in URI
+ # notation (remove leading slash from filesystem at the end)
+ bldhost=$(uri_token $rootfs server)
+ bldport=$(uri_token $rootfs port)
+ bldrfst=$(uri_token $rootfs path)
+ bldrfst=${bldrfst#/*}
+ ;;
+ aoe)
+ echo "Not implemented yet"
+ bldmod=
+ ;;
+ iscsi)
+ echo "Not implemented yet"
+ bldmod=
+ #iscsiserver=$(uri_token $rootfs server)
+ #iscsiport=$(uri_token $rootfs port)
+ #iscsitarget=$(uri_token $rootfs path)
+ ;;
+ lbdev)
+ # use a local device for mounting root block device with given
+ # filesystem, e.g. rootfs=lbdev://sda2/squashfs
+ bldmod="sata_sil sd_mod"
+ blddev=$(uri_token $rootfs server)
+ bldfst=$(uri_token $rootfs path)
+ bldfst=${bldfst#/*}
+ ;;
+ esac
+ ;;
+ # size of cache dnbd should use within ram
+ dcsize=*)
+ dnbdcachesize=${opts#dcsize=};;
+ # ip configuration client-ip:server-ip:gateway:netmask
+ ip=*)
+ ipinfo=${opts#ip=};;
+ # deprecated: nfs server and path (will be removed soon)
+ nfsroot=*)
+ nfsroot=${opts#nfsroot=}
+ echo -e "\n# nfs root information gotten via kernel command line in \n\
+$0\n# deprecated: please use rootfs=nfs://...\nnfsroot=\"${nfsroot}\"\n" \
+>> /etc/initramfs-setup
+ ;;
+ # size of tempfs if not max. 50% of RAM should be used
+ tmpfssize=*)
+ tmpfssize=${opts#tmpfssize=};;
+ # vendor code identifier for dhcp requests, that way OpenSLX clients could
+ # be distinguished from other (dhcp) clients
+ vci=*)
+ vci=${opts#vci=};;
+ xenbr)
+ xenbr=1;;
+ esac
+done
+
+runinithook '05-have-kernelvars'
+
+# at this point a timer should be started to ensure an automated reboot
+# or halt of the machine if SLX init does not succeed (e.g. missing kernel
+# module for the network adaptor)
+if [ ${DEBUGLEVEL} -lt 3 -o ${DEBUGLEVEL} = 8 ] ; then
+ cat<<EOF > /bin/watchdog
+#!/bin/ash
+echo \$$ > /tmp/watchdogpid
+[ ! -f /proc/version ] && mount -n -t proc proc /proc
+sleep 120 2> /dev/null
+echo "o" > /proc/sysrq-trigger
+EOF
+ chmod u+x /bin/watchdog
+ watchdog &
+fi
+
+# check if at least one type of IP configuration is availabe
+if [ -n "$nodhcp" -a -z "$ldap" -a -z "$ipinfo" -a $srvproto != "lbdev" ]
+ then echo -e "# You did not specify any advanced configuration mode for \
+your clients. You\n# might want to add the token 'dhcp' for DHCP config, \
+'file(=source)'\n# for config file get via TFTP or 'ldap(=source)' for LDAP \
+configuration to\n# your kernel command line." >> /etc/initramfs-setup
+ if strinfile "clientip" /etc/initramfs-setup ; then
+ # IP configuration seems to be present in initramfs-setup file
+ # TODO: FIX this, as it will clobber all kernel-cmdline values!
+ . /etc/initramfs-setup
+ ipinfo="ip=$clientip:$serverip:$gateway:$subnet_mask"
+ else
+ error "$init_errip"
+ fi
+fi
+
+# for ldap configuration at least basic IP setup is needed to contact the
+# server
+[ -n "$nodhcp" -a -n "$ldap" -a -z "$ipinfo" ] && error "$init_errldap"
+# set debug level and logfile
+if [ $DEBUGLEVEL -eq 20 ] ; then
+ echo "** Setting debuglevel to ${DEBUGLEVEL} at $(sysup)"
+elif [ $DEBUGLEVEL -ne 0 ] ; then
+ echo "Setting debuglevel to ${DEBUGLEVEL}"
+fi
+export MODPRV=" "
+export LOGFILE
+if [ "${DEBUGLEVEL}" -gt 0 -a "${DEBUGLEVEL}" != 8 ] ; then
+ # set LOGFILE and move it later on into stage4
+ LOGFILE="/var/log/slx-boot.log"
+ echo "Starting OpenSLX client boot logging at $(date)" >$LOGFILE
+ echo "1 4 1 7" >/proc/sys/kernel/printk
+ [ "${DEBUGLEVEL}" -ge 2 ] && MODPRV="-v"
+ [ "${DEBUGLEVEL}" -gt 3 -a "${DEBUGLEVEL}" -le 10 ] && {
+ set -x
+ # and the kernel too
+ echo "7 7 7 7" >/proc/sys/kernel/printk; }
+ [ "${DEBUGLEVEL}" -gt 10 -a "${DEBUGLEVEL}" -le 20 ] && set +x
+else
+ # switch off most of kernel debug output
+ echo "0 0 0 0" >/proc/sys/kernel/printk
+ # modprobe should stay quiet
+ MODPRV="-q"
+ LOGFILE="/dev/null"
+ # redirect console (after /dev/null is available, and /dev mounted)
+ #[ "${DEBUGLEVEL}" != 8 ] && exec < /dev/console > /dev/null 2>&1
+fi
+
+# check for WLAN specific settings and check for multiple ethernet interfaces
+# (we have at least the mac of PXE boot in bootmac)
+if [ -n "${essid}" ] ; then
+ # WLAN setup will most probably change the network interface name stored in
+ # nwif (to wlan0 or something like that)
+ wlanlinksetup
+ #echo "Starting shell for testing of WLAN setup procedure"
+ #/bin/ash
+else
+ # check here for the active ethernet link
+ for ethif in eth0 eth1 eth2 eth3 ; do
+ macaddr=$(ip link show dev $ethif 2>/dev/null | \
+ sed -n "/ether [0-9e-f]\{2\}:.*/p" | sed -e "s/.*ether //;s/ .*//")
+ # if there is no bootmac present in kernel commandline any checks are
+ # useless
+ if [ -z "$bootmac" ] ; then
+ bootmac="$macaddr"
+ error "$init_bootmac" nonfatal
+ fi
+ if [ "$macaddr" = "$bootmac" ] ; then
+ nwif=$ethif
+ break
+ elif [ "x$macaddr" = "x" ] ; then
+ # if the macaddr is empty on the first interface tried, there is no
+ # network adaptor visible (missing kernel module)
+ if [ "$ethif" = "eth0" ] ; then
+ error "$init_errnwad"
+ else
+ # assume a forcedeth problem here (nonmatching MACs)
+ error "$init_nveth" nonfatal
+ macaddr=${bootmac}
+ fi
+ break
+ fi
+ done
+fi
+
+# set up loopback networking
+[ $DEBUGLEVEL -eq 20 ] && echo "** starting ip config at $(sysup)"
+ip link set dev lo up 2>/dev/null
+ip addr add 127.0.0.1/8 dev lo 2>/dev/null
+ip link set dev $nwif up 2>/dev/null || error "$init_noeth"
+
+# XEN bridge config (fixme: should be moved to plugin a special hook might be
+# needed at this point)
+[ -n "$xenbr" ] && xenbr_config
+
+# analyze ip information from the kernel command line and put parts
+# of it into several variables
+if [ -n "$ipinfo" ] ; then
+ getip () {
+ local val="$ipinfo:"; i=$(($1 - 1));
+ while [ $i -gt 0 ] ; do
+ val=${val#*:} ; i=$(($i - 1));
+ done;
+ echo $val|sed "s/:.*//"; }
+ clientip=$(getip 1)
+ serverip=$(getip 2)
+ gateway=$(getip 3)
+ subnet_mask=$(getip 4)
+ echo -e "# ip configuration written by $0 script:\nclientip=$clientip\n\
+subnet_mask=$subnet_mask\ngateway=$gateway\nserverip=$serverip" \
+ >>/etc/initramfs-setup
+ # set static ip address
+ ip addr add $clientip/$(ipcalc -s -p $clientip $subnet_mask|sed s/.*=//) \
+ dev $nwif 2>/dev/null
+ ip route add default via $gateway 2>/dev/null
+else
+ noipyet="yes"
+fi
+# get configuration data via dhcp (with vendor code identifier if present
+# in ${vci} from kernel command line or initramfs-setup) ...
+[ -z "$nodhcp" ] && ( rundhcp ${vci}
+ waitfor /tmp/confviadhcp 20000
+ echo "dhcp finished at $(sysup)" >/tmp/dhcp-done
+ . /tmp/confviadhcp
+ if [ -n "$noipyet" ] ; then
+ # by now there should be a proper ip configuration present
+ if [ -z "$clientip" -o -z "$subnet_mask" -o -z "$gateway" \
+ -o -z "$broadcast_address" ] ; then
+ error "$init_errdhcp"
+ else
+ { ip addr add $clientip/$(ipcalc -s -p $clientip $subnet_mask) \
+ broadcast $broadcast_address dev $nwif 2>/dev/null && \
+ ip route add default via $gateway 2>/dev/null; } || \
+ error "$init_erripcfg"
+ fi
+ # fixme: to be checked!!
+ # else
+ # if [ -n "$file" -a "$srvproto" = "lbdev" ] ; then
+ # error "$init_erripcfg" nonfatal
+ # else
+ # error "$init_erripcfg"
+ # fi
+ # fi
+ fi; ) &
+# check if serverip is set as variable @@@serverip@@@
+sed "s,@@@serverip@@@,$serverip," -i /etc/initramfs-setup
+[ $DEBUGLEVEL -eq 20 ] && echo "** finished ip config at $(sysup)"
+# on some network adaptors we need to wait for the link to come up
+dmesg | grep -q "link down" && for i in 1 1 1 1 ; do
+ dmesg | grep -q "link up" && break
+ [ $DEBUGLEVEL -ge 1 ] && echo "network: waited half a second for the \
+link to come up" >>$LOGFILE
+ sleep $i
+done
+# ... or ldap if available (in background)
+[ -n "$ldap" ] && ldapconf &
+# ... or via (t)ftp/http file get (in background)
+[ -n "$file" ] && fileget &
+
+runinithook '15-have-ip-config'
+
+# if root filesystem should be imported via local or a network block device
+if [ -n "${bldmod}" ] ; then
+ # load block device driver(s) if needed
+ for module in ${bldmod} ; do
+ modprobe ${MODPRV} ${module} || error "$init_errbld"
+ done
+ [ -x /bin/mdev ] && mdev -s
+ [ -z "$bldrfst" ] && bldrfst=squashfs
+ bldhost=$(checkip $bldhost)
+ if [ $DEBUGLEVEL -eq 20 ] ; then
+ echo "** starting setup of ${bldmod} at $(sysup)"
+ else
+ echo "Stateless client using ${bldmod} on $bldhost:$bldport with $bldrfst"
+ fi
+ # fixme: check for fs in /proc/filesystems before trying to load the module
+ modprobe ${MODPRV} ${bldrfst} || error "$init_errbld" nonfatal
+
+ case "${srvproto}" in
+ # network block device present in standard kernel
+ nbd)
+ RDEV=/dev/nbd0
+ waitfor "${RDEV}" 20000 || error "$init_nbddev"
+ i=0
+ while ! nbd-client $bldhost $bldport ${RDEV} ; do
+ usleep 100000
+ i=$(($i + 1))
+ if [ $i -ge 1000 ] ; then
+ error "$init_nbds"; break
+ fi
+ done
+ usleep 100
+ echo deadline > /sys/block/nbd0/queue/scheduler
+ # echo "32" > /sys/block/nbd0/queue/read_ahead_kb
+ ;;
+ # dnbd2 by Vito Di Leo
+ dnbd2)
+ RDEV=/dev/vnbd0
+ waitfor "${RDEV}" 20000 || error "$init_nbddev"
+ # quickhack, should be read in from URI
+ echo 1 > /sys/block/vnbd0/config/vid
+ echo 1 > /sys/block/vnbd0/config/rid
+ # check for others in initramfs-setup and then kernel cmdline
+ rootfs="$(sed -n "/rootfs=/p" /etc/initramfs-setup| \
+ sed "s,rootfs=,,;s,\",,g") "
+ [ "$rootfs" = " " ] && \
+ rootfs="$(cat /proc/cmdline|sed "s,.*rootfs=\",,;s,\".*,,") "
+ i=0
+ # assume no more than 16 different dnbd2 servers (default 4)
+ while [ "x$bldhost" != "x" -a $i -lt 16 ]; do
+ #echo "I: $i R: $rootfs P:$bldport H:$bldhost"
+ echo $bldhost $bldport > /sys/block/vnbd0/server${i}/sock
+ i=$(($i + 1))
+ rootfs=${rootfs#* }
+ bldsp=$(echo ${rootfs}|sed "s, .*,,")
+ bldhost=$(uri_token $bldsp server)
+ bldport=$(uri_token $bldsp port)
+ done
+ # the cfq scheduler seem not a good idea here
+ echo deadline > /sys/block/vnbd0/queue/scheduler
+ # needed for some reason to settle initialization
+ sleep 1
+ i=0
+ while [ $(cat /sys/block/vnbd0/config/running) != 1 ] ; do
+ usleep 100000
+ echo 1 > /sys/block/vnbd0/config/running
+ i=$(($i + 1))
+ if [ $i -ge 50 ] ; then
+ error "$init_dnbd2s"; break
+ fi
+ done
+ echo "64" > /sys/block/vnbd0/queue/read_ahead_kb
+ ;;
+ # dnbd by Thorsten Zitterell
+ dnbd)
+ # quickhack
+ RDEV=/dev/dnbd0
+ if [ -z $nodnbdcache ] ; then # variable not really used yet
+ mkdir /dnbd
+ mount -n -o 'size=10%' -t tmpfs tmpfs /dnbd
+ ( cat /dev/zero > /dnbd/cache 2>/dev/null || echo "ok" >/tmp/cache ) &
+ clientopt="-c /dnbd/cache"
+ waitfor /tmp/cache 10000
+ fi
+ [ $(echo $bldhost|sed "s,\..*,,") -ge 224 ] && \
+ ip route add 224.0.0.0/4 dev $nwif
+ waitfor /dev/dnbd0 10000 || error "$init_nbddev"
+ echo "dnbd-client -b $bldhost -d $RDEV $clientopt"
+ while ! dnbd-client -b $bldhost -d $RDEV $clientopt ; do
+ usleep 10000
+ done
+ # problem with squashfs and cfq scheduler
+ echo noop > /sys/block/dnbd0/queue/scheduler
+ echo 0 > /sys/block/dnbd0/queue/read_ahead_kb
+ ;;
+ lbdev)
+ # using clients local block device (disk partition is to be specified)
+ RDEV=/dev/$blddev
+ ;;
+ esac
+ RWRO="ro"
+ if [ -n "${cowloop}" -a -x /bin/cowdev ] ; then
+ modprobe ${MODPRV} cowloop || {
+ error "$init_loadcow" nonfatal
+ unset cowloop; }
+ [ -x /bin/mdev ] && mdev -s
+ fi
+ if [ -n "${cowloop}" ] ; then
+ if [ -n "${unionfs}" -o -n "${aufs}" ] ; then
+ error "$init_cownobld"
+ unset unionfs aufs
+ fi
+ echo "Using Copy-on-Write block device for rw access"
+ mount -n -t tmpfs -o size=${cowsize} ramfs ${rwdir}
+ mkdir /dev/cow && mknod /dev/cow/ctl b 241 255
+ usleep 200
+ ln -s /dev/cowloop0 /dev/cow/0
+ # fixme - cowdev depending on blockdev choosen above ...
+ cowdev -a /dev/nbd0 ${rwdir}/nbd.cow
+ usleep 200
+ RWRO="rw"
+ RDEV=/dev/cow/0
+ # run ldconfig if not switched off via kernel command line
+ ldcfg
+ else
+ # use normal UnionFS behaviour because rootfs is not NFS
+ unset nfsro
+ fi
+ # finally mount the configured network/local block device
+ for i in 0 5000 20000 100000 500000 1000000 ; do
+ usleep $i
+ mount -n -t $bldrfst -o $RWRO $RDEV /mnt 2>/dev/null && break
+ done
+ [ $DEBUGLEVEL -eq 20 ] && echo "** finished blockdev setup stuff at $(sysup)"
+elif [ -n ${iscsiserver} ] ; then
+ [ $DEBUGLEVEL -eq 20 ] && echo "** started setting up iSCSI initiator at \
+$(sysup)"
+ #if [ -n ${iscsitarget} ] ; then
+ # echo "InitiatorName=${iscsitarget}"|sed "s,@@@serverip@@@,$serverip," \
+ # >/etc/initiatorname.iscsi
+ #else
+ # discovery
+ #fi
+ #echo -e "node.startup = automatic">/etc/iscsid.conf
+ #iscsid -c /etc/iscsid.conf
+ # the cowloop part has to be moved (option for iscsi devices too)
+ # and should be generalized for nbd, dnbd, iscsi
+fi
+
+# if no type of root filesystem is passed via kernel command line try
+# information gathered from dhcp process (only valid for nfs)
+if [ -z "${bldmod}" -a -z "${bldhost}" -a -z "${nfsserver}" ] ; then
+ # information has to be read from dhcp and ldap configuration
+ # cfgcomplete merges all configuration files
+ cfgcomplete
+fi
+
+# mount nfs rootfs
+if [ -z "${bldmod}" -a -z "${bldserver}" ] ; then
+ [ $DEBUGLEVEL -eq 20 ] && echo "** started nfs mount"
+ # read in extended initramfs-setup
+ . /etc/initramfs-setup
+ # prefer nfsserver and nfspath from kernel commandline over the information
+ # gotten from dhcp server
+ if [ -n "${nfsserver}" -a -n "${nfspath}" ] ; then
+ # load the nfs module if needed
+ nfsmod
+ # check if nfsserver is set as variable @@@serverip@@@
+ nfsserver=$(checkip $nfsserver)
+ nfsroot=${nfsserver}:${nfspath}
+ else
+ # we got a problem here
+ error "$init_nfssp" fatal
+ fi
+ for proto in tcp udp fail; do
+ [ $proto = "fail" ] && { error "$init_nfs"; break; }
+ mount -n -t nfs -o ro,nolock,${proto} ${nfsroot} /mnt && break
+ done
+ [ $DEBUGLEVEL -eq 20 ] && echo "** finished nfs mount at $(sysup)"
+fi
+
+runinithook '20-have-network-root'
+
+# get the complete collection of kernel modules available
+mount -n --bind /mnt/lib/modules/${KERNEL} /lib/modules/${KERNEL} || \
+ 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
+ echo "You can run 'hwautocfg main &' manually now ..."
+ /bin/ash
+else
+ [ $DEBUGLEVEL -eq 20 ] && echo "** started hwautocfg in background at \
+$(sysup)"
+ hwautocfg main &
+fi
+
+runinithook '25-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
+fi
+
+# setup of client root filesystem dependent on the availability of UnionFS
+if [ -n "${unionfs}" -o -n "${aufs}" ] ; then
+ echo "Using ${union_type} for rw access"
+ mkdir -p ${rwdir}/union ${rwdir}/uniontmp /rorootfs
+ mount -n -t tmpfs none ${rwdir}/uniontmp
+ # hack for handling unionfs with patched run-init
+ mount -n --move /mnt /rorootfs
+ if [ "$union_type" == "UnionFS" ]; then
+ mount -n -t unionfs -o dirs=${rwdir}/uniontmp:/rorootfs=${nfsro}ro \
+ none /mnt
+ elif [ "$union_type" == "AUFS" ]; then
+ mount -n -t aufs -o br:/${rwdir}/uniontmp:/rorootfs=ro none /mnt
+ fi
+ mkdir -p /mnt/uniontmp
+ mount -n --move ${rwdir}/uniontmp /mnt/uniontmp
+ chmod 0755 /mnt/uniontmp /mnt
+ # run ldconfig if switched on via kernel command line (token ldsc) or
+ # triggered by unionized root filesystem
+ ldcfg
+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
+ mkdir -p ${rwdir}/${path} >/dev/null 2>&1
+ mount -n --bind ${rwdir}/${path} /mnt/${path}
+ [ ${DEBUGLEVEL} -gt 1 -a ${DEBUGLEVEL} != 8 ] && \
+ echo "Created ${rwdir}/${path} and mounted it to /mnt/$path"
+ done
+ # see above ...
+ ldcfg
+ # save the RO directories mentioned in the distro-specific
+ # config to a temporary directory. They will later on be restored
+ for path in ${D_RODIRSINRW}; do
+ if [ -d /mnt/${path} ] ; then
+ list="${path} ${list}"
+ # exclude them from etc copy process too
+ echo "${path}/*"|sed -e "s,/root/,,;s,^/,," >>/tmp/etc.exclude
+ mkdir -p /root/${path} >/dev/null 2>&1
+ mount -n --bind /mnt/${path} /root/${path} >/dev/null 2>&1
+ fi
+ done
+ for path in /etc/${D_SYSCONFDIR} ${D_DIRINBINDMNT} ${list}; do
+ mkdir -p ${rwdir}/${path}
+ done
+ testmkd ${rwdir}/var/tmp 1777
+ # exclude all sysv runlevel link stuff
+ for i in ${D_RCDIRS} ${D_INITBOOTD} ; do
+ echo "*$i/*" >>/tmp/etc.exclude
+ done
+ # add list of files to be excluded and common excludes to the filter list
+ echo -e "${D_ETCEXCL}\n*~\n*.old\n*-\nxorg.conf*" >>/tmp/etc.exclude
+ # if ld.so.cache is to be generated then do not copy the file
+ [ -n "${ldsc}" ] && echo -e "ld.so.cache*" >>/tmp/etc.exclude
+ # for tar exclude lists might be used, more difficult for cp
+ cd /mnt
+ tar -X /tmp/etc.exclude -cp etc/*|tar -xp -C ${rwdir} 2>/dev/null
+ cd /
+ mount -n --bind ${rwdir}/etc /mnt/etc
+ mount -n --bind ${rwdir}/var /mnt/var
+ # get the "covered" mounts back into filesystem structure
+ for path in ${list}; do
+ mount -n --move /root/$path /mnt/$path #>>$LOGFILE 2>&1
+ done
+ #rm -rf /root/* >/dev/null 2>&1
+ # run some specific stuff !?
+fi
+
+runinithook '50-have-layered-fs'
+
+# script for stuff to execute during early bootup
+d_mkrlscript init boot.slx "Running configuration postponed from InitRamFS"
+echo "fs complete at $(sysup)" >/tmp/fscmpl
+
+# write debug file information after filesystem setup completed
+echo -e "# /etc${D_SYSCONFDIR}/logfile - file created by $0 (initramfs \
+from $date)\n#\n# logfile \
+for linux diskless client specific debugging output\nLOGFILE=\"$LOGFILE\"\n#\
+\n# debug level\nDEBUGLEVEL=\"$DEBUGLEVEL\"" \
+ > /mnt/etc/${D_SYSCONFDIR}/logfile || error "$init_errlog"
+
+# run distribution independent and dependent configuration of files and
+# services (offer debug shell in runlevel 22)
+if [ ${DEBUGLEVEL} = 22 ] ; then
+ /bin/ash
+else
+ servconfig &
+fi
+
+for path in @@@COMDIRINDXS@@@ ${D_DIRINDXS} ${D_DIRINBINDMNT} ; do
+ testmkd /mnt/${path}
+done
+# Needed writable subdirs nested in readonly subdirs of writable one
+for path in ${D_RWDIRSINRO}; do
+ mount -n -t tmpfs none /mnt/${path}
+done
+for i in /var/run/utmp /var/log/wtmp /var/log/lastlog /etc/mtab ; do
+ echo -n > /mnt/$i
+done
+chown 65534:0 /mnt/var/lib/nobody
+# /proc/bus/usb might be deprecated in newer kernels ...
+echo -e "# /etc/fstab - file generated by $0 (initramfs from $date)\n#\
+\tOpenSLX Project, info@openslx.com\n\nrootfs\t\t/\t\trootfs\t\tro\t\t 0 0\n\
+proc\t\t/proc\t\tproc\t\tdefaults\t 0 0\ninitramdevs\t/dev\t\ttmpfs\
+\t\trw\t\t 0 0\ndevpts\t\t/dev/pts\tdevpts\t\tmode=0620,gid=5\t 0 0" \
+ >/mnt/etc/fstab || error "$init_fstab"
+echo -e "rootfs / rootfs rw 0 0\ninitramdevs /dev tmpfs rw\
+ 0 0" > /mnt/etc/mtab
+
+# copy library cache if generated
+if [ -n "${ldsc}" ] ; then
+ # creating library cache takes a while ...
+ if waitfor /tmp/ldcfg 50000 ; then
+ test -s /mnt/tmp/ld.so.cache && \
+ mv /mnt/tmp/ld.so.cache /mnt/etc/ld.so.cache
+ else
+ error "$init_errldcfg"
+ fi
+else
+ error "$init_infldcfg" nonfatal
+fi
+
+runinithook '60-have-servconfig'
+
+# wait a while for hardware setup to complete and start cleanup procedure
+[ $DEBUGLEVEL -gt 1 ] && echo "Waiting for hwautocfg to finish ..."
+waitfor /tmp/hwcfg 20000 || error "$init_errhw"
+hwautocfg finish &
+
+# wait a while for services setup to complete
+[ $DEBUGLEVEL -gt 1 ] && echo "Waiting for servconfig to finish ..."
+waitfor /tmp/svcfg 10000 || error "$init_errsw"
+# IP configuration is complete and should not be updated automatically
+killall -9 udhcpc 2>/dev/null
+
+# if uniondirs is not set yet, maybe the unions were given via initramfs-setup
+if [ -z "$uniondirs" ]; then
+ if [ "$union_type" == "AUFS" ]; then
+ # does it contain "://"?
+ if [ "$aufs" != "${aufs#*://}" ]; then
+ uniondirs="$aufs"
+ fi
+ elif [ "$union_type" == "UnionFS" ]; then
+ # does it contain "://"?
+ if [ "$unionfs" != "${unionfs#*://}" ]; then
+ uniondirs="$unionfs"
+ fi
+ fi
+fi
+# if locations are given that should be unioned with the fs root, do it
+if [ -n "$uniondirs" ]; then
+ include_in_fsroot_union "$union_type" "$uniondirs"
+fi
+
+runinithook '70-before-plugins'
+
+# check for any plugin-specific runlevel scripts and run them, if found:
+if [ ${DEBUGLEVEL} = 25 ] ; then
+ /bin/ash
+else
+ if [ -d /etc/plugin-init.d ]; then
+ for plugin_starter in /etc/plugin-init.d/*.sh; do
+ if [ -e $plugin_starter ]; then
+ [ $DEBUGLEVEL -gt 0 ] \
+ && echo "Running plugin starter $plugin_starter ..."
+ [ $DEBUGLEVEL -eq 15 ] \
+ && sed '/^#!/ a\\set -x' -i $plugin_starter
+ . $plugin_starter >>/tmp/plugin_starter 2>&1
+ fi
+ done
+ fi
+fi
+
+runinithook '80-after-plugins'
+
+# create links for initial stage4 boot scripts
+initial_boot
+
+runinithook '85-have-initial-boot'
+
+# post init for some distro specific
+postinit
+[ -s /initramfs/postinit.local ] && {
+ mv /initramfs/postinit.local /bin/postinit.local;
+ chmod u+x /bin/postinit.local; }
+[ -f /bin/postinit.local ] && {
+ [ $DEBUGLEVEL -gt 0 ] && \
+ echo "Running postinit.local - if boot stops here, check the script!"
+ /bin/postinit.local; }
+
+# start a debug shell in higher debug levels
+[ $DEBUGLEVEL -gt 2 -a $DEBUGLEVEL != 8 ] && /bin/ash
+
+runinithook '90-postinit-done'
+
+# unmount the bind mounted modules directory
+export ticks
+for ticks in 0 1 2 5 10 20 30; do
+ sleep $ticks && umount -n /lib/modules/${KERNEL} 2>/dev/null && break
+ error "$init_wait" nonfatal
+done
+
+mount 2>/dev/null | grep -q /lib/modules/${KERNEL} && 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
+d_mkrlscript close boot.slx ""
+# put /tmp into stage4 mtab and add stuff to stage4 fstab
+sed -n "s,/mnt,,;/\/tmp /p" /proc/mounts >> /mnt/etc/mtab
+[ -f /tmp/fstab ] && cat /tmp/fstab >> /mnt/etc/fstab
+# preparations to leave initramfs - umounting ...
+umount -n /sys || error "$init_errsys" nonfatal
+umount -n /proc/bus/usb >/dev/null 2>&1
+chmod 1777 /mnt/dev/shm /mnt/tmp /mnt/tmp/scratch 2>/dev/null
+mount -n --move /dev /mnt/dev
+
+runinithook '95-cleanup'
+
+# kill hwautocfg, servconfig
+killall -9 hwautocfg servconfig 2>/mnt/dev/null
+# runtimer
+[ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 20 ] && \
+ echo "** SLX init ended near $(sysup)"
+# kill the watchdog (autopoweroff, if stage3 init never finishes)
+[ -f /tmp/watchdogpid ] && kill $(cat /tmp/watchdogpid) 2>/mnt/dev/null
+# move logfile into stage4 filesystem (if exists)
+[ -f /var/log/slx-boot.log ] && mv /var/log/slx-boot.log \
+ /mnt/var/log/slx-s3boot.log
+
+# unmount /proc and unset all old,unneeded environment variables
+umount -n /proc
+unset client debug date initrd ip bldroot nfsroot rootfs ticks vci vga
+unset BOOT_IMAGE KCMDLINE KERNEL MODPRV NWMODULES OLDPWD UDEVD_EVENT_TIMEOUT \
+ SLXVERSION UDEVD_EXPECTED_SEQNUM PATH
+
+runinithook '99-handing-over'
+
+# new style of pivoting (switch_root or run-init)
+exec /bin/switch_root -c dev/console /mnt /sbin/init || error "$init_runinit"