; 05rw Installtion Script
;$VER Install-05rw 1.2 (21.03.98)

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

(set #badkick "\n Sorry, this package requires OS v2.04 or better.\n")

(set #msg_welcome
  (cat
    "\nWelcome to the `05R/W' installation\n\n"
    "This script installs `05R/W 1.2'\n"
    "on your Amiga.\n\n"
    "Registered user gets their personal\n"
    "keyfile installed too.\n\n"
    "05R/W © 1996-1998 Maxime Doyen\n"
    "All rights reserved\n\n"
    "MUI © 1993-1998 Stefan Stuntz"
  )
)

(set #msg_askdestdir
  (cat
    "Please select a place for \"05rw\".\n"
    "A drawer will be created here for you."
  )
)

(set #reg_prompt "Thank you very much for purchasing `05R/W'. To turn your demo version into a registered version, your personalized keyfile needs to be installed on your hard disk in the L: directory. Do you want to do that now (recommended)?")
(set #reg_yes    "Yes, install keyfile")
(set #reg_no     "No, don't install keyfile")
(set #reg_help   "\nThe keyfile turns any `05R/W' demo version into a registered version. After installation in the L: directory of your harddisk, all features will be enabled. The keyfile is personalized with your name and address and may not be redistributed under any circumstances.")
(set #reg_noway  "\nYou choose not to install your keyfile. The options for registered users won't be enabled until you do that.\n\nYou can restart the installer script later or copy the keyfile manually with a command like\n\ncopy 05rw.key L:")


;=======================================================
;=================== Settings! =========================
;=======================================================

;sure we are running under OS2.04 or above
(if (< (/ (getversion) 65536) 37)
    (
      (message #msg_badkick)
      (exit (quiet))
    )
)

(message #msg_welcome (all))
(welcome)
(complete 0)

; get destination directory
(set destdir
  (askdir
    (prompt #msg_askdestdir)
    (help @askdir-help)
    (default "SYS:")
  )
)

(set @default-dest (expandpath destdir))

(set destination (tackon destdir "05rw"))


;=======================================================
;================== Procedures! ========================
;=======================================================

(procedure P_copydir dirname
  (copyfiles (infos) (all)
    (source dirname)
    (dest (tackon destination dirname))
  )
  (copyfiles
    (source (cat dirname ".info"))
    (dest destination)
  )
)


;=======================================================
;==================== Action! ==========================
;=======================================================

(if (= (exists destination) 0)
  (makedir destination)
)

(if (= (exists (tackon @default-dest "05rw.info")) 0)
  (copyfiles (noposition)
    (source "/05rw.info")
    (dest @default-dest)
    (optional nofail force)
  )
)

(complete 10)
(copyfiles (infos)
  (source "ReadMe")
  (dest destination)
)

(complete 20)
(copyfiles (infos)
  (source "05rw")
  (dest destination)
)

(complete 40)
(P_copydir "Docs")

(complete 60)
(P_copydir "Datas")

(complete 80)
(P_copydir "Docks")

(copyfiles (infos)
  (source "OrderForm")
  (dest destination)
)

; Copy Keyfile if exist
(complete 90)
(if (exists "/05rw.key")
(
	(if (askbool (prompt (cat #intro_0 "\n\n" #reg_prompt)) (choices #reg_yes #reg_no) (default 1) (help #reg_help))
	(
		(copyfiles
			(prompt #reg_copying)
			(source "/05rw.key")
			(dest "L:")
			(help @copyfiles-help)
			(confirm "expert")
		)
	)
	(
		(message #reg_noway)
	)
	)
)
)

(complete 100)

