;;
;;  $Final Writer Demo Hard Drive Installation Script German Version $
;;  $Date: 1995/11/03 16:27:08 $
;;  $Revision: 1.3 $
;;
;;  Deutsche Uebersetzung: Helmut Eisenkolb
;;  Update: Gregor Gerlach 08.04.1996 00:30:31

(set is_update 0)
(set @user-level 1)  ; force to use average mode
(complete 0)


;
; Installation Disk Names
;
(set #install_disk_1 "Textikon")

;
; File/drawer names that change with different language versions.
;
(set #fw_drawer      "FinalWriter_Demo_D")

;
; LHex file
;
(set #lhex_program
(cat  #install_disk_1
      ":Bonus/FinalWriter_Demo_D/lhex"
))

; -------------------------------------------------------------------
; TEXT TRANSLATION SHOULD BEGIN HERE - Translate everything in quotes.
;

(set #which_drawer_prompt
(cat  "In welchem Laufwerk oder Unterverzeichnis soll das Verzeichnis für die Final Writer Demo"
      " erstellt werden?"
))

(set #which_drawer_help
(cat  "Das Installationsprogramm wird ein Verzeichnis namens \""
      #fw_drawer
      "\" in der ausgewählten Disk bzw. Verzeichnis erstellen. Alle \"Final Writer\" "
      "Dateien werden in dieses neue Verzeichnis kopiert.\n\n"
      @askdir-help
))

(set #disk_space_prompt
(cat  "Es ist vermutlich nicht genug Platz für die Installation von \""
      #fw_drawer
      "\" auf diesem Laufwerk. Wollen Sie trotzdem fortfahren?"
))

(set #disk_space_help
(cat  #fw_drawer
      " benötigt ungefähr 2.5 Megabyte für eine komplette Installation. "
      "Falls die Final Writer Demo in dem Verzeichnis bereits installiert ist, "
      "können Sie fortfahren. Andernfalls bitte ABORT oder NO auswählen und "
      "entweder Platz auf dieser Partition schaffen, oder eine andere Partition "
      "für die Installation auswählen."
))

(set #disk_space_abort
(cat  #fw_drawer
      " Installation abgebrochen, nicht genug Speicherplatz auf dieser Partition. \""
))

(set #update_options_prompt
(cat  "Welche Teile möchten Sie updaten?"
))

(set #update_choice_0 "Final Writer Demo Programm")
(set #update_choice_1 "System-Dateien")
(set #update_choice_2 "System-Libraries")
(set #update_choice_3 "System-Schriftarten")

(set #ask_disk_prompt
(cat  "\n\nBitte \"%s\" in ein beliebiges Laufwerk einlegen."
))

(set #ask_disk1_help
(cat  "\"%s\" enthält das Final Writer Programm, Libraries, System-Schriftarten, und Daten, die installiert werden.\n\n"
      @askdisk-help
))


(set #install_program      "Installiere Final Writer Programm von \"%s\".")
(set #install_program_icon "Installiere Final Writer Programm und Icon von \"%s\".")
(set #install_datafiles    "Installiere Daten von \"%s\".")
(set #install_libs         "Installiere Libraries von \"%s\".")
(set #install_sysfonts     "Installiere System-Schriftarten von \"%s\".")

(set #install_program_err     "Fehler bei der Installation des Final Writer Programmes.")
(set #install_datafiles_err   "Fehler bei der Installation der Daten.")
(set #install_libs_err        "Fehler bei der Installation der Libraries.")
(set #install_sysfonts_err    "Fehler bei der Installation der System-Schriftarten.")

(set #kickstart_err
(cat  "Sie benötigen Workbench 2.04 oder höher um Final Writer zu installieren! "
      "(Workbench Version 37.67 und Kickstart 37.175 oder höher.)"
))

;
; TEXT TRANSLATION SHOULD END HERE - nothing below needs translation.
; -------------------------------------------------------------------

;
; make sure we are running under V37 or higher...
;
(if (< (/ (getversion) 65536) 37)
   (
    (abort  #kickstart_err)
   )
)

;
; Ask where to install Final Writer.
;
(set FW_dest
   (askdir
      (prompt  #which_drawer_prompt)
      (help    #which_drawer_help @askdir-help)
      (default @default-dest)
   )
)

;
; Check if this is an update
; the FWLibs directory is a tell-tale sign
; that FW is already installed here
;
(if (exists (tackon FW_dest "FWLibs"))
   (set is_update 1)
   (  (if (exists (tackon FW_dest #fw_drawer))
         (set is_update 1)
         (makedir (tackon FW_dest #fw_drawer) (infos))
      )
      (set FW_dest (tackon FW_dest #fw_drawer))
   )
)

(set @default-dest FW_dest)
(set disk_space (getdiskspace FW_dest))


;
; If first time installation, install all
;
(if (NOT is_update)
   (
      (set install_all 1)
      (set disk_space_needed 2810183)  ; 2.68 Megs
   )
)


;
;Check if enough disk space is available.
;
(if (AND (< disk_space disk_space_needed) (NOT is_update))
   (
      (set answer1
         (askbool
            (prompt  #disk_space_prompt)
            (help    #disk_space_help)
         )
      )
      (if (NOT answer1)
         (abort #disk_space_abort
               (getdevice @default-dest)
               "\"."
         )
      )
   )
)


;
; Allow updating user to select what they want updated.
;
(if is_update
   (set install_options
      (askoptions
         (prompt #update_options_prompt)
         (help @askoptions-help)
         (choices
            #update_choice_0     ; Program
            #update_choice_1     ; System Data Files
            #update_choice_2     ; System Libraries
            #update_choice_3)    ; System Fonts
         (default 15)            ; default to Program, Files, Libs, Fonts
      )
   )

   ; First time install
   (if install_all
      (set install_options 15)  ; hex F - all four options on
   )
)

;
; Copy the extraction utility over and remember where it is
;
(copyfiles
   (source #lhex_program)
   (dest FW_dest)
)
(set DeArcher (tackon FW_dest "lhex"))
(set error 0)

;
; Installing Files on Disk 1?
;
(if (IN install_options 0 1 2)
   (
      ; Get Disk 1
      (askdisk
         (prompt  (#ask_disk_prompt #install_disk_1))
         (help    (#ask_disk1_help #install_disk_1))
         (dest    #install_disk_1)
      )

      ;
      ; If installing/updating the program
      ;
      (if (IN install_options 0)
         (
            ; Make installer cd into FW_dest when it executes the run statement
            (set @execute-dir FW_dest)

            ; copy the Final Writer program over if the program
            ; icon doesn't exists copy it over too.
            ( if (exists (tackon FW_dest "FinalWriter.info"))
               ; This DOES NOT copy the icon, in case the user
               ; has modified the tool-types
               (
                  (working (#install_program #install_disk_1))
                  (set error
                     (run
                        ("\"%s\" -f x \"Textikon:Bonus/FinalWriter_Demo_D/FinalWriter.lha\" FinalWriter >NIL:" DeArcher)
                     )
                  )
               )
               ; This DOES copy the icon
               (
                  (working (#install_program_icon #install_disk_1))
                  (set error
                     (run
                        ("\"%s\" -f x \"Textikon:Bonus/FinalWriter_Demo_D/FinalWriter.lha\" >NIL:" DeArcher)
                     )
                  )
               )
            )
         )
      )

      (if error
         (abort #install_program_err)
      )

      (complete 25)

      ; Installing FWFiles
      (if (IN install_options 1)
         (
            ; If FWFiles doesn't exist, create it.
            (if (NOT (exists (tackon FW_dest "FWFiles")))
               (
               (makedir (tackon FW_dest "FWFiles") (infos))
               )
            )

            ; Make installer cd into FWFiles when it executes the run statement
            (set @execute-dir (tackon FW_dest "FWFiles"))

            ; Extract the files
            (working (#install_datafiles #install_disk_1))
            (set error
               (run
                  ("\"%s\" -f x \"Textikon:Bonus/FinalWriter_Demo_D/FWFiles.lha\" >NIL:" DeArcher)
               )
            )

            ; Abort if any errors
            (if error
               (abort #install_datafiles_err)
            )
         )
      )

      (complete 50)

      ; Installing FWLibs
      (if (IN install_options 2)
         (
            ; If FWLibs doesn't exist, create it.
            (if (NOT (exists (tackon FW_dest "FWLibs")))
               (
               (makedir (tackon FW_dest "FWLibs"))
               )
            )

            ; Make installer cd into FWLibs when it executes the run statement
            (set @execute-dir (tackon FW_dest "FWLibs"))

            (working (#install_libs #install_disk_1))
            (set error
               (run
                  ("\"%s\" -f x \"Textikon:Bonus/FinalWriter_Demo_D/FWLibs.lha\" >NIL:" DeArcher)
               )
            )

            ; Abort if any errors
            (if error
               (abort #install_libs_err)
            )

            (run ("Avail FLUSH"))
         )
      )
   )
)

(complete 75)

; Installing System Fonts
(if (IN install_options 3)
   (
      ; Get Disk 1
      (askdisk
         (prompt  (#ask_disk_prompt #install_disk_1))
         (help    (#ask_disk1_help #install_disk_1))
         (dest    #install_disk_1)
      )

      ; Installing FWFonts
      (if (IN install_options 3)
         (
            ; If FWFonts doesn't exist, create it.
            (if (NOT (exists (tackon FW_dest "FWFonts")))
               (
               (makedir (tackon FW_dest "FWFonts") (infos))
               )
            )

            ; Make installer cd into FWFonts when it executes the run statement
            (set @execute-dir (tackon FW_dest "FWFonts"))

            (working (#install_sysfonts #install_disk_1))
            (set error
               (run
                  ("\"%s\" -f x \"Textikon:Bonus/FinalWriter_Demo_D/FWFonts.lha\" >NIL:" DeArcher)
               )
            )

            ; Abort if any errors
            (if error
               (abort #install_sysfonts_err)
            )
         )
      )
   )
)

; If FWDocs doesn't exist, create it.
(if (NOT (exists (tackon FW_dest "FWDocs")))
   (
   (makedir (tackon FW_dest "FWDocs") (infos))
   )
)

; If FWClipArt doesn't exist, create it.
(if (NOT (exists (tackon FW_dest "FWClipArt")))
   (
   (makedir (tackon FW_dest "FWClipArt") (infos))
   )
)

; If FWTextClips doesn't exist, create it.
(if (NOT (exists (tackon FW_dest "FWTextClips")))
   (
   (makedir (tackon FW_dest "FWTextClips") (infos))
   )
)

(delete DeArcher)

(complete 100)

(exit)

