; $VER: MUIWBPattern English Install Script 1.2 (14.07.96) by Joe Carlson

;-----------------------------------------------------------------------------
; This script may be localized by translating the quoted text below:

; English Texts:
(set InstallText  "Where should %s be installed?")
(set CopyingText  "Copying %s to %s...")
(set SelectText   "Please select the files to install.")
(set ToolText     "Changing default tool of the startup icon to %s...")
(set AskText      "Do you want %s installed?")
(set StartupText  "the startup icon")
(set DocText      "the documentation")
(set CatalogText  "the catalogs")
(set TransText    "%s install script results:")

;-----------------  Do not edit anything past this line! ---------------------

(set ProgramText    "MUIWBPattern")
(set OldProgramText "MUI_WBPattern")
(set QuoteText      "\"%s\"")

; Paths:
(set DefPrefPath  (expandpath "SYS:Prefs"))
(set DefStartPath (expandpath "SYS:WBStartup"))
(set DefLocalePath "Locale:catalogs")

(transcript (TransText ProgramText))

(complete 0)

(set Pref-Path
   (askdir
      (prompt (InstallText (QuoteText ProgramText)))
      (help @askdir-help)
      (default DefPrefPath)
      (newpath)
   )
)

(complete 10)

(set Startup-Path
   (askdir
      (prompt (InstallText StartupText))
      (help @askdir-help)
      (default DefStartPath)
   )
)

(complete 20)

(set @default-dest Pref-Path)

(set Pref-Name       (tackon Pref-Path ProgramText))
(set Startup-Name    (tackon Startup-Path (cat ProgramText ".info")))
(set OldPref-Name    (tackon Pref-Path OldProgramText))
(set OldStartup-Name (tackon Startup-Path (cat OldProgramText ".info")))

; Rename versions older than 1.2 to new names
(if (exists OldPref-Name)
   (rename OldPref-Name Pref-Name)
)
(if (exists (cat OldPref-Name ".info"))
   (rename (cat OldPref-Name ".info") (cat Pref-Name ".info"))
)
(if (exists OldStartup-Name)
   (rename OldStartup-Name Startup-Name)
)

(set First-Time (NOT (exists Pref-Name)))

(copyfiles
   (prompt (CopyingText (QuoteText ProgramText) (QuoteText Pref-Path)))
	(source (tackon "Prefs" ProgramText))
   (dest Pref-Path)
   (if First-Time (infos) )   ; Don't loose old tooltypes if updating
   (help @copyfiles-help)
)

(complete 30)

(if First-Time
   (tooltype
      (dest Pref-Name)
      (noposition)
   )
)

(complete 40)

(copyfiles
	(prompt (CopyingText StartupText (QuoteText Startup-Path)))
	(help @copyfiles-help)
	(source "WBStartup/MUIWBPattern.info")
	(dest Startup-Path)
)

(complete 50)

(tooltype
   (prompt (ToolText Pref-Name))
   (dest (tackon Startup-Path ProgramText))
   (setdefaulttool Pref-Name)
   (noposition)
)

(if
   (askbool
      (prompt (AskText DocText))
      (help @askbool)
   )
; Install Docs
   (
      (set Doc-Path
         (askdir
            (prompt (InstallText DocText))
            (help @askdir-help)
            (default @default-dest)
         )
      )
      (complete 60)
      (copyfiles
         (prompt (SelectText DocText Doc-Path))
         (help @copyfiles-help)
         (source "")
         (dest Doc-Path)
         (infos)
         (pattern "#?.guide")
         (confirm 1)
      )
      (complete 70)
      (tooltype
         (dest (tackon Doc-Path "#?.guide"))
         (setdefaulttool
            (if (>= (getversion) 39)
               "Multiview"
               "Amigaguide"
            )
         )
         (noposition)
      )
   )
)

(complete 80)

(if
   (askbool
      (prompt (AskText CatalogText))
      (help @askbool)
   )
; Install Catalogs
   (
      (set Cat-Path
         (askdir
            (prompt (InstallText CatalogText))
            (default DefLocalePath)
            (help @default-dest)
         )
      )
      (complete 90)
      (copyfiles
         (prompt (SelectText DocText Doc-Path))
         (help @copyfiles-help)
         (source "Catalogs")
         (dest Cat-Path)
         (all)
         (confirm 1)
     )
  )
)

(complete 100)
