summaryrefslogtreecommitdiffstats
path: root/vmware
diff options
context:
space:
mode:
authorMichael Janczyk2006-04-06 04:28:14 +0200
committerMichael Janczyk2006-04-06 04:28:14 +0200
commit7445146c911842246d28c3cd81af2877e137026e (patch)
tree5ae1db9e07909400be1f2fbf4545478d1ed80130 /vmware
parentsome fixes and addons ... (diff)
downloadcore-7445146c911842246d28c3cd81af2877e137026e.tar.gz
core-7445146c911842246d28c3cd81af2877e137026e.tar.xz
core-7445146c911842246d28c3cd81af2877e137026e.zip
3.4:
runvmware: computername param added to config.xml ld4: ostype: new file with vmware ostype to use with runvmware alias: new file for aliases to use with vmware defaults: default command line options for runvmware win98config: config file for import in runvmware winconfig: resolution, computername, username, for import with runvmware vmware-prep: chmod 755 runvmware added after copy runvmware: new runvmware, few things outsourced (see above) new options: --floppyb --import <file> new Xdialog menu reads from .desktop files changed for ld4 (dirs,etc...) git-svn-id: http://svn.openslx.org/svn/openslx/ld4@166 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'vmware')
-rw-r--r--vmware/alias17
-rw-r--r--vmware/defaults7
-rw-r--r--vmware/ostype16
-rwxr-xr-xvmware/runvmware1181
-rw-r--r--vmware/win98config42
-rw-r--r--vmware/winconfig29
6 files changed, 644 insertions, 648 deletions
diff --git a/vmware/alias b/vmware/alias
new file mode 100644
index 00000000..a49560c9
--- /dev/null
+++ b/vmware/alias
@@ -0,0 +1,17 @@
+# alias file to use with runvmware
+#
+# -NO DUPLICATE ENTRIES!!!-
+
+######
+# -OSType- | -aliases separated through spaces-
+#####
+windows98 win98
+windows2000 win2k
+windowsxp winxppro winxp
+suse suse93
+
+#####
+# -Spec names- | -aliases separated through spaces-
+#####
+kursversion kurs
+
diff --git a/vmware/defaults b/vmware/defaults
new file mode 100644
index 00000000..52b57bf5
--- /dev/null
+++ b/vmware/defaults
@@ -0,0 +1,7 @@
+# file for runvmware
+#
+# here you can specify default command line options for runvmware
+# all in one line !!!!
+
+--include ${vmtempl}/winconfig --floppyb
+
diff --git a/vmware/ostype b/vmware/ostype
new file mode 100644
index 00000000..2aede341
--- /dev/null
+++ b/vmware/ostype
@@ -0,0 +1,16 @@
+# file for runvmware
+#
+# change VMware ostype here
+
+
+#####
+# For OSType use the first part of the image-name.
+# -OSType- | -VMWare name-
+#####
+windows98 win98
+windows2000 win2000pro
+windowsxp winxppro
+suse suse
+kubuntu other26xlinux
+debian other26xlinux
+
diff --git a/vmware/runvmware b/vmware/runvmware
index baf35257..6a15d939 100755
--- a/vmware/runvmware
+++ b/vmware/runvmware
@@ -1,13 +1,13 @@
#!/bin/sh
#
-# Description: Script for preparing VMware environment Diskless X Stations
-# (v4.0)
+# Description: Script for preparing VMware environment Diskless
+# X Stations (v4)
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 05-08-2005
-# Michael Janczyk <mj0@uni-freiburg.de>, 10-03-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 18-03-2006
+# Michael Janczyk <mj0@uni-freiburg.de>, 06-04-2006
# Copyright: (c) 2003, 2006 - RZ Universitaet Freiburg
#
-VERSION=pre0.14; LAST_CHANGES=10.03.06
+version=pre0.14; last_changes=06-04-06
################################################################################
@@ -19,369 +19,247 @@ VERSION=pre0.14; LAST_CHANGES=10.03.06
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
-# TO BE CHANGED!!!!
+### HEADER SECTION #############################################################
+# write runvmware.conf
+runvmwareconfheader () {
+ echo "
+ ##############################################################################
+ ###### This configuration file was generated by 'runvmware', ######
+ ###### dont use it for your own configurations - it will be overwritten ######
+ ###### ######
+
+ ###### identity ##############################################################
+ displayName = \"${displayname}\"
+ guestOS = \"${vmostype}\"
+ config.version = \"${confver}\"
+ virtualHW.version = \"${hver}\"
+ memsize = \"${mem}\"
+ numvcpus = \"1\"
-### HEADER SECTION #############################################################
-# VMware guestOS variable declaration
-ostypeheader ()
- {
- echo '
- # This configuration can be changed in runvmware
-
- #####
- # For OSType use the first part of the image-name.
- # -OSType- | -VMWare name- | -Description (use "-" for space)-
- #####
- windows98 win98 Windows-98
- windows2000 win2000pro Windows-2000-Professional
- windowsxp winxppro Windows-XP-Professional
- suse suse Novell-SuSe-Linux
- kubuntu other26xlinux kubuntu
- debian other26xlinux debian
-
- #####
- # What to boot if none of the obove is found, equivalent to *
- # -else- | -VMWare name- | -Description (use "-" for space)-
- #####
-
- else other Unspecified-OS
- '
- }
-
-
-# runvmware alias header
-aliasheader ()
- {
- echo '
- # This configuration can be changed in runvmware
- #
- # -NO DUPLICATE ENTRIES!!!-
-
- ######
- # -OSType- | -aliases separated through spaces-
- #####
- windows98 win98
- windows2000 win2k
- windowsxp winxppro winxp
- suse suse93
-
- #####
- # -Spec names- | -aliases separated through spaces-
- #####
- kursversion kurs k
- '
- }
-
-
-# runvmware.conf
-runvmwareconfheader ()
- {
- echo "
- # This configuration file was generated by 'runvmware', dont use it for your
- # own configurations - it will be overwritten
-
- apmSuspend = \"FALSE\"
- config.version = \"$CONFVER\"
- debug = \"FALSE\"
- disable_acceleration = \"FALSE\"
- displayName = \"$DISPLAYNAME\"
- ethernet0.address = \"00:50:56:0D:$MAC\"
- ethernet0.addressType = \"static\"
- ethernet0.connectionType = \"bridged\"
- ethernet0.present = \"TRUE\"
- $FLOPPYA
- floppy1.fileName = \"$FILENAME\"
- floppy1.fileType = \"file\"
- floppy1.present = \"TRUE\"
- floppy1.startConnected = \"TRUE\"
- guestOS = \"$VMOSTYPE\"
- hard-disk.enableIBR = \"FALSE\"
- ide0:0.fileName = \"$TMPDIR/disk\"
- ide0:0.mode = \"$NP\"
- ide0:0.present = \"TRUE\"
- isolation.tools.dnd.disable = \"TRUE\"
- logging = \"FALSE\"
- memsize = \"$MEM\"
- parallel0.bidirectional = \"FALSE\"
- parallel0.fileName = \"/dev/parport0\"
- parallel0.present = \"FALSE\"
- priority.grabbed = \"normal\"
- priority.ungrabbed = \"normal\"
- redoLogDir = \"$TMPDIR\"
- resume.repeatable = \"FALSE\"
- scsi0:0.deviceType = \"cdrom-raw\"
- scsi0:0.fileName = \"$CDR_1_NAME\"
- scsi0:0.present = \"$CDR_1\"
- scsi0:1.deviceType = \"cdrom-raw\"
- scsi0:1.fileName = \"$CDR_2_NAME\"
- scsi0:1.present = \"$CDR_2\"
- scsi0.present = \"$VMSCSI\"
- serial0.fileName = \"/dev/ttyS0\"
- serial0.present = \"TRUE\"
- sharedFolder0.enabled = \"TRUE\"
- sharedFolder0.expiration = \"never\"
- sharedFolder0.guestName = \"home\"
- sharedFolder0.hostPath = \"$HOME\"
- sharedFolder0.present = \"TRUE\"
- sharedFolder0.readAccess = \"TRUE\"
- sharedFolder0.writeAccess = \"TRUE\"
- sharedFolder.maxNum = \"1\"
- sound.present = \"TRUE\"
- suspendToDisk = \"TRUE\"
- tmpDirectory = \"$TMPDIR\"
- tools.syncTime = \"TRUE\"
- usb.present = \"TRUE\"
- virtualHW.version = \"4\"
- " \
- >$CONFILE
-
- # Set the appropriate permissions for the vmware config file
- chmod u+rwx $CONFILE >/dev/null 2>&1
- }
-
-
-preferencesheader ()
- {
- echo "
- # This configuration file was generated by 'runvmware', dont use it for your
- # own configurations - it will be overwritten
-
- hint.buslogic.needDriver = \"FALSE\"
- hint.cpuid.unknownfeature = \"FALSE\"
- hint.disklib.lockerror = \"FALSE\"
- hint.guestos.xp = \"FALSE\"
- hint.gui.poweroff = \"FALSE\"
- hint.gui.reset = \"FALSE\"
- hint.mks.fullscreen = \"FALSE\"
- hint.mks.notLocal = \"FALSE\"
- hint.moninit.newKernel = \"FALSE\"
- hint.nfsmounted.persistent = \"FALSE\"
- hint.nfsmounted.undoable = \"FALSE\"
- hint.nologging = \"FALSE\"
- hint.scsi.needDriver = \"FALSE\"
- hint.sound.openMixerFailed = \"FALSE\"
- hint.tools.toolsImage = \"FALSE\"
- hint.upgrade.legacyVM = \"FALSE\"
- hint.usbgLinux.altuhci = \"FALSE\"
- hint.vmui.poweroff = \"FALSE\"
- hint.xkeymap.notLocal = \"FALSE\"
- pref.allowInsanePkgs = \"FALSE\"
- pref.autoFitFullScreen = \"fitHostToGuest\"
- pref.autoRaise = \"FALSE\"
- pref.exchangeSelections = \"TRUE\"
- pref.grabOnKeyPress = \"FALSE\"
- pref.hotkey.shift = \"true\"
- pref.motionGrab = \"TRUE\"
- pref.motionScrollBarrier = \"100000\"
- pref.motionUngrabBarrier = \"1\"
- pref.openedVM0.present = \"TRUE\"
- pref.openedVM.maxNum = \"1\"
- pref.syncTime = \"FALSE\"
- pref.tip.startup = \"FALSE\"
- pref.toolbarIcons = \"FALSE\"
- pref.view.navBar.type = \"favorites\"
- pref.vmplayer.exit.vmAction = \"poweroff\"
- pref.vmplayer.fullscreen.autohide = \"TRUE\"
- pref.vmplayer.webUpdateOnStartup = \"FALSE\"
- prefvmx.defaultVMPath = \".vmware\"
- prefvmx.mru.config = \"$CONFILE:\"
- prefvmx.mru.suspended = \"\"
- tmpDirectory = \"$CONFDIR\"
- webUpdate.checkLast = \"1120235802\"
- webUpdate.checkPeriod = \"manual\"
- " \
- >$VMDIR/preferences
- }
-
-
-# Create Windows 98 config files
-win98header ()
- {
- echo -e "\tREGEDIT4\r
-
- [HKEY_CURRENT_USER\Networ\Persistent\H]\r
- \"RemotePath\"=\"\\\\192.168.1.2\\$USER\"\r
- \"UserName\"=\"$USER\"\r
- \"ProviderName\"=\"Microsoft Network\"\r" \
- > /media/loop0/home.reg
-
- echo -e "\tREGEDIT4\r
-
- [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP]\r
- \"ComputerName\"=\"$HOSTNAME\"\r
- \"Workgroup\"=\"$WORKGROUP\"\r
- \"Comment\"=\"$COMMENT\"\r
- \"StaticVxD\"=\"vnetsup.vxd\"\r
- \"Start\"=hex:00\r
- \"NetClean\"=hex:01\r
-
- [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\\\
-ComputerName]\r
- \"ComputerName\"=\"$HOSTNAME\"\r" \
- > /media/loop0/rechner.reg
-
- echo -e "\tREGEDIT4\r
-
- [HKEY_LOCAL_MACHINE\Network\Logon]\r
- \"username\"=\"$USER\"\r
- \"PrimaryProvider\"=\"Microsoft Network\"\r
- \"LMLogon\"=hex:00,00,00,00\r" \
- > /media/loop0/logon.reg
- }
-
-
-winresheader ()
- {
- echo -e "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r
- <settings>\r
- <eintrag>\r
- <resolution_x param=\"$X_PARAM\">\r
- </resolution_x>\r
- <resolution_y param=\"$Y_PARAM\">\r
- </resolution_y>\r
- <username param=\"$USER\">\r
- </username>\r
- </eintrag>\r
- </settings>\r" \
- > /media/loop0/config.xml
- }
+
+ ###### ide-disks #############################################################
+ ide0:0.mode = \"${np}\"
+ ide0:0.present = \"TRUE\"
+ ide0:0.fileName = \"${tmpdir}/disk\"
+
+ ide1:0.present = \"${cdr_1}\"
+ ide1:0.fileName = \"${cdr_1_name}\"
+ ide1:0.deviceType = \"cdrom-raw\"
+
+ ide1:1.present = \"${cdr_2}\"
+ ide1:1.fileName = \"${cdr_2_name}\"
+ ide1:1.deviceType = \"cdrom-raw\"
+
+
+ ###### scsi-disks ############################################################
+ scsi0.present = \"FALSE\"
+
+
+ ###### nics ##################################################################
+ ethernet0.present = \"TRUE\"
+ ethernet0.addressType = \"static\"
+ ethernet0.connectionType = \"bridged\"
+ ethernet0.address = \"00:50:56:0D:${mac}\"
+
+
+ ###### sound #################################################################
+ sound.present = \"TRUE\"
+
+
+ ###### usb ###################################################################
+ usb.present = \"TRUE\"
+
+
+ ###### floppies ##############################################################
+ floppy0.present = \"${floppya}\"
+ floppy0.fileName = \"/dev/fd0\"
+
+ floppy1.present = \"${floppyb}\"
+ floppy1.fileType = \"file\"
+ floppy1.fileName = \"${filename}\"
+ floppy1.startConnected = \"TRUE\"
+
+
+ ###### ports #################################################################
+ parallel0.present = \"FALSE\"
+
+ serial0.present = \"FALSE\"
+
+
+ ###### shared folders ########################################################
+ sharedFolder0.present = \"TRUE\"
+ sharedFolder0.enabled = \"TRUE\"
+ sharedFolder0.expiration = \"never\"
+ sharedFolder0.guestName = \"Home\"
+ sharedFolder0.hostPath = \"${HOME}\"
+ sharedFolder0.readAccess = \"TRUE\"
+ sharedFolder0.writeAccess = \"TRUE\"
+ sharedFolder.maxNum = \"1\"
+
+
+ ###### misc ##################################################################
+ tmpDirectory = \"${tmpdir}\"
+ mainMem.useNamedFile = \"FALSE\"
+ tools.syncTime = \"FALSE\"
+ redoLogDir = \"${tmpdir}\"
+
+ " \
+ >${confile}
+
+ # set the appropriate permissions for the vmware config file
+ chmod u+rwx ${confile} >/dev/null 2>&1
+}
+
+
+preferencesheader () {
+ echo "
+ ##############################################################################
+ ###### This configuration file was generated by 'runvmware', ######
+ ###### dont use it for your own configurations - it will be overwritten ######
+ ###### ######
+
+ hints.hideAll = \"TRUE\"
+ pref.exchangeSelections = \"TRUE\"
+ pref.hotkey.shift = \"TRUE\"
+ pref.tip.startup = \"FALSE\"
+ pref.vmplayer.fullscreen.autohide = \"TRUE\"
+ pref.vmplayer.webUpdateOnStartup = \"FALSE\"
+ prefvmx.defaultVMPath = \"${vmhome}\"
+ prefvmx.mru.config = \"${confile}:\"
+ tmpDirectory = \"${tmpdir}\"
+ webUpdate.checkPeriod = \"manual\"
+
+ " \
+ >${vmhome}/preferences
+}
### VARIABLES SECTION ##########################################################
-# Declaration of default variables
-
-# Hardware variables
-# Temporary disk space for logs, etc...
-export TMPDIR=/tmp/vmware_temporary/$USER/tmp
-# ;)
-MAC=
-declare -i MEM=0
-declare -i MEMTEST=0
-MEMOPT=
-PERMEM=66
-# Virtual Devices
-VMSCSI=FALSE
-CDR_1=FALSE
-CDR_2=FALSE
-FLOPPYA="floppy0.present = \"FALSE\""
-# Resolution
-HOSTRES=`xvidtune -show | grep -ve "^$"`
-X_PARAM=`echo "$HOSTRES" | awk '{print $3}'`
-Y_PARAM=`echo "$HOSTRES" | awk '{print $7}'`
+# declaration of default variables
+
+# hardware variables
+# temporary disk space for logs, etc...
+export tmpdir=/tmp/${USER}
+
+mac=
+declare -i mem=0
+declare -i memtest=0
+memopt=
+memhost=
+memmeg=
+memgig=
+permem=66
+# virtual devices
+cdr_1="FALSE"
+cdr_1_name="/dev/cdrom1"
+cdr_2="FALSE"
+cdr_2_name="/dev/cdrom2"
+floppya="FALSE"
+floppyb="FALSE"
+# place for the virtual floppy "B:"
+filename=`mount | grep -i "/tmp/${clientip}-fd0.img" | awk '{print $1}'`
# VMware variables
# VMware start options
-VMOPT="-X -q"
-# Config directory and file
-CONFDIR=/tmp/vmware_temporary/$USER/vmware
-CONFILE=$CONFDIR/runvmware.conf
-VMDIR=$HOME/.vmware
-# Zenity
-SESS_ZEN="/etc/X11/sessions"
-# VMware version
-VM_VER=5
-# Special Variables
-#UNDOPOINT="keep"
-CONFVER=7
-NP="independent-nonpersistent"
-# Set hostname: using original hostname and adding string "-vm"
-HOSTNAME=`hostname`"-vm"
-# Set samba workgroup
-WORKGROUP="tux-net"
-# Place for the virtual floppy "B:"
-FILENAME=`mount | grep -i "$HOST-1440.img" | awk '{print $1}'`
-COMMENT="Diskless Workstation VMware-Image"
-# Image Variables
-IMGDIR="/usr/share/vmware"
-ALIAS=
-SPEC=
-ENDING="vmdk"
-DISKFILE=
-RIGHTSFILE=
-NOIMAGE=0
-OSTYPE=
-DISPLAYNAME="Unknown OS"
-# Image checking variable
-FILECHECK=
-
-
-# Command line variables
-# Command line options, transform to lower case
-LINEOPTS=( `echo $@ | tr [A-Z] [a-z]` )
-SILENT=
-DEBUG=0
-INTER=
-COMDEF=
-NARG=
+vmopt="-X -q"
+# configfile
+confile="${tmpdir}/runvmware.conf"
+vmhome="${HOME}/.vmware"
+vmdir="/var/lib/vmware"
+# templates dir
+vmtempl="${vmdir}/templ"
+# .desktop files directory
+vmsessions="${vmdir}/vmsessions"
+# special Variables
+confver=8
+hver=4
+np="independent-nonpersistent"
+# set hostname: using original hostname and adding string "-vm"
+hostname="VM-${HOST}"
+# set samba workgroup
+workgroup="VMware-Workgroup"
+comment="Diskless X Station VMware Image"
+# image variables
+alias=
+spec=
+diskfile=
+rightsfile=
+noimage=0
+ostype=
+vmostype=
+displayname="Diskless X Station VMware Image"
+# image checking variable
+filecheck=
+
+
+# command line variables
+# start with this this default commmand line options + extra
+defaults=$(grep -v "#.*" ${vmtempl}/ostype)
+# add command line opts to defaults
+# defaults will be overwritten by command line options
+lineopts=( `echo ${defaults} $@` )
+nofclopt=$(expr $# + $(echo ${defaults} | wc -w))
+silent=
+include=
+debug=0
+inter=
+comdef=
+args=
### FUNCTIONS SECTION ##########################################################
-# Function to write to stdout/logfile
-# Logs labeled with $2=0 write to stdout, if debug set, write to logfile
-writelog ()
- {
- # Write to stdout
- ! [ $SILENT ] && [ "$2" = "0" ] && echo -e "$1"
-
- # Check if range given e.g. 0 0
- if [ -z "$2" ] || [ -z "$3" ];then
+# function to write to stdout/logfile
+# logs labeled with $2=0 write to stdout, if debug set, write to logfile
+writelog () {
+ # write to stdout
+ [ -z ${silent} ] && [ "$2" = "0" ] && echo -e "$1"
+
+ # check if range given e.g. 0 0
+ if [ -z "$2" ] || [ -z "$3" ];then
echo -e "\n\nNO RANGE IN WRITELOG STATEMENT:\n$1\n\tPlease correct!\n"
exit 1
- fi
+ fi
- # Log if level greater than 1 and log only from level $2 to level $3
- [ "$DEBUG" -ge "1" ] && [ "$DEBUG" -ge "$2" ] && [ "$DEBUG" -le "$3" ] && \
- echo -e "$1" >>$CONFDIR/runvmware.$DEBUG.log
- }
+ # log if level greater than 1 and log only from level $2 to level $3
+ [ "${debug}" -ge "1" ] && [ "${debug}" -ge "$2" ] && [ "${debug}" -le "$3" ] \
+ && echo -e "$1" >>${tmpdir}/runvmware.${debug}.log
+}
-help ()
- {
+help () {
cat <<EOH
USAGE: $0 [--options]
Image options:
- -i interactive mode with image selection
- -o <ostype> start ostype, e.g. windowsxp, suse,...
- (first part of image name)
- -s <specification> specify your image, e.g. standard
- (second part of image name)
- -a use aliases in runvmware header
+ -i|--interactive interactive mode with image selection
+ -o|--os <ostype> start ostype, e.g. winxp, suse,...
+ (first part of image name (winxp-pro.vmdk))
+ -s|--spec <spec.> specify your image, e.g. pro, home,...
+ (second part of image name (winxp-home.vmdk))
+ -a|--alias use aliases
--silent no stdout from runvmware
- --displayaliases aliases you can use with option -a
--mem <n(M(h)),n(G(h))> override autoallocation of memory, in percent
m,M megabyte, g,G gigabyte, h,H reserve f. host
--delay <n seconds> delay the start of the script n seconds
--image <directory> specify image directory
--persistent use persistent mode
- --define-vm-ostype <os> overwrite vmware ostype
+ --vmostype <vmwareos> define VMware ostype
+ --include <includefile> include code right before program start
+ --displayaliases aliases you can use with option -a
+ --floppyb use /media/loop0 as floppy B,
+ needed for exchanging files w/ VMware
VMware options:
- --run <programm> specify programm, e.g. vmware, vmplayer, ...
+ --run <program> specify programm, e.g. vmware, vmplayer, ...
--windowed start in windowed mode
--edit only open config file in vmware (only VMware)
--donotquit do not quit after image stopped (only VMware)
@@ -395,177 +273,202 @@ runvmware options:
EOH
- # Print Version , remove path
- echo -e "$0: LAST CHANGES $LAST_CHANGES | VERSION $VERSION\n" |\
- awk -F "/" '{print "\t\t"$NF}'
-
- exit 0
- }
-
-
-checkalias ()
- {
- writelog "Checking alias for $OSTYPE${SPEC:+", $SPEC"}...\c" 0 1
- # OSTYPE=
- OSALIAS=`aliasheader | grep -v "#.*" | grep -w "$OSTYPE" | awk '{print $1}'`
- [ -n "$OSALIAS" ] && OSTYPE=$OSALIAS
-
- # SPEC=
- [ -n "$SPEC" ] && \
- SPECALIAS=`aliasheader | grep -v "#.*" | grep -w "$SPEC" | awk '{print $1}'`
- [ -n "$SPECALIAS" ] && SPEC=$SPECALIAS
-
- writelog "finished\nResult:\n\tOS=$OSTYPE${SPEC:+"\\\n\\\tSPEC=$SPEC"}\n" 0 1
- }
-
-
-x_dialog ()
- {
- DESKTOPS=( `ls $SESS_ZEN 2>/dev/null | sed -e "s,.desktop,,"` )
- DESKTOPSNR=`ls $SESS_ZEN 2>/dev/null | wc -l`
- (( NARG=0 ))
- while [ "$DESKTOPSNR" -gt "$NARG" ]; do
- MENU="$MENU ${DESKTOPS[$NARG]} ${DESKTOPS[$NARG]}"
- (( NARG=$NARG+1 ))
- done
-
- # --stderr because of 1>/dev/nul
- Xdialog --title "VMware Image Menu" \
- --stderr \
- --no-tags \
- --ok-label "Run Image" \
- --cancel-label "Abort Runvmware" \
- --menubox "Please choose the image you would like to run:" 24 51 6 \
- $MENU 1>/dev/null
- }
-
-
-filecheck ()
- {
- FILECHECK=`LANG=us ls -lh $DISKFILE 2>&1`
- writelog "Filecheck:\n$FILECHECK\n" 0 1
- NOIMAGE=`echo $FILECHECK | grep -i "No such file or directory" | wc -l`
- RIGHTSFILE=$DISKFILE
-
- # Check if link
- if [ -L "$DISKFILE" ]; then
+ # print version , remove path
+ echo -e "$0: LAST CHANGES $last_changes | VERSION $version\n" \
+ | awk -F "/" '{print "\t\t"$NF}'
+
+ exit 0
+}
+
+
+checkalias () {
+ if [ -r "${vmtempl}/alias" ]; then
+
+ writelog "Checking alias for ${ostype}${spec:+", ${spec}"}...\c" 0 1
+
+ # ostype=
+ osalias=$(grep -v "#.*" ${vmtempl}/alias | grep -w "${ostype}" \
+ | awk '{print $1}')
+ [ -n "${osalias}" ] && ostype=${osalias}
+
+ # spec=
+ [ -n "${spec}" ] \
+ && specalias=$(grep -v "#.*" ${vmtempl}/alias | grep -w "${spec}" \
+ | awk '{print $1}')
+ [ -n "${specalias}" ] && spec=${specalias}
+
+ writelog "finished\nResult:" 0 1
+ writelog "\tOS=${ostype}${spec:+"\\\n\\\tSpec=$spec"}\n" 0 1
+
+ else
+ writelog "NO alias file found: ${vmtempl}/alias" 0 1
+ writelog "Try without option \"-a\"" 0 1
+ exit 1
+
+ fi
+}
+
+
+x_dialog () {
+ desktops=( `ls ${vmsessions} 2>/dev/null | sed -e "s,.desktop,,"` )
+ desktopsnr=$(echo "${#vmsessions[*]}")
+ (( args=0 ))
+ while [ "${desktopsnr}" -gt "${args}" ]; do
+ execute=$(grep -m 1 -i "exec" ${vmsessions[${args}]} \
+ | awk -F "=" '{print $2}')
+ executenam=$(grep -m 1 -i "name" ${vmsessions[${args}]} \
+ | awk -F "=" '{print $2}')
+ executecom=$(grep -m 1 -i "comment" ${vmsessions[${args}]} \
+ | awk -F "=" '{print $2}')
+ menu="${menu} ${execute} ${executenam:-${execute}} \
+ ${executecom:-${executenam:-${execute}}}"
+ (( args=${args}+1 ))
+ done
+
+ # --stderr because of 1>/dev/null
+ Xdialog --title "VMware Image Menu" \
+ --stderr \
+ --no-tags \
+ --ok-label "Run Image" \
+ --cancel-label "Abort Runvmware" \
+ --item-help \
+ --menubox "Please choose the image you would like to run:" 24 51 6 \
+ ${menu} 1>/dev/null
+}
+
+
+filecheck () {
+ filecheck=$(LANG=us ls -lh ${diskfile} 2>&1)
+ writelog "Filecheck:\n${filecheck}\n" 0 1
+ noimage=$(echo ${filecheck} | grep -i "no such file or directory" | wc -l)
+ rightsfile=${diskfile}
+
+ # check if link
+ if [ -L "${diskfile}" ]; then
writelog "Vmware Image Problem:\c" 0 1
writelog "\tThe image you've specified is a link.\n" 0 1
writelog "\tContinuing to start VMware, but it may cause problems!\n" 0 0
- # Take link target
- RIGHTSFILE=`ls -lh $DISKFILE 2>&1 | awk -F "->" '{print $2}'`
- FILECHECK=`LANG=us ls -lh $RIGHTSFILE 2>&1`
- fi
+ # take link target
+ rightsfile=$(ls -lh ${diskfile} 2>&1 | awk -F "->" '{print $2}')
+ filecheck=$(LANG=us ls -lh ${rightsfile} 2>&1)
+ fi
- # Does file exist
- if [ "$NOIMAGE" -ge "1" ]; then
+ # does file exist
+ if [ "${noimage}" -ge "1" ]; then
writelog "Vmware Image Problem:\c" 0 0
writelog "\tThe image you've specified doesn't exist." 0 0
writelog "Filecheck says:\c" 0 1
- writelog "\t\t$DISKFILE:\n\t\t\tNo such file or directory" 0 1
+ writelog "\t\t${diskfile}:\n\t\t\tNo such file or directory" 0 1
writelog "Hint:\c" 0 0
writelog "\t\t\tCompare spelling of the image with your options.\n" 0 0
exit 1
- fi
+ fi
- # Readable?
- if ! [ -r "$DISKFILE" ]; then # $RIGHTSFILE see above
+ # readable?
+ if ! [ -r "${diskfile}" ]; then # ${rightsfile} see above
writelog "Vmware Image Problem:\c" 0 1
writelog "\tThe image you've specified has wrong rights." 0 1
- writelog "Filecheck says:\t\t`echo $FILECHECK |\
- awk '{print $1" "$3" "$4}'` $RIGHTSFILE" 0 1
- writelog "Hint:\t\t\tChange rights with: chmod a+r $RIGHTSFILE\n" 0 0
+ writelog "Filecheck says:\t\t`echo ${filecheck} \
+ | awk '{print $1" "$3" "$4}'` ${rightsfile}" 0 1
+ writelog "Hint:\t\t\tChange rights with: chmod a+r ${rightsfile}\n" 0 0
exit 1
- fi
- }
+ fi
+}
#### INTERPRET COMMAND LINE OPTIONS ############################################
-# Print help if no clo
+# print help if no clo
if [ $# = "0" ]; then
- help
- exit 0
+ help
+ exit 0
fi
-# Start
-(( NARG=0 ))
-while [ $# -gt "$NARG" ]; do
- case "${LINEOPTS[$NARG]}" in
- -h|--help)
- help
- ;;
- --version)
- echo -e "\n$0: LAST CHANGES $LAST_CHANGES | VERSION $VERSION\n" |\
- awk -F "/" '{print "\t"$NF}'
- exit 0
- ;;
- -i)
- INTER="yes"
+# interpretation of command line arguments
+(( args=0 ))
+while [ ${nofclopt} -gt "${args}" ]; do
+ case "${lineopts[${args}]}" in
+ -h|--help)
+ help
+ ;;
+ --version)
+ echo -e "\n$0: LAST CHANGES ${last_changes} | VERSION ${version}\n" \
+ | awk -F "/" '{print "\t"$NF}'
+ exit 0
+ ;;
+ -i|--interactive)
+ inter="TRUE"
+ ;;
+ -o|--os)
+ (( args=${args}+1 )) # needed for checking unknown options
+ ostype=${lineopts[${args}]}
+ ;;
+ -s|--spec)
+ (( args=${args}+1 ))
+ spec=${lineopts[${args}]}
+ ;;
+ -a|--alias)
+ alias="TRUE"
+ ;;
+ --silent)
+ silent="TRUE"
+ ;;
+ --displayaliases)
+ cat ${vmtempl}/alias; exit 0
+ ;;
+ --delay)
+ (( args=${args}+1 ))
+ sleep ${lineopts[${args}]}
+ ;;
+ --image)
+ (( args=${args}+1 ))
+ vmdir=${lineopts[${args}]}
+ ;;
+ --persistent)
+ np="independent-persistent"
+ ;;
+ --include)
+ (( args=${args}+1 ))
+ include=${lineopts[${args}]}
+ ;;
+ --vmostype)
+ (( args=${args}+1 ))
+ vmostype=${lineopts[${args}]}
+ comdef="TRUE"
+ ;;
+ --mem)
+ (( args=${args}+1 ))
+ memopt=${lineopts[${args}]}
+ ;;
+ --run)
+ (( args=${args}+1 ))
+ vmrun=${lineopts[${args}]}
+ ;;
+ --debug)
+ (( args=${args}+1 ))
+ debug=${lineopts[${args}]}
+ ;;
+ --windowed)
+ vmopt=$(echo ${vmopt} | sed -e "s,-X,-x,")
+ ;;
+ --floppyb)
+ floppyb="TRUE"
+ ;;
+ --edit)
+ vmopt=""
+ ;;
+ --donotquit)
+ vmopt=$(echo ${vmopt} | sed -e "s,-q,,")
+ ;;
+ *)
+ echo -e "\n\tOption \"${lineopts[${args}]}\" not found, please correct.\n"
+ sleep 1
+ help
;;
- -o)
- (( NARG=$NARG+1 )) # Needed for checking unknown options
- OSTYPE=${LINEOPTS[$NARG]}
- ;;
- -s)
- (( NARG=$NARG+1 ))
- SPEC=${LINEOPTS[$NARG]}
- ;;
- -a)
- ALIAS="yes"
- ;;
- --silent)
- SILENT=true
- ;;
- --displayaliases)
- aliasheader; exit 0
- ;;
- --delay)
- (( NARG=$NARG+1 ))
- sleep ${LINEOPTS[$NARG]}
- ;;
- --image)
- (( NARG=$NARG+1 ))
- IMGDIR=${LINEOPTS[$NARG]}
- ;;
- --persistent)
- NP="independent-persistent"
- ;;
- --define-vm-ostype)
- (( NARG=$NARG+1 ))
- VMOSTYPE=${LINEOPTS[$NARG]}
- COMDEF="yes"
- ;;
- --mem)
- (( NARG=$NARG+1 ))
- MEMOPT=${LINEOPTS[$NARG]}
- ;;
- --run)
- (( NARG=$NARG+1 ))
- VMRUN=${LINEOPTS[$NARG]}
- ;;
- --debug)
- (( NARG=$NARG+1 ))
- DEBUG=${LINEOPTS[$NARG]}
- ;;
- --windowed)
- VMOPT=`echo $VMOPT | sed -e "s,-X,-x,"`
- ;;
- --edit)
- VMOPT=""
- ;;
- --donotquit)
- VMOPT=`echo $VMOPT | sed -e "s,-q,,"`
- ;;
- *)
- echo -e "\n\tOption \"${LINEOPTS[$NARG]}\" not found, please correct.\n"
- sleep 1
- help
- ;;
- esac
- (( NARG=$NARG+1 ))
+ esac
+ (( args=${args}+1 ))
done
@@ -573,201 +476,194 @@ done
### STARTING ###################################################################
-# Logo for console
+# logo for console
+if [ -z ${silent} ]; then
cat <<EOL
.----.--.--.-----.--.--.--------.--.--.--.---.-.----.-----.
| _| | | | | | | | | | _ | _| -__|
|__| |_____|__|__|\___/|__|__|__|________|___._|__| |_____|
- Script for preparing VMware environment...(v$VERSION)
+ Script for preparing VMware environment...(v${version})
EOL
-writelog "Starting...`echo $NP|sed -e \"s,i.*-,,g\"|tr [a-z] [A-z]`-mode\n" 0 0
+writelog "Starting...`echo ${np} | sed -e \"s,i.*-,,g\" \
+ | tr [a-z] [A-Z]`-mode\n" 0 0
+
+fi
### CHECK MACHINE SETUP ########################################################
-# Create environment
-# Remove leftover locks from former runs,
+# create environment
+# remove leftover locks from former runs,
# problems may occure if you run more then one vmware with this script
-rm -rf $TMPDIR >/dev/null 2>&1
-rm -f $CONFDIR/*LOCK >/dev/null 2>&1
-rm -f $CONFDIR/*.$DEBUG.log >/dev/null 2>&1
-
-# Check if /tmp/vmware_temporary is existing
-writelog "Checking /tmp/vmware_temporary directory...\c" 0 99
-if ! [ -d "/tmp/vmware_temporary" ]; then
- writelog "\n/tmp/vmware_temporary does not exist, or is no directory!" 0 99
- writelog "\n\tExiting!\n" 0 99
- exit 1
-fi
-writelog "OK!" 0 99
+rm -f ${tmpdir}/*LOCK >/dev/null 2>&1
+rm -f ${tmpdir}/*.${debug}.log >/dev/null 2>&1
+
-# Create vmware directories
-mkdir -p $TMPDIR >/dev/null 2>&1
-mkdir -p $CONFDIR >/dev/null 2>&1
-mkdir -p $VMDIR >/dev/null 2>&1
+# create vmware directories
+mkdir -p ${tmpdir} >/dev/null 2>&1
+mkdir -p ${vmhome} >/dev/null 2>&1
-# Start logging, because now we have the directories created ;)
+# start logging, because now we have the directories created ;)
writelog "##################################################" 1 99
-writelog "#\n# File created by $0 (v.$VERSION)\n# on `date`" 1 99
-writelog "# LOGLEVEL=$DEBUG\n#" 1 99
+writelog "#\n# File created by $0 (v.${version})\n# on `date`" 1 99
+writelog "# LOGLEVEL=${debug}\n#" 1 99
writelog "##################################################\n" 1 99
-# Repeat only for logfile ;)
-writelog "Starting...`echo $NP|sed -e \"s,i.*-,,g\"|tr [a-z] [A-z]`-mode\n" 1 1
+# repeat only for logfile ;)
+writelog "Starting...`echo ${np} | sed -e \"s,i.*-,,g\" \
+ | tr [a-z] [A-Z]`-mode\n" 1 1
-# Log disksetup
+# log disksetup
writelog "Directories:" 0 1
-writelog "\tTMPDIR=$TMPDIR\n\tCONFDIR=$CONFDIR\n\tVMDIR=$VMDIR\n" 0 1
-writelog "vmware_temporary:\n`ls -l /tmp/vmware_temporary`\n" 0 1
+writelog "\tTmpdir=${tmpdir}\n\tVMhome=${vmhome}\n" 0 1
+writelog "Tmpdir info:\n`mount | grep -i "/tmp "`\n" 0 1
-# Configuring MAC address: first four bytes are fixed (00:50:56:0D) the
+# configuring MAC address: first four bytes are fixed (00:50:56:0D) the
# last two bytes are taken from the local network adaptor
-writelog "Starting hardware/device detection...\c" 0 1
-
-MAC=`/sbin/ifconfig eth0 | grep eth0 | sed -e "s, ,,g" | \
- awk -F : '{print $(NF-1)":"$NF}'`
-
-
-# Gather memory info and set virtual machine memory size accordingly
-MEMTEST=`cat /proc/meminfo | grep MemTotal | sed -e 's,[0-9][0-9][0-9] kB,,' \
- -e 's,MemTotal: *,,'`
-
-# Check if command line option given and calculate memory for vmware
-if [ -n "$MEMOPT" ]; then
- # Memory allocation for host or guest?
- MEMHOST=`echo $MEMOPT | grep -i "h"`\
- && MEMOPT=`echo $MEMOPT | sed -e "s,[h,H],,"`
- # Memory given in megabyte
- MEMMEG=`echo $MEMOPT | grep -i "m"`
- # Memory given in gigabyte
- MEMGIG=`echo $MEMOPT | grep -i "g"`
- # Remove m or M
- [ -n "$MEMMEG" ] && MEM=`echo $MEMOPT | sed -e "s,[m,M],,"`
- # Remove g or G and convert to megabyte
- [ -n "$MEMGIG" ] && MEM=`echo $MEMOPT | sed -e "s,[g,G],,"`\
- && MEM=$MEM*1024
- # If no m or g, then it is percent
- [ -z "$MEMMEG" ] && [ -z "$MEMGIG" ] && MEM=$MEMTEST/100*$MEMOPT/4*4
- # Memory allocation for host or guest? If host calculate for guest.
- [ -n "$MEMHOST" ] && MEM=$MEMTEST-$MEM
- # Else use PERMEM variable to calculate memory percentage for vmware
-else MEM=$MEMTEST/100*$PERMEM/4*4
+writelog "Starting hardware / device detection...\c" 0 1
+
+mac=$(/sbin/ifconfig eth0 | grep eth0 | sed -e "s, ,,g" \
+ | awk -F ":" '{print $(NF-1)":"$NF}')
+
+
+# get memory in MB
+memtest=$(expr $(grep -i "memtotal" /proc/meminfo | awk '{print $2}') / 1024)
+
+# check if command line option given and calculate memory for vmware
+if [ -n "${memopt}" ]; then
+ # memory allocation for host or guest?
+ memhost=`echo ${memopt} | grep -i "h"`\
+ && memopt=`echo ${memopt} | sed -e "s,[h,H],,"`
+ # memory given in megabyte
+ memmeg=`echo ${memopt} | grep -i "m"`
+ # memory given in gigabyte
+ memgig=`echo ${memopt} | grep -i "g"`
+ # remove m or M
+ [ -n "${memmeg}" ] && mem=$(echo ${memopt} | sed -e "s,[m,M],,")
+ # remove g or G and convert to megabyte
+ [ -n "${memgig}" ] && mem=$(echo ${memopt} | sed -e "s,[g,G],,") \
+ && mem=${mem}*1024
+ # if no m or g, then it is percent
+ [ -z "${memmeg}" ] && [ -z "${memgig}" ] && mem=${memtest}/100*${memopt}/4*4
+ # memory allocation for host or guest? If host calculate for guest.
+ [ -n "${memhost}" ] && mem=${memtest}-${mem}
+ # else use ${permem} variable to calculate memory percentage for vmware
+else mem=${memtest}/100*${permem}/4*4
fi
-# Check memory range
-MEMTEST=$MEMTEST-128
-if [ "$MEM" -lt "128" ] || [ "$MEM" -gt "$MEMTEST" ]; then
- writelog "\n\n\tYour memory is out of range: $MEM MB.\n\
- \tMin. 128 MB for host and guest!\n\tTry --mem option.\n" 0 1
+# check memory range
+memtest=${memtest}-128
+if [ "${mem}" -lt "128" ] || [ "${mem}" -gt "${memtest}" ]; then
+ writelog "\n\n\tYour memory is out of range: ${mem} MB.\n\
+ \tMin. 128 MB for host and guest!\n\tTry --mem option.\n" 0 1
exit 1
fi
-# Look for cdrom,dvd and floppy and add them to the vm config file
+# look for cdrom,dvd and floppy and add them to the vm config file
if [ -L /dev/cdrom1 ] ; then
- VMSCSI=TRUE
- CDR_1=TRUE
- CDR_1_NAME="/dev/cdrom1"
+ cdr_1="TRUE"
fi
if [ -L /dev/cdrom2 ] ; then
- VMSCSI=TRUE
- CDR_2=TRUE
- CDR_2_NAME="/dev/cdrom2"
+ cdr_2="TRUE"
fi
-# Floppy
-[ -d /sys/block/fd0 ] && FLOPPYA="floppy0.fileName = /dev/fd0"
+# floppy
+[ -d /sys/block/fd0 ] && floppya="TRUE"
-writelog "finished\nResults:\n\tMAC=$MAC\n\tMEM=$MEM\n\tVMSCSI=$VMSCSI" 0 1
-writelog "\tCDR_1=$CDR_1\n\tCDR_2=$CDR_2\n" 0 1
+writelog "finished\nResults:\n\tMAC=00:50:56:0D:${mac}\n\tMem=${mem} MB" 0 1
+writelog "\tCD-ROM_1=${cdr_1}\n\tCD-ROM_2=${cdr_2}\n" 0 1
### SELECT VIRTUAL IMAGE #######################################################
-# Interactive mode
-if [ -n "$INTER" ]; then
- writelog "Starting interactive mode...\c" 0 0
-
- MENUTEST=`ls $SESS_ZEN 2>/dev/null | wc -l`
-
- # Check for session files
- if [ "$MENUTEST" = "0" ]; then
- writelog "\rNo sessions found in /etc/X11/sessions for option -i" 0 99
- writelog "Please use option -o/-s and check your configuration \n" 0 0
- exit 1
- fi
-
- # Check for Xdialog
- if ! [ `which Xdialog 2>/dev/null` ]; then
- writelog "\rXdialog not found!\t\t" 0 99
- writelog "Please install Xdialog for interactive mode, \c" 0 0
- writelog "or use options -o/-s.\n" 0 0
- exit 1
- fi
-
- # Create Menu, etc...
- ARGS=`x_dialog 2>&1 | tr [A-Z] [a-z] | sed -e "s,-, ,"` # 2>&1, see function
- OSTYPE=`echo $ARGS | awk '{print $1}'`
- SPEC=`echo $ARGS | awk '{print $2}'`
-
- if [ -z "$ARGS" ]; then
- writelog "\rNo image selected, please retry or use option -o / -s\n" 0 0
- writelog "No image was selected (opton -i); return value is: $ARGS\n" 2 2
- exit 1
- fi
-
- writelog "finished.\nResult:\n\tostype=$OSTYPE${SPEC:+\n\tspec=$SPEC}\n" 0 1
+# interactive mode
+if [ -n "${inter}" ]; then
+ writelog "Starting interactive mode...\c" 0 0
+
+ menutest=$(ls ${vmsessions} 2>/dev/null | wc -l)
+
+ # check for session files
+ if [ "${menutest}" = "0" ]; then
+ writelog "\rNo sessions found in ${vmsessions} for option -i" 0 99
+ writelog "Please use option -o/-s and check your configuration \n" 0 0
+ exit 1
+ fi
+
+ # check for Xdialog
+ if ! [ `which Xdialog 2>/dev/null` ]; then
+ writelog "\rXdialog not found!\t\t" 0 99
+ writelog "Please install Xdialog for interactive mode, \c" 0 0
+ writelog "or use options -o/-s.\n" 0 0
+ exit 1
+ fi
+
+ # create menu, etc...
+ args_zen=$(x_dialog 2>&1 | sed -e "s,-, ,") # 2>&1, see function
+ ostype=$(echo ${args_zen} | awk '{print $1}')
+ spec=$(echo ${args_zen} | awk '{print $2}')
+
+ if [ -z "${args_zen}" ]; then
+ writelog "\rNo image selected, please retry or use option -o / -s\n" 0 0
+ writelog "No image was selected (opton -i); \c" 2 2
+ writelog "return value is: ${args_zen}\n" 2 2
+ exit 1
+ fi
+
+ writelog "finished.\nResult:" 0 1
+ writelog "\tostype=${ostype}${spec:+\n\tspec=${spec}}\n" 0 1
fi
-# Aliases
-[ -n "$ALIAS" ] && checkalias
+# aliases
+[ -n "${alias}" ] && checkalias
-# Image allocation
+# image allocation
writelog "Starting image detection...\c" 0 1
-DISKFILE="$IMGDIR/$OSTYPE${SPEC:+"-$SPEC"}.$ENDING"
-
-# Check if VMOSTYPE defined via command line
-if [ -z "$COMDEF" ]; then
- VMOSTYPE=`ostypeheader | grep -v "#.*" | grep -w "$OSTYPE" | \
- awk '{print $2}'`
- DISPLAYNAME=`ostypeheader | grep -v "#.*" | grep -w "$OSTYPE" |\
- awk '{print $3}' | sed -e "s,-, ,g"`
-
- # If OSTYPE not found use else statement
- VMOSTYPE=${VMOSTYPE:-`ostypeheader | grep -v "#.*" | grep -w "else" | \
- awk '{print $2}'`}
- DISPLAYNAME=${DISPLAYNAME:-`ostypeheader | grep -v "#.*" | \
- grep -w "else" | awk '{print $3}' |\
- sed -e "s,-, ,g"`}
+diskfile="${vmdir}/${ostype}${spec:+"-${spec}"}.vmdk"
+
+# check if ${vmostype} defined via command line
+if [ -z "${comdef}" ]; then
+ vmostype=$(grep -v "#.*" ${vmtempl}/ostype | grep -w "${ostype}" \
+ | awk '{print $2}')
+
+ # if ${ostype} not found use else statement
+ vmostype=${vmostype:-"other"}
+
fi
-writelog "finished\nResults:\n\tDISKFILE=$DISKFILE\n\tVMOSTYPE=$VMOSTYPE" 0 1
-writelog "\tDISPLAYNAME=$DISPLAYNAME\n" 0 1
+
+# define name for VMware window
+displayname=$(grep -m 1 -i "name" \
+ ${vmsessions}/${ostype}${spec:+"-${spec}"}.desktop | awk -F "=" '{print $2}')
+
+
+writelog "finished\nResults:\n\tDiskfile=${diskfile}" 0 1
+writelog "\tVMostype=${vmostype}\n\tDisplayname=${displayname}\n" 0 1
-# Link to windows image
-writelog "Linking \"ln -fs $DISKFILE $TMPDIR/disk\"...\c" 0 1
-ln -fs $DISKFILE $TMPDIR/disk
-writelog "finished\nResult:\n`ls -l $TMPDIR/disk`\n" 0 1
+# link to windows image
+writelog "Linking \"ln -fs ${diskfile} ${tmpdir}/disk\"...\c" 0 1
+ln -fs ${diskfile} ${tmpdir}/disk
+writelog "finished\nResult:\n`ls -l ${tmpdir}/disk`\n" 0 1
-# Check if image exists, etc...
+# check if image exists, etc...
filecheck
@@ -775,27 +671,17 @@ filecheck
### WRITE CONFIGURATION FILES ##################################################
-# Create preferences
+# create preferences
preferencesheader
-# Create VMware startup file
+# create VMware startup file
runvmwareconfheader
-# Prepare config files for the clientOS (win)
-[ "$VMOSTYPE" = "win98" ] && win98header # Windows 98 specific
+# include file which is given via command line
+. ${include}
-# Set Resolution for Windows guest
-winresheader
-
-
-
-
-### DELETE IF OBSOLETE #########################################################
-# old, delete when obsolete
-xvidtune -show | grep -ve "^$"| \
-awk {'print "[resolution]\r\nx="$3"\r\ny="$7"\r\n\r\n[username]\r\n\
- user_name="ENVIRON["USER"]"\r\n"'} \
- > /media/loop0/config.ini
+# copy VMware (-Player) bios
+cp ${vmtempl}/nvram.5.0 ${tmpdir}/nvram 2>&1 >/dev/null
@@ -803,27 +689,26 @@ awk {'print "[resolution]\r\nx="$3"\r\ny="$7"\r\n\r\n[username]\r\n\
### RUN VMWARE(-Player) ########################################################
# ...with the automatically written config file
-if [ `which vmplayer 2>/dev/null` ] && [ -z "$VMRUN" ]\
- || [ "$VMRUN" = "vmplayer" ]; then
- writelog "\nStarting VMplayer..." 0 0
- cp /usr/share/dxs/VMware/nvram.5.0 $CONFDIR/nvram 2>&1 >/dev/null
- VMOPT=`echo $VMOPT | sed -e "s,-q,," -e "s,-x,,"` # Remove unsupported opts.
- vmplayer $VMOPT $CONFILE 2>&1 >/dev/null
-
-elif [ `which vmware 2>/dev/null` ] && [ -z "$VMRUN" ]\
- || [ "$VMRUN" = "vmware" ]; then
- # Copy licence file and virtual bios to VMware directory
- writelog "copying nvram and licence..." 0 0
- cp /usr/share/dxs/VMware/license.ws.5.0 $VMDIR 2>&1 >/dev/null
- cp /usr/share/dxs/VMware/nvram.5.0 $CONFDIR/nvram 2>&1 >/dev/null
-
- # Run VMware
- writelog "\nStarting VMware..." 0 0
- vmware $VMOPT $CONFILE 2>&1 >/dev/null
+if [ `which vmplayer 2>/dev/null` ] && [ -z "${vmrun}" ] \
+ || [ "${vmrun}" = "vmplayer" ]; then
+
+ writelog "\nStarting VMplayer..." 0 0
+ vmopt=$(echo ${vmopt} | sed -e "s,-q,," -e "s,-x,,") # remove unsupported opts
+ # run VMplayer
+ vmplayer ${vmopt} ${confile} 2>&1 >/dev/null
+
+elif [ `which vmware 2>/dev/null` ] && [ -z "${vmrun}" ] \
+ || [ "${vmrun}" = "vmware" ]; then
+
+ # copy licence file to VMware directory
+ cp /var/lib/vmware/templ/license.ws.5.0 ${vmhome} 2>&1 >/dev/null
+ writelog "\nStarting VMware..." 0 0
+ # run VMware
+ vmware ${vmopt} ${confile} 2>&1 >/dev/null
else
- writelog "\nNo VMware/VMPlayer found!\n" 0 99
- exit 1
+ writelog "\nNo VMware/VMPlayer found!\n" 0 99
+ exit 1
fi
diff --git a/vmware/win98config b/vmware/win98config
new file mode 100644
index 00000000..41317687
--- /dev/null
+++ b/vmware/win98config
@@ -0,0 +1,42 @@
+#
+# this is an include file for runvmware
+#
+# create Windows 98 config files
+
+
+# sync is needed to ensure that data is really written to virtual disk
+sync
+echo -e "\tREGEDIT4\r
+
+[HKEY_CURRENT_USER\Networ\Persistent\H]\r
+\"RemotePath\"=\"\\\\192.168.1.2\\${USER}\"\r
+\"UserName\"=\"${USER}\"\r
+\"ProviderName\"=\"Microsoft Network\"\r" \
+> /media/loop0/home.reg
+
+
+echo -e "\tREGEDIT4\r
+
+[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP]\r
+\"ComputerName\"=\"${hostname}\"\r
+\"Workgroup\"=\"${workgroup}\"\r
+\"Comment\"=\"${comment}\"\r
+\"StaticVxD\"=\"vnetsup.vxd\"\r
+\"Start\"=hex:00\r
+\"NetClean\"=hex:01\r
+
+[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\\\
+ComputerName]\r
+\"ComputerName\"=\"${hostname}\"\r" \
+> /media/loop0/rechner.reg
+
+
+echo -e "\tREGEDIT4\r
+
+[HKEY_LOCAL_MACHINE\Network\Logon]\r
+\"username\"=\"${USER}\"\r
+\"PrimaryProvider\"=\"Microsoft Network\"\r
+\"LMLogon\"=hex:00,00,00,00\r" \
+> /media/loop0/logon.reg
+
+sync
diff --git a/vmware/winconfig b/vmware/winconfig
new file mode 100644
index 00000000..750dd22c
--- /dev/null
+++ b/vmware/winconfig
@@ -0,0 +1,29 @@
+#
+# this is an include file for runvmware
+#
+# create Windows config file
+
+
+# definition of some resolution variables
+hostres=$(xvidtune -show | grep -ve "^$")
+x_param=$(echo "${hostres}" | awk '{print $3}')
+y_param=$(echo "${hostres}" | awk '{print $7}')
+
+# sync is needed to ensure that data is really written to virtual disk
+sync
+echo -e "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r
+<settings>\r
+ <eintrag>\r
+ <computername param=\"${hostname}\">\r
+ </computername>
+ <resolution_x param=\"${x_param}\">\r
+ </resolution_x>\r
+ <resolution_y param=\"${y_param}\">\r
+ </resolution_y>\r
+ <username param=\"${USER}\">\r
+ </username>\r
+ </eintrag>\r
+</settings>\r" \
+> /media/loop0/config.xml
+
+sync