; $VER: StormWIZARD V1.06 Install Version 1.02 (2.7.96)
; Installatiert StormWizard auf der Festplatte
;
; (c) 1996 HAAGE & PARTNER Computer GmbH

(complete 0)

; Die Versionsnummer und das Erstellungs-Datum der hier installierten
; Versionen.

(set stw-version "1.06")
(set stw-date "(25 Jun 96)")

;====================================================================
; Initialisierungen

(set @default-dest "")

(set os-version (/ (getversion) 65536))
(set os-13 (< os-version 36))
(set os-20 (>= os-version 36))
(set os-21 (>= os-version 38))

(set totalmem (database "total-mem")) ; Diese schöne Funktion vereinfacht einiges

; Die Pfadnamen der Programme, die vom Installations-Skript aufgerufen werden.

; Die Pfadnamen der einzelnen Quell-Dateien.

(set #libfile				(tackon (pathonly @icon) "LIBS/Wizard.library"))		; Hier stehen die Bibliothek

(set #prp-copy-lib
	"Copy the WIZARD-LIBRARY\n")
(set #hlp-copy-lib
	"You can´t do anything without the Library!")
(set #prp-copy-all
	"Copy all files for StormWIZARD on your harddisc!\n")
(set #hlp-copy-all (cat
	"You can start StormWIZARD from the CD!\n"
	"If you want to do so, you have to\n"
	"install the Wizard.library into the LIBS: folder."))

; ----------------------------- Prozeduren ------------------------------

(Procedure Make_Folder
    (
    (set folder (tackon folder "StormWIZARD"))
    (if (= (exists folder) 0)
       (
       (makedir folder (infos))
       )
    ))
)

;=====================================================================================
; Beginn der Installation
;=====================================================================================

; Eine kleine Einleitung, gefolgt vom Startbild des Installers.

(set folder "WORK:StormWIZARD")

(set act-user-level @user-level)
(user 1)

(message (cat	"\nWelcome to the installation of the \n\n\"StormWIZARD demo "

					 stw-version " of the "stw-date "\"!\n\n"

					"This script copies the files needed by StormC "

					"to your harddisk.\n\n\n"
					"© Copyright 1996 HAAGE & PARTNER Computer GmbH"))

(user act-user-level)
(welcome)


(complete 5)

(set act-user-level @user-level)

(user act-user-level)


(set ok 0)
(while (not ok)
	(set folder
		(askdir
			(prompt (cat "\n"
							 "Select a path for your StormWIZARD installation.\n"
							 "A drawer named StormWIZARD will be created!"))
			(help (cat	"    You will get an overview of all volumes with 'Show drives' "
							"Form this list you should select the first, non colored, items. "
							"only\n"
							"    Typical names are \"WORK:\", \"HD0:\" or \"DH0:\"; "
							"do not use such names as \"DF0:\", \"DF1:\", "
							"\"DF2:\", \"DF3:\", \"RAD:\", \"RAM:\", \"System2.0:\", "
							"\"WB_2.x:\", \"System3.0:\" or \"WB_3.x:\"!"
							"\n\n"
							"The Storm C installation can not be placed on a volume directly. "
							"You have to select a drawer. Ohterwise an error will be shown. "
							"\n\n"
							@askdir-help))
			(default folder)
			(disk)
		)
	)

   (Make_Folder)    ; // Automatisch neues Verzeichnis anlegen!

	; Ist der Dateiname leer oder endet mit einem ':' oder existiert unter
	; diesem Namen kein Verzeichnis, wird eine Fehlermeldung angezeigt; andernfalls
	; kann die Auswahl-Schleife beendet werden.
	(if (or (or (or (<= (strlen folder) 0) (= (substr folder (- (strlen folder) 1) 1) ":")) (= (exists folder (noreq)) 0)) (= (getdiskspace folder) -1))
		(message (cat	"\nYour selection \"" folder "\" is not a valid "
							"drawer !\n\n"
							"Use 'Show drives' to get a list of all volumes. "
							" Form this list you should only select the first, non color, items. "
							"\n"
							"Use \"New drawer...\" to create a new drawer on the current "
   							"volume."))

		;else
		(
			(set freediskspace (getdiskspace folder))	; Der freie Speicher auf diesem Medium

			(if (< freediskspace size-komplett)
				(
				(user 1)
				(message (cat	"\nThere is not enough free space on the volume you "
											"selected for the complete installation of StormWIZARD. "
											"\n\n"
											"Free diskspace " freediskspace "!\n"
											"diskspace needed " size-komplett "!\n\n"
											"Please select another volume !"))

				)
			;else
			(set ok 1)
			)
		)
	)
)

(makeassign "STORMWIZARD")

(user act-user-level)

(set @default-dest folder)	; Die Zuweisung ist sehr wichtig!

(copyfiles											; Alles kopieren
	(prompt #prp-copy-all)
	(help #hlp-copy-all)
	(source (pathonly @icon))
	(dest folder)
	(all)
	(confirm)
)
; Wizard.Library in die Libs-Schublade kopieren!

(copylib
	(prompt #prp-copy-lib)
	(help #hlp-copy-lib)
	(source #libfile)
	(dest "LIBS:")
	(confirm)
)

(complete 95)

; ------- STARTUP ÄNDERN

(set command1 (cat  "ASSIGN STORMWIZARD: " folder ""))

(set command1.txt
	(cat 
	 	"\n\n\nThere User-Startup must be changed to get StromWIZARD "
      "work right.\n\n"
	 	command1
	)
)

(startup "StormWIZARD"
	(prompt command1.txt)
	(help #help-startup)
	(command command1)
)

(makeassign "STORMWIZARD")
(makeassign "STORMWIZARD" folder)

(complete 100)

; ------- FERTIG

(message (cat 
	"\nInstallation of StormWIZARD is done.\n"
   "When the lines:\n" command1 "\nare not inserted in your Startup-Sequence or "
   "User-Startup, please do it by your own.\n\n"
   "\n\nBest wishes ... ")
)
