diff options
author | Sebastian Schmelzer | 2010-09-02 17:50:49 +0200 |
---|---|---|
committer | Sebastian Schmelzer | 2010-09-02 17:50:49 +0200 |
commit | 416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5 (patch) | |
tree | 4715f7d742fec50931017f38fe6ff0a89d4ceccc /initramfs/stage3-stuff | |
parent | Fix for the problem reported on the list (sed filter forgotten for the (diff) | |
download | core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.gz core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.xz core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.zip |
change dir structure
Diffstat (limited to 'initramfs/stage3-stuff')
-rwxr-xr-x | initramfs/stage3-stuff/bin/dhcpmkconfig | 47 | ||||
-rwxr-xr-x | initramfs/stage3-stuff/bin/hwautocfg | 299 | ||||
-rwxr-xr-x | initramfs/stage3-stuff/bin/init-wrapper | 60 | ||||
-rwxr-xr-x | initramfs/stage3-stuff/bin/servconfig | 308 | ||||
-rw-r--r-- | initramfs/stage3-stuff/etc/functions | 1029 | ||||
-rw-r--r-- | initramfs/stage3-stuff/etc/ldap-functions | 75 | ||||
-rw-r--r-- | initramfs/stage3-stuff/etc/messages | 204 | ||||
-rw-r--r-- | initramfs/stage3-stuff/etc/messages.de | 215 | ||||
-rwxr-xr-x | initramfs/stage3-stuff/init | 1030 |
9 files changed, 0 insertions, 3267 deletions
diff --git a/initramfs/stage3-stuff/bin/dhcpmkconfig b/initramfs/stage3-stuff/bin/dhcpmkconfig deleted file mode 100755 index fa01db75..00000000 --- a/initramfs/stage3-stuff/bin/dhcpmkconfig +++ /dev/null @@ -1,47 +0,0 @@ -#!/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/initramfs/stage3-stuff/bin/hwautocfg b/initramfs/stage3-stuff/bin/hwautocfg deleted file mode 100755 index 1f02892e..00000000 --- a/initramfs/stage3-stuff/bin/hwautocfg +++ /dev/null @@ -1,299 +0,0 @@ -#!/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/initramfs/stage3-stuff/bin/init-wrapper b/initramfs/stage3-stuff/bin/init-wrapper deleted file mode 100755 index 57fcb8a0..00000000 --- a/initramfs/stage3-stuff/bin/init-wrapper +++ /dev/null @@ -1,60 +0,0 @@ -#!/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/initramfs/stage3-stuff/bin/servconfig b/initramfs/stage3-stuff/bin/servconfig deleted file mode 100755 index 1248918e..00000000 --- a/initramfs/stage3-stuff/bin/servconfig +++ /dev/null @@ -1,308 +0,0 @@ -#!/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 diff --git a/initramfs/stage3-stuff/etc/functions b/initramfs/stage3-stuff/etc/functions deleted file mode 100644 index 3985bd57..00000000 --- a/initramfs/stage3-stuff/etc/functions +++ /dev/null @@ -1,1029 +0,0 @@ -# Copyright (c) 2003..2006 - RZ Uni Freiburg -# Copyright (c) 2006..2009 - 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/sh - 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 -# remove temporary '::' from path, since it conflicts with port specification -# ticket #232 -if strinstr "::" "$rest" ; then - rest=$(echo $rest | sed -e 's,::,§§§§§,g') -elif strinstr "\:\:" "$rest" ; then - rest=$(echo $rest | sed -e 's,\:\:,§§§§§,g') -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" ;; - # add '::' again to path, remove duplicate "//" - path) echo "$path" | sed -e 's,§§§§§,\:\:,g;s,//,/,' ;; - port) echo "$port" ;; - query) echo "$query" ;; -esac -} -############################################################################# -# mounter for different file sources -fsmount () { -local proto=$1 -local server=$2 -local srcpath=$3 -local target=$4 -local mntopt=$5 -local transport -testmkd ${target} -case "${proto}" in - *nbd) - # TODO: to be filled in ... - ;; - lbdev) - # we expect the stuff on toplevel directory, filesystem type should be - # autodetected here ... (vmimgserv is blockdev here) - vmbdev=/dev/${server} - waitfor ${vmbdev} 20000 - mount -o ro ${vmbdev} ${target} || error "$scfg_evmlm" nonfatal - ;; - nfs) - # we expect nfs mounts here ... check that nfs module is loaded before - cat /proc/filesystems | grep -q -E "[[:space:]]nfs" || \ - { modprobe ${MODPRV} nfs 2>/dev/null || error "$error_nfsmod" nonfatal; } - for transport in tcp udp fail; do - [ $transport = "fail" ] && { error "$init_nfs" nonfatal; - noimg=yes; break;} - mount -n -t nfs -o ${mntopt},nolock,${transport} \ - ${server}:${srcpath} ${target} && break - done - ;; - smb|cifs) - # cifs mounts might be problematic if accessed with superuser id - mount -n -o ${mntopt},user=guest,guest,file_mode=0755,dir_mode=0755 \ - -t ${proto} //${server}${srcpath} ${target} - #d_mkrlscript entry boot.slx "/opt/openslx/uclib-rootfs/bin/mount -n \ - #-o ${mntopt},guest,user=guest,file_mode=0755,dir_mode=0755 -t ${proto} \ - #//${server}${srcpath} ${target#/mnt}" - ;; -esac -} -############################################################################# -# 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 -} -############################################################################# -# 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 -[ -f /lib/ld-linux.so.2 ] || ln -s /mnt/lib/ld-linux.so.2 /lib/ld-linux.so.2 -for fs in xfs reiserfs ext2 ; 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 ] && continue - 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 -# see for options.c file in udhcp subdir of busybox for accepted "-O option" -udhcpc -O nissrv -O nisdomain -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 -} - -# tftp wrapper -# usage tftp_get <path> <tftpdserver> [count] -# count is optional - default is 3 - use -1 for indefinit -tftp_get () { - local file="$1" - local file_server="$2" - local download_successful=0 - local countdown="$3" - - if [ -z "$1" -o -z "$2" ]; then - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[tftp_get] Usage: tftp_get <path> <server> [count]" - return 1; - fi - - [ "$countdown" = "" ] && countdown=3 - - until [ $download_successful -eq 1 ] - do - if [ "$countdown" = "0" ]; then - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[tftp_get] download of \"$file\" from \"$file_server\" ... failed" - return 0; - fi - tftp -g -r $file -l /tmp/$(basename $file) $file_server - [ -s /tmp/$(basename $file) ] && download_successful=1 - countdown=$(expr $countdown - 1) - usleep 200000 - done - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[tftp_get] download of \"$file\" from \"$file_server\" ... successful" - return 0; -} - - -# wget wrapper -# usage wget_get <path> <ftp/httpserver> [count] -# count is optional - default is 3 - use -1 for indefinit -wget_get () { - local file="$1" - local file_server="$2" - local download_successful=0 - local countdown="$3" - - if [ -z "$1" -o -z "$2" ]; then - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[wget_get] Usage: wget_get <path> <server> [count]" - return 1; - fi - - [ "$countdown" = "" ] && countdown=3 - - until [ $download_successful -eq 1 ] - do - if [ "$countdown" = "0" ]; then - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[wget_get] download of \"$file\" from \"$file_server\" ... failed" - return 0; - fi - wget -q $file_server$file -O /tmp/$(basename $file) - [ -s /tmp/$(basename $file) ] && download_successful=1 - countdown=$(expr $countdown - 1) - usleep 200000 - done - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[wget_get] download of \"$file\" from \"$file_server\" ... successful" - return 0; -} - - -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}) - # wait for dns if "fileserv" is a name and not lbd device - [ "$fileprot" != "lbd" ] && \ - echo ${fileserv} | grep -qi [a-z] && waitfor /tmp/dhcp-done 10000 - [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\ -$filepath, fileserv:$fileserv" >>$LOGFILE - case "$fileprot" in - ftp|http) - wget_get $cfgfile $fileprot://$fileserv \ - && { unpack /tmp/$(basename $cfgfile) && break; } 2>>$LOGFILE - ;; - lbd) - local ldev=$fileserv - echo "Waiting for configuration file ${cfgfile} ...." - [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\ -$filepath, fileserv:$fileserv" >>$LOGFILE - waitfor /mnt/${cfgfile} 10000 - if [ -f /mnt/${cfgfile} ]; then - unpack /mnt/$cfgfile - else - error "$init_errlfg" - fi - ;; - *) - tftp_get $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 ... - 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_get $cfgfile $fileserv \ - 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; } - ;; - esac - done - echo -e "\n## Configuration via fileget from ${fileprot}://${fileserv}/\ -${cfgfile}\n# Hierarchy is distro client and as last distro/default" \ - >>/tmp/confviafile -fi -cat /initramfs/machine-setup >>/tmp/confviafile 2>/dev/null || \ - error "$nomachsetup" -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 - /bin/init-wrapper $hook_script $DEBUGLEVEL - . /tmp/env/wrapper.env - 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.UTF-8" - 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.UTF-8" - 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.UTF-8" - # 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.UTF-8" - LANG="es_ES" - KEYTABLE="es" - XKEYBOARD="es" - KDEKEYBOARD="es" - CHARSET="iso8859-15" - KDEKEYBOARDS="de,us,fr" - TZ="Europe/Madrid" - ;; - # Finland - fi) - COUNTRY="fi" - LANG="fi_FI.UTF-8" - KEYTABLE="fi" - XKEYBOARD="fi" - KDEKEYBOARD="fi" - CHARSET="iso8859-15" - KDEKEYBOARDS="us" - TZ="Europe/Helsinki" - ;; - # France - fr*) - COUNTRY="fr" - LANG="fr_FR.UTF-8" - 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.UTF-8" - KEYTABLE="us" - XKEYBOARD="us" - KDEKEYBOARD="il" - CHARSET="iso8859-8" - KDEKEYBOARDS="us,fr,de" - TZ="Asia/Jerusalem" - ;; - # Ireland - ie) - COUNTRY="ie" - LANG="en_IE.UTF-8" - 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.UTF-8" - KEYTABLE="it" - XKEYBOARD="it" - KDEKEYBOARD="it" - CHARSET="iso8859-15" - KDEKEYBOARDS="fr,us,de" - TZ="Europe/Rome" - ;; - # Japan - ja) - COUNTRY="jp" - LANG="ja_JP.UTF-8" - 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.UTF-8" - KEYTABLE="us" - XKEYBOARD="us" - KDEKEYBOARD="en_US" - CHARSET="iso8859-15" - KDEKEYBOARDS="nl,de,fr" - TZ="Europe/Amsterdam" - ;; - # Poland - pl) - COUNTRY="pl" - LANG="pl_PL.UTF-8" - 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.UTF-8" - 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_SK.UTF-8" - 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.UTF-8" - 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.UTF-8" - 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.UTF-8" - 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.UTF-8" - 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 -} - -############################################################################# -# 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 - 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/testlog - #FIXME: do mount - ;; - 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 udev configuration -config_udev () { -: -} -# 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 -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 () { -: -} -# set up localization like keytable, console -dlocale () { -: -} diff --git a/initramfs/stage3-stuff/etc/ldap-functions b/initramfs/stage3-stuff/etc/ldap-functions deleted file mode 100644 index d2b6753e..00000000 --- a/initramfs/stage3-stuff/etc/ldap-functions +++ /dev/null @@ -1,75 +0,0 @@ -####################################################################### -# 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 deleted file mode 100644 index ca66245d..00000000 --- a/initramfs/stage3-stuff/etc/messages +++ /dev/null @@ -1,204 +0,0 @@ -# Copyright (c) 2003 - 2006 - RZ Uni Freiburg -# Copyright (c) 2006 - 2009 - 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 5. -# Fhis file contains the standard set 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 added via \ -slxconfig-demuxer\n run. Please reconfigure the module list and add the \ -appropriate modules\n without *.ko suffix." -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 or firmware directory does not exist. \ -That could mean:\n\ - * The kernel was updated but the demuxer 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; ls /mnt/lib/firmware' to check." -init_loadaufs=" Loading of AUFS and/or UnionFS failed - Either the module(s) \ -are not\n present or do not match the running kernel. If you do not want to \ -see\n this message add the token(s) 'noaufs'/'nounionfs' to your kernel \ -command\n line or remove the modules from your kernel module directory." -init_loadunions=" Stacking of directories failed, because UnionFS/AUFS is not \ -loaded." -init_deselau=" You switched off AUFS and UnionFS via kernel commandline, thus \ -no module\n was loaded, using traditional bind mounts." -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\n but 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_errloop=" The loopback mounting of the rootfs container failed. Either \ -the file is\n not available, unreadable or problems with the filesystem \ -modules." -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 or firmware \ -directory ..." -init_errumnt=" Unmount of the kernel modules directory \ -failed for some reason. Some\n modprobe process still active!?" -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?" -nomachsetup=" No machine-setup file found. You might not have gotten any \ -configuration\n from your server. You could find that out by checking if \ -/initramfs and\n /rootfs are present!" - -# messages from distro functions -df_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." -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_errpmap=" The portmapper $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_rdate=" Your configured ntpserver does not offer time configuration \ -on port 37." -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_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 deleted file mode 100644 index 487332d7..00000000 --- a/initramfs/stage3-stuff/etc/messages.de +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright (c) 2003 - 2006 - RZ Uni Freiburg -# Copyright (c) 2006 - 2010 - 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 5 -# 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_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- bzw. Firmware-Verzeichnis existiert \ -nicht. Das\n 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/UnionFS schlug fehl - entweder das Modul ist \ -nicht vorhanden, oder\n es passt nicht zum laufenden Kernel. Wenn Sie diese \ -Meldung nicht sehen\n wollen, fügen Sie das Token 'noaufs'/'nounionfs' den \ -Kernel Start\n Optionen hinzu oder loeschen Sie die Module." -init_deselau=" Sie haben AUFS und UnionFS mittels Kernel-Commandline \ -ausgeschaltet, deshalb\n wurde kein entsprechendes Kernel-Modul geladen." -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 mehr sehen\n wollen, 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_errloop=" Der Loopback-Mounting des Rootfilesystem-Containers schlug \ -fehl. Entweder\n die Datei existiert nicht, ist unlesbar oder es gibt \ -Probleme mit\n den Filesystem-Modulen." -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 Zeiteinheiten das Kernel-Modul- bzw. Firmware-Verzeichnis \ -auszuhaengen ..." -init_errumnt=" Das Kernel Modul Verzeichnis auszuhaengen \ -scheiterte aus irgendeinem Grund. Sind einige\n ,,modprobe'' noch aktiv!?" -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?" -nomachsetup=" Die Datei machine-setup nicht gefunden. Es koennte sein, dass das \ -Konfigurations-\n paket nicht erfolgreich vom Server beschafft wurde. Das \ -erkennen Sie daran,\n dass die Verzeichnisse /initramfs, /rootfs angelegt \ -wurden. Ihr\n OpenSLX Client wird deshalb nicht wie erwartet funktionieren." - -# messages from distro functions -df_erritab=" Die Datei /etc/inittab existiert nicht oder ist keine regulaere. \ -\n Sie wird fuer den Boot-Process benoetigt." -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_errpmap=" Der Portmapper $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_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 deleted file mode 100755 index 3f97dba0..00000000 --- a/initramfs/stage3-stuff/init +++ /dev/null @@ -1,1030 +0,0 @@ -#!/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 at http://openslx.org -# -# Main script for initial ramfs for OpenSLX linux stateless clients -############################################################################# - -# fixme: the primary init script should never fail, so move all critical code -# into sub script calls (see ticket 259) - -export PATH=/bin:/sbin:/usr/bin/:/usr/sbin - -# 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 -# create some standard links (expected?) in /dev -ln -s /proc/kcore /dev/core -ln -s /proc/self/fd /dev/fd -ln -s /proc/self/fd/0 /dev/stdin -ln -s /proc/self/fd/1 /dev/stdout -ln -s /proc/self/fd/2 /dev/stderr - -# redirect kernel messages to tty10 instead of the standard console -getty -i -n -l /bin/cat 38400 tty10 & -setlogcons 10 - -# 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 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, bridge setups or -# on machines with more than one ethernet card built in -export 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="$(expr $(grep -i "memtotal" /proc/meminfo | awk '{print $2}') \ - / 100 \* 75 - 128000)k" # in kbyte -cowsize="50%" -rwdir=/dev/shm -nfsro="nfs" -aufs=1 -unionfs=1 - -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 - # shut down pc - shutdown) - cat <<EOL - - SHUTTING DOWN PC! - -EOL - echo "o" >/proc/sysrq-trigger - ;; - # 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=} - if [ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 20 ] ; then - echo "** SLX init started near $(sysup)" - elif [ $DEBUGLEVEL -ge 3 -a $DEBUGLEVEL -le 20 ] ; then - # create, start a debug shell process - echo "Debug shell started on second console (tty2)" - echo -e "#!/bin/sh\nsh" >/bin/debugshell - chmod u+x /bin/debugshell - getty -i -n -l /bin/debugshell 38400 tty2 & - # start logging (debuglevel >=3) - # fixme: SuSE hangs in Creating /var/log/boot.msg if activated - echo "Syslogd started on third console (tty3)" - # just to have some name in syslog - echo "(slx init)" >/proc/sys/kernel/hostname - syslogd -C2048 - klogd - logread -f > /dev/tty3 2>/dev/null & - logread -f >> /var/log/messages 2>/dev/null & - fi - ;; - # 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 - nounionfs) - unionfs=0;; - # 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 - noaufs) - aufs=0;; - 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 of two components - 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) - ;; - lbd) - # use a local device for mounting root block device with given - # filesystem directly or a root filesystem container from another - # filesystem, e.g. rootfs=lbd://sda1/squashfs (bldmod cannot be - # empty, use loop or the real device stuff) - bldmod=loop - 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 (rewritten to standard style) - nfsroot=*) - srvproto=nfs - nfsroot=${opts#nfsroot=} - nfspath=${nfsroot#*:} - nfsserver=${nfsroot%:/*} - grep -q -E "nfsserver" /etc/initramfs-setup || \ - echo -e "\n# nfs root information gotten via kernel command line \n\ -in $0\n# deprecated: please use rootfs=nfs://...\nnfsserver=\"${nfsserver}\"\ -\nnfspath=\"${nfspath}\"">> /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=};; - # option for ddcinfo - ddcinfo=*) - ddcinfo=${opts#ddcinfo=};; - 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/sh -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 != "lbd" ] - 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" -fi - -runinithook '10-nw-if-config' - -# check for multiple ethernet interfaces (we have at least the mac of PXE boot -# device in $bootmac) -# check here for the active ethernet link (skip non-ethN interfaces) -if strinstr "eth" "$nwif" ; then - for ethif in eth0 eth1 eth2 eth3 ; do - export macaddr=$(ip link show dev $ethif 2>/dev/null | \ - grep -i link.ether | awk '{print $2}') - # if there is no bootmac present in kernel commandline any checks are - # useless - if [ -z "$bootmac" ] ; then - bootmac="$macaddr" - [ "$ethif" != "eth0" ] && 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) - macaddr=${bootmac} - fi - break - fi - done -fi -# quickfix for proper nwif passing ... (to be fixed in a more general way) -sed "s/nwif=.*/nwif=\"${nwif}\"/" -i /tmp/env/wrapper.env -# hook to setup bridging (several virtualization tools ... -runinithook '20-nw-bridge-config' - -# 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" - -# 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) - broadcast_address=$(ipcalc -s -b $clientip $subnet_mask|sed s/.*=//) - [ -z "$broadcast_address" ] && broadcast_address=255.255.255.255 - # we might have an idea of the dns server via preboot - dns_srv=$(getip 5) - [ -n "$dns_srv" ] && echo nameserver $dns_srv >/etc/resolv.conf; - echo -e "# ip configuration written by $0 script:\nclientip=$clientip\n\ -subnet_mask=$subnet_mask\ngateway=$gateway\nserverip=$serverip\n\ -broadcast_address=$broadcast_address" >>/etc/initramfs-setup - # set static ip address - ip addr add $clientip/$(ipcalc -s -p $clientip $subnet_mask|sed s/.*=//) \ - broadcast $broadcast_address 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) ... -if [ -z "$nodhcp" ] ; then - ( rundhcp ${vci}; echo "dhcp finished at $(sysup)" >/tmp/dhcp-done ) & - if [ -n "$noipyet" ] ; then - waitfor /tmp/dhcp-done 20000 - . /tmp/confviadhcp - # by now there should be a proper ip configuration present - if [ -z "$clientip" -o -z "$subnet_mask" -o -z "$broadcast_address" ] - then error "$init_errdhcp" - else - { ip addr add \ - $clientip/$(ipcalc -s -p $clientip $subnet_mask|sed s/.*=//) \ - broadcast $broadcast_address dev $nwif 2>/dev/null || \ - error "$init_erripcfg"; } - # if gateway is available set it - [ -n $gateway ] && ip route add default via $gateway 2>/dev/null - fi - # fixme: to be checked!! - # else - # if [ -n "$file" -a "$srvproto" = "lbd" ] ; then - # error "$init_erripcfg" nonfatal - # else - # error "$init_erripcfg" - # fi - # 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 '25-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 - 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 - - # for debugging: interface might not be properly up - check reachability - [ $DEBUGLEVEL -ge 1 ] && ping -c 1 -w 15 ${bldhost} >/dev/null 2>&1 - - 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} -persist ; 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=20%' -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 - ;; - lbd) - # using clients local block device (disk partition is to be specified - RDEV=/dev/$blddev - echo "$bldrfst" >>/etc/filesystems - realbldrfst=$bldrfst - # we might need to mount the base layer filesystem first before accessing - # e.g. a squashfs container file on it - bldrfst=auto - ;; - 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 - # check if we got the rootfilesystem directly or need to mount a container - # file from the mounted block device - if [ "${srvproto}" = "lbd" -a -f /mnt/boot/${slxconf_system_name} ]; then - mkdir /dev/bootdisk - mount --move /mnt /dev/bootdisk - mount -t ${realbldrfst} -o loop \ - /dev/bootdisk/boot/${slxconf_system_name} /mnt || error "$init_errloop" - fi - [ $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 - # check if nfsserver is set as variable @@@serverip@@@ - nfsserver=$(checkip $nfsserver) - else - # we got a problem here - error "$init_nfssp" fatal - fi - # interface might not be properly up - check reachability - ping -c 1 -w 15 ${nfsserver} >/dev/null 2>&1 - # mount the rootfs via nfs readonly (ro) - fsmount nfs ${nfsserver} ${nfspath} /mnt ro - #for transport in tcp udp fail; do - # [ $proto = "fail" ] && { error "$init_nfs"; break; } - # mount -n -t nfs -o ro,nolock,${transport} ${nfsroot} /mnt && break - #done - [ $DEBUGLEVEL -eq 20 ] && echo "** finished nfs mount at $(sysup)" -fi - -runinithook '35-have-network-root' - -# get the complete collection of kernel modules and firmwares available -testmkd /lib/firmware -mount -n --bind /mnt/lib/modules /lib/modules && \ -mount -n --bind /mnt/lib/firmware /lib/firmware || 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/sh -else - [ $DEBUGLEVEL -eq 20 ] && echo "** started hwautocfg in background at \ -$(sysup)" - hwautocfg main & -fi - -runinithook '40-started-hw-config' - -# unionfs/aufs modules visible by now if installed, try to use aufs for rw -# access if available -union_type="" -if [ ${aufs} -eq 1 ] && \ - modprobe ${MODPRV} aufs 2>/dev/null && \ - lsmod | grep -qe "^aufs" ; then union_type="AUFS" -elif [ ${unionfs} -eq 1 ] && \ - modprobe ${MODPRV} unionfs 2>/dev/null && \ - lsmod | grep -qe "^unionfs" ; then union_type="UnionFS" -elif [ ${aufs} -eq 0 -a ${unionfs} -eq 0 -a -z "${cowloop}" ] ; then - error "$init_deselau" nonfatal - unset aufs unionfs -else - error "$init_loadaufs" nonfatal - unset aufs unionfs -fi - -# runtimer -[ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 20 ] && \ - echo "** Filesystem setup started at $(sysup)" -# setup of client root filesystem dependent on the availability of UnionFS -if [ "x${union_type}" != "x" ] ; then - echo "Using ${union_type} for rw access" - mkdir -p ${rwdir}/union ${rwdir}/uniontmp /rorootfs - # adapting tempfs size of the device directory (takes /tmp in stage4) - mount -o remount,size=${tmpfssize} ${devdir} - mount -n -t tmpfs -o size=${tmpfssize} 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 - # running hardware disk/tmp setup now - hwautocfg disk & - # run ldconfig if switched on via kernel command line (token ldsc) or - # triggered by unionized root filesystem - ldcfg -elif [ -z "${cowloop}" ] ; then - # fire up hardware disk/tmp setup first - hwautocfg disk & - echo "Using bind mounts to ramdisk for rw access" - mount -n -t tmpfs -o size=75% 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 "-\ndhcp*\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' - -# generate a set of default directories -. /etc/openslx.conf -for dir in $OPENSLX_DEFAULT_LOGDIR $OPENSLX_DEFAULT_BINDIR \ - $OPENSLX_DEFAULT_LIBDIR $OPENSLX_DEFAULT_VIRTDIR; do - testmkd /mnt/$dir -done -chmod -R 1777 /mnt/${OPENSLX_DEFAULT_LOGDIR} - -# 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 -# runtimer -[ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 20 ] && \ - echo "** Filesystem setup completed at $(sysup)" - -# 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/sh -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 - [ $DEBUGLEVEL -gt 2 ] && 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' - -# ddcinfo temporary overwrite (with kernel cmdline ddcinfo=1) -if [ "${ddcinfo}" = "1" -a -f /initramfs/plugin-conf/xserver.conf ]; then - echo 'xserver_ddcinfo="1"' >> /initramfs/plugin-conf/xserver.conf -fi - -# runtimer -[ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 20 ] && \ - echo "** Plugin configuration started at $(sysup)" - -# check for any plugin-specific runlevel scripts and run them, if found: -if [ ${DEBUGLEVEL} = 25 ] ; then - /bin/sh -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 -n "Running plugin starter $plugin_starter ..." - [ $DEBUGLEVEL -eq 15 ] \ - && sed '/^#!/ a\\set -x' -i $plugin_starter - init-wrapper $plugin_starter >>/tmp/plugin_starter 2>&1 - if [ $? -eq 0 ]; then - [ $DEBUGLEVEL -gt 0 ] \ - && echo " ok" - else - [ $DEBUGLEVEL -gt 0 ] \ - && echo " failed" - fi - fi - done - # load variables defined by plugins to current environment - [ -f /tmp/env/wrapper.env ] && . /tmp/env/wrapper.env - fi -fi - -runinithook '80-after-plugins' - -# runtimer -[ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 20 ] && \ - echo "** Plugin configuration finished at $(sysup)" - -# create links for initial stage4 boot scripts -initial_boot - -runinithook '85-have-initial-boot' - -# post init for some distro specific stuff to run -postinit -# general postinit.local configurable by the admin via openslx/config/<system> -[ -f /initramfs/postinit.local ] && { - [ $DEBUGLEVEL -gt 0 ] && \ - echo -n "Running script /bin/postinit.local ... " - chmod u+x /initramfs/postinit.local - /initramfs/postinit.local - [ $DEBUGLEVEL -gt 0 ] && echo "ok"; } - -# start a debug shell in higher debug levels -[ $DEBUGLEVEL -gt 2 -a $DEBUGLEVEL != 8 ] \ - && echo "DEBUGLEVEL>2: starting debug-shell, exit with CTRL+D" && /bin/sh - -runinithook '90-postinit-done' - -# unmount the bind mounted modules, firmware directories and nfs /tmp/scratch -# (if present) -export ticks -for ticks in 0 1 2 5 10 20 30; do - sleep $ticks && umount -n /lib/modules 2>/dev/null && break - error "$init_wait" nonfatal -done -for ticks in 0 1 2 5 10 20 30; do - sleep $ticks && umount -n /lib/firmware 2>/dev/null && break - error "$init_wait" nonfatal -done -mount 2>/dev/null | grep -q "/tmp/scratch type nfs" && \ - for ticks in 0 1 2 5 10 20 30; do - sleep $ticks && umount -n /tmp/scratch 2>/dev/null && break - done - -mount 2>/dev/null | grep -q /lib/modules && error "$init_errumnt" -# 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 /dev/shm /mnt/tmp 2>/dev/null - -runinithook '95-cleanup' - -# kill hwautocfg, servconfig, hwinfo, syslogd, etc. -killall -9 hwautocfg servconfig debugshell hwinfo syslogd logread 2>/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>/dev/null -# stop logging services if required and move logfile into stage4 filesystem -# (if exists) -killall klogd 2>/dev/null -[ -f /var/log/slx-boot.log ] && mv /var/log/slx-boot.log \ - /mnt/var/log/slx-s3boot.log -[ -f /var/log/messages ] && cp /var/log/messages \ - /mnt/var/log/slx_messages 2>/dev/null -# if no syslog plugin was configured, start the daemon again writing to no -# logfile directly (useless fake test as placeholder) -# THIS IS NOT WORKING SOMEHOW!! -#[ ! -d /mnt/opt/openslx/plugin-repo/syslog/ ] && syslogd -O /mnt/var/log/testfile - -# move /dev and unmount /proc and unset all old, unneeded environment -# variables -mount -n --move /dev /mnt/dev -umount -n /proc -unset client debug date initrd ip bldroot macaddr nwif 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 /sbin/switch_root -c dev/console /mnt /sbin/init $DEBUG_UPSTART || \ - error "$init_runinit" |