From 1ea77b35197a40aa9b90e9092473701c217ccbbf Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Thu, 23 Mar 2006 20:26:02 +0000 Subject: stuff for tftp file get, path for vmsessions/*.desktop ... git-svn-id: http://svn.openslx.org/svn/openslx/ld4@117 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initrd/distro-specs/suse/functions-9.3 | 6 ++--- initrd/distro-specs/ubuntu/functions-5.10 | 1 + initrd/initrd-stuff/bin/servconfig | 36 ++++++++++++++------------- initrd/initrd-stuff/etc/functions | 41 +++++++++++++++++++++---------- initrd/initrd-stuff/init | 21 +++++++++++++--- 5 files changed, 67 insertions(+), 38 deletions(-) (limited to 'initrd') diff --git a/initrd/distro-specs/suse/functions-9.3 b/initrd/distro-specs/suse/functions-9.3 index 274d126a..0072fd27 100644 --- a/initrd/distro-specs/suse/functions-9.3 +++ b/initrd/distro-specs/suse/functions-9.3 @@ -4,7 +4,7 @@ # functions file). This file is the main base for the # following SuSE distributions # -# Author(s): Dirk von Suchodoletz , 21-03-2006 +# Author(s): Dirk von Suchodoletz , 23-03-2006 # Blabla # Blub # @@ -248,10 +248,8 @@ SuspendCommand=/usr/bin/powersave --suspend-to-disk BaseXsession=/etc/opt/gnome/gdm/Xsession SessionDesktopDir=/usr/share/xsessions/:/etc/X11/sessions/:\ /etc/opt/gnome/dm/Sessions/:/opt/gnome/share/gdm/BuiltInSessions/:\ -/var/lib/vmware/import/vmsessions +$vmsessions BaseXsession=/etc/opt/gnome/gdm/Xsession -SessionDesktopDir=/usr/share/xsessions/:/etc/opt/gnome/dm/Sessions/:\ -/opt/gnome/share/gdm/BuiltInSessions/ UserAuthFBDir=/tmp UserAuthFile=.Xauthority StandardXServer=/usr/X11R6/bin/X diff --git a/initrd/distro-specs/ubuntu/functions-5.10 b/initrd/distro-specs/ubuntu/functions-5.10 index 02008429..3270e95e 100644 --- a/initrd/distro-specs/ubuntu/functions-5.10 +++ b/initrd/distro-specs/ubuntu/functions-5.10 @@ -231,6 +231,7 @@ config_xdm () { # configure gdm as display manager config_gdm () { : +# do not forget to add the $vmsessions (see SuSE config) } # configure kdm as display manager diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig index fce4d8c9..fc8ea483 100755 --- a/initrd/initrd-stuff/bin/servconfig +++ b/initrd/initrd-stuff/bin/servconfig @@ -4,7 +4,7 @@ # for linux diskless clients (executed within initial # ramdisk) # -# Author(s): Dirk von Suchodoletz , 21-03-2006 +# Author(s): Dirk von Suchodoletz , 23-03-2006 # Blabla # Blub # @@ -184,6 +184,24 @@ config_sshd 12 10 # simple network management protocol agent config_snmp 24 02 +####################################################################### +# vmware stuff: two scenarios +# * VM images in /usr/share/vmware - then simply link +# * VM images via additional mount (mount source NFS, NBD, ...) + +# create needed directories and files +if [ "x$vmware" != "x" ] || [ "x$vmware" != "xno" ] ; then + 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 + export vmsessions=/var/lib/vmware/vmsessions +fi + ####################################################################### # X11/GUI stuff if [ "x$start_x" != "xno" ] ; then @@ -331,21 +349,5 @@ config_nscd # chmod a+rwxt /mnt/tmp/.X11-unix -####################################################################### -# vmware stuff: two scenarios -# * VM images in /usr/share/vmware - then simply link -# * VM images via additional mount (mount source NFS, NBD, ...) - -# create needed directories and files -if [ "x$vmware" != "x" ] || [ "x$vmware" != "xno" ] ; then - 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 -fi - # servconfig finished successfully echo "finished" > /tmp/svcfg diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions index ea7243b4..3e5b7a8a 100644 --- a/initrd/initrd-stuff/etc/functions +++ b/initrd/initrd-stuff/etc/functions @@ -2,13 +2,13 @@ # linux diskless clients (included by init, hwautocfg, # servconfig, ... within initial ramdisk) # -# Author(s): Dirk von Suchodoletz , 21-03-2006 +# Author(s): Dirk von Suchodoletz , 23-03-2006 # Felix Endres, 21-03-2006 # Blub # # Copyright: (c) 2006 - RZ Universitaet Freiburg # -# Version: 0.4.2a +# Version: 0.4.2b ####################################################################### # generate events with the sysfs trigger @@ -257,7 +257,20 @@ echo "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) +# kernel command line) +# tftpget is helper function for fileget +tftpget () { +# $1 is type of tftp command, $2 is config file name to get, $3 IP of +# server to get file from +case "$1" in + atftp) + atftp -g -r $2 $3 + ;; + tftp) + echo "get $2" | tftp $3 + ;; +esac +} fileget () { for tftp in /bin/atftp /bin/tftp ; do test -x $tftp && break @@ -265,19 +278,21 @@ done if [ -n "$FILESRC" ] ; then cfgfile=${FILESRC#*:} tftpserver=${FILESRC%:*} + tftpget $tftp $cfgfile $tftpserver else - cfgfile="/tftpboot/dxs-config/$clientip.cfg" + cfgfile="/tftpboot/dxs-config" + # ensure that a / is at the end of path to config file + cfgfile=$cfgfile"/" tftpserver=$serverip + # try to get configuration files successively; start with first part + # of the servers IP, add second part ... + set `IFS="."; echo $serverip` + for i in $1 $2 $3 $4 ; do + cfgfile=$cfgfile$i + tftpget $tftp $cfgfile $tftpserver + cfgfile=$cfgfile"." + done fi -# -case "$tftp" in - atftp) - atftp -g -r $cfgfile $tftpserver - ;; - tftp) - echo "get $cfgfile" | tftp $tftpserver - ;; -esac echo "finished" > /tmp/file-done } diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init index 39280a4d..38576137 100755 --- a/initrd/initrd-stuff/init +++ b/initrd/initrd-stuff/init @@ -2,13 +2,13 @@ # Description: main script for new type of initial ramdisk for # linux diskless clients version 4 # -# Author(s): Dirk von Suchodoletz , 08-03-2006 +# Author(s): Dirk von Suchodoletz , 23-03-2006 # Bla # Blub # # Copyright: (c) 2006 - RZ Universitaet Freiburg # -# Version: 0.2.3b +# Version: 0.2.3c # functions common for all distros errmsg="functions file contains a lot of script \ @@ -20,7 +20,7 @@ functionality. Without this\ninit script will not run." specific configuration file could not be found" && exit 1 ) export PATH=/bin:/sbin:/usr/bin/:/usr/sbin -export date="12-02-2006" +export date="23-03-2006" export DEBUGLEVEL=0 export KERNEL="@@@KERNVER@@@" @@ -96,6 +96,10 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup # if ld.so.cache should not be generated noldsc) NOLDSC=yes;; + # additional source to union root filesystem with + union*) + UNIONFS=1 + UNIONDIRS=${opts#union=};; # if unionfs should be used unionfs*) UNIONFS=1;; @@ -277,6 +281,12 @@ fi if [ -z "${DNBDOPT}" -a -z "${NBDOPT}" ] ; then nfsmnt ${NFSROOT} ${MODPRV} fi + +# if additional sources should be used for a combined root filesystem +if [ -n ${UNION} ] ; then + : +fi + # get the complete collection of kernel modules available mount -n --bind /mnt/lib/modules/${KERNEL} /lib/modules/${KERNEL} || \ error " The requested modules directory does not exist. That could mean:\n\ @@ -303,10 +313,13 @@ fi msg="Starting ldconfig - switch it off via kernel cmdline option 'noldsc'" if [ -n "${UNIONFS}" ] ; then echo "Using UnionFS for rw access" + [ -n ${NFSROOT} ] && NFSRO=nfs mkdir -p ${RWDIR}/union ${RWDIR}/uniontmp mount -n -t tmpfs none ${RWDIR}/uniontmp mount -n --move /mnt /root - mount -n -t unionfs -o dirs=${RWDIR}/uniontmp=rw:/root=nfsro none /mnt + # probably more sources should be merged into union (${ADDFS} is defined) + mount -n -t unionfs -o dirs=${RWDIR}/uniontmp=rw:/root=${NFSRO}ro${ADDFS} \ + none /mnt mkdir -p /mnt/uniontmp mount -n --move ${RWDIR}/uniontmp /mnt/uniontmp # run ldconfig if not switched off via kernel command line -- cgit v1.2.3-55-g7522