; * $VER: Install GuruStatistix 1.0
; * Script written by Eckhard Ludwig
;=============================================================================

(complete 0)

(set Opt 2)
(set #welcome
  (cat
        "\n\n\nWelcome to the GuruStatistix installation utility.\n\n"
        "This program lets you install GuruStatistix 1.0 on your Amiga.\n\n\n"
        "GuruStatistix © 1997 Steffen Clemenz. This is freeware."
  ))

(set #choose-text
  (cat "Please choose a directory where to put GuruStatistix-drawer."
  ))

(set #choose-textviewer
  (cat "Please choose your favourite textviewing utility."
  ))

(set #choose-help
  (cat "In this location a drawer will be created. All files will be installed inside this drawer."
  ))

(set #inst-main
  (cat "Installing GuruStatistix ..."
  ))

(set #inst-Lokale
  (cat "Installing Locale ..."
  ))

(set #create-maindir
  (cat "Creating GuruStatistix directory"
  ))

(set #Locale-Copy   "Copy catalogue ...")

(set #choose-locale
  (cat "Where to put locale-file? Choose a directory."
  ))

(set #copy-locale
  (cat "Copying Lokale-Files"
  ))

(set #copyfiles-help
  (cat "This copies the files to the selected directory."
  ))

(set #inst-main
  (cat "Installing main program ..."
  ))

(set #choose-gurudat
  (cat "Where is mcp.gurudat? And how is the name of the file?"
  ))

(set #gurudat-help
  (cat "I must now where is the mcp.gurudat-file."
  ))

(set #choose-guruhistory   "Where is the Guruhistory-file? And which name it had?")

(set #guruhistory-help   "I need the Guruhistory-file, because this is the file i want to analyse.")

(set #choose-docs   "Where to put the document?")

(set #docs-help   "This function copies the document to the selected directory.")

(set #copydocs   "Copying documentation?")

(set #copydocs-help   "Should I?")

 (SET #exit-Msg 
  (CAT "\n\nMuch fun with my programm\n Thanx goes to the MCP-Developers.\n\n"
                   "Steffen Clemenz"
  ))

; deutsche Texte *****************************

(IF (= @language "deutsch")
(
(set Opt 1)
(set #welcome
  (cat
        "\n\n\nWillkommen zu dem GuruStatistix Installer.\n\n"
        "Dieses Programm installiert GuruStatistix 1.0 auf Ihrem Amiga.\n\n\n"
        "Gurustatistix ist ©1997 von Steffen Clemenz. Gewidmet Matthias Zinke."
  ))

(set #choose-text
  (cat "Bitte wählen Sie das Verzeichniss wohin GuruStatistix installiert werden soll. Dieses Installationsscript legt dort selbst eine Schublade an."
  ))

(set #choose-textviewer
  (cat "Bitte wähle Deinen favorisierten Textanzeiger."
  ))

(set #textviewer-help
  (cat "Den Textanzeiger benötigst Du damit Du das Ergebnis des GuruStatistix-Programms nach dem Ende des Programms sofort ansehen kannst."
  ))

(set #choose-help
  (cat "Bei der Installation werden alle Dateien in dieses Verzeichniss installiert."
  ))

(set #create-maindir
  (cat "Erstelle GuruStatistix-Verzeichnis"
  ))

(set #choose-locale
  (cat "Wohin soll das Lokale-File? Wähle eine Directory."
  ))

(set #copy-locale
  (cat "Kopiere Lokale-Files"
  ))

(set #copyfiles-help
  (cat "Dies kopiert das angegebene File in die ausgewählte Directory."
  ))

(set #inst-main
  (cat "Installiere Hauptprogramm ..."
  ))

(set #choose-gurudat
  (cat "Wo befindet sich die MCP.gurudat Datei? Und welchen Namen hat sie?"
  ))

(set #gurudat-help
  (cat "Ich muss wissen wo die mcp.gurudat Datei ist, damit ich dann dem Fehler die Absturzursache zuorden kann. Wenn Du keinen Namen für die mcp.gurudat angibst wird es einen Fehler im GuruStatistixprogramm ergeben, so daß es nicht möglich sein wird die Absturzursachen zu benennen."
  ))

(set #choose-guruhistory   "Wo ist die Guruhistory-Datei? Welche Bezeichnung hat sie?")

(set #guruhistory-help   "Ich brauche natürlich noch die GuruHistory-Datei mit Pfadangabe und Dateiname, denn um diese Datei dreht es sich ja.")


(set #choose-docs   "Wo soll die Beschreibung hin?")

(set #docs-help   "Dies kopierte die Anleitung in das ausgewählte Verzeichnis.")

(set #copydocs   "Kopiere Dokumentation?")

(set #copydocs-help   "Soll ich wirklich?")

(set #Locale-Copy   "Kopiere Cataloge ...")

(SET #exit-Msg
  (CAT "\n\nViel Spaß mit dem Programm\n wünscht\n\n"
                   "Steffen Clemenz\n\n\n\n\nVielen Dank an die Entwickler von MCP."
  ))
))
;*********************************************
; Greetings & Path ...

(message #welcome)

(welcome)

(set @default-dest (getassign "RAM" "dva"))
  (if (= @default-dest "")
   (set @default-dest "SYS:"))
  
(set @default-dest (askdir
    (prompt #choose-text)
    (help #choose-help)
    (default @default-dest))
  ) 
  
(set @default-dest (tackon @default-dest "GuruStatistix"))

(makedir @default-dest (prompt #create-maindir)(infos))
  
;*********************************************
; Installation procedure
; 

(copyfiles
        (prompt #inst-main)
        (help   @copyfiles-help)
        (source "GuruStatistix")
        (dest   @default-dest)
        (confirm "EXPERT")
        (optional "force")
        (infos)
)

;*********************************************
; copy of documents

(set @default-doc @default-dest)

(set @default-doc (askdir
    (prompt #choose-docs)
    (help #docs-help)
    (default @default-doc)))

(IF (= @language "deutsch")
(copyfiles
       (prompt #copydocs)
       (help   @copydocs-help)
       (source "docs/GuruStatistixD.guide")
       (dest   @default-doc)
       (confirm "EXPERT")
       (optional "force")
       (infos))
)

(IF (= @language "english")
(copyfiles
       (prompt #copydocs)
       (help   @copydocs-help)
       (source "docs/GuruStatistixE.guide")
       (dest   @default-doc)
       (confirm "EXPERT")
       (optional "force")
       (infos))
)

;*********************************************
; copy the locales

(IF (= @language "deutsch")
(
(set @default-locale (getassign "Locale:catalogs/deutsch" "dva"))
  (if (= @default-locale "")
   (set @default-locale "Locale:catalogs/deutsch"))

(set @default-locale (askdir
    (prompt #choose-locale)
    (help #choose-help)
    (default @default-locale)))

(copyfiles
       (prompt #copylocale)
       (help   @copyfiles-help)
       (source "locale/deutsch/GuruStatistix.catalog")
       (dest   @default-locale)
       (confirm "EXPERT")
       (optional "force")
       (infos))
))

(IF (= @language "english")
(
(set @default-locale (getassign "Locale:catalogs/english" "dva"))
  (if (= @default-locale "")
   (set @default-locale "Locale:catalogs/english"))

(set @default-locale (askdir
    (prompt #choose-locale)
    (help #choose-help)
    (default @default-locale)))

(copyfiles
       (prompt #copylocale)
       (help   @copyfiles-help)
       (source "locale/english/GuruStatistix.catalog")
       (dest   @default-locale)
       (confirm "EXPERT")
       (optional "force")
       (infos))
))

(set @default-viewer "sys:utilities/multiview")

(set @default-viewer (askfile
    (prompt #choose-textviewer)
    (help #textviewer-help)
    (default @default-viewer)))

(set @gurudat "sys:s/mcp.gurudat")

(set @gurudat (askfile
    (prompt #choose-gurudat)
    (help #gurudat-help)
    (default @gurudat)))

(set @guruhistory "sys:s/GuruHistory")

(set @guruhistory (askfile
    (prompt #choose-guruhistory)
    (help #guruhistory-help)
    (default @guruhistory)))

(textfile
        (dest "env:GuruStatistix.prefs")
        (append (cat @default-locale "\n" @gurudat "\n" @default-viewer "\n" @guruhistory))
        (safe)
)

(EXIT #exit-Msg )
