;Install Script for Shareware Version of FLM (noDisk) (c) 1995 Denis Unger

(if (= @language "deutsch")
; German Installation
(
 (set default-lang 1)
 (set #lpath "deutsch")
 (set #flmdestination
   (cat "Bitte Zielverzeichnis von FLM auswählen.\n"
        "Ein Verzeichnis FLM wird automatisch erstellt."
   )
 )
 (set #copyhothelplib_nc "Kopiere hothelplib.deutsch ...")
 (set #copyhothelp3prefs "Kopiere Prefs-Datei für Hothelp ...")
 (set #copyflm_catalog "Kopiere flm.catalog ...")
 (set #copyhothelplib_catalog "Kopiere hothelplib.catalog ...")
 (set #copyhothelp_lib "Kopiere hothelp.library ...")
 (set #copyhothelp_handler "Kopiere HothelpHandler ...")
 (set #copyflmfiles "Kopiere FLM-Dateien ...")
 (set #copyonlinehelp "Kopiere Online-Hilfe ...")
 (set #instmodetext1 "Shareware-Version")
 (set #instmodetext2 "Update für registrierte Nutzer")
 (set #instmodeprompt "Bitte auswählen")
 (set #flmupdate_dest "Bitte FLM-Verzeichnis auswählen")
 (set #mustnotupdate "FLM muß nicht geupdatet werden.")
 (set #noflmfound "FLM befindet sich nicht\nim angegebene Verzeichnis.")
))
(if (= @language "english")
; English Installation
(
 (set default-lang 2)
 (set #lpath "english")
 (set #flmdestination
   (cat "Please choose destination directory for FLM.\n"
        "A directory FLM will be created."
   )
 )
 (set #copyhothelplib_nc "Copying hothelplib.english ...")
 (set #copyhothelp3prefs "Copying prefs-file for Hothelp ...")
 (set #copyflm_catalog "Copying flm.catalog ...")
 (set #copyhothelplib_catalog "Copying hothelplib.catalog ...")
 (set #copyhothelp_lib "Copying hothelp.library ...")
 (set #copyhothelphandler "Copying HothelpHandler ...")
 (set #copyflmfiles "Copying FLM file ...")
 (set #copyonlinehelp "Copying Online help ...")
 (set #instmodetext1 "Shareware version")
 (set #instmodetext2 "Update for registered user's")
 (set #instmodeprompt "Please choose")
 (set #flmupdate_dest "Please choose FLM directory")
 (set #mustnotupdate "You must not update FLM")
 (set #noflmfound "Can not find the programm FLM")
))
(if (= @language "français")
; French Installation
(
 (set default-lang 3)
 (set #lpath "français")
 (set #flmdestination
   (cat "Choisissez le répertoire destination de FLM.\n"
        "Création du répertoire FLM..."
   )
 )
 (set #copyhothelplib_nc "Copie de hothelplib.english ...")
 (set #copyhothelp3prefs "Copie du fichier prefs pour Hothelp ...")
 (set #copyflm_catalog "Copie de flm.catalog ...")
 (set #copyhothelplib_catalog "Copie de hothelplib.catalog ...")
 (set #copyhothelp_lib "Copie de la hothelp.library ...")
 (set #copyhothelphandler "Copie du HothelpHandler ...")
 (set #copyflmfiles "Copie des fichiers FLM ...")
 (set #copyonlinehelp "Copie de l'Aide en ligne ...")
 (set #instmodetext1 "Shareware version")
 (set #instmodetext2 "Update for registered user's")
 (set #instmodeprompt "Please choose")
 (set #flmupdate_dest "Please choose FLM directory")
 (set #mustnotupdate "You must not update FLM")
 (set #noflmfound "Can not find the programm FLM")
))

;get workbench version
(set vernum (getversion "libs:version.library"))
(set wbver (/ vernum 65536))

(complete 0)

(set instmode
    (askchoice
        (choices #instmodetext1 #instmodetext2)
        (prompt #instmodeprompt)
        (help "")
    )
)

(if (= instmode 0)
(
;Shareware-Version
 (set flm-path
    (askdir
        (prompt #flmdestination)
        (help "")
        (default @default-dest)
    )
 )
 (set @default-dest (tackon flm-path "FLM"))

 (makedir
    (@default-dest)
    (infos)
 )
;now a directory FLM exists

 (complete 10)

;copy hothelp needed files ...
 (copyfiles
    (prompt #copyhothelplib_nc)
    (help "")
    (all)
    (source (cat "hothelp/" #lpath))
    (dest @default-dest)
 )

;copy catalogs ...
 (if (> wbver 37)
  (copylib
    (prompt #copyhothelplib_catalog)
    (help "")
    (source (cat "locale/catalogs/" #lpath))
    (dest (cat "locale:catalogs/" #lpath))
    (confirm)
  )
 )

 (complete 20)

 (copyfiles
    (prompt #copyflmfiles)
    (help "")
    (all)
    (source "FLM")
    (dest @default-dest)
 )

 (complete 40)

 (copyfiles
    (prompt #copyflmfiles)
    (help "")
    (all)
    (source (cat "otherfiles/" #lpath))
    (dest @default-dest)
 )

 (complete 80)

;Online-Help
 (copyfiles
  (prompt #copyonlinehelp)
  (help "")
  (all)
  (source (cat "projekte/" #lpath))
  (dest (cat @default-dest "/Projekte"))
 )

 (complete 90)

 (copylib
    (prompt #copyhothelp_lib)
    (help "")
    (source "libs/hothelp.library")
    (dest "libs:")
    (confirm)
 )

 (copylib
    (prompt #copyhothelphandler)
    (help "")
    (source "l/HotHelpHandler")
    (dest "l:")
    (confirm)
 )

 (complete 100)
)
(
;********************
;****** update ******
;********************
 (complete 0)

 (set flm-path
    (askdir
        (prompt #flmupdate_dest)
        (help "")
        (default @default-dest)
    )
 )
 (set @default-dest flm-path)

 (set test (exists (cat @default-dest "/FLM")))
 (if (= test 1)
  (
   (set test (getversion (cat @default-dest "/FLM")))
   (set flmoldver1 (/ test 65536))
   (set flmoldver2 (- test (* flmoldver1 65536)))
  )
  (
   (message #noflmfound)
   (exit)
  )
 )


 (set test (getversion "FLMr/FLM"))
 (set flmnewver1 (/ test 65536))
 (set flmnewver2 (- test (* flmnewver1 65536)))
; (message flmoldver1 "." flmoldver2 "-" flmnewver1 "." flmnewver2)

 (if (<= flmnewver2 flmoldver2)
  (
   (message #mustnotupdate)
   (exit)
  )
 )

;Online-Help
 (copyfiles
  (prompt #copyonlinehelp)
  (help "")
  (all)
  (source (cat "projekte/" #lpath))
  (dest (cat @default-dest "/Projekte"))
 )

 (complete 20)

;copy catalogs ...
 (if (> wbver 37)
  (copylib
    (prompt #copyflm_catalog)
    (help "")
    (source (cat "locale/catalogs/" #lpath))
    (dest (cat "locale:catalogs/" #lpath))
    (confirm)
  )
 )

 (complete 30)

 (copyfiles
    (prompt #copyflmfiles)
    (help "")
    (all)
    (source "FLMr")
    (dest @default-dest)
 )


 (complete 100)
)
)
(exit)
