From 494d472f83758f41e6f38b9b63fc42e79c5d3635 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Sat, 25 Mar 2006 16:17:31 +0000 Subject: ensured "ash" compatibility, minor fixes and cleanups, ... git-svn-id: http://svn.openslx.org/svn/openslx/ld4@128 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initrd/distro-specs/suse/functions-9.3 | 28 ++++++++-------- initrd/distro-specs/ubuntu/functions-5.10 | 56 ++----------------------------- initrd/initrd-stuff/bin/hwautocfg | 9 +++-- initrd/initrd-stuff/bin/screenres | 2 +- initrd/initrd-stuff/bin/servconfig | 19 +++++++---- initrd/initrd-stuff/etc/functions | 18 +++++----- initrd/mkdxsinitrd | 37 ++++++++++---------- 7 files changed, 61 insertions(+), 108 deletions(-) (limited to 'initrd') diff --git a/initrd/distro-specs/suse/functions-9.3 b/initrd/distro-specs/suse/functions-9.3 index 6aa1d4b6..fbd74586 100644 --- a/initrd/distro-specs/suse/functions-9.3 +++ b/initrd/distro-specs/suse/functions-9.3 @@ -4,9 +4,7 @@ # functions file). This file is the main base for the # following SuSE distributions # -# Author(s): Dirk von Suchodoletz , 24-03-2006 -# Blabla -# Blub +# Author(s): Dirk von Suchodoletz , 25-03-2006 # # Copyright: (c) 2006 - RZ Universitaet Freiburg # @@ -60,9 +58,8 @@ if [ -f /mnt/etc/init.d/ntp ] ; then fi testmkd /mnt/var/lib/ntp/var/run/ntp &>/dev/null if [ "x$start_ntp" = "xinitial" ] ; then - echo -e "\t# entry added by $0: $date" \ - >>/mnt/etc/${D_INITDIR}/boot.ld - echo -e "\tntpdate -s -b $ntp_servers >${LOGFILE} 2>&1 &" \ + echo -e "\t# entry added by $0: $date\n\t( ntpdate -s -b $ntp_servers\ + >${LOGFILE} 2>&1 && \\n\t which hwclock &>/dev/null && hwclock -w ) &" \ >>/mnt/etc/${D_INITDIR}/boot.ld elif [ "x$start_ntp" = "xyes" ] ; then rllinker "ntp" "$start" "$stop" @@ -114,8 +111,12 @@ fi config_sshd () { if [ "x$start_sshd" = "xyes" ] ; then if [ -f /mnt/etc/init.d/sshd ] ; then - testmkd /mnt/var/lib/sshd; testmkd /mnt/var/lib/empty + testmkd /mnt/var/lib/sshd + testmkd /mnt/var/lib/empty rllinker "sshd" "12" "10" + else + error " The sshd start script does not seem to be installed, so \ +requesting\n the start of service does not make much sense." nonfatal fi fi } @@ -410,15 +411,14 @@ sed -e "s,TARGETS =,TARGETS = vmware-prep," \ # (before most of the normal boot init scripts) # this script should operate like a normal runlevel script d_mkrlscript () { -local switch=$1 -local name=$2 -local info=$3 +local switch="$1" +local name="$2" +local info="$3" case "$1" in init) - echo -en "#!/bin/sh\n# skeleton of /etc/${D_INITDIR}/$name written \ -from $0\n. /etc/rc.status\n. /etc/sysconfig/logfile\nrc_reset\n\ -case \"\$1\" in\n start)\n\techo -n " >>/mnt/etc/${D_INITDIR}/$name - echo "\"$info\"" >>/mnt/etc/${D_INITDIR}/$name + echo -e "#!/bin/sh\n# skeleton of /etc/${D_INITDIR}/$name written \ +from $0\n. /etc/rc.status\n. /etc/sysconfig/logfile\nrc_reset\ncase \ +\"\$1\" in\n start)\n\techo -n \"$info\"" >>/mnt/etc/${D_INITDIR}/$name chmod u+x /mnt/etc/${D_INITDIR}/$name ;; close) diff --git a/initrd/distro-specs/ubuntu/functions-5.10 b/initrd/distro-specs/ubuntu/functions-5.10 index 6567f14b..31a20a64 100644 --- a/initrd/distro-specs/ubuntu/functions-5.10 +++ b/initrd/distro-specs/ubuntu/functions-5.10 @@ -146,56 +146,6 @@ if [ "x$start_snmp" = "xyes" ] ; then fi } -# x11 stuff -descsession () { -if [ "x$desktop_session" != "x" ] ; then - windowmanagers="$desktop_session" - # write script for desktop-session chooser - if [ "x$vmware" != "xno" ] ; then - debug="" - [ ${DEBUGLEVEL} -gt 0 ] && debug="--debug 1" - echo -e "#!/bin/sh\n#\n# file generated by\n#\t$0:\n#\t$date\n -OSTYPE=\`echo \$0 | sed -e \"s,-, ,\" -e \"s,.*/,,\" | awk '{print \$1}'\` -SPECTYPE=\`echo \$0 | sed -e \"s,-, ,\" -e \"s,.*/,,\" | awk '{print \$2}'\`\n -OPTS=\"-o \$OSTYPE \${SPECTYPE:+\"-s \$SPECTYPE\"}\"\n -xterm -bg black -fg white -geometry 170x30+0-0 +sb \ --e \"runvmware \$OPTS $debug\"\n" > /mnt/var/X11R6/bin/desktop-session - chmod a+x /mnt/var/X11R6/bin/desktop-session - addpath="true"; - fi -else - windowmanagers="kde,gnome,icewm,failsafe" -fi -# check if /usr/X11R6/bin is writeable, else use /var/X11R6/bin -if [ -w /mnt/usr/X11R6/bin/WM-Session ] ; then - sesspath="/usr/X11R6/bin" -else - sesspath="/var/X11R6/bin" - addpath="true" -fi - -# create links to desktop-session chooser -[ -f /mnt/usr/bin/X11/wmlist ] && wmlist=`cat /mnt/usr/bin/X11/wmlist` - -for i in `echo $windowmanagers|sed -e "s/,/ /g"` ; do - # beware!! quickhack for VMware sessions - strinstr "$i" "$wmlist" || \ - test -x /mnt/usr/X11R6/bin/$i || \ - echo -e "[Desktop Entry]\nX-SuSE-translate=true\nEncoding=UTF-8\n\ -Type=XSession\nExec=$i\nTryExec=$sesspath/$i\n\ -Name=$i\n" > /mnt/etc/X11/sessions/$i.desktop - # does not work correctly (add /var/X11R6/bin to path!!) - test -x /mnt/usr/X11R6/bin/$i || \ - ln -fs /var/X11R6/bin/desktop-session /mnt/$sesspath/$i -done - -# add special path /var/X11R6/bin to the PATH variable -[ "x$addpath" != "x" ] && \ - echo -e "# added path component by $0: $date\n\ -PATH=\"\$PATH:/var/X11R6/bin\"" >>/mnt/etc/profile - -} - # configure display manager (runlevel links and kind of manager) config_dm () { # should be stated that entries were made (fixmee how??) @@ -253,9 +203,9 @@ config_bt () { # (before most of the normal boot init scripts) # this script should operate like a normal runlevel script (fixme!!) d_mkrlscript () { -local switch=$1 -local name=$2 -local info=$3 +local switch="$1" +local name="$2" +local info="$3" case "$switch" in init) echo -e "#!/bin/sh\n# skeleton of /etc/${D_INITDIR}/$name written \ diff --git a/initrd/initrd-stuff/bin/hwautocfg b/initrd/initrd-stuff/bin/hwautocfg index 526e59b6..bc9ffd11 100755 --- a/initrd/initrd-stuff/bin/hwautocfg +++ b/initrd/initrd-stuff/bin/hwautocfg @@ -181,9 +181,8 @@ for section in Files ServerFlags Module InputDevice Monitor \ sed -e "s,XMODULE,${XMODULE}," -e "s%XDESC%${XDESC}%" >>$xfc # special options may be needed for some drivers [ $DEBUGLEVEL -gt 1 ] && msg "X setup" \ -"adding for some Xfree86 modules \ -(radeon, s3virge, nvidia) special options to\nthe 'Device' section. Consult \ -hwsetup if you like to add more or remove some." +"adding for some Xfree86 modules (radeon, s3virge, nvidia) special\noptions \ +to the 'Device' section. Consult hwsetup if you like to add more or\nremove some." [ x$DRV = "xs3virge" ] && { echo -e "\tOption\t\t\"XVideo\" \"Off\"\n" >>$xfc [ $DEBUGLEVEL -gt 1 ] && msg "X setup" \ @@ -279,10 +278,10 @@ modprobe ${MODPRV} usbcore & # "drivers" (pseudo, placeholder strings, ...) to exclude from loading # depending on distro more hw modules have to be excluded too. use the # D_HWMODTOIGNORE for that purpose -DRIVERLIST=" disabled unknown ignore pcspkr synaptics keybdev\ +DRIVERLIST=" disabled unknown ignore pcspkr synaptics keybdev kanotix\ ${D_HWMODTOIGNORE} " # driver blacklist (real modules which fail to load) -DRIVERLIST=${DRIVERLIST}"hw_random kanotix genericwheelusb " +DRIVERLIST=${DRIVERLIST}"hw_random genericwheelusb " # hack for pseudo modules (not to load) for i in $DRIVERLIST ; do echo -e "alias\t$i\tusbcore" >> /etc/modprobe.conf diff --git a/initrd/initrd-stuff/bin/screenres b/initrd/initrd-stuff/bin/screenres index 8a04f40a..ad263ae9 100755 --- a/initrd/initrd-stuff/bin/screenres +++ b/initrd/initrd-stuff/bin/screenres @@ -62,7 +62,7 @@ fi echo " ($tft_probability)" # Find the lines with two times 3 to 4 digits delimited by an x. Print with the two values reverted, so sort sorts w.r.t the 2nd value. Then swap back -screen_resolutions=`sed -n '/edid/I,$s/.*[ \t]\([0-9]\{3,4\}\) *x *\([0-9]\{3,4\}\).*/\2 x \1/p' ${tmp_ddcprobe_output}| sort -r -n | uniq| sed -n 's/\([0-9]\{3,4\}\) x \([0-9]\{3,4\}\).*/"\2x\1"/p' ` +screen_resolutions=`sed -n '/edid/I,$s/.*[ \t]\([0-9]\{3,4\}\) *x *\([0-9]\{3,4\}\).*/\2 x \1/p' ${tmp_ddcprobe_output}| sort -rn | sort -rnu | sed -n 's/\([0-9]\{3,4\}\) x \([0-9]\{3,4\}\).*/"\2x\1"/p' ` screen_resolutions=`echo $screen_resolutions` echo "Supported Screen Modes: $screen_resolutions" diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig index 6de5ba48..2be55ba7 100755 --- a/initrd/initrd-stuff/bin/servconfig +++ b/initrd/initrd-stuff/bin/servconfig @@ -192,19 +192,24 @@ config_snmp 24 02 # create needed directories and files if [ "x$vmware" != "x" ] || [ "x$vmware" != "xno" ] ; then # in the future other types of sources besides NFS should be supported - mount -t nfs -o ro,nolock,intr,nodev,soft,timeo=2,nosuid \ - ${imgsrv} /mnt/${vmdir} & + for i in /var/lib/vmware /etc/vmware/vmnet1 /etc/vmware/vmnet8 \ + /var/run/vmware ; do + testmkd /mnt/$i + done + # mount the vmware image source or link it (compatibility to ver. 3) + if [ -d /mnt/usr/share/vmware ] ; then + ln -sf /usr/share/vmware /var/lib/vmware + elif [ -n "${imgsrv}" ] ; then + mount -t nfs -o ro,nolock,intr,nodev,soft,timeo=2,nosuid \ + ${imgsrv} /mnt/var/lib/vmware & + fi # generate a runlevel script - d_mkrlscript init vmware-prep "Starting preparation of vmware environment" + d_mkrlscript init vmware-prep 'Starting preparation of vmware environment' sed "s,^#.*,,;/^$/d;s,^,\t," /etc/vmware-prep >> \ /mnt/etc/${D_INITDIR}/vmware-prep d_mkrlscript close vmware-prep "" chmod u+x /mnt/etc/${D_INITDIR}/vmware-prep config_vmware - for i in /var/lib/vmware /etc/vmware/vmnet1 /etc/vmware/vmnet8 \ - /var/run/vmware ; do - testmkd /mnt/$i - done chmod 1777 /mnt/var/run/vmware rm /mnt/etc/vmware/not_configured 2>/dev/null # define a variable where gdm/kdm should look for additional sessions diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions index 3e5b7a8a..65a811ca 100644 --- a/initrd/initrd-stuff/etc/functions +++ b/initrd/initrd-stuff/etc/functions @@ -12,7 +12,7 @@ ####################################################################### # generate events with the sysfs trigger -function trigger_device_events() { +trigger_device_events () { list=$(echo /sys/bus/*/devices/*/uevent) list="$list $(echo /sys/class/*/*/uevent)" list="$list $(echo /sys/block/*/uevent /sys/block/*/*/uevent)" @@ -40,7 +40,7 @@ function trigger_device_events() { ####################################################################### # produce error message and if $2 is empty run (debug) shell -error() { +error () { local message="An error occured during execution of $0 script:\n\n$1\n" # check if LOGFILE is really writeable if [ -n "${LOGFILE}" ] ; then @@ -61,7 +61,7 @@ else /bin/sh fi } -msg() { +msg () { echo -e "$1 info: $2" } ####################################################################### @@ -75,7 +75,7 @@ return 0 ####################################################################### # load a certain module - name of module with path in argument one, the # error message in second argument -loadmod() { +loadmod () { local modpath=$1 local module=`echo $modpath|sed -e "s,.*/,,"` local msg=$2 @@ -87,7 +87,7 @@ fi } ####################################################################### # compute prefix bit number from netmask -nm2pref() { +nm2pref () { set `IFS="."; echo $1` local n=0 for i in $1 $2 $3 $4 ; do @@ -144,7 +144,7 @@ esac } ####################################################################### # nfs mounter -nfsmnt() +nfsmnt () { local nfsroot=$1 errmsg=" Mount of root filesystem via NFS was requested via kernel command \ @@ -176,7 +176,7 @@ esac } ####################################################################### # create configuration file for dhclient -mkdhclconf() { +mkdhclconf () { local vci=$1 # provide dhclient with proper configuration echo -e "option bootlocal-script code 221\t= string;\n\ @@ -205,7 +205,7 @@ fi ####################################################################### # dhcp client -rundhcp() +rundhcp () { local commonerr=" The following problems could produce that error:\n\ * The af_packet.ko module is either not loaded nor present in kernel.\n\ @@ -326,7 +326,7 @@ strinstr (){ #done #return 1 #} -strinfile(){ +strinfile (){ case "$(cat $2)" in *$1*) return 0;; esac return 1 } diff --git a/initrd/mkdxsinitrd b/initrd/mkdxsinitrd index 2ec5b3e3..430dd79d 100755 --- a/initrd/mkdxsinitrd +++ b/initrd/mkdxsinitrd @@ -311,8 +311,8 @@ done # needed standard binaries for bbins in \ - cat chmod chown chroot cp expr fdisk killall ln mkdir mkfs.ext2 \ - modprobe mount portmap rmmod sed sort tar umount uniq + cat chmod chown chroot cp expr fdisk killall ln ls mkdir mkfs.ext2 \ + modprobe mount portmap rmmod sed sort rm tar umount do cobi ${bbins} bin || echo "Program ${bbins} not found" done @@ -334,7 +334,7 @@ cobi $tftp bin # debug binaries for bbins in \ - date ls lsmod lsof ps rm strace time + date lsmod lsof ps strace time do cobi ${bbins} bin || echo "Program ${bbins} not found" done @@ -348,8 +348,7 @@ done # if nfs mkdir -p ${INSTDIR}/var/lib/nfs/state -# if nbd -# cobi nbd-client bin +# if nbd or dnbd if [ -n "${FSMODULES}" ] ; then for i in ${FSMODULES}; do case "$i" in @@ -421,23 +420,24 @@ for module in af_packet unix ${NWMODULES} ${FSMODULES} ${DEBUGMODULES}; do cp ${ROOTDIR}/$mod ${mpath} # fixmee!! selection of dependent modules could be handled a little bit # more clever + rdirprefix="${ROOTDIR}/lib/modules/${KERNVER}/kernel" + ddirprefix="${INSTDIR}/lib/modules/${KERNVER}/kernel" case "$module" in e100|8139too|via-rhine|sis900|epic100|sundance|8139cp|eepro100|pcnet32) - cp ${ROOTDIR}/lib/modules/${KERNVER}/kernel/drivers/net/mii.ko \ - ${INSTDIR}/lib/modules/${KERNVER}/kernel/drivers/net &>/dev/null + cp ${rdirprefix}/drivers/net/mii.ko \ + ${ddirprefix}/drivers/net &>/dev/null ;; nfs) # create directory structure for modules needed and copy them # to the proper place (as expected by modprobe/modules.dep) - mkdir -p ${INSTDIR}/lib/modules/${KERNVER}/kernel/net/sunrpc/ - mkdir -p ${INSTDIR}/lib/modules/${KERNVER}/kernel/fs/lockd - mkdir -p ${INSTDIR}/lib/modules/${KERNVER}/kernel/fs/nfs_common - cp ${ROOTDIR}/lib/modules/${KERNVER}/kernel/net/sunrpc/sunrpc.ko \ - ${INSTDIR}/lib/modules/${KERNVER}/kernel/net/sunrpc &>/dev/null - cp ${ROOTDIR}/lib/modules/${KERNVER}/kernel/fs/lockd/lockd.ko \ - ${INSTDIR}/lib/modules/${KERNVER}/kernel/fs/lockd &>/dev/null - cp ${ROOTDIR}/lib/modules/${KERNVER}/kernel/fs/nfs_common/nfs_acl.ko \ - ${INSTDIR}/lib/modules/${KERNVER}/kernel/fs/nfs_common &>/dev/null + mkdir -p ${ddirprefix}/net/sunrpc + mkdir -p ${ddirprefix}/fs/lockd ${ddirprefix}/fs/nfs_common + cp ${rdirprefix}/net/sunrpc/sunrpc.ko \ + ${ddirprefix}/net/sunrpc &>/dev/null + cp ${rdirprefix}/fs/lockd/lockd.ko \ + ${ddirprefix}/fs/lockd &>/dev/null + cp ${rdirprefix}/fs/nfs_common/nfs_acl.ko \ + ${ddirprefix}/fs/nfs_common &>/dev/null ;; esac fi @@ -450,9 +450,8 @@ cp ${ROOTDIR}/lib/modules/${KERNVER}/modules.* \ for dirs in `find initrd-stuff/* ! -regex ".*/\..*"` ; do repco ${dirs##initrd-stuff/} done -chmod 755 ${INSTDIR}/init ${INSTDIR}/bin/servconfig \ - ${INSTDIR}/bin/hwautocfg ${INSTDIR}/bin/dhcpmkconfig \ - ${INSTDIR}/bin/screenres +chmod 755 ${INSTDIR}/init \ + ${INSTDIR}/bin/{servconfig,hwautocfg,screenres,dhcpmkconfig} ######################################################################### # End of file copy procedures -- cgit v1.2.3-55-g7522