;
; $VER: install 34.1 (22 Jul 1995)
;
; Installer script for magPLIP package.
;
; (C) Copyright 1995 Marius Grger
;     All Rights Reserved.
;
; $HISTORY:
;
; 30 Jul 1995 : 034.001 :  initial
;

(set #cpu           (database "cpu"))
(set #level         @user-level)
(set #device        "magplip.device")
(set #config        "magPLIP.config")
(set #helpfile      "magPLIP.guide")
(set #more          "RUN SYS:Utilities/More")
(set #install-notes "\"Installation Notes\"")

; -------------------------- Installation mode ---------------------------

; (The installer documentation says not to use this call
; final distribtions, but I know no way to let the next decision
; popping up in novice mode. If you do, please mail to
; mag@sysgo.de. Thanks.)
(user 2)
(set mode
     (askoptions
         (prompt "Which parts should be installed ?")
         (choices "magPLIP device driver" "AmigaGuide documentation")
         (help @askoptions-help)
     )
)
(user #level)

(set #installdevice (IN mode 0))
(set #installguide (IN mode 1))

; -------------------------- Installtion setup ---------------------------

(if #installdevice
   (
      (set #devicedir
          (askdir
                  (prompt "Please locate the directory for SANA II device drivers:")
                  (help @askdir-help)
                  (default "AmiTCP:DEVS/Networks")
          )
      )
      (set #configdir
          (askdir
                  (prompt "Please locate the directory for SANA II configurations:")
                  (help @askdir-help)
                  (default "ENV:Sana2")
          )
      )
   )
)

(if #installguide
   (set helpdir
           (askdir
                   (prompt "Please locate the directory for AmigaGuide-Documents:")
                   (help (cat "   Select here the directory where you keep your "\
                              "AmigaGuide online help documents.\n\n"
                               @askdir-help
                         )
                   )
                   (default "HELP:english")
           )
   )
)

; ------------------------- Device Installation --------------------------

(if #installdevice
   (
      (set #proc
        (askchoice
           (prompt (cat "There are diffent versions of \"" #device "\", each one optimized "
                        "for a specific CPU type. Please select one: "))
           (choices  "MC68000"
                     "MC68020"
                     "MC68040"
           )
           (help (cat "  Select here the CPU type that is installed in your system. "
                 "\n\n  Currently, this is a MC" #cpu ".\n\n  If you select a certain CPU type "
                 "in the choice box, \"" #device "\" will run on any CPU which "
                 "type is higher or equal to the selection. However, it won't "
                 "run on a system equipped with a lower type.\n\n"
                 @askchoice-help)
           )
           (default 0)
        )
      )

      (copylib
         (prompt (cat "Copying the device"))
         (help @copylib-help)
         (source (cat (tackon "DEVS/Networks" #device)
                    (if (= 0 #proc) ".000")
                    (if (= 1 #proc) ".020")
                    (if (= 2 #proc) ".040")
         ))
         (dest #devicedir)
         (newname #device)
         (confirm)
      )
      (copyfiles
         (prompt (cat "Copying the configuration file"))
         (help @copylib-help)
         (source (tackon "ENV/Sana2" #config))
         (dest #configdir)
         (confirm)
      )
   )
)

; ------------------------- Guide Installation --------------------------

; install AmigaGuide file
(if #installguide
   (
      (copyfiles
              (prompt "Copying AmigaGuide file")
              (help @copyfiles-help)
              (source "help")
              (dest helpdir)
              (pattern (cat #helpfile "(%|.info)"))
              (confirm)
      )
   )
)

; --------------------- Display Installation Notes -----------------------

(if (OR #installclient #installserver)
   (run #more #install-notes)
)

