;***** XenolinkUUCP 1.0 Install script

(transcript "Installing XenolinkUUCP...")
(set @default-dest "Xenolink:")

;***** Introduction
(complete 0)

;***** Destination Directory Selection & Creation
(if (= (exists "Xenolink:XenolinkUUCP" (noreq)) 0)
(
	(set xuucpmsg "Please select a place for \"XenolinkUUCP\". A drawer called \"XenolinkUUCP\" will be created here.")
)
)

(set @default-dest (expandpath @default-dest))

(set destination
	(askdir
		(prompt xuucpmsg)
		(help @askdir-help)
		(default @default-dest)
	)
)

(set destination (tackon destination "XenolinkUUCP"))
(set @default-dest (destination))

(if (= (exists destination) 2)
(message
	"A XenolinkUUCP drawer does already exist in the selected directory. By selecting \"Proceed\", "
	"you indicate that you want to update the XenolinkUUCP installation with the "
	"most recent version. Several XenolinkUUCP specific files will be overwritten!"
)
)

(makedir destination
	(help @makedir-help)
	(infos)
)

(set dest1 (tackon destination "news"))
(makedir dest1
	(help @makedir-help)
	(infos)
)

(set dest1 (tackon destination "spool"))
(makedir dest1
	(help @makedir-help)
	(infos)
)

(set dest1 (tackon destination "mail"))
(makedir dest1
	(help @makedir-help)
	(infos)
)

(run (cat "copy " "/XenolinkUUCP.info \"" destination ".info\""))

;***** Docs Drawer
(complete 20)

(copyfiles
	(prompt "Creating Docs Drawer...")
	(source "Doc")
	(dest (tackon destination "Doc"))
	(choices "XenolinkUUCP.dvi" "XenolinkUUCP.txt")
	(infos)
	(help @copyfiles-help)
)
(run (cat "copy " "Doc.info \"" destination "\""))

;***** Man Drawer
(complete 30)

(if (askbool
    (prompt "\nDo you want to copy the original MAN files that came"
            "with the original AmigaUUCP 1.17b4 distribution also?\n")
    (help "jdsjjfdsa")
    )
    (copyfiles
      (prompt "Creating Man Drawer...")
      (source "Man")
      (dest (tackon destination "Man"))
      (all)
      (help @copyfiles-help)
    )
)
(run (cat "copy " "Doc.info \"" destination "\""))

;***** Binaries
(complete 40)

(message
	"Do you want to install the Xenolink versions of AmigaUUCP 1.17b4")
(copyfiles
   (prompt "Installing binaries...")
	(source "c")
   (dest (tackon destination "c"))
	(infos)
   (all)
	(help @copyfiles-help)
)

(if (askbool
    (prompt "\nDo you want to install null-handler and fifo-handler, needed for getty")
    (help "jdsjjfdsa")
    )
    (copyfiles
      (prompt "Installing handlers ...")
      (source "l/")
      (choices "null-handler" "fifo-handler")
      (dest "l:")
      (help @copyfiles-help)
    )
)

(if (askbool
    (prompt "\nDo you want to install mountlist entry for NULL:, needed for getty")
    (help "jdsjjfdsa")
    )
    (copyfiles
      (prompt "Installing Null-handler ...")
      (source "devs/dosdrivers/Null")
      (dest "devs:dosdrivers/")
      (help @copyfiles-help)
    )
)

;***** Rexx Scripts
(complete 60)

(message
	"Install needed ARexx scripts..."
)
(copyfiles
	(prompt "Installing example ARexx scripts...")
	(source "Rexx")
	(dest (tackon destination "Rexx"))
	(infos)
	(all)
	(help @copyfiles-help)
)

;***** Startup-Sequence
(complete 75)

(message
	"Append the startup for XenolinkUUCP to your user-startup"
)
(startup "XenolinkUUCP"
	(prompt "Some required commands will be added to your \"s:user-startup\" file.")
	(help @startup-help)
   (command "if exists \"" destination "\"\n")
	(command "   assign UUCP: \"" destination "\"\n")
	(command "   Assign c: UUCP:C Add\n")
	(command "   path   UUCP:c     Add\n")
	(command "   Assign TMP:       ram:\n")
	(command "   Assign UUSPOOL:   UUCP:Spool\n")
	(command "   Assign UULIB:     UUCP:Lib\n")
	(command "   Assign UUMAIL:    UUCP:Mail\n")
	(command "   Assign UUNEWS:    UUCP:News\n")
	(command "   Assign Getty:     UUCP:Lib\n")
	(command "   Assign UUMan:     UUCP:Man\n")
	(command "   RUN <nil: >nil: l:fifo-handler\n")
	(command "   mount null:\n")
	(command "endif\n")
)

(message
   "Install the configuration files for XenolinkUUCP in XCONFIG:"
)
;***** Configuration files
(complete 80)
(if (= (exists "XCONFIG:XenolinkUUCP") 2)
(message
	"A XenolinkUUCP drawer does already exist in the selected directory. By selecting \"Proceed\", "
	"you indicate that you want to update the XenolinkUUCP installation with the "
	"most recent version. Several XenolinkUUCP specific configuration files will be overwritten!"
)
)

(makedir "XCONFIG:XenolinkUUCP"
	(help @makedir-help)
	(infos)
)

(copyfiles
	(prompt "Installing configuration files...")
	(source "configuration/XenolinkUUCP")
	(dest ("XCONFIG:XenolinkUUCP/"))
	(infos)
	(all)
	(help @copyfiles-help)
)

;***** Finished
(complete 100)

(welcome "Welcome to XenolinkUUCP 1.0")

(exit "Please reboot your computer before trying to start any XenolinkUUCP programs.")
