#!/bin/sh

# \
if [ -x ../bin/etixwish ]; then

# the next line restarts using tixwish \
exec ../bin/etixwish "$0" "$@"
# \
else

# the next line restarts using tixwish \
exec tixwish "$0" "$@"

# \
fi

# Main-module of X-CD-Roast
# 23.1.96 T. Niederreiter

set XCDR_VERSION "0.95c"

# Check if user is root
catch {regexp {^[^(]*\(([^)]*)\)} [exec id] dummy user}
if { $user != "root" } {
        puts "Error: X-CD-Roast must be started by user \"root\"."
        exit
}

# Check if /dev/sr* devices are there
if { [catch { glob "/dev/sr*" }] != 0 } {
	puts "Error: No /dev/sr-Devices found."
	puts "See README how to create the /dev/sr0 and /dev/sr1 devices."
	exit
}

# Check if /dev/sg* devices are there
set nrsgdev 0
catch { set nrsgdev [llength [glob "/dev/sg\[a-h\]"]] }
if { $nrsgdev < 8 } {
	puts "Error: Some or all Generic-SCSI-Devices are missing."
	puts "Please create first the devices. Run \"./MAKEDEV.sg\""
	puts "in the xcdroast-0.95c directory."
	exit
}
# Check if the binaries are there
if { [catch { glob "../bin/scsiinq"}] != 0 } {
	puts "Error: No binaries-found."
	puts "Please run \"make\" prior the start of X-CD-Roast."
	exit
}


source ExternalProgs.tcl
source GetHardwareInfo.tcl
source HandleCfgFile.tcl
source ConvertModule.tcl
source HandlePartitions.tk
source MiscTools.tcl
source Dialog.tk
source Messages.tcl
source HandleAudio.tk
source MkMain.tk
source MkSetup.tk
source MkCopy.tk
source MkMaster.tk

# Create the Main-Menu

proc MenuMain {} {
frame .main
pack .main

	mkmain .main 
}

MenuMain

createglobalvars

# run Init 
source Init.tcl

log . "started"

# Enter Setup if needed
if { $forcesetup == 1 } {
	.main.right.b1 invoke
	set forcesetup 0
}

# set Endian-order
setEndianorder	


