diff options
author | Dirk von Suchodoletz | 2006-10-29 18:20:14 +0100 |
---|---|---|
committer | Dirk von Suchodoletz | 2006-10-29 18:20:14 +0100 |
commit | 4a7db4b6f67f0a50f6dfed031e3fa46c4837de03 (patch) | |
tree | 7706b68dbe6d7e61aabbedcc2493d9c915b44aad /initramfs/initrd-stuff | |
parent | Changed init for using a variable @@@serverip@@@ instead of fixed (diff) | |
download | core-4a7db4b6f67f0a50f6dfed031e3fa46c4837de03.tar.gz core-4a7db4b6f67f0a50f6dfed031e3fa46c4837de03.tar.xz core-4a7db4b6f67f0a50f6dfed031e3fa46c4837de03.zip |
Cleanup, minor fix, formatting, comments, ...
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@488 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs/initrd-stuff')
-rwxr-xr-x | initramfs/initrd-stuff/bin/hwautocfg | 8 | ||||
-rwxr-xr-x | initramfs/initrd-stuff/bin/servconfig | 56 | ||||
-rw-r--r-- | initramfs/initrd-stuff/etc/functions | 110 | ||||
-rwxr-xr-x | initramfs/initrd-stuff/init | 2 |
4 files changed, 87 insertions, 89 deletions
diff --git a/initramfs/initrd-stuff/bin/hwautocfg b/initramfs/initrd-stuff/bin/hwautocfg index af8442a6..4d496d5c 100755 --- a/initramfs/initrd-stuff/bin/hwautocfg +++ b/initramfs/initrd-stuff/bin/hwautocfg @@ -3,7 +3,7 @@ # universal (distro independent) hardware autoconfiguration script for # OpenSLX linux diskless clients, using hwconfig from knoppix as base tool # -# Dirk von Suchodoletz <dvs@OpenSLX.com>, 07-10-2006 +# Dirk von Suchodoletz <dvs@OpenSLX.com>, 29-10-2006 # # (c) 2003 - 2006 - RZ Universitaet Freiburg # (c) 2006 - OpenSLX.org Project @@ -127,11 +127,11 @@ fi monmanual=yes # check for special X driver (fglrx, nvidia, ...) -check_glx +checkglx # finally write config file echo -e "#\n# autogenerated X hardware configuration by $0\n# \ -Dirk von Suchodoletz <dirk@goe.net>, $date" >$xfc +OpenSLX.ORG Project <openslx-users@openslx.org>, $date" >$xfc echo -e "# DO NOT EDIT THIS FILE BUT '$0' INSTEAD!\n#" \ >>$xfc for section in Files ServerFlags Module InputDevice Monitor \ @@ -205,7 +205,7 @@ for section in Files ServerFlags Module InputDevice Monitor \ done } -####################################################################### +############################################################################# # script starts here # functions common for all distros diff --git a/initramfs/initrd-stuff/bin/servconfig b/initramfs/initrd-stuff/bin/servconfig index 9751e97a..62457cfa 100755 --- a/initramfs/initrd-stuff/bin/servconfig +++ b/initramfs/initrd-stuff/bin/servconfig @@ -4,7 +4,7 @@ # diskless clients (executed in stage3 within initial ramfs). The file- # system is setup when servconfig starts # -# Dirk von Suchodoletz <dvs@OpenSLX.com>, 03-09-2006 +# Dirk von Suchodoletz <dvs@OpenSLX.com>, 29-10-2006 # Michael Janczyk <mj0>, 27-10-2006 # Lars Mueller <lm@OpenSLX.com>, 23-06-2006 # Oliver Tappe <ot@OpenSLX.com>, 23-06-2006 @@ -32,7 +32,7 @@ [ $DEBUGLEVEL -gt 3 -a $DEBUGLEVEL -lt 8 -o $DEBUGLEVEL -eq 12 ] && \ set -x -####################################################################### +############################################################################# # copy distro specific scripts, programs, libraries and configs cp -a /etc/sysconfig/files/* /mnt 2>/dev/null & # boot.local file (different for several distros) @@ -41,9 +41,9 @@ cp -a /etc/sysconfig/files/* /mnt 2>/dev/null & cat /etc/boot.local >> /mnt/etc/${D_BOOTLOCAL} } -####################################################################### -# read and unify configuration options - default configuration file, -# from dhcp, ldap ... +############################################################################# +# read and unify configuration options - default configuration file, from +# dhcp, ldap ... # wait for the appearance of configuration from several sources cfgcomplete . /etc/machine-setup @@ -79,7 +79,7 @@ echo " Diskless Workstation (v4.1/$dstr (c) <OpenSLX.ORG project> ">/mnt/etc/issue -####################################################################### +############################################################################# # vmware stuff first part: two scenarios # * VM images in /usr/share/vmware - then simply link # * VM images via additional mount (mount source NFS, NBD, ...) @@ -114,7 +114,7 @@ if [ "x$vmware" != "x" ] && [ "x$vmware" != "xno" ] ; then fi fi -####################################################################### +############################################################################# # set localization if [ -z "$country" ] ; then error "$scfg_country" nonfatal @@ -122,16 +122,16 @@ if [ -z "$country" ] ; then fi localization "${country}" -####################################################################### -# setup passwd and shadow for local system users like root, bin, daemon -# and nobody if no user/admin provided passwd exists ... -# the root password provided by machine-setup is used only if no passwd -# file is provided (default case) +############################################################################# +# setup passwd and shadow for local system users like root, bin, daemon and +# nobody if no user/admin provided passwd exists ... +# the root password provided by machine-setup is used only if no passwd file +# is provided (default case) if [ ! -f /rootfs/etc/passwd ] ; then basepasswd fi -####################################################################### +############################################################################# # dns and ip configuration # hostname of the machine echo "$host_name" >/proc/sys/kernel/hostname @@ -153,19 +153,17 @@ test -n "$domain_name_servers" && { echo nameserver $nameserver >>/mnt/etc/resolv.conf; done; } -####################################################################### +############################################################################# # initial boot scripts # delete and create runlevel links for initial booting (SuSE, Debian, # ...) initial_boot -####################################################################### -# +############################################################################# # run distro specific configuration function config_distro - -####################################################################### +############################################################################# # # boot.local if [ -n "$bootlocal_script" ]; then @@ -173,7 +171,7 @@ if [ -n "$bootlocal_script" ]; then $bootlocal_script" >> /mnt/etc/${D_INITDIR}/boot.local fi -####################################################################### +############################################################################# # basic (non network) services # at daemon - calling distro specific function config_atd @@ -236,7 +234,7 @@ config_automount # configure bluetooth services config_bt -####################################################################### +############################################################################# # network(ed) services # network time service (ntp) configuration file @@ -264,7 +262,7 @@ config_snmp # setup afs client stuff config_afs -####################################################################### +############################################################################# # NIS # setup nis configuration if needed if [ "x$nis_domain" != "x" ] && [ "x$nis_servers" != "x" ] ; then @@ -276,11 +274,11 @@ $date\n\nypserver "$nis_servers >/mnt/etc/yp.conf config_nis fi -####################################################################### +############################################################################# # name service caching daemon if networked user database config_nscd -####################################################################### +############################################################################# # vmware stuff second part: setting up the environment # create needed directories and files @@ -341,13 +339,13 @@ Type=Application" >/mnt/etc/X11/sessions/default.desktop # add scripts for default.desktop and vmimages.desktop cd /mnt/var/X11R6/bin ln -s desktop-session xdmmenu - ln -s desktop-session vmmenu + ln -s desktop-session vmmenu fi -####################################################################### -# 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 +############################################################################# +# 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 waitfor /tmp/tmpready 10000 [ $DEBUGLEVEL -eq 8 ] && echo "** Setup of /tmp completed at $(sysup)" # create some directories and correct permissions @@ -378,7 +376,7 @@ if [ -n "$scratch" -a -z "$tmpisdisk" ] ; then fi chmod 1777 /mnt/tmp -####################################################################### +############################################################################# # X11/GUI stuff if [ "x$start_x" != "xno" ] ; then # creating directories commonly needed for X11 in all distros diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions index 95de2ac7..17bb1053 100644 --- a/initramfs/initrd-stuff/etc/functions +++ b/initramfs/initrd-stuff/etc/functions @@ -10,7 +10,7 @@ # (c) 2006 - RZ Universitaet Freiburg # (c) 2006 - OpenSLX.ORG Project -####################################################################### +############################################################################# # set of empty dummy functions (loaded before real functions in the # distro specific files - to have no undeclared function in init, serv- # config, hwautocfg, ... @@ -33,7 +33,7 @@ udev_hotplug () { } -####################################################################### +############################################################################# # generate events with the sysfs trigger trigger_device_events () { list=$(echo /sys/bus/*/devices/*/uevent) @@ -61,7 +61,7 @@ trigger_device_events () { done } -####################################################################### +############################################################################# # produce error message and if $2 is empty run (debug) shell error () { local e_msg="$1" @@ -93,7 +93,7 @@ else # } fi } -####################################################################### +############################################################################# # system uptime for performance analysis sysup () { uptime=$(sed -e "s, .*,," /proc/uptime) @@ -102,7 +102,7 @@ echo "${uptime} s." } -####################################################################### +############################################################################# # micro sleep - either busybox command or simply loop and delete 1 from # the first argument gotten until zero usleep () { @@ -114,12 +114,12 @@ else fi return 0 } -####################################################################### +############################################################################# # (re)generate dynamic linked libraries cache from /etc/ld.so.conf ldcfg () { [ -z "${NOLDSC}" ] && echo "$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 () { @@ -162,7 +162,7 @@ case "$2" in query) echo "$query" ;; esac } -####################################################################### +############################################################################# # load a certain module - name of module with path in argument one, the # error message in second argument loadmod () { @@ -175,7 +175,7 @@ if [ -f $modpath ] ; then echo "$error_modload '$module'. $msg" fi } -####################################################################### +############################################################################# # compute prefix bit number from netmask nm2pref () { set `IFS="."; echo $1` @@ -194,7 +194,7 @@ local n=0 done echo $n } -####################################################################### +############################################################################# # configure Xen bridge xenbr0 xenbr_config () { modprobe netloop @@ -221,10 +221,10 @@ ip link set ${vif0} up ip link set ${pdev} up brctl addif ${bridge} ${pdev} } -####################################################################### -# configure IP address statically - first argument the ip address, -# second the netmask, then gateway and broadcast address and last -# interface. All arguments have to be given. +############################################################################# +# configure IP address statically - first argument the ip address, second the +# netmask, then gateway and broadcast address and last interface. All +# arguments have to be present. ipsetup () { local ip=$1 local nm=$2 @@ -273,8 +273,9 @@ case $ipcfg in ;; esac } -####################################################################### -# replace @@@serverip@@@ with real serverip +############################################################################# +# 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 @@ -284,7 +285,7 @@ else fi } -####################################################################### +############################################################################# # nfs mounter for root filesystem and other sources nfsmnt () { @@ -316,7 +317,7 @@ case $mnt in esac return $ret } -####################################################################### +############################################################################# # create configuration file for dhclient mkdhclconf () { local vci=$1 @@ -345,7 +346,7 @@ if [ -n "$vci" ] ; then fi } -####################################################################### +############################################################################# # dhcp client rundhcp () { @@ -403,10 +404,10 @@ esac echo "dhcp finished" > /tmp/dhcp-done } -####################################################################### -# function for retrieving configuration file (machine-setup) via tftp -# from a predefined server or given source (file=tftp-server:/path via -# kernel command line) +############################################################################# +# function for retrieving configuration file (machine-setup) via tftp from a +# predefined server or given source (file=tftp-server:/path via kernel +# command line) # tftpget is helper function for fileget tftpgetunpack () { # $1 is config file name to get, $2 IP of server to get file from @@ -454,8 +455,8 @@ else # In order to remedy, we evaluate $SLX_USE_ABSOLUTE_TFTP_PATH in order # to find out if we should use the absolute path when accessing files # via tftp: - #if [ "${SLX_USE_ABSOLUTE_TFTP_PATH}" -ge 1 ]; then - # local cfgdir="${SLX_TFTPBOOT_PATH}/client-config" + #if [ "${slxconf_tftp_prefix}" -ge 1 ]; then + # local cfgdir="${slxconf_tftp_prefix}/client-config" #else local cfgdir="client-config" #fi @@ -475,28 +476,28 @@ test -f /initramfs/machine-setup && \ echo "fileget via $srvproto finished" > /tmp/file-done } -####################################################################### -# function for creating directories after testing of their existance -# avoids to recreate directories in union mounts +############################################################################# +# function for creating directories after testing of their existance avoids +# to recreate directories in union mounts testmkd () { test -d $1 || mkdir -p $1 >/dev/null 2>&1 } -####################################################################### +############################################################################# # simple basename replacement basename () { local b=${1##*/} echo ${b%$2} } -####################################################################### +############################################################################# # simple string in string search strinstr (){ case "$2" in *$1*) return 0;; esac return 1 } -####################################################################### +############################################################################# # simple string in file search strinfile (){ case "$(cat $2)" in *$1*) return 0;; esac @@ -504,14 +505,14 @@ strinfile (){ } -####################################################################### +############################################################################# # check boot commandline for specified option inkernelcmdline (){ strinstr " $1" "${KCMDLINE}" return "$?" } -####################################################################### +############################################################################# # wait for a file to appear and stop after maxwait counts waitfor () { local file=$1 @@ -525,9 +526,9 @@ done return 0 } -####################################################################### -# ldconfig is needed if rootfilesystem is composed of several parts. -# search for ldconfig and execute it +############################################################################# +# ldconfig is needed if rootfilesystem is composed of several parts search +# for ldconfig and execute it # check that /mnt/etc/ld.so.conf is never lost ldconfig () { local cachefile="$1" @@ -541,9 +542,9 @@ done echo "finished" > /tmp/ldcfg } -####################################################################### -# base passwd/shadow, the standard user present in every system. All -# other system users should be generated within the service function +############################################################################# +# base passwd/shadow, the standard user present in every system. All other +# system users should be generated within the service function basepasswd () { # strip every line with userid between 500 and 99999 from the passwd # file @@ -559,7 +560,7 @@ sed 's/:.*/:!:13078:0:99999:7:::/;/^root.*/d' /tmp/newpasswd \ >> /mnt/etc/shadow } -####################################################################### +############################################################################# # wait for the completion of configuration file (machine-setup). It is # composed from different sources cfgcomplete () { @@ -578,9 +579,9 @@ echo "config completed" > /tmp/cfgcomplete fi } -####################################################################### -# localization simply derived from $language variable set in -# machine-setup or other sources - mostly taken from knoppix +############################################################################# +# 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" @@ -818,7 +819,7 @@ case "$country" in KDEKEYBOARDS="us,de,fr" TZ="Europe/Istanbul" ;; - # Taiwan - Traditional Chinese version (thanks to Chung-Yen Chang) + # Taiwan - Traditional Chinese version tw) COUNTRY="tw" LANG="zh_TW.Big5" @@ -857,9 +858,9 @@ case "$country" in ;; esac } -####################################################################### -# setup initial boot scripts (for most standard distributions, gentoo -# is to be handled differently) +############################################################################# +# setup initial boot scripts (for most standard distributions, gentoo is to +# be handled differently) initial_boot () { for i in ${D_RCDIRS} ${D_INITBOOTD} ; do rm -f /mnt/etc/$i/* @@ -874,10 +875,9 @@ for i in boot.ld ${D_INITSCRIPTS}; do ln -sf /etc${D_INITDIR}/$i /mnt/etc/${D_INITBOOTD}/K${revcnt}$i done } -####################################################################### -# find out if prerequisites for special X server modules are met -# incomplete -check_glx () { +############################################################################# +# find out if prerequisites for special X server modules are met (incomplete) +checkglx () { case "${XMODULE}" in radeon) # check ${XDESC}/ hwsetup.info device string in Cards file and then @@ -896,10 +896,10 @@ case "${XMODULE}" in esac } -####################################################################### -# dummy functions - avoid undefined functions in servconfig (functions -# are normally overwritten by settings within distro-functions - a file -# generated by mkdxsconfig from <distro>/functions-default & ~-version +############################################################################# +# dummy functions - avoid undefined functions in servconfig (functions are +# normally overwritten by settings within distro-functions - a file generated +# by slxmkramfs from <distro>/functions-default & ~-version # overwrite xorg configuration set by hwautocfg displayvars (){ diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init index 36594f84..dc61fa25 100755 --- a/initramfs/initrd-stuff/init +++ b/initramfs/initrd-stuff/init @@ -456,7 +456,7 @@ elif [ -z "$COWLOOP" ] ; then # run some specific stuff !? fi # script for stuff to execute during early bootup -d_mkrlscript init boot.ld "Running configuration postponed from InitRD" +d_mkrlscript init boot.ld "Running configuration postponed from InitRamFS" echo "fs complete" >/tmp/fscmpl # write debug file information after filesystem setup completed |