; MagicStartMenu Installation Script
; Copyright © 1996 by Ralph Torchia
; $VER:MagicStartMenu v1.0 (07-23-96)

(set @PRGVersion "1.0")
(set @logo-choice "logo.bru")
(set @default-dest "SYS:")

;
; Let's Introduce ourselves
;

(welcome
  ("\nWelcome to the Magic StartMenu %s installer script.\n\n" @PRGVersion)
  ("    MagicStartMenu documentation comes in AmigaGuide format.  Make sure to read this in order to complete the installation process.\n")
  ("    Follow the installer script's instructions to install Magic StartMenu.\n")
)

;
; Where is StartMenu located???
;

(set @default-dest
  (askdir
    (prompt "Where is the StartMenu Drawer Located?")
    (help "The install script needs to know where the StartMenu drawer is found on your system.")
    (default @default-dest)
  )
)

;
; Is the StartMenu drawer really where the user said it is???
;

(if (<> (exists (tackon @default-dest "StartMenu")) 2)
    (exit "The StartMenu drawer is not located here!\nInstallation is halted." (quiet))
)

;
; Give the user a choice of a Logo
;

(message "There are 3 logos that you can choose from.\n  Press \"Proceed\" to see a sample picture...")
(run "SYS:utilities/multiview logosample.iff")

(
  (set @choice
    (askchoice
      (prompt "Which logo would you like to have installed for StartMenu?")
      (choices ("1 - White Amiga Text")
               ("2 - Colour Gradiant Bkgd")
	          ("3 - Black Amiga Text")
      )
     (help "Choice 1 is my favourite...")
    )
  )
  (if (= @choice 0) (set @logo-choice "logo.bru"))
  (if (= @choice 1) (set @logo-choice "logo2.bru"))
  (if (= @choice 2) (set @logo-choice "logo3.bru"))
)


;
; Copy the all the main files to the StartMenu drawer
;

(copyfiles
  (prompt "Copying icon/brushes to %s" (tackon @default-dest "StartMenu"))
  (help @copyfiles-help)
  (source "Main")
  (pattern "#?")
  (dest (tackon @default-dest "StartMenu"))
)

;
; If StartMenuLite is present then copy the necessary files
;

(if (= (exists (tackon @default-dest "StartMenu/StartMenuLite.info")) 1)
  ((copyfiles
    (prompt "Copying icon to %s" (tackon @default-dest "StartMenuLite"))
    (help @copyfiles-help)
    (source (tackon "Main/" "StartMenu.info"))
    (dest (tackon @default-dest "StartMenu"))
    (newname "StartMenuLite.info")
   )
  (tooltype
    (prompt "Re-Setting PATH tooltype for StartMenuLite Icons.")
    (help "StartMenu requires the PATH tooltype set to the directory to where it is located.")
    (dest (tackon @default-dest "StartMenu/StartMenuLite"))
    (settooltype "PATH" (tackon @default-dest "StartMenu"))
  ))
)

;
; If StartMenuUlraLite is present then copy the necessary files
;

(if (= (exists (tackon @default-dest "StartMenu/StartMenuUltraLite.info")) 1)
  ((copyfiles
    (prompt "Copying icon to %s" (tackon @default-dest "StartMenuUltraLite"))
    (help @copyfiles-help)
    (source (tackon "Main/" "StartMenu.info"))
    (dest (tackon @default-dest "StartMenu"))
    (newname "StartMenuUltraLite.info")
  )
  (tooltype
    (prompt "Re-Setting PATH tooltype for StartMenuUltraLite Icons.")
    (help "StartMenu requires the PATH tooltype set to the directory to where it is located.")
    (dest (tackon @default-dest "StartMenu/StartMenuUltraLite"))
    (settooltype "PATH" (tackon @default-dest "StartMenu"))
  ))
)

;
; Don't forget to reset the StartMenu icon PATH tooltype
;

(tooltype
  (prompt "Re-Setting PATH tooltype for StartMenu Icons.")
  (help "StartMenu requires the PATH tooltype set to the directory to where it is located.")
  (dest (tackon @default-dest "StartMenu/StartMenu"))
  (settooltype "PATH" (tackon @default-dest "StartMenu"))
)

;
; We don't need these logo files that we copied
;

(delete (tackon @default-dest "StartMenu/logo2.bru"))
(delete (tackon @default-dest "StartMenu/logo3.bru"))

;
; Copy the appropriate logo file
;

(copyfiles
  (prompt "Copying logo to %s" (tackon @default-dest "StartMenu"))
  (help @copyfiles-help)
  (source (tackon "Main/" @logo-choice))
  (dest (tackon @default-dest "StartMenu"))
  (newname "logo.bru")
)

;
; Copy all of the brush files
;

(copyfiles
  (prompt "Copying brushes to %s" (tackon @default-dest "StartMenu/Brushes"))
  (help @copyfiles-help)
  (source "Brushes")
  (pattern "#?")
  (dest (tackon @default-dest "StartMenu/Brushes"))
)

;
; Copy all the new icons to the Extras directory
;

(copyfiles
  (prompt "Copying icons to %s" (tackon @default-dest "StartMenu/Extras"))
  (help @copyfiles-help)
  (source "Extras")
  (dest (tackon @default-dest "StartMenu/Extras"))
  (pattern "#?")
)

;
; Set new icons for WinControl in the StartUp
;

(if (= (exists (tackon @default-dest "StartMenu/Startup/WinControl.info")) 1)
  (copyfiles
    (prompt "Copying icon to %s" (tackon @default-dest "StartMenu/Startup/WinControl"))
    (help @copyfiles-help)
    (source (tackon "Extras/WinControl" "WinControl.info"))
    (dest (tackon @default-dest "StartMenu/Startup"))
   )
)

;
; Is WCPrefs in the SYS:Prefs with an ugly icon?
;

(if (= (exists "SYS:Prefs/WCPrefs") 1)
  (copyfiles
    (prompt "Copying WCPref icon to SYS:Prefs")
    (help @copyfiles-help)
    (source (tackon "Extras/WinControl" "WCPrefs.info"))
    (dest "SYS:Prefs")
  )
)

;
; Set new icons for WinMaster in the Startup
;

(if (= (exists (tackon @default-dest "StartMenu/Startup/WinMaster.info")) 1)
  (copyfiles
    (prompt "Copying icon to %s" (tackon @default-dest "StartMenu/Startup/WinMaster"))
    (help @copyfiles-help)
    (source (tackon "Extras/WinMaster" "WinMaster.info"))
    (dest (tackon @default-dest "StartMenu/Startup"))
   )
)

;
; Don't forget to Copy the new StartMenu drawer icon!!!
;

(copyfiles
  (prompt "Copying icon to %s" (tackon @default-dest "StartMenu"))
  (help @copyfiles-help)
  (source "/MagicStartMenu.info")
  (dest @default-dest)
  (newname "StartMenu.info")
)

;
; Bye-Bye!
;

(exit)
