summaryrefslogtreecommitdiffstats
path: root/src/initramfs/stage3-stuff/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/initramfs/stage3-stuff/bin')
-rwxr-xr-xsrc/initramfs/stage3-stuff/bin/dhcpmkconfig47
-rwxr-xr-xsrc/initramfs/stage3-stuff/bin/hwautocfg299
-rwxr-xr-xsrc/initramfs/stage3-stuff/bin/init-wrapper60
-rwxr-xr-xsrc/initramfs/stage3-stuff/bin/servconfig308
4 files changed, 714 insertions, 0 deletions
diff --git a/src/initramfs/stage3-stuff/bin/dhcpmkconfig b/src/initramfs/stage3-stuff/bin/dhcpmkconfig
new file mode 100755
index 00000000..fa01db75
--- /dev/null
+++ b/src/initramfs/stage3-stuff/bin/dhcpmkconfig
@@ -0,0 +1,47 @@
+#!/bin/sh
+# Copyright (c) 2003..2006 - RZ Uni Freiburg
+# Copyright (c) 2006..2010 - 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
+
+# script started twice by udhcpc, quit fast if no ip configuration present
+[ -z "$ip" ] && exit 0
+
+# 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 HOME IFS KCMDLINE DEBUGLEVEL MODPRV TERM BOOTIF BOOT_IMAGE \
+ infomsg mask lease interface cfgmsg cfgfile boot_file no_bootsplash
+# set the broadcast address if not delivered by dhcp
+[ -z "$broadcast" ] && \
+ broadcast=$(ipcalc -b $ip/$subnet|sed s/.*=//)
+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 "s,nissrv,nis_servers,;s,nisdomain_name,nis_domain," \
+ -e "s,wins,netbios_name_servers,;/OPTIND.*/d" >>/tmp/confviadhcp
+
+# generate a local /etc/resolv.conf (might overwrite the version from preboot)
+[ -n "$domain" ] && echo -e "search $domain\n" >/etc/resolv.conf
+test -n "$dns" && {
+ for name in $dns; do
+ echo nameserver $name >>/etc/resolv.conf;
+ done; }
+
diff --git a/src/initramfs/stage3-stuff/bin/hwautocfg b/src/initramfs/stage3-stuff/bin/hwautocfg
new file mode 100755
index 00000000..1f02892e
--- /dev/null
+++ b/src/initramfs/stage3-stuff/bin/hwautocfg
@@ -0,0 +1,299 @@
+#!/bin/sh
+# Copyright (c) 2003..2006 - RZ Uni Freiburg
+# Copyright (c) 2006..2010 - 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/sh" >${tool}
+ chmod u+x ${tool}
+done
+# no kernel messages, switch on hotplug via /sbin/mdev
+echo "0 0 0 0" >/proc/sys/kernel/printk
+echo "/sbin/mdev" >/proc/sys/kernel/hotplug
+modprobe -a ${MODPRV} usbhid hid-bright 2>/dev/null &
+# check from vga= that the traditional framebuffer is needed e.g. for splashy
+# get information on the graphics adaptor if bootsplash or xserver plugins are
+# present and the new drm/kms infrastructure is present
+if strinfile "vga=" /proc/cmdline; then
+ ( modprobe -a vesafb fbcon 2>/dev/null
+ hwinfo --gfxcard >/etc/hwinfo.gfxcard ) &
+elif [ -e /etc/init-hooks/00-started/xserver.sh -o \
+ -e /etc/init-hooks/05--have-kernelvars/bootsplash.sh ] && \
+ [ -e /lib/modules/${KERNEL}/kernel/drivers/gpu ]; then
+ # check for the standard modules (single gpu, multiple connector only)
+ ( hwinfo --gfxcard >/etc/hwinfo.gfxcard
+ case $(cat /etc/hwinfo.gfxcard) in
+ *i915*)
+ modprobe -a ${MODPRV} i915 2>/dev/null
+ ;;
+ *intel*|*Intel*)
+ modprobe -a ${MODPRV} i810 i830 i915 2>/dev/null
+ ;;
+ *nvidia*|*NVidia*|*nouveau*)
+ modprobe ${MODPRV} nouveau 2>/dev/null
+ ;;
+ *radeon*|*Radeon*)
+ modprobe ${MODPRV} radeon 2>/dev/null
+ ;;
+ *mga*|*matrox*|*Matrox*)
+ modprobe ${MODPRV} mga 2>/dev/null
+ ;;
+ *)
+ modprobe -a ${MODPRV} r128 savage sis tdfx ttm via
+ ;;
+ esac
+ modprobe -a drm fbcon; mdev -s ) &
+fi
+
+# check and then load appropriate network card modules
+nwcardlist=$(echo ${slxconf_listnwmod}|sed "s/\ /|/g")
+# save results for later info and for Xen plugin when starting Xen VM
+hwinfo --netcard --usb-ctrl >/etc/hwinfo.netcard-usbctrl
+grep modprobe /etc/hwinfo.netcard-usbctrl | grep -E "$nwcardlist|hcd" | \
+ grep -v ehci | sed 's/.* Cmd: "//;s/"//' | sort -u >/etc/modprobe.base
+# virtio hack
+if [ $(grep -ic "virtio_pci" /etc/modprobe.base) -ge 1 ]; then
+ echo "modprobe virtio_net" >>/etc/modprobe.base
+fi
+sh /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; echo "read pci device list at $(sysup)" \
+ >/tmp/hwdataready ) &
+( usleep 100000 ; hwinfo --bios >/etc/hwinfo.bios ) &
+# for mounting partitions/devices with the "auto" option
+echo -e "ext3\next2\nreiserfs\nxfs\njfs\next4\nvfat" >/etc/filesystems
+# request a local block device for config and root filesystem (lbd://)
+if grep -iq '"lbd://' /proc/cmdline /etc/initramfs-setup; then
+ modprobe -a ${MODPRV} ehci_hcd usb-storage sd_mod
+ mdev -s
+fi
+return 0
+}
+
+#############################################################################
+# main part
+hwmain () {
+# activate the previously detected devices
+[ $DEBUGLEVEL -ge 2 ] || modloadbg=" >/dev/null 2>\&1"
+# check for rtc if not compiled directly into the kernel
+( [ -e /proc/driver/rtc ] || modprobe ${MODPRV} rtc-cmos ) &
+waitfor /tmp/hwdataready 10000
+sed '/Driver Info #1/,/Config Status:/d' \
+ /etc/hwinfo.data | grep modprobe | sed "s|.* Cmd: \"||;s|\"|$modloadbg|" \
+ | sort -u >/etc/modprobe.pci
+sh /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 "SCSI|SATA" /etc/hwinfo.data && modprobe ${MODPRV} sd_mod
+ grep -q -E "IDE" /etc/hwinfo.data && modprobe ${MODPRV} ide-disk
+ hwinfo --disk | sed -n "/Device File: /p" | \
+ sed -e "s|.*Device File: /dev/||;s| .*||" >/etc/hwinfo.disk
+ echo "disk detection finished at $(sysup)" >/tmp/diskready; ) &
+[ $DEBUGLEVEL -eq 21 ] && echo "** finished 2nd hwdetection at $(sysup)"
+
+# load disk/optical high level drivers
+modprobe ${MODPRV} ide-cd 2>/dev/null
+modprobe ${MODPRV} sr_mod 2>/dev/null
+modprobe ${MODPRV} ide-floppy 2>/dev/null
+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
+#ln -s /proc/sound/oss/sndstat /dev/sndstat
+
+[ $DEBUGLEVEL -eq 21 ] && echo "** finished most of module loading 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
+
+# parallel port setup
+modprobe ${MODPRV} parport_pc && modprobe ${MODPRV} ppdev
+
+# if any new device appeared up to now
+mdev -s
+return 0
+}
+#############################################################################
+# harddisk partition setup part
+disk () {
+# 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 /tmp/diskready 20000
+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 (83) into /etc/fstab with "noauto",
+ # special partition 45 (persistent scratch) to /var/scratch and 46
+ # to /var/openslx
+ for partid in 83 45 46 ; do
+ for hdpartnr in $(cat /etc/disk.partition | \
+ sed -n -e "/ ${partid} /p"|sed -e "s/[[:space:]].*//") ; do
+ mkdir -p /mnt/media/${hdpartnr#/dev/*} 2>/dev/null
+ if [ ${partid} -eq 83 ] ; then
+ echo -e "$hdpartnr\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto,\
+noexec\t 0 0" >>/tmp/fstab
+ elif [ ${partid} -eq 45 ] ; then
+ # if more than one id45 present, the latter ones are simply mounted
+ # over the previous (the mounts are postponed a bit via do_mnt to
+ # have the filesystem completely prepared)
+ echo -e "waitfor ${hdpartnr} 4000\n\
+ mount -t auto ${hdpartnr} /mnt/media/${hdpartnr#/dev/*}\n\
+ ln -sf /media/${hdpartnr#/dev/*} /mnt/var/scratch" >>/etc/do_mnt
+ echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\
+\t\t 0 0" >>/tmp/fstab
+ elif [ ${partid} -eq 46 ] ; then
+ # mount a home directory to (/mnt)/var/home
+ echo -e "waitfor ${hdpartnr} 4000\n\
+ mount -t auto ${hdpartnr} /mnt/media/${hdpartnr#/dev/*} \n\
+ test -d /mnt/media/${hdpartnr#/dev/*}/home && \
+ ln -sf /media/${hdpartnr#/dev/*} /mnt/var/home" >>/etc/do_mnt
+ echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\
+\t\t 0 0" >>/tmp/fstab
+ fi
+ done
+ done
+ # add
+ [ -f /etc/do_mnt ] && sed -e "1i. /etc/functions" -i /etc/do_mnt
+ done
+ # determine if tmp preparation should wait for format/mount or not
+ [ -z "$part44" ] && echo "finished at $(sysup)" >/tmp/tmpready
+else
+ echo "no harddisk found ( $(sysup) )" >/tmp/tmpready
+fi
+[ $DEBUGLEVEL -eq 21 ] && echo "** finished hdd stuff at $(sysup)"
+}
+
+#############################################################################
+# cleanup/finishing part
+finish () {
+mdev -s
+# mount filesystem parts (if any) requested in disk setup
+[ -f /etc/do_mnt ] && sh /etc/do_mnt &
+# remove unneeded disk and mouse drivers
+[ ! -s /etc/hwinfo.disk ] && rmmod sd_mod 2>/dev/null
+#grep -q " PS/2 " /etc/hwinfo.mouse || \
+# { rmmod psmouse 2>/dev/null; rm /dev/psaux 2>/dev/null; }
+# more sophistication possible :)
+# remove /sbin/mdev as not available in stage4
+echo >/proc/sys/kernel/hotplug
+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 and initramfs-setup settings
+. /etc/slxsystem.conf
+. /etc/initramfs-setup
+
+# 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 of pci stuff
+ main)
+ hwmain
+ # main script run timer or debug information
+ [ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 21 ] && \
+ echo "** HW main setup finished at $(sysup)"
+ echo "hwsetup main part finished at $(sysup)" >/tmp/hwcfg
+ ;;
+ # disk setup part (detecting general id82,83 and slx id44,45,46, formatting
+ # if required and mounting)
+ disk)
+ # try to enable compressed RAM SWAP
+ if modprobe ${MODPRV} ramzswap && [ -f /usr/bin/rzscontrol ] ; then
+ mdev -s
+ rzscontrol /dev/ramzswap0 --init
+ swapon /dev/ramzswap0
+ #hdswap="# disk swap disabled because of enabled compressed ramswap"
+ fi
+ # if disk action is not disabled
+ if [ "x${hw_local_disk}" != "xno" ] ; then
+ disk
+ else
+ echo "using harddisk switched off by hw_local_disk set to 'no' ( $(sysup) )" \
+ >/tmp/tmpready
+ fi
+ ;;
+ # remove unneeded kernel modules
+ finish)
+ finish
+ ;;
+esac
diff --git a/src/initramfs/stage3-stuff/bin/init-wrapper b/src/initramfs/stage3-stuff/bin/init-wrapper
new file mode 100755
index 00000000..57fcb8a0
--- /dev/null
+++ b/src/initramfs/stage3-stuff/bin/init-wrapper
@@ -0,0 +1,60 @@
+#!/bin/sh
+# Copyright (c) 2006..2010 - 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
+#
+# wrapperscript for plugin init files
+#############################################################################
+
+# Get parameters
+init_file="$1"
+DEBUGLEVEL="$2"
+
+[ -z $DEBUGLEVEL ] && DEBUGLEVEL=0
+
+# How do the localization here? There is not yet a country-Variable
+. /etc/messages
+. /etc/functions
+. /etc/distro-functions
+
+# Configuration settings for this slx system's environment
+. /etc/slxsystem.conf 2>/dev/null
+
+# 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
+
+# Initial
+testmkd /tmp/env
+
+if [ ! -f /tmp/env/base.sed ]; then
+ # Get environment and prepare as sed command
+ pre_env_base=$(env | sed -e 's/^\([^=]*\).*/\1/' | tr '\n' ';')
+ pre_env_base=$(echo $pre_env_base| sed -e 's/;/\.\*\/\/;s\/\^/g')
+ pre_env_base="s/^$pre_env_base//;"
+ $(echo $pre_env_base > /tmp/env/base.sed)
+else
+ pre_env_base=$(cat /tmp/env/base.sed)
+fi
+
+# Load temporary environments
+[ -f /tmp/env/wrapper.env ] && . /tmp/env/wrapper.env
+
+[ "${DEBUGLEVEL}" -eq 15 ] && set -x
+[ -f $init_file ] && . $init_file
+[ "${DEBUGLEVEL}" -eq 15 ] && set +x
+
+# Remove already known environment variables from postenv
+#env |sed -e $pre_env_base | sort -u | \
+# Store the environment for re-initialization in runinithook function
+env | grep -v -E "debug|DEBUGLEVEL" | sort -u | \
+ sed "1s|.*|# generated by init-wrapper; last changed by $init_file|" | \
+ sed -e 's/^\([^=]*\)=\(.*\)/export \1="\2"/' \
+ > /tmp/env/wrapper.env
+
diff --git a/src/initramfs/stage3-stuff/bin/servconfig b/src/initramfs/stage3-stuff/bin/servconfig
new file mode 100755
index 00000000..1248918e
--- /dev/null
+++ b/src/initramfs/stage3-stuff/bin/servconfig
@@ -0,0 +1,308 @@
+#!/bin/sh
+# Copyright (c) 2003..2006 - RZ Uni Freiburg
+# Copyright (c) 2006..2010 - 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
+
+# load variables defined by plugins
+[ -f /tmp/env/wrapper.env ] && . /tmp/env/wrapper.env
+
+# 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, group files for temporarily (within stage3 configuration) used
+# by chown
+cp /mnt/etc/passwd /etc
+cp /mnt/etc/group /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 simply sets a list of variables)
+localization "${country}"
+# start distrospecific localization
+dlocale
+
+#############################################################################
+# setup passwd and shadow for local system users like root, bin, daemon and
+# nobody if no user/admin provided passwd exists ... fixme: see #206
+[ ! -e /rootfs/etc/shadow ] && \
+ basepasswd $(sed "/+::0/d;s/root://;s/:.*//" /rootfs/etc/shadow 2>/dev/null)
+
+#############################################################################
+# 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
+
+# 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 udev
+config_udev
+
+# 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
+ amserv=$(uri_token $automnt_src server)
+ ampath=$(uri_token $automnt_src path)
+ amdirn=$(echo ${automnt_dir}|sed "s,/,_,g")
+ echo -e "/${automnt_dir}\t/etc/auto.${amdirn}\n" \
+ >> /mnt/etc/auto.master
+ echo -e "# /etc/auto.${amdirn} created by $0:\n" \
+ > /mnt/etc/auto.${amdirn}
+ # add '/' to path because uri_token removes any leading '/' (s. function)
+ echo -e "*\t-rsize=32768,wsize=32768,rw\t${amserv}:/${ampath}/&" \
+ >> /mnt/etc/auto.${amdirn}
+ # 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
+
+if [ -n "$ntp_servers" ]; then
+ # rdate uses the time protocol (port 37 which is not the ntp standard port)
+ # thus not every standard ntp-server might offer this service)
+ ( rdate -s "$ntp_servers" 2>/dev/null || error "$scfg_rdate" nonfatal
+ hwclock -w ) &
+fi
+
+# 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
+
+# configure samba service
+config_samba
+
+#############################################################################
+# NIS (variable typically fetched via dhcp)
+# setup nis configuration if needed
+if [ "x$nis_domain" != "x" -a "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)
+ # hanging mount processes might stop further setup - timeout
+ # should be configured ...
+ # fsmount proto server path target options
+ fsmount nfs ${tmpserv} ${tmppath} /tmp/scratch \
+ "rw,intr,soft,timeo=2,nosuid" && {
+ if [ -d /tmp/scratch/${clientip} ] ; then
+ mv /tmp/scratch/${clientip} /tmp/scratch/${clientip}.totrash
+ rm -rf /tmp/scratch/${clientip}.totrash 2>/dev/null &
+ fi
+ testmkd /tmp/scratch/${clientip}
+ # no need for tempfs there ...
+ umount /mnt/tmp >/dev/null 2>&1
+ fsmount nfs ${tmpserv} ${tmppath} /mnt/tmp \
+ "rw,intr,soft,timeo=2,nosuid"; }
+ ;;
+ esac
+fi
+
+# script run timer
+[ $DEBUGLEVEL -eq 8 ] && echo "** SW setup finished at $(sysup)"
+
+# servconfig finished successfully
+echo "servconfig finished at $(sysup)" > /tmp/svcfg