set panel(welcome.text) "Welcome to the VMware for Linux Configuration Wizard."
set panel(welcome.text2) {This wizard automates the most common tasks in order to properly create and configure a VMware Virtual Machine. It will ask a few simple questions, and at the end it will create all the files you need to run the VM.
The configuration settings which you will be selecting for the new virtual machine can be viewed and changed at a later time by using the Configuration Editor.
Click the "Next" button to proceed.
At any point you may return to the previous panel by clicking on the "Prev" button, or abort the wizard by clicking on the "Cancel" button. You may also select default parameters and skip to the last panel by using the "Finish" button.
The "Help" button provides context sensitive help and links to relevant online documentation.}
set panel(os.text) {Please select the operating system you plan on installing in the virtual machine (your guest OS). This information is used to determine optimal default values for the guest OS, and it does not limit your machine's ability to run other OSes.}
set panel(os.entry) Other
proc OS_Init {name} {
set osNames { \
{"dos" "MS DOS"} \
{"win31" "Windows 3.1"} \
{"win95" "Windows 95"} \
{"win98" "Windows 98"} \
{"nt4" "Windows NT (Workstation or Server) 4.0"} \
pack .dir.frame.entry -in .dir.frame -side left -pady 1m
# pack .dir.frame.browse -in .dir.frame -side left -padx 2m
pack .dir.label .dir.frame -in .dir -anchor w -padx 5m
}
proc Dir_Activate {} {
global panel db
set panel(dir.entry) $db(directory)
focus .dir.frame.entry
.dir.frame.entry icursor end
}
proc Dir_Deactivate {} {
global panel db
if {$panel(dir.entry) != $db(directory)} {
if {$panel(dir.entry) == ""} {
set panel(dir.entry) "."
}
set db(directory) $panel(dir.entry)
set db(directory.userSet) 1
if {[string index $db(directory) [expr {[string length $db(directory)] - 1}]] != "/"} {
set db(directory) "$db(directory)/"
}
}
UpdateMountPoint
}
proc Dir_Browse {} {
global panel
set ret [tk_getSaveFile]
if {$ret != ""} {
set panel(dir.entry) $ret
}
}
proc UpdateMountPoint {} {
global db
set path [file nativename $db(directory)]
while {1} {
if {![catch {exec $db(helper.df) -P -T -k $path} dfOut]} {
break
}
if {$path == "/"} {
DialogWin .error "Configuration Wizard Error" \
"Error execing $db(helper.df):\n$dfOut" {} 0 OK
exit
}
set path [file dirname $path]
}
regsub -all {[ ]+} $dfOut " " dfOut
set lines [split $dfOut "\n"]
if {[llength $lines] != 2} {
DialogWin .error "Configuration Wizard Error" \
"Bad df output:\n$dfOut" {} 0 OK
exit
}
set fields [split [lindex $lines 0]]
if {![regexp -nocase {(1024|1k)-blocks} [lindex $fields 2]]} {
DialogWin .error "Configuration Wizard Error" \
"Bad df output:\n$dfOut--[lindex fields 2]" {} 0 OK
exit
}
set fields [split [lindex $lines 1]]
set db(directory.mountPoint.name) [lindex $fields 6]
set db(directory.mountPoint.type) [lindex $fields 1]
set db(directory.mountPoint.available) [expr {int(ceil([lindex $fields 4]/1024))}]
}
##
## Disk selection panel
##
set panel(diskType.title) {Virtual Disk Type Setting}
set panel(diskType.init) DiskType_Init
set panel(diskType.activate) DiskType_Activate
set panel(diskType.deactivate) DiskType_Deactivate
set panel(diskType.next) <null>
set panel(diskType.text) {Please choose what type of disk the virtual machine will use.}
set panel(diskType.fileTextIn) {Virtual disks appear as files on the host operating system's file system.}
set panel(diskType.partText) {Existing physical disks are the disks seen by the host operating system. They can be used as disks for this virtual machine. This option is recommended for advanced users only.
If a physical disk is empty, you can install an operating system in it.
If a physical disk already has an operating system installed (you have a multi-boot system), you can bring that disk up within the virtual machine.
You have the following access rights for IDE drives on this system:}
set panel(diskType.nfsWarnText) {The directory you have chosen is on an NFS mounted file system ($mount). Disk performance to NFS file systems can be slow. It is advised that you change the virtual machine's directory to a local file system.}
set panel(diskType.fileText) $panel(diskType.fileTextIn)
proc DiskType_Init {name} {
global panel db
radiobutton .diskType.file -text "New Virtual Disk" -variable db(diskType) \
-value file -anchor w -command DiskType_Set -padx 5m
pack .diskType.warn -in .diskType -anchor w -padx 2m
} else {
pack forget .diskType.warn
}
}
part {
pack forget .diskType.warn
set text ""
foreach drive $db(hostRawDisk.validDrives) {
set text "${text}\n /dev/$drive"
switch $db(hostRawDisk.$drive.userAccess) {
"np" {set text "$text - not present"}
"none" {set text "$text - no access"}
"ro" {set text "$text - read only access"}
"rw" {set text "$text - read/write access"}
}
}
if {[llength $db(hostRawDisk.drives)] != 0} {
set text "$panel(diskType.partText)\n$text"
.diskType.msg2 configure -text $text
} else {
set text1 {Either you don't have access to the IDE drives on this system or no IDE drives were detected. You will only be able to configure a virtual disk on the host file system.
You have the following access rights for IDE drives on this system:}
DialogWin .error "Configuration Wizard Help" "$text1\n$text" {} 0 OK
set db(diskType) file
DiskType_Set
}
}
}
}
proc DiskType_Deactivate {} {
global db panel
switch $db(diskType) {
file { set panel(diskType.next) diskSize }
part { set panel(diskType.next) rawDisk_[lindex $db(hostRawDisk.drives) 0] }
}
}
proc DiskType_Activate {} {
DiskType_Set
}
##
## Disk size panel
##
set panel(diskSize.title) {Virtual Disk Size Setting}
set panel(diskSize.init) DiskSize_Init
set panel(diskSize.activate) DiskSize_Activate
set panel(diskSize.deactivate) DiskSize_Deactivate
set panel(diskSize.next) cdrom
set panel(diskSize.text) {The wizard will create a persistent virtual disk on the host file system. Please enter the size of the virtual disk. After the disk is created, this parameter may not be changed.}
set panel(diskSize.hostDiskSpace) {The disk size you have selected ($diskSize MB) is greater than the free space on the file system ($mountPoint has $available MB available). The disk can be created now but your virtual machine may run out of host disk space later.}
set panel(diskSize.sizeZeroText) {The virtual disk size must be at least 1 megabyte.}
set panel(diskSize.sizeLimitationText) {Because of limitations of the host file system the maximum allowable virtual hard disk size is 2047 megabytes.}
proc DiskSize_Init {name} {
global panel option
frame .diskSize.frame -relief flat
label .diskSize.frame.label -text "Virtual disk size (in megabytes):"
regsub -all {\$diskSize} $text $panel(diskSize.entry) text
regsub -all {\$mountPoint} $text $db(directory.mountPoint.name) text
regsub -all {\$available} $text $db(directory.mountPoint.available) text
.diskSize.warn.msg configure -text $text
pack .diskSize.warn -in .diskSize -anchor w -pady 5m -padx 2m
} else {
pack forget .diskSize.warn2
pack forget .diskSize.warn
}
}
proc DiskSize_Activate {} {
global panel db option
if {0} {
# used to be here with rawdisk option
# obsolete now - this warning is in disk type panel
if {$db(directory.mountPoint.type) == "nfs"} {
regsub {\$mount} "$panel(diskType.nfsWarnText)" \
$db(directory.mountPoint.name) text
.diskSize.warn3.msg configure -text $text
pack .diskSize.warn3 -in .diskSize -anchor w -pady 5m -padx 2m
} else {
pack forget .diskSize.warn3
}
}
set panel(diskSize.entry) $db(diskSize)
focus .diskSize.frame.entry
.diskSize.frame.entry icursor end
}
proc DiskSize_Deactivate {} {
global panel db
if {($panel(diskSize.entry) == "") || ($panel(diskSize.entry) == 0)} {
DialogWin .error "Wizard Error" $panel(diskSize.sizeZeroText) {} 0 OK
set panel(diskSize.entry) $db(diskSize)
.diskSize.frame.entry icursor 5
return retry
}
if {$panel(diskSize.entry) > 2047} {
DialogWin .error "Wizard Error" $panel(diskSize.sizeLimitationText) {} 0 OK
set panel(diskSize.entry) 2047
return retry
}
if {$panel(diskSize.entry) != $db(diskSize)} {
set db(diskSize) $panel(diskSize.entry)
set db(diskSize.userSet) 1
}
}
##
## Safe rawdisk panel
##
set last ""
foreach drive $db(hostRawDisk.drives) {
set panel(rawDisk_${drive}.title) {Rawdisk Permissions Setting}
set panel(rawDisk_${drive}.init) RawDisk_Init
set panel(rawDisk_${drive}.activate) RawDisk_Activate
set panel(rawDisk_${drive}.deactivate) RawDisk_Deactivate
if {$last != ""} {
set panel(${last}.next) rawDisk_${drive}
}
set last rawDisk_${drive}
set panel(rawDisk_${drive}.next) cdrom
set panel(rawDisk_${drive}.text) "The IDE drive /dev/$drive has been detected on your system. Please select which partition(s) you want the virtual machine to access. If you don't want the virtual machine to use this disk at all, select 'No Access' for all partitions."
DialogWin .warning "Overlapping partitions" "Partitions $i and $j overlap.\nConsequently, they should have the same access rights.\n\nClick on the OK button, then modify their access rights." {} 0 OK
return 0
}
}
}
return 1
}
proc RawDisk_Deactivate {} {
global db panel
set name $panel(current)
set drive $panel(${name}.drive)
# The check for overlapping ranges has to handle complex dependancy
# situations like this:
#
# partition access
# ------------ ------
# container RO
# contained1 RO
# contained2 RO <- The user sets this to RW
#
# In that case, container _and also contained1_ should be set to RW too.
# That's why I think here is the best place to handle such a case.
# We must perform this check even when the user pressed the "Back" button
# because he could press on "Finish" just after
if {[RawDisk_CheckOverlappingRanges $drive] == 0} {
return retry
}
set db(rawDisk.${drive}.used) 0
foreach part $db(hostRawDisk.${drive}.partitions) {
if {$db(rawDisk.${drive}.${part}.access) != "none"} {
set db(rawDisk.${drive}.used) 1
break
}
}
return ""
}
##
## CDROM panel
##
set panel(cdrom.title) {CD-ROM Device Setting}
set panel(cdrom.init) CDROM_Init
set panel(cdrom.activate) CDROM_Activate
set panel(cdrom.deactivate) CDROM_Deactive
set panel(cdrom.next) floppy
if {$db(cdrom.present)} {
set panel(cdrom.text) {A CD-ROM drive was detected on your host system. Do you want the virtual machine to see and access the CD-ROM?}
} else {
set panel(cdrom.text) {No CD-ROM was detected on the host. If you have a CD-ROM on the host and you want the virtual machine to use it please enter its location.}
}
set panel(cdrom.fileWarnText) {The device you have selected is not present on the host machine. Do you want to continue?}
pack .cdrom.frame.fileName .cdrom.frame.browse -in .cdrom.frame -side left \
-pady 1m -padx 1m
pack .cdrom.disabled .cdrom.enabled .cdrom.frame -in .cdrom -anchor w
CDROM_Set
}
proc CDROM_Activate {} {
focus .cdrom.frame.fileName
.cdrom.frame.fileName icursor end
}
proc CDROM_Deactive {} {
global db panel
if {$db(cdrom.wanted) && ![file exists $db(cdrom.fileName)]} {
set ret [DialogWin .error "Wizard Warning" $panel(cdrom.fileWarnText) \
{} 0 No Yes]
if {$ret == 0} {
return retry
}
}
}
proc CDROM_Set {} {
global db
if {$db(cdrom.wanted)} {
pack .cdrom.frame -in .cdrom -anchor w -padx 15m
} else {
pack forget .cdrom.frame
}
}
proc CDROM_Browse {} {
global db
set ret [tk_getOpenFile -initialdir /dev]
if {$ret != ""} {
set db(cdrom.fileName) $ret
}
}
##
## Floppy panel
##
set panel(floppy.title) {Floppy Device Setting}
set panel(floppy.init) Floppy_Init
set panel(floppy.activate) Floppy_Activate
set panel(floppy.deactivate) Floppy_Deactive
set panel(floppy.next) networking
if {$db(floppy.present)} {
set panel(floppy.text) {A floppy drive was detected on your host system. Do you want the virtual machine to see and access the floppy?}
} else {
set panel(floppy.text) {No floppy was detected on the host. If you have a floppy on the host and you want the virtual machine to use it please enter its location.}
}
set panel(floppy.fileWarnText) {The device you have selected is not present on the host machine. Do you want to continue?}
pack .floppy.frame.fileName .floppy.frame.browse -in .floppy.frame -side left \
-pady 1m -padx 1m
pack .floppy.disabled .floppy.enabled .floppy.frame -in .floppy -anchor w
Floppy_Set
}
proc Floppy_Activate {} {
focus .floppy.frame.fileName
.floppy.frame.fileName icursor end
}
proc Floppy_Deactive {} {
global db panel
if {$db(floppy.wanted) && ![file exists $db(floppy.fileName)]} {
set ret [DialogWin .error "Wizard Warning" $panel(floppy.fileWarnText) \
{} 0 No Yes]
if {$ret == 0} {
return retry
}
}
}
proc Floppy_Set {} {
global db
if {$db(floppy.wanted)} {
pack .floppy.frame -in .floppy -anchor w -padx 15m
} else {
pack forget .floppy.frame
}
}
proc Floppy_Browse {} {
global db
set ret [tk_getOpenFile -initialdir /dev]
if {$ret != ""} {
set db(floppy.fileName) $ret
}
}
##
## Networking panel
##
set panel(networking.title) {Networking Setting}
set panel(networking.init) Networking_Init
set panel(networking.activate) <null>
set panel(networking.deactivate) <null>
set panel(networking.next) confirm
set panel(networking.text) {A virtual machine can be connected to other systems through standard networking protocols. Please select the networking option for your virtual machine.}
set panel(networking.noneText) {Your virtual machine will be a stand-alone system. It will not be networked and therefore not able to communicate with other systems.}
set panel(networking.bridgedText) {Your virtual machine will be bridged to the outside network. It will appear as a separate machine on the host machine's subnet. The operating system will require proper network configuration. Please contact your network administrator in order to get proper settings.}
set panel(networking.hostOnlyText) {Your virtual machine will only be able to talk to the host operating system through an internal virtual network.}
proc Networking_Init {name} {
global install panel
radiobutton .networking.none -text "No Networking" -variable db(networking) \
-value none -anchor w -padx 5m -command Networking_Set
set panel(confirm.text) {Congratulations! You have finished configuring your virtual machine. Please review the following information and make sure that all is correct. You can go back in order to change these settings.}
set panel(confirm.configText) {You have configured the following virtual machine:}
set panel(confirm.fileText) {You can fine tune these settings and configure more options (like the use of parallel and serial ports) at any time using the VMware Configuration Editor.
By clicking on the "Done" button, the following will be created:}
set panel(confirm.font) *-courier-bold-r-normal--12-120-*-*-*-*-*-*
proc Confirm_Init {name} {
global panel
message .confirm.configMsg -justify left -width $panel(width) -pady 3m -text $panel(confirm.configText)
message .confirm.configInfo -justify left -width $panel(width) -padx 5m -font $panel(confirm.font)
message .confirm.fileMsg -justify left -width $panel(width) -pady 3m -text $panel(confirm.fileText)
message .confirm.fileInfo -justify left -width $panel(width) -padx 5m -font $panel(confirm.font)
pack .confirm.configMsg .confirm.configInfo .confirm.fileMsg .confirm.fileInfo -in .confirm -anchor w
}
proc Confirm_Activate {} {
global db
.nav.next configure -state disabled -default normal
.nav.finish configure -text Done -default active -underline 0
bind . <KeyPress-Return> Save
bind . <Alt-KeyPress-d> Save
bind . <Alt-KeyPress-f> {}
bind . <Alt-KeyPress-n> {}
# .confirm.configMsg configure -text "You have configured the following virtual machine to run $db(OS.name)."
set config "$db(memorySize) megabytes of RAM"
if {$db(diskType) == "file"} {
set config "${config}\n$db(diskSize) megabytes persistent hard disk"
} else {
foreach drive $db(hostRawDisk.drives) {
if {$db(rawDisk.${drive}.used)} {
set config "${config}\nrawdisk /dev/$drive"
}
}
}
if {$db(cdrom.wanted)} {
set config "${config}\n1 CD-ROM drive"
}
if {$db(floppy.wanted)} {
set config "${config}\n1 floppy drive"
}
if {$db(networking) == "bridged"} {
set config "${config}\nbridged networking"
} elseif {$db(networking) == "hostOnly"} {
set config "${config}\nhost only networking"
}
.confirm.configInfo configure -text $config
set files "$db(directory)"
set files "$files\n$db(directory)$db(OS.name).cfg"
if {$db(diskType) == "file"} {
set files "$files\n$db(directory)$db(OS.name).dsk"
} else {
foreach drive $db(hostRawDisk.drives) {
if {$db(rawDisk.${drive}.used)} {
set files "$files\n$db(directory)$db(OS.name).${drive}"
}
}
}
set files "$files\n$db(directory)$db(OS.name).nvram"
set files "$files\n$db(directory)$db(OS.name).log"
.confirm.fileInfo configure -text $files
}
proc Confirm_Deactivate {} {
.nav.next configure -state normal -default active
.nav.finish configure -text Finish -default normal -underline 0
# Compute the number of availbale IDE slots for hard drives
if {$db(cdrom.wanted)} {
set maxDisk 3
} else {
set maxDisk 4
}
# Restrict the number of hard drives to declare in the config file
if {[llength $usedDrives] > $maxDisk} {
DialogWin .error "Configuration Wizard Warning" "There are not enough IDE slots in the Virtual Machine to place all your hard drives.\n\nAlthough a safe raw disk file will be generated for all your hard drives, the Virtual Machine configuration file will only use the first $maxDisk of them." {} 0 OK
set cfgDrives [lrange $usedDrives 0 [expr $maxDisk - 1]]
if [catch {exec $db(helper.netscape) www.vmware.com >& /dev/null &}] {
DialogWin .error "Help Error" "Can't open $db(helper.netscape)." {} 0 OK
}
}
}
proc startLogo {} {
global increment started
if {!$started} {
set increment -1
set started 1
moveLogo
} elseif {$started > 5} {
set started 0
moveLogo
DialogWin .winner "Configuration Wizard" "mendel\nbugnion\ndevine\nedward\nyoel\npatrick\nbhlim\nluigi\nbennett\njohnh\nmnelson\nsam\nhpreg\nchris" {} 0 OK
} else {
incr started
set increment [expr {-1 * ($increment + $increment)}]
}
}
proc moveLogo {} {
global increment started
if {!$started} {
.logo yview moveto 0
} else {
.logo yview scroll $increment units
after 30 moveLogo
}
}
wm title . "VMware for Linux Configuration Wizard"
pack .logo -fill y -side left
pack .nav -side bottom -padx 5m
NewPanel welcome
NewPanel os
NewPanel dir
NewPanel diskType
NewPanel diskSize
foreach drive $db(hostRawDisk.drives) {
NewPanel rawDisk_${drive}
}
NewPanel cdrom
NewPanel floppy
NewPanel networking
NewPanel confirm
if {[info exists option(safedisk)]} {
set drive $option(safedisk)
GetRawDiskInfo $drive
if {![info exists db(hostRawDisk.$option(safedisk).partitions)]} {
puts "$drive is not a valid drive"
exit
}
set panel(safeDisk.title) {Rawdisk Permissions Setting}
set panel(safeDisk.init) RawDisk_Init
set panel(safeDisk.activate) SafeDisk_Activate
set panel(safeDisk.deactivate) SafeDisk_Deactivate
set panel(safeDisk.next) cdrom
set panel(safeDisk.text) "The IDE drive /dev/$drive has been detected on your system. Please select which partition(s) you want the virtual machine to access."
set panel(safeDisk.drive) $drive
proc SafeDisk_Activate {} {
.nav.prev configure -state disabled -default normal
.nav.next configure -state disabled -default normal
.nav.finish configure -text Done -default active -underline 0
}
proc SafeDisk_Deactivate {} {
global option
set fileName [tk_getSaveFile -initialfile "safe_$option(safedisk)" \
-title "Save File As"]
if {$fileName == ""} {
return retry
}
RawDisk_Save $option(safedisk) $fileName
exit
}
NewPanel safeDisk
set panel(current) safeDisk
}
Activate $panel(current)
# Update the appearance of the (hidden) main window