;
; $VER: install 34.3 (01 Apr 1998)
;
; Installer script for magPLIP package.
;
; (C) Copyright 1995 Marius Gröger
;     All Rights Reserved.
;
; $HISTORY:
;
; 01 Apr 1998 : 034.003 :  updated to support new linplip.device
; 10 Mar 1996 : 034.002 :  copy also scheme picture
; 30 Jul 1995 : 034.001 :  initial
;

(set #cpu           (database "cpu"))
(set #level         @user-level)
(set #device        "magplip.device")
(set #device-name   "magPLIP")
(set #config        "magPLIP.config")
(set #helpfile      "magPLIP.guide")
(set #picfile       "cable.iff")
(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
; ruppert@amigaworld.com. Thanks.)
(user 2)
(set #which-device
     (askchoice
	 (prompt "Which connection do you want to use ?")
	 (choices "Amiga <--> Amiga" "Amiga <--> Linux")
	 (help "Please select which computers do you want to connect to each other!\n\n" @askchoices-help)
     )
)

(if (= #which-device 1)
    (
	(set #device "linplip.device")
	(set #device-name "linPLIP")
    )
)

(set mode
     (askoptions
	 (prompt "Which parts should be installed ?")
	 (choices (cat #device-name " device driver") "AmigaGuide® documentation" "schematic wiring picture")
	 (help @askoptions-help)
     )
)
(user #level)

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

; -------------------------- 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)
      )
   )
)

; install picture file
(if #installpic
   (
      (copyfiles
	      (prompt "Copying schematic picture")
	      (help @copyfiles-help)
	      (source "help")
	      (dest helpdir)
	      (pattern (cat #picfile "(%|.info)"))
	      (confirm)
      )
   )
)

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

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

