; Installer script for the Diz-Explorer program
;******************************************************************************
;     _  _      ____
;    / \/ \    /___ |   
;   / /\/\ \     _ ||
;  / / /\ \ \   |_|||
; / / /  \ \ \ ____||
;/_/ /_/\_\ \_\\____|
;
; $VER: 3.00_Diz-Explorer_Installer (Nov-24-1997) 
; 
; If you wish to use any part of this installer you must ask us.
;
; Installer    by Jochen Grus & Martin Gentile 1996, 1997 
; Diz-Explorer by Jochen Grus 1997,98 
; Last Update: MAY-5-1998
;---------------------------------------
;        This could be your logo! 
;           __  __      _______ 
;          /  \/  \    /_____/ \
;         /  \  /  \  /  \  /  /
;        /  / \/ \  \/ /\ \/  / 
;       /  /  /  -\  \ \/ /  /  
;      /  /  /  __    \__/  /   
;      \_/  /__/  \_/\_____/    
;
;     Explorer 4.0 Demo-Version 
;
;              1998 by: 
;
;   Jochen Grus and Martin Gentile
;---------------------------------------
;******************************************************************************
(procedure Explor (set JOH 1) ( (while (< JOH 4444)  (set JOH (+ JOH 1)) )  ) )

(procedure InformX
(working (cat "\n\n"
              " LHA  TAR\n"
              " LZX  TGZ\n"
              " DMS  EXE\n"
              " ARJ  SIT\n"
              " ARC  LZH\n"
              " ZOO  RAR\n"
              " ZIP  LZ\n"
              " \n"
         )           
)
)
(procedure InformY
(working (cat "\n\n"
              "\n"
              "\n"
              "Diz-Explorer Pro Version 4.0 Beta\n"
              "\n"
              "by\n"
              "\n"
              "   Jochen Grus & Martin Gentile   \n"
              "\n"
         )           
)
)
(InformY)

