;
; Install Kit Installation by Andreas Falkenhahn 1997-98
;
; If you`ve problems editing or using this installer script, e-mail me:
; Andreas.Falkenhahn@mail.regio.net
; 
; Nah, the Commo Installer is really a piece of gold. But some shitty
; bugs should be removed in the next version. It`s easy to program, powerful
; and compatible => that`s what we need ;)
; 
; April 8th, `98 by SF^Airsoft
;


(set #ver "2.5")
(set #cver "1.1")
(set #iver "1.1")

(message (cat "\n\nInstall Kit V" #ver "\n\n(c) 1996-98 by\n\nAndreas Falkenhahn"
              "\n\nThe ultimate CD32 Games Emulator\n\n&\n\nInstaller"
         )
)

(set #lang (cat "Please select the language, you wanna use during the installation."
                "Bitte suchen Sie die Sprache aus, die während der Installation benutzt werden soll!")
)

(set #readme "ReadMe")

; Ask
    (set whatdo (askchoice
  
        (prompt #lang)
        (help   "Select language") 
 
        (choices

                    "Deutsch"
                    "English"
        )
    )) 

(if (= whatdo 0) (

   (set #welcome (cat "\n"
             "Willkommen zum Installationsprogramm für das\n\nInstall Kit"
             "\n\nDieses Programm installiert Ihnen das komplette Install Kit"
             "\noder nur einzelne Teile daraus auf Ihre Festplatte.\n\n"
             "Das Install Kit Paket ist Shareware und kostet 20 DM.\n"
             "Viele Funktionen sind nur eingeschränkt bzw. gar nicht nutzbar. "
                  )
   )

  (set #assign (cat "\n"
           "Es müssen 2 Zeilen in Ihre User-Startup eingefügt werden!"
           "\n\nAssign InstallKit: <InstallKit Zielverzeichnis>"
           "\nAssign Kit:        <InstallKit Zielverzeichnis>"
  ))      
  (set #whereinstall "Suchen Sie bitte den Zielpfad für das Install Kit aus! (eine Schublade mit dem Namen InstallKit wird angelegt)")
  (set #libcopy "Kopiere reqtools.library nach libs:...")
  (set #libcopy1 "Kopiere lowlevel.library nach libs:...")
  (set #libcopy2 "Kopiere freeanim.library nach libs:...")
  (set #help (cat "\n"
             "Install Kit Installation (c) A. Falkenhahn 1997\n"
             "===============================================\n\n"
             "Folgende Dinge sollten Sie beachten:\n\n"
             "1) Ich übernehme keinerlei Haftung für irgendwelche\n"
             "   Schäden, die das Install Kit verursacht hat.\n\n"
             "2) Wenn Sie das Install Kit installieren & nutzen\n"
             "   lassen Sie sich bitte registrieren.\n\n"
             "Infos zu den einzelnen Installationsschritten:\n\n"
             "1) Suchen Sie das Verzeichnis aus, in dem das\n"
             "   InstallKit Verzeichnis erstellt werden soll.\n"
             "   alle Dateien werden in das Verzeichnis kopiert.\n"
             "   Außer einige Tools und Dokumentationen, für\n"
             "   diese können Sie dann Extra Verzeichnisse\n"
             "   aussuchen.\n\n"
             "2) Suchen Sie nun die Sprache für die Dokumentation\n"
             "   und das Install Kit aus.\n\n"
             "3) Wählen Sie, ob Sie Userinstaller installiert\n"
             "   haben wollen.\n\n"
             "4) Wählen Sie, ob Sie Developermaterial installiert\n"
             "   haben wollen.\n\n"
             "5) Wählen Sie, ob Sie Bonusprogramme installiert\n"
             "   haben wollen.\n\n"
             "6) Wenn ja, welche.\n\n"
             "7) Wählen Sie, ob ScriptCopy extern installiert werden\n"
             "   soll.\n\n"
             "8) Wählen Sie, ob das Cheat+Info Guide installiert werden\n"
             "   soll.\n\n"
             "9) Wählen Sie, ob der Original Install Kit Bildschirmschoner\n"
             "   installiert werden soll.\n\n"
  ))

  (set #diskisfull "Auf diesem Laufwerk ist leider nicht genug Platz!")
  (set #language "Bitte suchen Sie die Sprache für die AmigaGuide® Dokumentation aus!")
  (set #catalog "Bitte suchen Sie die Sprache für das Install Kit aus!")
  (set #where "Wohin soll die AmigaGuide® Dokumentation kopiert werden?")
  (set #ques1 (cat "\n" 
            "Möchten Sie einige Demo-Userinstaller installiert haben"
            "\n(nur nützlich für die registrierte Version) ?"
            "\n\nHinweis: Userinstaller sind Installskripts, die mit dem"
            "\nInstaller Editor erstellt worden sind. Initalisiert und"
            "\nerstellt können Sie nur mit der registrierten Version."
  ))
  (set #ques2 "\nMöchten Sie Bonusprogramme installieren?")
  (set #ques3 "\nSoll das Entwickler Material installiert werden?")
  (set #where1 "Wohin sollen die Bonusprogramme kopiert werden?")
  (set #where2 "Wohin soll das Developer Material kopiert werden?")
  (set #which "Welche Bonusprogramme sollen installiert werden?")
  (set #ques4 "Soll das Cheat+Info Guide mitinstalliert werden?")
  (set #ques5 "\nSoll ScriptCopy extern installiert werden?")
  (set #where3 "Wohin soll ScriptCopy kopiert werden?")
  (set #ques6 "Soll der Original Install Kit Bildschirmschoner installiert werden?")
  (set #where4 "Wohin soll der Bildschirmschoner kopiert werden?")
  (set #where5 "Wohin soll das Bildschirmschoner Prefsfile kopiert werden?")
  (set #ja "Ja")
  (set #no "Nein")
  (set #te "Test")
  (set #install1 (cat
               "Bitte warten - das Install Kit wird nun auf Ihrem System installiert!"
               "\n\nBitte unterstützen Sie die Shareware Idee, und lassen Sie sich"
               "\nregistrieren. Die Registrierung kostet 20 DM oder $15 US-Dollar."
               "\nBitte senden Sie das Geld mit dem ausgefüllten Registrationsformular an:"
               "\n\nAndreas Falkenhahn\nAn der Trift 2\n36132 Eiterfeld-Arzell\nDEUTSCHLAND"
                 )
  )
 
  (set #copy "kopieren")
  (set #ncopy "nicht kopieren")
  (set #where6 "Wohin sollen die Piktogramme kopiert werden?")
  (set #where7 "Wohin soll das CD32 Games Cheat Kit kopiert werden?")
  (set #where8 "Wohin soll das CD32 Games Info Kit kopiert werden?")
  (set #icons (cat "\n"
             "Sollen die mitgelieferten Piktogramme für Spiele\n"
             "installiert werden?"
  ))
  (set #ckit (cat "\n"
            "Soll das CD32 Games Cheat Kit V" #cver " mitinstalliert werden?\n\n"
            "Hinweis: Das Cheat Kit beinhaltet Cheats für viele CD32\n"
            "Spiele. Außerdem Tips & Tricks, Komplettlösungen...."
  ))
  (set #ikit (cat "\n"
            "Soll das CD32 Games Info Kit V" #iver " mitinstalliert werden?\n\n"
            "Hinweis: Das Info Kit bietet zu vielen Spiele einige\n"
            "Infos an. Außerdem gibt es für jedes vom Info Kit\n"
            "unterstützte Spiel ein Bild!"
  ))
  (set #found (cat "\n"
             "Es wurde eine ältere Version des Install Kit auf Ihrer\n"
             "Festplatte gefunden! Wenn die Installation fortgesetzt\n"
             "wird, werden alle Dateien der alten Version gelöscht.\n"
             "Sollten Sie noch wichtige Dateien im Verzeichnis haben\n"
             "sichern Sie sich diese bitte erst, bevor Sie mit der\n"
             "Installation fortfahren!"
  ))
)) 

(if (= whatdo 1) (

  (set #where6 "Where shall the icons be installed?")
  (set #where7 "Where shall the CD32 Games Cheat Kit be installed?")
  (set #where8 "Where shall the CD32 Games Info Kit be installed?")
  (set #icons (cat "\n"
             "Do you wanna have the icons for Games installed\n"
             "on your Harddrive?"
  ))
  (set #ckit (cat "\n"
            "Do you wanna have the CD32 Games Cheat Kit V" #cver " installed?\n\n"
            "Info: The Cheat Kit consists of Cheats for many CD32\n"
            "Games. Additionally there are hints, solutions..."
  ))
  (set #ikit (cat "\n"
            "Do you wanna have the CD32 Games Info Kit V" #iver " installed?\n\n"
            "Info: The Info Kit has infos about some CD32 games.\n"
            "Additionally there is a picture of every game, which\n"
            "is supported by the Info Kit."
  ))
  (set #found (cat "\n"
             "Es wurde eine ältere Version des Install Kit auf Ihrer\n"
             "Festplatte gefunden! Wenn die Installation fortgesetzt\n"
             "wird, werden alle Dateien der alten Version gelöscht.\n"
             "Sollten Sie noch wichtige Dateien im Verzeichnis haben\n"
             "sichern Sie sich diese bitte erst, bevor Sie mit der\n"
             "Installation fortfahren!"
  ))

   (set #libcopy "Copying reqtools.library to libs:...")
   (set #libcopy1 "Copying lowlevel.library to libs:...")
   (set #libcopy2 "Copying freeanim.library to libs:...")
   (set #assign (cat "\n"
               "Two assigns must be added to your S:User-Startup!"
               "\n\nAssign InstallKit: <your destination>"
               "\nAssign Kit: <your destination>"
   ))

   (set #install1 (cat "\n"
            "Please wait - the Install Kit is installing..."
            "\n\nPlease support the Shareware idea and register yourself!"
            "\nRegistering costs 20 DM or $15."
            "\nPlease send the cash with the filled in Regform to:"
            "\n\nAndreas Falkenhahn\nAn der Trift 2\n36132 Eiterfeld-Arzell\nGERMANY"
   )) 

  (set #welcome (cat "\n"
             "Welcome to the installerprogram for the\n\nInstall Kit"
             "\n\nThis program installs the complete Install Kit"
             "\n or only parts of it to your Harddisk.\n\n"
             "The Install Kit package is Shareware and costs $15US.\n"
             "Many options are disabled."
               )
   )

  (set #whereinstall "Select destination path (a drawer called InstallKit will be created there)")
  (set #whereinstall_help (cat "\n"
                     "No help available!"
  ))

  (set #diskisfull "Not enough free space on this drive!")
  (set #language "Please select language for the AmigaGuide® Documentation!")
  (set #catalog "Please select language for the Install Kit!")
  (set #where "Where shall the AmigaGuide® documentation be copied?")
  (set #ques1 "\nShall I install some Demo-Userinstaller (only usable for registered versions) ?")
  (set #ques2 "\nShall I install some bonus programs?")
  (set #ques3 "\nShall I install the Developer material?")
  (set #where1 "Where shall the bonus programs be copied to?")
  (set #where2 "Where shall the developer material be copied to?")
  (set #which "Which bonus programs shall be copied?")
  (set #ques4 "Shall I install the Cheat+Info guide?")
  (set #ques5 "\nShall I install ScriptCopy external?")
  (set #where3 "Where shall ScriptCopy be copied to?")
  (set #ques6 "\nShall I install the original Install Kit Screenblanker?")
  (set #where4 "Where shall the screen blanker be copied to?")
  (set #where5 "Where shall the screen blanker prefs be copied to?")
  (set #ja "Yes")
  (set #no "No")
  (set #te "Test")
  (set #copy "copy")
  (set #ncopy "don`t copy")
)) 

(message #welcome)

(welcome)

(complete 10)

;(if (exists "InstallKit:InstallKit" (noreq))
;   (set tname "InstallKit:")
;  (
;   (set tname "SYS:")
;  )
;)

(set name
        (askdir
                (prompt #whereinstall)
                (help   #help)
                (default "dh4:")  ; dh4: is my test partition :) so simply ignore
        )
)

(complete 15)

(if (< (getdiskspace name) 4000000)
        (abort #diskisfull)
)

(complete 20)

;(if (exists "kit:data/VERS")
;   (message #found)
;   (run "C:Delete >NIL: InstallKit: all")
;   (run "C:Rename >NIL: InstallKit:/IKit2.2")
;)
   
(copyfiles
    (source "/IKit2.5.info")
    (dest   name)
    (nogauge)
)

(complete 25)

(set sstr (substr name (- (strlen name) 1) 1))
(if (or (= sstr "/") (= sstr ":")) (set dname (cat name "IKit2.5")) (set dname (cat name "/IKit2.5")))

(set sstr (substr dname (- (strlen dname) 1) 1))
(if (or (= sstr "/") (= sstr ":")) (set dmname (cat dname "IKit_Main")) (set dmname (cat dname "/IKit_Main")))

(set sstr (substr dname (- (strlen dname) 1) 1))
(if (or (= sstr "/") (= sstr ":")) (set doname (cat dname "IKit_Docs")) (set doname (cat dname "/IKit_Docs")))

(set sstr (substr dname (- (strlen dname) 1) 1))
(if (or (= sstr "/") (= sstr ":")) (set dirname (cat dname "IKit_Bonus")) (set dirname (cat dname "/IKit_Bonus")))

(set sstr (substr dname (- (strlen dname) 1) 1))
(if (or (= sstr "/") (= sstr ":")) (set diname (cat dname "IKit_Main/Daten")) (set diname (cat dname "/IKit_Main/Daten")))

(working #install1)

(copyfiles
    (source "IKit_Main.info")
    (dest   dname)
    (nogauge)
)
 
(makedir dname)
(makedir dmname)

(copyfiles
    (source "IKit_Main/kit")
    (dest dmname)
    (nogauge)
)

(complete 30)

(copyfiles
    (source "IKit_Main/InstallKit")
    (dest dmname)
    (nogauge)
)

(complete 32)

(copyfiles
    (source "IKit_Main/InstallKit.info")
    (dest dmname)
    (nogauge)
)

(complete 35)

(MakeAssign "doc1" dmname)
(MakeDir "doc1:Daten")
(MakeDir "doc1:Daten/Data")

(complete 40)

(copyfiles
    (source "IKit_Main/Daten/Data")
    (dest   "doc1:Daten/Data")
    (nogauge)
    (all)
)

(complete 45)

(MakeDir doname)

(complete 50)

(copyfiles
     (source "IKit_Docs.info")
     (dest dname)
     (nogauge)
)
  
(complete 55)

(set langu1 (askchoice

         (prompt #language)
         (help   @askchoice-help)
 
         (choices

                  "deutsch"
                  "english"

         )

))

(set doc (askdir

            (prompt #where)
            (help @askdir-help)
            (default doname)
         
)) 
       
(complete 60)

(if (= langu1 0) (

   (working #install1) 

   (copyfiles
         (source "IKit_Docs/InstallKit_deutsch.guide")
         (dest doc)
         (nogauge)
   )

   (copyfiles
        (source "IKit_Docs/InstallKit_deutsch.guide.info")
        (dest doc)
        (nogauge)
   )

))

(if (= langu1 1) (

  (working #install1) 

   (copyfiles
         (source "IKit_Docs/InstallKit_english.guide")
         (dest doc)
         (nogauge)
   )

   (copyfiles
        (source "IKit_Docs/InstallKit_english.guide.info")
        (dest doc)
        (nogauge)
   )

))

(complete 65)

(if (= langu1 2) (
  (working #install1) 

   (copyfiles
         (source "Docs/InstallKit_nederlands.gui")
         (dest doc)
         (nogauge)
   )

   (copyfiles
        (source "Docs/InstallKit_nederlands.gui.info")
        (dest doc)
        (nogauge)
   )

))

(if (= langu1 3) (
  (working #install1) 

   (copyfiles
         (source "Docs/InstallKit_srpski.guide")
         (dest doc)
         (nogauge)
   )

   (copyfiles
        (source "Docs/InstallKit_srpski.guide.info")
        (dest doc)
        (nogauge)
   )

))

(if (= langu1 4) (
  (working #install1) 

   (copyfiles
         (source "Docs/InstallKit_finnish.guide")
         (dest doc)
         (nogauge)
   )

   (copyfiles
        (source "Docs/InstallKit_finnish.guide.info")
        (dest doc)
        (nogauge)
   )

))

(complete 70)

(if (= 1 (askbool (prompt #ques1) (help @askbool-help)))

(
 (
  (working #install1)
  (MakeDir "doc1:Daten/User")
  (copyfiles
      (source "IKit_Main/Daten/User")
      (dest   "doc1:Daten/User")
      (nogauge)
      (all)
  )  
 ))
)      

(if (= 1 (askbool (prompt #ques2) (help @askbool-help)))

(
 (
  (makedir dirname)
  (copyfiles
     (source "IKit_Bonus.info")
     (dest   dname)
     (nogauge)
  )
  
  (set bdir
      (askdir
          (prompt #where1)
          (help @askdir-help)
          (default dirname)
  )) 
  (working #install1)
  (makedir "T:Kit")
  (copyfiles
     (source "IKit_Bonus/CD32Boot")
     (dest   "T:Kit")
     (nogauge)
  )
  (copyfiles
     (source "IKit_Bonus/CD32Boot.info")
     (dest   "T:Kit")
     (nogauge)
  )
  (copyfiles
     (source "IKit_Bonus/ChangeIcons")
     (dest   "T:Kit")
     (nogauge)
  )
  (copyfiles
     (source "IKit_Bonus/ChangeIcons.info")
     (dest   "T:Kit")
     (nogauge)
  )
  (copyfiles
     (source "IKit_Bonus/Installer2Disk")
     (dest   "T:Kit")
     (nogauge)
  )
  (copyfiles
     (source "IKit_Bonus/Installer2Disk.info")
     (dest   "T:Kit")
     (nogauge)
  )
 (copyfiles
     (source "IKit_Bonus/Disk2Installer.info")
     (dest   "T:Kit")
     (nogauge)
  )
  (copyfiles
     (source "IKit_Bonus/De-InstallKit.info")
     (dest   "T:Kit")
     (nogauge)
  )
  (copyfiles
     (source "IKit_Bonus/Disk2Installer")
     (dest   "T:Kit")
     (nogauge)
  )
  (copyfiles
     (source "IKit_Bonus/De-InstallKit")
     (dest   "T:Kit")
     (nogauge)
  )

(
  (copyfiles (prompt #which)
  (help @copyfiles-help)
  (source "T:Kit")
  (dest bdir)
  (optional "nofail")
  (confirm "average")
  (files)
  (infos)
  (all)
 )
))))

(complete 80)

(if (= 1 (askbool (prompt #ques5) (help @askbool-help)))

(
 (
  (set sc (askdir
         (prompt #where3)
         (help   @askdir-help)
         (default "C:")
  ))

 (copyfiles
    (source "IKit_Main/Daten/Data/ScriptCopy")
    (dest   sc)
    (nogauge)
 )
)))

(complete 85)

(makedir (cat dname "/IKit_Icons"))

(if (= 1 (askbool (prompt #icons) (help @askbool-help)))

(
 (
  (set icon (askdir
            (prompt #where6)
            (help   @askdir-help)
            (default (cat dname "/IKit_Icons"))
  ))
  (working #install1)
  (run (cat "C:Copy >NIL: IKit_Icons " icon " ALL"))  ; that`s a bit weird, but I dunno how to copy from a drawer in another drawer and keep all files right, sorry! perhaps it`s a bug!
  (copyfiles
       (source "IKit_Icons.info")
       (dest dname)
       (nogauge)
  )        
)))

(makedir (cat dname "/IKit_CheatKit"))

(if (= 1 (askbool (prompt #ckit) (help @askbool-help)))

(
 (
  (set cheat (askdir
            (prompt #where7)
            (help   @askdir-help)
            (default (cat dname "/IKit_CheatKit"))
  ))
  (working #install1)
  (run (cat "C:Copy >NIL: IKit_CheatKit " cheat " ALL"))  ; that`s a bit weird, but I dunno how to copy from a drawer in another drawer and keep all files right, sorry! perhaps it`s a bug!
  (copyfiles
       (source "IKit_CheatKit.info")
       (dest dname)
       (nogauge)
  )        
)))

(makedir (cat dname "/IKit_InfoKit"))

(if (= 1 (askbool (prompt #ikit) (help @askbool-help)))

(
 (
  (set info (askdir
            (prompt #where8)
            (help   @askdir-help)
            (default (cat dname "/IKit_InfoKit"))
  ))
  (working #install1)
  (run (cat "C:Copy >NIL: IKit_InfoKit " info " ALL"))  ; that`s a bit weird, but I dunno how to copy from a drawer in another drawer and keep all files right, sorry! perhaps it`s a bug!
  (copyfiles
       (source "IKit_InfoKit.info")
       (dest dname)
       (nogauge)
  )        
)))


(if (= 1 (askbool (prompt #ques6) (help @askbool-help)))
(
 (
  (set sb (askdir
         (prompt #where4)
         (help   @askdir-help)
         (default "Sys:WBStartup")
  ))

  (copyfiles
     (source "IKit_Bonus/Blanker/InstallKit_Blanker")
     (dest   sb)
     (infos)
     (nogauge)       
  )

  (set sbp (askdir
          (prompt #where5)
          (help   @askdir-help)
          (default "Sys:Prefs")
  ))
  
  (copyfiles
     (source "IKit_Bonus/Blanker/InstallKit_BlankerPrefs")
     (dest   sbp)
     (infos)
     (nogauge)
  ) 

)))

(complete 90)

(copylib
  (prompt #libcopy)
  (help   @copylib-help)
  (source "IKit_Main/libs/reqtools.library")
  (dest   "LIBS:")
  (optional force askuser)
  (confirm)
)

(complete 92)

(copylib
  (prompt #libcopy1)
  (help   @copylib-help)
  (source "IKit_Main/libs/lowlevel.library")
  (dest   "LIBS:")
  (optional force askuser)
  (confirm)
)

(complete 94)

(copylib
   (prompt #libcopy2)
   (help   @copylib-help)
   (source "IKit_Main/libs/freeanim.library")
   (dest   "LIBS:")
   (optional force askuser)
   (confirm)
)
 
(complete 95)

(copyfiles
   (source "IKit_Main/Daten/data/REST")
   (dest   "C:")
   (nogauge)
) 

(complete 96)

(copyfiles
   (source "IKit_Main/Daten/data/RSTStart")
   (dest   "C:")
   (nogauge)
)

(complete 97)

(copyfiles
   (source "IKit_Main/devs/RSTMountlist")
   (dest   "devs:")
   (nogauge)
)

(complete 98)

(copyfiles
   (source "IKit_Main/devs/InstallKitMountlist")
   (dest   "devs:")
   (nogauge)
)

(copyfiles
   (source "ReadMe")
   (dest   dname)
   (infos) 
   (nogauge)
)


(complete 99)

(if (= whatdo 0) (
   
   (set #assign (cat "\n"
       "Damit das Install Kit korrekt laufen kann, sollten\n"
       "Sie die zwei folgenden Zeilen in Ihre S:User-Startup\n"
       "einfügen lassen:\n\n"
       "C:Assign InstallKit: " dname "\n"
       "C:Assign Kit: " diname "\n\n"
       "Das Install Kit läuft zwar auch ohne diese Zuweisungen,\n"
       "allerdings nur in bestimmten Teilen!"
   ))

))

(if (= whatdo 1) (
 
   (set #assign (cat "\n"
       "The Install Kit needs the following two lines\n"
       "in your S:User-Startup to run correct:\n\n"
       "C:Assign InstallKit: " dname "\n"
       "C:Assign Kit: "diname "\n\n"
       "It runs without the lines too, but not in all\n"
       "parts!"
    ))
))
  
(startup (prompt #assign) (help @startup-help)

          "InstallKit"
          (command (cat
              "C:Assign >NIL: InstallKit: " dname "\n"
              "C:Assign >NIL: Kit: " diname
          )
))

(run (cat "Sys:Utilities/MultiView " #readme))

(complete 100)

(exit)
