;
; $VER: install 34.1 (22 Jul 1995)
;
; Installer script for NetInput package.
;
; (C) Copyright 1995 Marius Gröger
;     All Rights Reserved.
;
; $HISTORY:
;
; 22 Jul 1995 : 034.001 :  initial
;

(set #cpu (database "cpu"))
(set #level @user-level)
(set #server        "netinputd")
(set #client        "netinput")
(set #helpfile      "NetInput.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 "NetInput client" "NetInput server" "AmigaGuide® documentation")
         (help @askoptions-help)
     )
)
(user #level)

(set #installclient (IN mode 0))
(set #installserver (IN mode 1))
(set #installguide (IN mode 2))

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

(if #installserver
   (set #serverdir
       (askdir
               (prompt "Please locate the directory for IP services:")
               (help (cat "   Select here the directory where you keep "\
                          "your IP clients.\n\n"
                          @askdir-help
                     )
               )
               (default "AmiTCP:serv")
       )
   )
)

(if #installclient
   (set #clientdir
       (askdir
               (prompt "Please locate the directory for IP clients:")
               (help (cat "   Select here the directory where you keep "\
                          "your IP servers.\n\n"
                          @askdir-help
                     )
               )
               (default "AmiTCP:bin")
       )
   )
)

(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")
           )
   )
)

; ------------------------- Server Installation --------------------------

(if #installserver
   (
      (set #proc
        (askchoice
           (prompt (cat "There are diffent versions of \"" #server "\", 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, \"" #server "\" 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 server"))
         (help @copylib-help)
         (source (cat (tackon "serv" #server)
                    (if (= 0 proc) ".000")
                    (if (= 1 proc) ".020")
                    (if (= 2 proc) ".040")
         ))
         (dest #serverdir)
         (newname #server)
         (confirm)
      )
   )
)

; ------------------------- Client Installation --------------------------

(if #installclient
   (
      (set proc
        (askchoice
           (prompt (cat "There are diffent versions of \"" #client "\", 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, \"" #client "\" 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 client"))
         (help @copylib-help)
         (source (cat (tackon "bin" #client)
                    (if (= 0 proc) ".000")
                    (if (= 1 proc) ".020")
                    (if (= 2 proc) ".040")
         ))
         (dest #clientdir)
         (newname #client)
         (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)
)

