From 30692c67a567c223b3fb752fd8781407c783db79 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Mon, 22 Jan 2007 00:47:54 +0000 Subject: Recoded the shell "(u)sleep" functions, depends on /proc by now, but should not impose to much (obsoletes rev. 629). Added AUTHORS file. Switched off halt/shutdown links for initial/boot.d scripts (in functions seems no need, but may produce problems if switched on) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@640 95ad53e4-c205-0410-b2fa-d234c58c8868 --- AUTHORS | 11 ++++++++ initramfs/initrd-stuff/bin/hwautocfg | 20 +++++++++------ initramfs/initrd-stuff/bin/servconfig | 19 ++++++++------ initramfs/initrd-stuff/etc/functions | 47 ++++++++++++++++++++--------------- initramfs/initrd-stuff/init | 44 +++++++++++++++++--------------- 5 files changed, 86 insertions(+), 55 deletions(-) create mode 100644 AUTHORS diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..c7fe8ec5 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,11 @@ +Authors are named in the row of entry dates into the OpenSLX +project. + +Dirk von Suchodoletz, , 2002 - 2007 +Michael Janczyk, <>, 2003 - 2007 +Nico Dietrich, <>, 2005 - 2006 +Felix Endres, <>, 2005 - 2007 +Tobias Maier, <>, 2005 - 2006 +Bastian Wissler, <>, 2006 - 2007 +Lars Mueller, , 2006 - 2007 +Oliver Tappe, , 2006 - 2007 diff --git a/initramfs/initrd-stuff/bin/hwautocfg b/initramfs/initrd-stuff/bin/hwautocfg index eeea00d7..ad2ac3cc 100755 --- a/initramfs/initrd-stuff/bin/hwautocfg +++ b/initramfs/initrd-stuff/bin/hwautocfg @@ -1,13 +1,19 @@ #!/bin/sh +# Copyright (c) 2003 - 2006 - RZ Uni Freiburg +# Copyright (c) 2006, 2007 - OpenSLX GmbH # -# universal (distro independent) hardware autoconfiguration script for -# OpenSLX linux diskless clients, using hwconfig from knoppix as base tool +# 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 # -# Dirk von Suchodoletz , 16-12-2006 +# General information about OpenSLX can be found under http://openslx.org # -# (c) 2003 - 2006 - RZ Universitaet Freiburg -# (c) 2006 - OpenSLX.org Project +# universal (distro independent) hardware autoconfiguration script for +# OpenSLX linux diskless clients, using hwconfig from knoppix as base tool +############################################################################# # local functions used within hwautocfg displaysetup () { # (temporary) configuration file @@ -348,7 +354,7 @@ modprobe ${MODPRV} snd-mixer-oss test -f /proc/bus/usb/devices || \ mount -n -t usbfs usbfs /proc/bus/usb 2>/dev/null [ -n "$IDE" ] && modprobe -q ide_generic 2>/dev/null -usleep 10 && hwsetup -v > /tmp/hwsetup.info +usleep 200 && hwsetup -v > /tmp/hwsetup.info # remaining drivers listed in /tmp/hwsetup.info cat /tmp/hwsetup.info| while read LINE ; do if strinstr "driver:" "${LINE}"; then @@ -356,7 +362,7 @@ cat /tmp/hwsetup.info| while read LINE ; do if ! strinstr " ${DRIVER} " "${DRIVERLIST}"; then strinstr "Card:" "${DRIVER}" || strinstr "ps/2" "${DRIVER}" || { modprobe ${MODPRV} ${DRIVER} & - usleep 8; } + usleep 100; } DRIVERLIST="${DRIVERLIST} ${DRIVER}" fi fi diff --git a/initramfs/initrd-stuff/bin/servconfig b/initramfs/initrd-stuff/bin/servconfig index 9155a2de..6a857892 100755 --- a/initramfs/initrd-stuff/bin/servconfig +++ b/initramfs/initrd-stuff/bin/servconfig @@ -1,17 +1,20 @@ #!/bin/sh +# Copyright (c) 2003 - 2006 - RZ Uni Freiburg +# Copyright (c) 2006, 2007 - 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 is setup when servconfig starts -# -# Dirk von Suchodoletz , 14-12-2006 -# Michael Janczyk , 10-01-2007 -# Lars Mueller , 23-06-2006 -# Oliver Tappe , 23-06-2006 -# -# (c) 2006 - RZ Universitaet Freiburg -# (c) 2006 - OpenSLX.ORG Project +############################################################################# # check for configuration files to source # functions common for all distros, messages contains all error and diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions index 083e6951..1bf5ffdc 100644 --- a/initramfs/initrd-stuff/etc/functions +++ b/initramfs/initrd-stuff/etc/functions @@ -1,14 +1,16 @@ -# common function script for the configuration of linux diskless clients -# (included by init, hwautocfg, servconfig, ... within OpenSLX initial -# ramfs) +# Copyright (c) 2003 - 2006 - RZ Uni Freiburg +# Copyright (c) 2006, 2007 - OpenSLX GmbH # -# Dirk von Suchodoletz , 17-12-2006 -# Felix Endres, 30-04-2006 -# (xenbr), 12-12-2006 -# Tobias Maier +# This program/file is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING # -# (c) 2006 - RZ Universitaet Freiburg -# (c) 2006 - OpenSLX.ORG Project +# 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 +# +# 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 @@ -100,7 +102,7 @@ if [ -n "$2" ] ; then 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 20 + [ "$DEBUGLEVEL" -gt 2 -a "$DEBUGLEVEL" != 8 ] && sleep 10 else echo -e "${error_msg}${e_msg}${error_shell}" # load usb modules to have keyboard enabled - they might have to be @@ -110,7 +112,7 @@ else echo -n "Reboot now? [y]" read input # [ -z "$input" -o "$input" = "y" -o "$input" = "Y" ] && { -# usleep 100 +# usleep 5000 # [ -f /proc/sysrq-trigger ] || mount -t proc none /proc # echo "b" > /proc/sysrq-trigger # } @@ -126,14 +128,17 @@ echo "${uptime} s." ############################################################################# -# micro sleep - either busybox command or simply loop and delete 1 from -# the first argument gotten until zero +# micro sleep - argument takes number of milliseconds. either busybox command +# or simply use uptime information usleep () { if [ -x /bin/usleep ]; then - /bin/usleep `expr $1 \* 60000` + /bin/usleep `expr $1 \* 1000` else - local count=`expr $1 \* 10` - while [ $count -gt 0 ] ; do count=`expr $count \- 1` ; done + local starttime=$(sed -e "s, .*,,;s,\.,," /proc/uptime) + while [ $(sed -e "s, .*,,;s,\.,," /proc/uptime) -le \ + $(expr $starttime + $1 - 2) ] + do : + done fi return 0 } @@ -144,7 +149,7 @@ if [ -x /bin/sleep ]; then #elif [ -x /bin/bash ]; then # TMOUT=$1 read else - usleep `expr $1 \* 100` + usleep `expr $1 \* 1000` fi } ############################################################################# @@ -902,13 +907,15 @@ for i in ${D_RCDIRS} ${D_INITBOOTD} ; do rm -f /mnt/etc/$i/* done count=10 -# boot.ld is a special runlevel script generated within initial ramdisk -# which should be executed before the rest +# boot.ld is a special runlevel script generated within initialramfs which +# should be executed before the normal runlevel scripts. Proper shutdown is +# not needed!? for i in boot.ld ${D_INITSCRIPTS}; do count=`expr $count + 1` revcnt=`expr 41 - $count` ln -sf /etc${D_INITDIR}/$i /mnt/etc/${D_INITBOOTD}/S${count}$i - ln -sf /etc${D_INITDIR}/$i /mnt/etc/${D_INITBOOTD}/K${revcnt}$i + # uncomment if proper shutdown of bootup scripts is required + #ln -sf /etc${D_INITDIR}/$i /mnt/etc/${D_INITBOOTD}/K${revcnt}$i done } diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init index 231e7ea3..b29b0719 100755 --- a/initramfs/initrd-stuff/init +++ b/initramfs/initrd-stuff/init @@ -1,25 +1,29 @@ #!/bin/sh -# main script for new type of initial ramdisk for OpenSLX linux diskless -# clients version 4 +# Copyright (c) 2003 - 2006 - RZ Uni Freiburg +# Copyright (c) 2006, 2007 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING # -# this file is distributed under the GPLv2, see ~/openslx/COPYING +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org # -# Dirk von Suchodoletz , 10-01-2007 -# (xenbr), 27-09-2006 +# General information about OpenSLX can be found under http://openslx.org # -# (c) 2006 - RZ Universitaet Freiburg -# (c) 2006 - OpenSLX GmbH +# main script for new type of initial ramdisk for OpenSLX linux diskless +# clients version 4 +############################################################################# # functions common for all distros, messages contains all error and info # output (for some reason the error output is not produced properly - crash) . /etc/messages -. /etc/functions || ( echo -e $init_mff && usleep 10000 ) -. /etc/distro-functions || ( echo -e $init_dff && usleep 10000 ) +. /etc/functions || ( echo -e $init_mff && sleep 100 ) +. /etc/distro-functions || ( echo -e $init_dff && sleep 100 ) # configuration settings (several file and directory variables) -. /etc/sysconfig/config || ( echo -e $init_dscf && usleep 10000 ) +. /etc/sysconfig/config || ( echo -e $init_dscf && sleep 100 ) # configuration settings for slx environment . /etc/sysconfig/slxconfig 2>/dev/null || ( echo -e $init_sscf && \ - usleep 10000 ) + sleep 100 ) export PATH=/bin:/sbin:/usr/bin/:/usr/sbin export date="$slxconf_date" @@ -261,7 +265,7 @@ else MODPRV="-q" LOGFILE="/dev/null" # redirect console (after /dev/null is available, and /dev mounted) - exec < /dev/null > /dev/null 2>&1 + [ "${DEBUGLEVEL}" != 8 ] && exec < /dev/null > /dev/null 2>&1 fi # load network adaptor modules for mod in ${NWMODULES}; do @@ -328,9 +332,9 @@ if [ -n "${nbdmod}" ] ; then RDEV=/dev/nbd0 waitfor "${RDEV}" 20000 || error "$init_nbddev" while ! nbd-client $nbdhost $nbdport ${RDEV} ; do - usleep 10 + usleep 100 done - usleep 10 + usleep 100 # switch off unneeded block read ahead echo "0" > /sys/block/nbd0/queue/read_ahead_kb ;; @@ -346,7 +350,7 @@ if [ -n "${nbdmod}" ] ; then fi waitfor /dev/dnbd0 10000 || error "$init_nbddev" while ! dnbd-client -b $nbdhost -d /dev/dnbd0 $clientopt ; do - usleep 20 + usleep 100 done echo "0" > /sys/block/dnbd0/queue/read_ahead_kb RDEV=/dev/dnbd0 @@ -367,10 +371,10 @@ if [ -n "${nbdmod}" ] ; then echo "Using Copy-on-Write block device for rw access" mount -n -t tmpfs -o size=${COWSIZE} ramfs ${RWDIR} mkdir /dev/cow && cp -a /tmp/ctl /dev/cow - usleep 10 + usleep 200 ln -s /dev/cowloop0 /dev/cow/0 cowdev -a /dev/nbd0 ${RWDIR}/nbd.cow - usleep 10 + usleep 200 RWRO="rw" RDEV=/dev/cow/0 # run ldconfig if not switched off via kernel command line @@ -380,7 +384,7 @@ if [ -n "${nbdmod}" ] ; then NFSRO="" fi # finally mount the block device - for i in 5 40 60 ; do + for i in 1 50 100 200 400 1000 ; do usleep $i mount -n -t $nbdrfst -o $RWRO $RDEV /mnt 2>/dev/null && break done @@ -546,8 +550,8 @@ else fi # copy machine configuration (from global settings, additions made within # here and from dhcp/ldap sources) to client /etc for later checks -waitfor /tmp/hwcfg 20000 || error "$init_errhw" waitfor /tmp/svcfg 20000 || error "$init_errsw" +waitfor /tmp/hwcfg 30000 || error "$init_errhw" # IP configuration is made and should not be updated automatically, udevd # should be killed if started within init killall -9 dhcpcd dhclient pump udhcpc 2>/dev/null @@ -566,7 +570,7 @@ postinit [ $DEBUGLEVEL -gt 2 -a $DEBUGLEVEL != 8 ] && /bin/sh # unmount the bind mounted modules directory -for i in 0 40 100 200 300 500 800 1000 1200; do +for i in 0 200 300 500 800 1000 1200 2000 5000 ; do usleep $i && umount -n /lib/modules/${KERNEL} 2>/dev/null && break error "$init_wait" nonfatal done -- cgit v1.2.3-55-g7522