;  *** MegaSearch installation scipt ***

(set #install-msg (cat "\n\nMegaSearch installation script.\n"
                       "This script installs MegaSearch on your Amiga.\n\n"
                       "Man © 1995/96 Markus Hillenbrand\n"
                       "All rights reserved."
                  )
)

(set #bad-kick         "You must be using Kickstart 3.0 to install using this script!")

(set #copying-reqtools "Copying textfield.gadget to SYS:Classes/Gadgets ...")

; Hier gehts los

(message #install-msg)
(welcome "Welcome to the MegaSearch installation!")

(if (< (/ (getversion) 65536) 39)
(
    (abort #bad-kick)
))    

(copylib
        (prompt "\n" #copying-reqtools)
        (help @copylib-help)
        (source "Textfield/Textfield.gadget")
        (dest "SYS:Classes/Gadgets")
        (confirm)
) 

(set mydest
   (askdir  (prompt  "Select the directory where you want to install the program. A drawer will NOT be created.")
            (help    @askdir-help)
            (default "Work:")
            (disk)
   )
)

(copyfiles  (prompt "Copying executable")
            (help   @copyfiles-help)
            (source "MegaSearch")
            (dest   mydest)
            (infos)
)

(copyfiles  (prompt "Copying documentation")
            (help   @copyfiles-help)
            (source "MegaSearch.guide")
            (dest   mydest)
            (infos)
)

(copyfiles  (prompt "Copying About.IFF")
            (help   @copyfiles-help)
            (source "About.IFF")
            (dest   mydest)
)

(set filtername (cat mydest "/.filter"))
(if (exists filtername) (copyfiles  (prompt "A filter exists, copy new filter anyway ?")
                                    (help   @copyfiles-help)
                                    (source ".filter")
                                    (dest   mydest)
                                    (confirm)
                        )
                        (copyfiles  (prompt "Copying Filter")
                                    (help   @copyfiles-help)
                                    (source ".filter")
                                    (dest   mydest)
                        )
)

(set listdir (cat mydest "/Lists"))

(makedir listdir)

(set answer (askchoice  (prompt  "Do you want to install index files for 'Aminet-CD 4-9' ?")
                        (help    @askchoice-help)
                        (choices "Yes" "No")
            )
)

(if (= answer 0) (copyfiles  (prompt  "Copying Index Files for Aminet CD's")
                             (help    @copyfiles-help)
                             (source  "lists")
                             (dest    listdir)
                             (pattern "Aminet#?")
                             (files)
                 )
)

(set answer (askchoice  (prompt  "Do you want to install index files for 'Meeting-Pearls-CD 1-3' ?")
                        (help    @askchoice-help)
                        (choices "Yes" "No")
            )
)

(if (= answer 0) (copyfiles  (prompt  "Copying Index Files for Meeting Pearls CD's")
                             (help    @copyfiles-help)
                             (source  "lists")
                             (dest    listdir)
                             (pattern "Meeting#?")
                             (files)
                 )
)

(set answer (askchoice  (prompt  "Do you want to install index files for 'FredFish-CDs' ?")
                        (help    @askchoice-help)
                        (choices "Yes" "No")
            )
)

(if (= answer 0) (copyfiles  (prompt  "Copying Index Files for FredFish CD's")
                             (help    @copyfiles-help)
                             (source  "lists")
                             (dest    listdir)
                             (pattern "#?Fish#?")
                             (files)
                 )
)

(startup "MegaSearch" (prompt  "Adding the assign MegaSearch: to S:User-Startup")
                      (help    @startup-help)
                      (command "Assign MegaSearch: " mydest)
)

(makeassign "MegaSearch" mydest (safe))