(Explor)(Explor)
(InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (Explor) (Explor)

;*** System Stuff ***
(set cpu (database "cpu"))  (set vblank (database "vblank"))
(set graphmem (database "graphics-mem")) (set totmem (database "total-mem"))
(set osver (/ (getversion "LIBS:version.library") 65536))
(if (= vblank "60") ((set blank "NTSC")) ((set blank "PAL")))
(set fastmem (- totmem graphmem))

(if (= osver 37) (set workbench "2.0")) (if (= osver 38) (set workbench "2.1"))
(if (= osver 39) (set workbench "3.0")) (if (= osver 40) (set workbench "3.1"))
(if (= osver 41) (set workbench "3.5"))

(set cpu (database "cpu"))
(if (= cpu 68000) (set #cpu 0)) (if (= cpu 68010) (set #cpu 1))
(if (= cpu 68020) (set #cpu 2)) (if (= cpu 68030) (set #cpu 3))
(if (= cpu 68040) (set #cpu 4)) 
(if (> (exists ("sys:libs/68060.library")) 0) (set #cpu 5) )
(if (> (exists ("sys:libs/ppc.library")) 0) (set #cpu 6) )

(if (> cpu 68010)  (set #fpuGuess 0)  (set #fpuGuess 1) )
   
(set vernum1 (getversion "Explorer")) (set ver2 (/ vernum1 65536)) 
(set rev1 (- vernum1 (* ver1 65536) ) ) (set Explorerver (cat ver1 "4.0 Beta" rev1))

(if (> (exists ("env:Language")) 0) (set lanfound (getenv "Language")) )
(set lan 0)

(if (= "english"     lanfound) (set lan 0))
(if (= "deutsch"     lanfound) (set lan 1))
(if (= "italiano"    lanfound) (set lan 2)) 
(if (= "francais"    lanfound) (set lan 3)) 
(if (= "svenska"     lanfound) (set lan 4)) 
(if (= "norsk"       lanfound) (set lan 5)) 
(if (= "nederlands"  lanfound) (set lan 6)) 
(if (= "dansk"       lanfound) (set lan 7)) 

(set #English       "English")
(set #Deutsch       "Deutsch")
(set #Italiano     "Italiano")
(set #Francais     "Francais")
(set #Svenska       "Svenska")
(set #Norsk           "Norsk")
(set #Nederlands "Nederlands")
(set #Dansk           "Dansk")

(set mfound 0) (set newicon1 1) 
(set keeper 1) (set firsttime 0)

;***********************************************************************
; The English Installation Strings
;***********************************************************************
(set #about (cat "\n\n\n\nWelcome to the Diz-Explorer PRO Version " Explorerver "\n\n\nCopyright  1997,98 by\n\nJochen Grus & Martin Gentile\n") )
(set #aboutpacker (cat "\n\n\n\nNow you should copy all packers to the >C< directory. Before the installation you should check the versions! ") )
(set #aboutdevices (cat "\n\n\n\nNow you should copy all devices to the >DEVS< directory. Before the installation you should check the versions! ") )
(set #aboutlhacheck (cat "\n\n\n\n                - W A R N I N G -               Installation found the following file in the C-directory: LHACHECK. You should delete this file because it has the BBS-Trojan VIRUS!!! ") )
(set #askcpu "\nThe installer has found the following CPU:\n")
(set #askcpu2 "\nThe installer program has found a CPU. The installer should show correctly what kind of cpu is installed...\n")
(set #whereExplorer "Where do you wish to install the Diz-Explorer. A directory called 'Explorer' will be created if one is not there. If a copy of Explorer is found it will be backed up.")
(set #filethere1 "\n\nThe installer has found an Explorer version ")
(set #filethere2 " at ")
(set #filethere3 "\n\nThe file will be renamed to ")
(set #filethere4 " and it will then be moved to ")
(set #backuptoXXX "Back-UP to file named 'Diz-Explorer.")
(set #copyover "Copy Over Old Version")
(set #oktodelete1 "\nIs it ok to delete the older Diz-Explorer binary so that the Explorer Directory can be made?\n")
(set #oktodelete2 "\nIs it ok to delete the older _renamed_ Explorer binary so that the Explorer Directory can be made?\n")
(set #Explorerfound "\nThe Installer has found a copy of Explorer already installed. What do you want to do?\n")
(set #newicon "\nDo you wish to copy over The Diz-Explorer Icon from the archive? If you have any ToolTypes already set you should select no.\n")
(set #nonewicon  "No  - ToolTypes already set.")
(set #yesnewicon "Yes - Copy over the old DIZ-Explorer Icon.")
(set #whatcat "\nSelect the Explorer Language catalog you wish to install.\n")
(set #wherecat "\nWhere do you wish to install the Explorer Language Catalog? There is no need for it yet. Default is ")
(set #catnofind "Can not find this catalog in this Explorer archive. No need for it yet.")
(set #whatdocs "\nWhat Explorer documentation would you like to install?\n")
(set #wheredocs "Where would you like the Explorer documentation you selected to be installed?")
(set #byebye (cat "\nDiz-Explorer Install Complete!\n\n" ))
(set #setup_help
		(cat
			"Explorer needs an Assign in main directory to "
			"properly setup. If you skip this pass you MUST "
			"manually enter it later in your User-StartUp or "
			"in a shell prior to run Explorer."
		)
	)



;***********************************************************************
; The German Installation Strings for the Diz-Explorer
;***********************************************************************

(if (= lan 1)
(
 (set po 1)

(set #about (cat "\n\n\n\nWillkommen zum DIZ-Explorer PRO Version " Explorerver "\n\n\nCopyright  1997,98 by\n\nJochen Grus & Martin Gentile\n") )
(set #aboutpacker (cat "\n\n\n\nJetzt sollten Sie alle Packer in das >C< Verzeichnis installieren. Man sollte vorher die Versionen berprfen! Es sind aber alle aktuellen Packer hier vorhanden! ") )
(set #aboutdevices (cat "\n\n\n\nJetzt sollten Sie alle Devices in das >Devs< Verzeichnis installieren. Man sollte vorher die Versionen berprfen! Es sind aber alle aktuellen Devices hier vorhanden! ") )
(set #aboutlhacheck (cat "\n\n\n\n                - W A R N U N G -                                                                     Installation hat folgende Datei im C-Verzeichnis gefunden: LHACHECK. Sie sollten diese Datei entfernen, da es den VIRUS BBS-Trojan enthlt!!! ") )
(set #askcpu "\nFolgender Prozessor wurde vom Installer erkannt:\n")
(set #askcpu2 "\nDer Installer hat einen Prozessor gefunden. Es mte den richtigen Typ korrekt erkannt haben! \n")
(set #whereExplorer "Wohin wollen Sie den DIZ-Explorer installieren ? Ein Verzeichnis 'Explorer' wird erzeugt, wenn es nicht existiert. Wenn bereits eine Explorer Version vorhanden ist, kann diese gesichert werden.")
(set #filethere1 "\n\nDas Installationsprogramm hat eine Explorer Version gefunden")
(set #filethere2 " at ")
(set #filethere3 "\n\nDie Datei wird umbenannt in ")
(set #filethere4 " und wird dann verschoben nach ")
(set #backuptoXXX "sichern als Datei 'Diz-Explorer.")
(set #copyover "alte Version berschreiben")
(set #oktodelete1 "\nSind Sie damit einverstanden, da das alte Diz-Explorer Hauptprogramm gelscht, so da das Explorer Verzeichnis erstellt werden kann?\n")
(set #oktodelete2 "\nSind Sie damit einverstanden, da das alte _umbenannte_ Explorer Hauptprogramm gelscht wird, so da das Explorer Verzeichnis erstellt werden kann?\n")
(set #Explorerfound "\nDas Installationsprogramm hat bereits eine installierte Explorer Version gefunden. Was wollen Sie tun?\n")
(set #newicon "\nWollen Sie das Diz-Explorer Piktogramm aus dem Archiv bernehmen? Wenn Sie bereits die Programmmerkmale verndert haben, whlen Sie bitte Nein.\n")
(set #nonewicon  "Nein  - Programmmerkmale verndert.")
(set #yesnewicon "Ja - berschreibe das alte DIZ-Explorer Icon.")
(set #whatcat "\nWhlen Sie die Sprache, die installiert werden soll.\n")
(set #wherecat "\nWohin wollen Sie die Explorer Sprachdatei installieren? Wird noch nicht gebraucht. Eingestellt ist ")
(set #catnofind "Ich kann die passende Sprachdatei im Archiv nicht finden. Wird noch nicht gebraucht.")
(set #whatdocs "\nWelche Anleitung zum Explorer wollen Sie installieren ?\n")
(set #wheredocs "Wohin wollen Sie die gewhlte Anleitung kopieren?")
(set #byebye (cat "\nDie DIZ-Explorer Installation wurde erfolgreich abgeschlossen!""\n\nViel Spa beim Entdizzen...\n\n" ))
(set #setup_help
		(cat
			"Der Explorer braucht ein Assign um richtig arbeiten "
			"zu knnen. Wenn Sie jetzt abbrechen mssen Sie spter "
			"diese Eintrge manuell in der User-StartUp vornehmen "
			"oder im Shell ein Assign herstellen um mit dem Explorer "
                        "arbeiten zu knnen. "
		)
	)

;***********************************************************************
; The Italiano Installation Strings
;***********************************************************************
;(set #setup1
;	(cat
;		"Per preparare l'ambiente del Explorer DEVO modificare la tua "
;		"User-StartUp aggiungendo i seguenti comandi:\n\n"
;	)
;)
;
;(set #setup2	"Se salti questo passo DOVRAI inserirli manualmente pi tardi.")
;
;(set #setup_help
;	(cat
;		"Explorer necessita di un assegnamento alla sua directory "
;		"principale al fine di funzionare correttamente. Se "
;		"salti questo passo DOVRAI inserirlo manualmente nella "
;		"tua User-StartUp o in una shell prima di eseguire il Explorer."
;	)
;)
;
;Please make your own Strings for the installation...  Si! I will do it!
;
;***********************************************************************
; The Francais Installation Strings
;***********************************************************************
;
;Please make your own Strings for the installation..  Qui! je vais le faire!
;
;***********************************************************************
; The Svenska Installation Strings
;***********************************************************************
;
;Please make your own Strings for the installation...  Yo! I will do it!
;
;***********************************************************************
; The Norsk Installation Strings
;***********************************************************************
;
;Please make your own Strings for the installation...  Yo! I will do it!
;
;***********************************************************************
; The Nederlands Installation Strings
;***********************************************************************
;
;Please make your own Strings for the installation...  Yo! Ick do dat!
;
;***********************************************************************
; The Dansk Installation Strings
;***********************************************************************
;
;Please make your own Strings for the installation...  Yo! I will do it!
;

)
)

;***********************************************************************
; Tach Mdelz and Jungz !
;***********************************************************************
(message #about)
(welcome) 
;********************************************************************
; Checking the CPU - Hello CPU are you there???
;********************************************************************
  (set cpu (database "cpu"))
(if (= cpu 68000) (set #cpu 0)) (if (= cpu 68010) (set #cpu 0))
(if (= cpu 68020) (set #cpu 0)) (if (= cpu 68030) (set #cpu 0))
(if (= cpu 68040) (set #cpu 1)) (if (= cpu 68060) (set #cpu 1)) 
(if (= @installer-version 0)
  (if (> (exists ("sys:libs/68060.library")) 0) (set #cpu 1) )
  (if (= cpu 68060) (set #cpu 1))
  (if (> (exists ("sys:libs/ppc.library")) 0) (set #cpu 2) )
  (if (= cpu 68060) (set #cpu 1))
)

(set cpuPick (askchoice (choices "68020 or 68030" "68040 or 68060" "PC603 or PC604")
			(prompt #askcpu)
	                (help   #askcpu2)
          		(default #cpu)
	  )
)

(if (= cpuPick 0) (set cpuadd ".020")) (if (= cpuPick 1) (set cpuadd ".040")) (if (= cpuPick 2) (set cpuadd ".ppc"))

;***********************************************************************
; Ask where to put the DIZ-EXPLORER & Make w new directory if needed
;***********************************************************************
(set Explorerdir  (askdir (prompt #whereExplorer)
		        (help   #whereExplorer)
     		        (default "SYS:")
               )  
)

(set where Explorerdir)

;***********************************************************************
; Check to see if the DIZ-EXPLORER is already there, if so ask to backup
;***********************************************************************
(if (= 1 (exists (tackon where "Explorer") ) ) 
  (
    (set vernum1 (getversion (tackon where "Explorer") ))
    (set ver1 (/ vernum1 65536)) (set rev1 (- vernum1 (* ver1 65536) ) )
    (set Explorer_old (cat ver1 "." rev1))

    (message (cat #filethere1 ver1 "." rev1 #filethere2 where #filethere3 
                  (cat "Explorer" Explorer_old) #filethere4 (tackon Explorerdir "Explorer") )
    )
    

    (copyfiles (source (tackon where "Explorer"))
               (dest where) 
               (infos)
               (newname (cat "Explorer." Explorer_old))
    )
    
    (delete (tackon Explorerdir "Explorer") (prompt #oktodelete1) (help #oktodelete1) (confirm) (infos)) 

    (if (< (exists (tackon Explorerdir "Explorer")) 2) (makedir (tackon Explorerdir "Explorer") (infos)) )    

    (copyfiles (source (tackon where (cat "Explorer." Explorer_old) ))
                       (dest (tackon Explorerdir "Explorer")) 
                       (infos)
               
    )

    (delete (tackon where (cat "Explorer" Explorer_old)) (prompt #oktodelete2) (help #oktodelete2) (confirm) (infos) ) 

    ;(set firsttime 1)

  )
)

(if (< (exists (tackon Explorerdir "Explorer")) 2) (makedir (tackon Explorerdir "Explorer") (infos)) )
(set where (tackon Explorerdir "Explorer"))
(set @default-dest where)

;********************************************************************
; Check for the old one and backup it or not...
;********************************************************************
(if (exists (tackon where "Explorer")) 
  (
      (set vernum1 (getversion (tackon where "Explorer") ))
      (set ver1 (/ vernum1 65536)) (set rev1 (- vernum1 (* ver1 65536) ) )
      (set Explorer_old (cat ver1 "2." rev1))

      (set keeper  (askchoice (choices  (cat #backuptoXXX Explorer_old "'")  #copyover)
                     (prompt #Explorerfound)
	             (help   #Explorerfound)
                     (default 0)
	           )
      )    


      (if (= keeper 0)
         (copyfiles (source (tackon where "Explorer"))
                     (dest where) 
                     (infos)
                     (newname (cat "Explorer" Explorer_old))
         )
      )          

      (set firsttime 1)
    
  )
)

;********************************************************************
; Copy over the old Explorer file and Icon if wanted (Sure!)
;********************************************************************
(copyfiles (source "Explorer") (dest where) (optional "nofail") )


(if (= firsttime 0)  (copyfiles (source "Explorer.info") (dest where) (optional "nofail") ) )


(if (OR (= keeper 0) (= (exists (tackon where "Explorer.info")) 0))
  (
  
   (set newicon (askchoice (choices #yesnewicon #nonewicon)
                           (prompt #newicon)
	                   (help   #newicon)
                           (default 0)
	        )
   )
  
   (if (= newicon 0) 
     (copyfiles (source "Explorer.info") (dest where)  (optional "nofail") )
   )

  )

)

;********************************************************************
; Select and copy the packers to the C-Directory...     Goil
;********************************************************************
(message #aboutpacker)
  ((makedir (tackon Explorerdir "Explorer/Extras") (infos) ) 

    (copyfiles
      (prompt "Copying the packers")
      (source "ram:explorer/c")
      (all)
      (dest "c:")
      (confirm)
      (help 
        "This will copy the packers to the >C< directory. "
        "If you copy it to the SYS:c directory, it will not check if there are newer versions! "
        "But normally these are the right versions for you... "
      )
    )
)

;********************************************************************
; Checking the C-Directory for LhaCheck - Oh no... 
;********************************************************************
   (if (exists "c:lhacheck")
(message #aboutlhacheck))

;********************************************************************
; Select and copy the devices to the Devs-Directory...   Joh Mann!  
;********************************************************************
(message #aboutdevices)

  (
    (copyfiles
      (prompt "Copying the FMS- and DMS-Device")
      (source "ram:explorer/devs")
      (all)
      (dest "devs:")
      (confirm)
      (help 
        "This will copy the FMS- and the DMS-device to the >DEVS< directory. "
        "If you copy it to the SYS:Devs directory, it will not check if there are newer versions! "
        "But normally these are the right versions for you... "
      )
    )
)

;********************************************************************
; Ask and copy the documentations if wanted!
;********************************************************************
(set docs (askoptions (choices " Explorer.guide" " Explorer_Short.guide" " Example-Amiga.list" " Example-PC.list")
		      (prompt #whatdocs)
                      (help #whatdocs)
	  )
)

(if (<> docs 0)
 (
   (set docsdir (askdir (prompt #wheredocs)
		       (help   #wheredocs)
     		       (default where)
                )  
   )
   (copyfiles (source "Ram:Explorer/Extras") (dest (tackon where "Extras")) (all))
   (if (IN docs 0) (copyfiles (source "Explorer.guide") (dest docsdir) (infos) (optional "nofail") ) )
   (if (IN docs 0) (copyfiles (source "Explorer_short.guide") (dest docsdir) (infos) (optional "nofail") ) )
   (run (cat "run SYS:utilities/AmigaGuide ram:explorer/explorer_short.guide") )

 )

)
;********************************************************************
; Modify User-Startup   - Wow! It work`s...
;********************************************************************
(set #setup1
        (cat "\n\n\nTo get Explorer work right there has to be made "
        "some changes to your User-Startup !\n\n"
        command1
        )
)

(if (= @language "deutsch") (

(set #setup1
        (cat "\n\n\nUm mit Explorer richtig arbeiten zu knnen, mu "
        "eine nderung an der User-Startup vorgenommen werden.\n\n"
        command1
        )
)
))
(set #setup2
		(cat
			"If you skip this pass you MUST manually enter "
			"it later."
		)
	)

(if (= @language "deutsch") (

(set #setup2
		(cat
			"Wenn Sie jetzt abrechen, men sie spter die nderung "
			"manuell vornehmen !"
		)
	)
))

(startup "Explorer"
		(prompt
			(cat
				#setup1
				"Assign Explorer: \"" @default-dest "\"\n"
				"Path Explorer: ADD\n\n"
				#setup2
			)
		)
		(help #setup_help)
		(command
			"Assign Explorer: \"" @default-dest "\"\n"
			"Path Explorer: ADD\n"
		)
	)


(working "\nDeleteing temporary files.")
(run "Delete RAM:Explorer ALL FORCE QUIET")
(run "Delete RAM:Explorer/c ALL FORCE QUIET")
(run "Delete RAM:Explorer.info ALL FORCE QUIET")

(set #endnow (cat "Installation of Explorer completed.\n"
    "When the lines:\n" command1 "\ndoesn`t appear "
    "in your Startup-Sequence or User-Startup, "
    "please do it manually.\n\n"
    "Best wishes...\n\n"
    "Jochen Grus & Martin Gentile"
    ))

(if (= @language "deutsch") (

    (set #endnow (cat "\nInstallation von Explorer beendet.\n\n"
        "Falls die Zeilen:\n" #setup1 "\nnicht in Ihre Startup-Sequence bzw. "
        "User-Startup eingefgt wurde, dann holen Sie dies bitte nach.\n\n"
        "\n\nWir wnschen ihnen viel Erfolg mit den Explorer!\n\n"
        "Jochen Grus & Martin Gentile"
    ))
))

;********************************************************************************
; Ende - Bye - Fin - Finito - Fuck i must go now - see u in the next whisky bar. 
;********************************************************************************

(procedure Explor (set JOH 1) ( (while (< JOH 4444)  (set JOH (+ JOH 1)) )  ) )

(procedure InformX
(working (cat "\n\n"
              " LHA  TAR\n"
              " LZX  TGZ\n"
              " DMS  EXE\n"
              " ARJ  SIT\n"
              " ARC  LZH\n"
              " ZOO  RAR\n"
              " ZIP  LZ\n"
              " \n"
         )           
)
)
(procedure InformY
(working (cat "\n\n"
              "\n"
              "\n"
              "Diz-Explorer Pro Version 4.0 Beta\n"
              "\n"
              "by\n"
              "\n"
              "   Jochen Grus & Martin Gentile   \n"
              "\n"
         )           
)
)
(InformY)

(Explor)(Explor)
(InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (InformX)(Explor)
(InformY)(Explor) (Explor) (Explor)

(exit #byebye)
