; $VER: Install-AssignZ 1.1 (18.02.95)
; Script to install AssignZ
; 1993-95 Tobias Abt 

(set #AssignZName
(cat "AssignZ"
))

;=============================================================================
; English strings

(if (= @language "english")
(

(set #Bad-Kick
(cat "\n\nYou need Kick/WB 2.04 or better for AssignZ!"
))

(set #Message
(cat "\n\nWelcome to AssignZ!\n"
     "You are about to install a very powerful Utility for your convenience using the Amiga."
))

(set #Path-Manually
(cat "Select path manually"
))

(set #Yes
(cat "Yes"
))

(set #No
(cat "No"
))

;AssignZ
(set #Ask-AssignZ
(cat "\n\nWhere do you want AssignZ to be installed?"
))

(set #Help-AssignZ
(cat "Usually it is most reasonable to install AssignZ in the"
     "WBStartup drawer of your system partition"
))

(set #AskPath-AssignZ
(cat "Select path for AssignZ, please"
))

(set #Ask-AssignZCfg
(cat "\n\nWhere do you want AssignZ to put its config file?"
))

(set #Help-AssignZCfg
(cat "Any drawer which can be reached when AssignZ is started."
     "Common paths are SYS:WBStartup, S: or SYS:Storage"
))

(set #With-AssignZ
(cat "With AssignZ"
))

(set #Ask-AssignZCfgPath
(cat "Select a path for AssignZ's config file, please"
))

(set #Rename-AssignZCfg
(cat "Renaming old AssignZ.config"
))

;icons
(set #Ask-NiceIcons
(cat "\n\nDo you want the nice 16 color icon for AssignZ?"
))

(set #Help-NiceIcons
(cat "Do you want to get the icon for Workbenches with 16 colors and more or do you want the simple one with four colors?"
))

(set #Ask-ReplaceIcon
(cat "\n\nDo you want to replace the existing icon?"
))

(set #Help-ReplaceIcon
(cat "If you select YES, the old icon and the therein contained configuration will be replaced by an icon with default configuration."
))

;actions
(set #Installing
(cat "Installing"
))

(set #WorkOn
(cat "Working on icon for"
))

(set #EmptyCfg
(cat "Creating empty config file for"
))

(set #Complete
(cat "\n\n\nInstallation complete"
))

; languages
(set #Ask-Languages
(cat "Which languages except English should be installed?"
))

(set #Help-Languages
(cat "English is the builtin language. The other language(s) are available through locale catalogs which are optionally (need locale.library)"
))

(set #Lang-German
(cat "German"
))

(set #InstCat
(cat "Installing catalog file: "
))

(set #Ask-AssignZCatalogs
(cat "\n\nWhere do you want AssignZ to put its catalog file(s)?"
))

(set #Help-AssignZCatalogs
(cat "The catalogs for locale.library can be either stored in the same directory as AssignZ or in 'LOCALE:'"
))

(set #Locale
(cat "In 'LOCALE:'"
))

)) ; english strings

;=============================================================================
; German strings

(if (= @language "deutsch")
(

(set #Bad-Kick
(cat "\n\nSie bentigen KickStart 2.04 oder hher fr AssignZ!"
))

(set #Message
(cat "\n\nWillkommen zu AssignZ! \nSie erhalten jetzt die Gelegenheit,\n"
     "Ihr System um ein leistungsfhiges Programm fr die komfortablere Bedienung ihres Amigas zu erweitern."
))

(set #Path-Manually
(cat "Pfad manuell whlen"
))

(set #Yes
(cat "Ja"
))

(set #No
(cat "Nein"
))

; AssignZ
(set #Ask-AssignZ
(cat "\n\nWo soll AssignZ installiert werden?"
))

(set #Help-AssignZ
(cat "In der Regel ist es am sinnvollsten, AssignZ in der "
     "WBStartup-Schublade der Systempartition zu installieren"
))

(set #AskPath-AssignZ
(cat "Whlen Sie bitte das Zielverzeichnis fr AssignZ"
))

(set #Ask-AssignZCfg
(cat "\n\nWo soll AssignZ seine Konfigurationsdaten ablegen?"
))

(set #Help-AssignZCfg
(cat "Irgeindeine Schublade, die beim Start von AssignZ erreichbar"
     "ist. Gngige Schubladen wren zum Beispiel SYS:WBStartup, S: oder SYS:Storage"
))

(set #With-AssignZ
(cat "Zu AssignZ"
))

(set #Ask-AssignZCfgPath
(cat "Whlen Sie bitte das Zielverzeichnis fr AssignZ's Konfigurationsdatei"
))

(set #Rename-AssignZCfg
(cat "Benenne alte Konfigurationsdatei um"
))

;icons
(set #Ask-NiceIcons
(cat "\n\nWollen Sie das nette 16-farbige Icon zu AssignZ?"
))

(set #Help-NiceIcons
(cat "Wenn Sie die Workbench mit mindestens 16 Farben und der Amberpalette"
     "und gegebenenfalls PatchPens benutzen, empfehle ich Ihnen, mit 'JA' zu antworten..."
))

(set #Ask-ReplaceIcon
(cat "\n\nWollen Sie das bereits existierende Icon ersetzen?"
))

(set #Help-ReplaceIcon
(cat "Wenn Sie JA whlen, wird das alte Icon und die darin enthaltenen Konfigurationsdaten durch ein neues Icon ersetzt!"
))

;actions
(set #Installing
(cat "Installiere"
))

(set #WorkOn
(cat "Bearbeite Icon von"
))

(set #EmptyCfg
(cat "Erstelle eine leere Konfigurationsdatei fr"
))

(set #Complete
(cat "\n\n\nInstallation beendet"
))

; languages
(set #Ask-Languages
(cat "Welche Sprachen auer Englisch sollen noch installiert werden?"
))

(set #Help-Languages
(cat "Intern ist AssignZ mit englischen Texten ausgestattet. Die andere(n) Sprache(n) sind ber zustzliche Dateien realisiert (bentigt locale.library)"
))

(set #Lang-German
(cat "Deutsch"
))

(set #InstCat
(cat "Installiere Catalogdatei: "
))

(set #Ask-AssignZCatalogs
(cat "Whlen Sie bitte das Zielverzeichnis fr AssignZ's Sprachdatei(en)"
))

(set #Help-AssignZCatalogs
(cat "Es ist mglich, diese Dateien entweder im gleichen Verzeichnis wie AssignZ oder in 'LOCALE:' abzulegen."
))

(set #Locale
(cat "'LOCALE:'"
))

)) ; german strings



