;*****************************************************
; IntuiPoint installation script                     *
; $VER 1.0 IP-Install (01-01-95)                     *
;                                                    *
;*****************************************************

(set IPscrDir "//")
(set IPdestDir @default-dest)
(set CatalogSrcDir "/catalogs")
(set DefaultOutb    "Mail:outbound")
(set DefaultInb     "Mail:inbound")
(set reqtoolslib "/libs/reqtools.library")

;*****************************************************
; English strings

(set default_lang 4)

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

(set #start-msg
(cat "\n\nIntuiPoint installation script.\n"
		 "An Intuitionized interface\n"
		 "for Fidonet technology.\n"
     "IntuiPoint © 1995 Paolo Bozzo\n"
))

(set #where-ip "Where should IntuiPoint be copied ?")

(set #drawer-ip
(cat "\nA IP drawer does already exist in the selected "
	" directory. By selecting \"Proceed\", you"
	" indicate that you want to update the IP.\n"
	"Several IP specific files will be overwritten!"
))

(set #mail_not_found "MAIL: directory not found\nDo you want to assign it?")
(set #mail_help "The MAIL: directory will contain\nthe inbound and outbound mail drawers")
(set #where_mail "Where should MAIL: be assigned ?")

(set #inst_expand "Installing 'expand' utility")
(set #inst_ip "Installing 'ip' utility")
(set #guide_path "english")

(set #copyip-help "Ip allows you to start Intuipoint\nas a background process")
(set #copyexpand-help "expand allows you to extract files\nfrom an archive")

(set #ask_fido2ip "\nDo you want to install\nthe Fido2IP utility?")
(set #help_fido2ip "Fido2IP converts fido *.msg files\nto IntuiPoint data")
(set #fido2ip "Installing 'Fido2IP' utility")

(set #query_docs "\nDo you want to install\nthe utility docs?")
(set #help_docs "English docs for 'IP', 'Expand, 'Fido2IP'")
(set #do_docs "Installing docs...")
(set #doc_path "docs")

(set #query_rexx "\nDo you want to install\nthe rexx-macro examples?")
(set #help_rexx  "Arexx macros for IntuiPoint (examples)")
(set #do_rexx "Installing arexx macros...")

(set #ip-startup "\nSome required commands will be added to your \"s:user-startup\" file.")
(set #ip-exit "\nPlease reboot your computer before trying to start IntuiPoint.")


;*****************************************************
; Italiano

(if (= @language "italiano")
(
(set default_lang 16)

(set #bad-kick
(cat "E' necessario il Kickstart 2.04 per installare!"
))

(set #start-msg
(cat "\n\nProgramma di installazione di IntuiPoint.\n"
		 "Una interfaccia intuitiva\n"
		 "per la tecnologia Fidonet.\n"
     "IntuiPoint © 1995 Paolo Bozzo\n"
))

(set #where-ip "Dove devo copiare IntuiPoint ?")

(set #drawer-ip
(cat "\nUn cassetto per IntuiPoint gią esiste "
	" Selezionando \"Proceed\", si"
	" indica si voler aggiornamere il programma.\n"
	"Molti files verranno sovrascritti!"
))

(set #mail_not_found "cassetto MAIL: non trovato\ndevo assegnarlo?")
(set #mail_help "Il cassetto MAIL: conterrą\nle directories di entrata e uscita\ndi posta.")
(set #where_mail "Dove devo assegnare MAIL:?")

(set #guide_path "italiano")
(set #inst_expand "Installo il programma 'expand'")
(set #inst_ip "Installo il programma 'ip'")

(set #copyip-help "Ip lancia Intuipoint da una finestra shell\ncome processo asincrono")
(set #copyexpand-help "expand riconosce il formato di compressione\ne chiama l'apposito de-compressore")

(set #ask_fido2ip "\nDevo installare il programma Fido2IP?")
(set #help_fido2ip "Fido2IP converte messaggi fido (*.msg)\nnel formato di IntuiPoint\nutile se avete gią una base-messaggi")
(set #fido2ip "Installo il programma 'Fido2IP'")

(set #query_docs "\nInstallo la documentazione delle utilities?")
(set #help_docs "documentazione di 'IP', 'Expand, 'Fido2IP'")
(set #do_docs "Installo la documentazione...")
(set #doc_path "ita_docs")

(set #query_rexx "\nInstallo gli esempi Arexx?")
(set #help_rexx  "Macro arexx per IntuiPoint (esempi)")
(set #do_rexx "Installo Macro arexx...")

(set #ip-startup "\nAlcuni comandi saranno aggiunti al file \"s:user-startup\".")
(set #ip-exit "\nPer favore resettate il vostro Amiga\nprima di lanciare IntuiPoint.")
))

;*****************************************************
; make sure we are running under a 2.04 ROM

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

(message #start-msg)

(set maildir (getassign "MAIL"))

(if (= maildir "")
	(
  if (<> (askbool(prompt #mail_not_found)
                 (help #mail_help)
         ) FALSE)
  	(
  	(set maildir (askdir
  		(prompt #where_mail)
  		(help @askdir-help)
  		(default @default-dest)
  		))
  	(makeassign "MAIL" maildir)
  	)
	)
)

(if (exists "MAIL:" (noreq))
	(
		(if (= (exists DefaultInb (noreq)) FALSE)
				(makedir DefaultInb)
		)
		(if (= (exists DefaultOutb (noreq)) FALSE)
      	(makedir DefaultOutb)
		)
	)
)

(set IPdestDir
	(tackon
		(askdir
			(prompt #where-ip)
			(help @askdir-help)
			(default @default-dest)
		)
		"IntuiPoint"
	)
)

(set @default-dest IPdestDir)

(if (= (exists IPdestDir) 2)
        (message #drawer-ip)
)
(
	(makedir IPdestDir (help @makedir-help) (infos))
)

(makedir (tackon IPdestDir "Catalogs"))

	(copyfiles
		(source (tackon IPscrDir "IntuiPoint"))
		(dest IPdestDir)
	)

(run "/check_wb")
(if (<(getenv "wb_height") 400)
	(copyfiles
		(source (tackon IPscrDir "icons/IntuiPoint.info"))
		(dest IPdestDir)
	)
	(copyfiles
		(source (tackon IPscrDir "IntuiPoint.info"))
		(dest IPdestDir)
	)
)

(copyfiles
	(source (tackon IPscrDir "Catalogs"))
	(dest (tackon IPdestDir "Catalogs"))
	(all)
)

(copyfiles
	(source (tackon IPscrDir #guide_path))
	(dest IPdestDir)
	(all)
	(infos)
)

(tooltype
	(dest (tackon IPdestDir "ip.guide"))
	(setdefaulttool "SYS:Utilities/AmigaGuide")
)

(copyfiles
	(prompt (#inst_expand))
	(help   (#copyexpand-help))
	(source (tackon IPscrDir "bin/expand"))
	(dest "C:")
	(confirm)
)

(copyfiles
	(prompt (#inst_ip))
	(help (#copyip-help))
	(source (tackon IPscrDir "bin/ip"))
	(dest "C:")
	(confirm)
)

(if (askbool(prompt #ask_fido2ip)(help #help_fido2ip))
	(copyfiles
		(prompt (#fido2ip))
		(help (#help_fido2ip))
		(source (tackon IPscrDir "bin/Fido2IP"))
		(dest "C:")
		(confirm)
	)
)

(if (askbool(prompt #query_docs)(help #help_docs))
	(
	(set docsdir (tackon IPdestDir "docs"))
	(if (exists docsdir (noreq)) (makedir docsdir (infos)))
	(copyfiles
		(prompt (#do_docs))
		(source (tackon IPscrDir #doc_path))
		(dest docsdir)
		(all)
		(infos)
	)
	)
)

(if (askbool(prompt #query_rexx)(help #help_rexx))
	(
	(set rexdir (tackon IPdestDir "rexx"))
	(if (exists rexdir (noreq)) (makedir rexdir))
	(copyfiles
		(prompt (#do_rexx))
		(source (tackon IPscrDir "rexx"))
		(dest rexdir)
		(all)
	)
	)
)

(startup "IntuiPoint"
	(prompt #ip-startup)
	(help @startup-help)
	(command "if exists \"" IPdestDir "\"\n")
	(command "   assign IntuiPoint: \"" IPdestDir "\"\n")
	(command "   assign add REXX:   IntuiPoint:Rexx\n")
	(command "endif")
)

(exit (#ip-exit))
