diff options
author | Dirk von Suchodoletz | 2006-09-03 15:59:27 +0200 |
---|---|---|
committer | Dirk von Suchodoletz | 2006-09-03 15:59:27 +0200 |
commit | 42afca10fa4df79e7dfd7ddfe4df21df82ac159c (patch) | |
tree | 325bcad9dcccee0faea4ca88cf135e9c6a2ec07b /initrd/initrd-stuff/etc | |
parent | More cleanups in servconfig ... (diff) | |
download | core-42afca10fa4df79e7dfd7ddfe4df21df82ac159c.tar.gz core-42afca10fa4df79e7dfd7ddfe4df21df82ac159c.tar.xz core-42afca10fa4df79e7dfd7ddfe4df21df82ac159c.zip |
VMware environment: loopfile and mount will be placed in /etc/vmware
now to avoid problems with nfs and unionfs. Cleanups in vmware-prep
script. Introduced new debug level for script runtime calculation, see
DebugLevel for further information. Code cleanups in major initramfs
scripts, improved /tmp handling in hwautocfg and init ... Removed imgsrv
variable (from machine-setup), just merged with the vmware variable (put
the vmware image source here ...)
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@352 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd/initrd-stuff/etc')
-rw-r--r-- | initrd/initrd-stuff/etc/functions | 24 | ||||
-rw-r--r-- | initrd/initrd-stuff/etc/vmware-prep | 148 |
2 files changed, 46 insertions, 126 deletions
diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions index 006ccb17..4ad7fe5c 100644 --- a/initrd/initrd-stuff/etc/functions +++ b/initrd/initrd-stuff/etc/functions @@ -2,7 +2,7 @@ # (included by init, hwautocfg, servconfig, ... within OpenSLX initial # ramfs) # -# Dirk von Suchodoletz <dvs@OpenSLX.com>, 31-08-2006 +# Dirk von Suchodoletz <dvs@OpenSLX.com>, 03-09-2006 # Felix Endres, 30-04-2006 # Tobias Maier # @@ -72,10 +72,11 @@ else LOGFILE="/dev/null" fi # if nonfatal error else fatal error message and shell if [ -n "$2" ] ; then - [ "$DEBUGLEVEL" -ge 1 ] && echo -e "${error_msg}${e_msg}${error_nfe}" \ - >> ${LOGFILE} - [ "$DEBUGLEVEL" -gt 1 ] && echo -e "${error_msg}${e_msg}${error_nfe}" - [ "$DEBUGLEVEL" -gt 2 ] && usleep 20 + [ "$DEBUGLEVEL" -ge 1 -a "$DEBUGLEVEL" != 8 ] && \ + 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 else echo -e "${error_msg}${e_msg}${error_shell}" # load usb modules to have keyboard enabled - they might have to be @@ -91,6 +92,14 @@ else # } fi } +####################################################################### +# system uptime for performance analysis +sysup () { +uptime=$(sed -e "s, .*,,;s,\.,," /proc/uptime) +echo "${uptime} ms." +# if start times are kept, a summary of runtimes would be possible too +} + ####################################################################### # micro sleep - either busybox command or simply loop and delete 1 from @@ -322,7 +331,8 @@ case $dhcp in error "$error_pump" ;; ipconfig) - [ $DEBUGLEVEL -gt 1 ] && echo -e "# You are using ipconfig as dhcp \ + [ $DEBUGLEVEL -gt 1 -a "$DEBUGLEVEL" != 8 ] && \ +echo -e "# You are using ipconfig as dhcp \ client. With this tool you only get the\n# basic IP settings from the \ server. No vendor specific, self defined\n# dhcp options are possible this \ way. use dhclient instead or get them via\n# tftp (to be enabled via kernel \ @@ -370,7 +380,7 @@ esac # unpack part (only gzip is supported) if [ -s $dst ] ; then tar -xpzf $dst 2>/dev/null - [ "$DEBUGLEVEL" -le 2 ] && rm $dst + [ "$DEBUGLEVEL" -le 2 -o "$DEBUGLEVEL" -eq 8 ] && rm $dst return 0 else return 1 diff --git a/initrd/initrd-stuff/etc/vmware-prep b/initrd/initrd-stuff/etc/vmware-prep index 21333ed7..df83fd96 100644 --- a/initrd/initrd-stuff/etc/vmware-prep +++ b/initrd/initrd-stuff/etc/vmware-prep @@ -1,140 +1,50 @@ #!/bin/sh # -# Description: Kernel of a generic runlevel script file for use with -# Diskless X Stations (v4.0) - script prepares vmware -# environment. Start and stop functionality is added within -# initial ramdisk +# Kernel of a generic runlevel script file for use with OpenSLX diskless +# linux machines - script prepares vmware environment. Start and stop +# functionality is added within initialramfs # -# Author(s): Michael Janczyk <mj0@uni-freiburg.de>, 15-04-2006 -# Dirk von Suchodoletz <dirk@goe.net>, 23-08-2006 -# Copyright: (c) 2003, 2006 - RZ Universitaet Freiburg +# Michael Janczyk <mj0@uni-freiburg.de>, 15-04-2006 +# Dirk von Suchodoletz <dirk@goe.net>, 03-09-2006 +# +# (c) 2003, 2006 - RZ Universitaet Freiburg # # Version: 0.2.324 # -################################################################################ - - - -### VERBOSE? ################################################################### +####################################################################### # set verbose mode (set -x(v)) #set -xv - - -### CONFIGURATION ############################################################## +### CONFIGURATION ##################################################### # read configuration information . /etc/machine-setup - - -### VARIABLES SECTION ########################################################## +### VARIABLES SECTION ################################################# # Declaration of default variables vmdir=/var/lib/vmware -#path=/var/X11R6/bin -#sessions= -#session_name= - - - -### FUNCTIONS SECTION ########################################################## -# NOT NEEDED NOW -# unionfs used? -#pathtest () { -# if `touch /usr/X11R6/bin/touch >/dev/null 2>&1`; then -# path=/usr/X11R6/bin/ -# rm ${path}/touch >/dev/null 2>&1 -# else -# test -d ${path} || mkdir -p ${path} -# fi -#} - - -# loop file for exchanging information between linux and vmware -mount_loop () { - modprobe loop >/dev/null 2>&1 - mkdir -p /tmp/loop0 - cp ${vmdir}/templ/fd0.img /tmp/${clientip}-fd0.img - chmod a+rw /tmp/${clientip}-fd0.img - mount -n -t msdos -o loop,umask=000 /tmp/${clientip}-fd0.img \ - /tmp/loop0 -} - - -# device creation - the module does not trigger udev properly -vmnet () { - for i in 0 1 2 3 4 5 6 7 8 9; do - [ -c /dev/vmnet${i} ] || mknod /dev/vmnet${i} c 119 ${i}; - done - chmod 0700 /dev/vmnet* -} - -# MOVED TO INITRD -# special start script for vmware with predefined image -#copyscript () { -# # runvmware -# cp ${vmdir}/templ/runvmware ${path} -# chmod 755 ${path}/runvmware >/dev/null 2>&1 -# -# # default kdm session. Xdialog with WM and VMware images -# cp ${vmdir}/templ/defaultwm ${path}/defaultwm -# chmod 755 ${path}/defaultwm >/dev/null 2>&1 -#} - - -# MOVED TO INITRD -# blabla sessiondinens -#desktop_session () { -# echo -e "#!/bin/sh\n#\n# file generated by ${0} at ${date}\ -# \n# set to black background\nxsetroot -solid \"black\"\ -# \nstartvm=\$(echo \$0 | sed -e \"s,.*/,,\")\ -# \nxterm -bg black -fg white -geometry 100x30+0-0 +sb \ -# -e \"${path}/runvmware -s \${startvm} ${debug}\"\n" \ -# > ${path}/desktop-session -# chmod 755 ${path}/desktop-session -#} - - -# MOVED TO INITRD -# copy nach blabla -#vmsession2desktop_session () { -# sessions=$(ls ${vmdir}/vmsessions/*.desktop 2>/dev/null) -# if [ -n "${sessions}" ]; then -# for i in ${vmdir}/vmsessions/*.desktop; do -# session_name=$(cat ${i} | grep -iw "exec" \ -# | awk -F "=" '{print $2}') -# ln -s ${path}/desktop-session ${path}/${session_name} -# done -# fi -#} +### START SCRIPT ###################################################### -### START SCRIPT ############################################################### - -# create vmdir -#mkdir -p /var/lib/vmware 2>&1 - -# mount von zeugs (wohl besser in der InitRD, da sonst Sessions nicht -# rechtzeitig fuer gdm/kdm verfuegbar) -#mount -t nfs -o ro,nolock,intr,nodev,soft,timeo=2,nosuid ${imgsrv} ${vmdir} - -# check path -#pathtest +modprobe loop >/dev/null 2>&1 # device creation - the module does not trigger udev properly -vmnet - -# special start script for vmware with predefined image -#copyscript +for i in 0 1 2 3 4 5 6 7 8 9; do + [ -c /dev/vmnet${i} ] || mknod /dev/vmnet${i} c 119 ${i}; +done +chmod 0700 /dev/vmnet* # loop file for exchanging information between linux and vmware guest -mount_loop - -# blabla sessiondinens -#desktop_session - -# copy nach blabla -#vmsession2desktop_session - -# mount usbfs -mount -t usbfs usbfs /proc/bus/usb +loopsrc=/etc/vmware/loopimg +loopdst=/etc/vmware/fd-loop +mkdir -p $loopsrc +grep "unionfs" /proc/mounts >/dev/null && \ + mount -o size=1500k -t tmpfs vm-loopimg $loopsrc +mkdir -p $loopdst +cp ${vmdir}/templ/fd0.img /$loopsrc/fd1.img +chmod a+rw /$loopsrc/fd1.img +mount -n -t msdos -o loop,umask=000 /$loopsrc/fd1.img $loopdst + +# mount usbfs needed for vmware to detect usb devices +grep "/proc/bus/usb" /proc/mounts >/dev/null || \ + mount -t usbfs usbfs /proc/bus/usb |