;=============================================================================
;               install ...
;=============================================================================

(complete 0)

(if (< (getversion) (* 37 65536))
    (abort #Bad-Kick)
)

(set olduserlevel @user-level)
(user 2)
(message #Message)
(user olduserlevel)

(if (askbool (prompt #Ask-AssignZ)
             (help #Help-AssignZ)
             (choices "SYS:WBStartup" #Path-Manually)
   )
   (set AssignZPath "SYS:WBStartup")
   (set AssignZPath 
      (askdir (prompt #AskPath-AssignZ)
              (help #Help-AssignZ)
              (default "SYS:WBStartup")
      )
   )
)
(complete 10)

(if (askbool (prompt #Ask-AssignZCfg)
             (help #Help-AssignZCfg)
             (choices #With-AssignZ #Path-Manually)
    )
    (set AssignZCfgPath AssignZPath)
    (set AssignZCfgPath 
       (askdir (prompt #Ask-AssignZCfgPath)
               (help #Help-AssignZCfg)
               (default AssignZPath)
       )
    )
)
(complete 20)

(if (= (exists (tackon AssignZCfgPath "AssignZ.config")) 1)
    (set AssignZCfg 0)
    (set AssignZCfg 1)
)
(complete 30)

(if (> (getversion "libs:locale.library") (* 38 65536))
   (
      (set languages (askoptions (prompt  #Ask-Languages)
                                 (help    #Help-Languages)
                                 (choices #Lang-German)
                                 (default languages)
                     )
      )
      (if (askbool (prompt #Ask-AssignZCatalogs)
                   (help #Help-AssignZCatalogs)
                   (choices #With-AssignZ #Locale)
         )
         (set LocalePath AssignZPath)
         (set LocalePath "LOCALE:")
      )
   )
   (set languages 0)
)
(complete 40)

(if (exists (tackon AssignZPath "AssignZ.info") (noreq))
    (set copyicon
        (askbool (prompt #Ask-ReplaceIcon)
                 (help #Help-ReplaceIcon)
                 (choices #Yes #No)
        )
    )
    (set copyicon 1)
)
(complete 50)

(if copyicon
   (set niceicons
      (askbool (prompt #Ask-NiceIcons)
               (help #Help-NiceIcons)
               (choices #Yes #No)
               (default 0)
      )
   )
)
(complete 60)

(copyfiles
   (prompt #Installing " AssignZ")
   (source #AssignZName)
   (dest AssignZPath)
   (files)
   (optional force askuser)
)
(complete 70)

(if copyicon
   (copyfiles
      (if niceicons
          (source "icons/AssignZ16.info")
          (source "icons/AssignZ4.info")
      )
      (newname "AssignZ.info")
      (dest AssignZPath)
      (files)
   )
)
(tooltype
   (prompt #WorkOn " AssignZ")
   (dest (tackon AssignZPath "AssignZ"))
   (settooltype "CONFIGNAME"  (tackon AssignZCfgPath "AssignZ.config"))
   (settooltype "CX_PRIORITY" "0")
   (settooltype "CX_POPKEY"   "lcommand z")
   (settooltype "CX_POPUP"    "NO")
   (settooltype "STARTPRI"    "-127")
   (settooltype "DONOTWAIT"   "")
   (setstack 8000)
   (noposition)
)
(complete 80)

(if AssignZCfg
   (textfile (prompt #EmptyCfg " AssignZ")
             (dest (tackon AssignZCfgPath "AssignZ.config"))
             (append "# $VER: AssignZ.config V1.0 written by AssignZ V2.7\n# AssignZ configuration file\n#\n")
   )
)
(complete 90)

(if languages
   (
      (if (= (exists "LOCALE:catalogs/deutsch/AssignZ.catalog") 1)
          (delete "LOCALE:catalogs/deutsch/AssignZ.catalog")
      )
      (if (= (exists (tackon AssignZPath "catalogs/deutsch/AssignZ.catalog")) 1)
          (delete (tackon AssignZPath "catalogs/deutsch/AssignZ.catalog"))
      )
      (
         (if (= (exists (tackon LocalePath "catalogs")) 0)
             (makedir (tackon LocalePath "catalogs"))
         )
         (if (BITAND languages 1) ; deutsch
            (
               (if (= (exists (tackon LocalePath "catalogs/deutsch")) 0)
                   (makedir (tackon LocalePath "catalogs/deutsch"))
               )
               (copyfiles
                  (prompt #InstCat #Lang-German)
                  (source "catalogs/deutsch/AssignZ.catalog")
                  (dest (tackon LocalePath "catalogs/deutsch"))
                  (files)
                  (optional force askuser)
               )
            )
         )
      )
   )
)
(complete 100)

(user 2)
(message #Complete)
(exit (quiet))
