From 4a7db4b6f67f0a50f6dfed031e3fa46c4837de03 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Sun, 29 Oct 2006 17:20:14 +0000 Subject: Cleanup, minor fix, formatting, comments, ... git-svn-id: http://svn.openslx.org/svn/openslx/trunk@488 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/initrd-stuff/etc/functions | 110 +++++++++++++++++------------------ 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'initramfs/initrd-stuff/etc/functions') 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 /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 /functions-default & ~-version # overwrite xorg configuration set by hwautocfg displayvars (){ -- cgit v1.2.3-55-g7522