;;;$VER: Install-RexxLocalDates 2.0 (8.6.96)
;;;
;;; Default installationen er:
;;;
;;; Kopier rexxlocaldates.library til LIBS:
;;; Kopier RexxLocalDates.guide, RexxLocalDates.guide.info til HELP:
;;; Kopier Test_RexxLocalDates.rexx til REXX:
;;; Tilføj RxLib rexxlocaldates.library 1 -30 0 til User-Startup
;;;

;;;
;;; Forskellige sprog ...
;;;

;;;
;;; Dansk
;;;

(if (= @language "dansk")
    ((set #have_strings TRUE)

     (set #installask "Hvad skal installeres?")
     (set #installchoice1 "rexxlocaldates.library")
     (set #installchoice2 "Amigaguide dokumentation")
     (set #installchoice3 "Eksempel script")
     
     (set #installlib_where "Hvor skal rexxlocaldates.library installeres?")
     (set #installlib-help (cat "Den fulde nytte af rexxlocaldates.library opnås kun, hvis det valgte directory er indeholdt i den logiske enhed LIBS:\n\n" @askdir-help))
     
     (set #installguide_where "Hvor skal amigaguide dokumentationen installeres?")
     (set #installscript_where "Hvor skal eksempel scriptet installeres?")

     (set #copylib_info "Kopierer rexxlocaldates.library")
     
     (set #copyguide_info "Kopierer amigaguide dokumentation")

     (set #copyscript_info "Kopierer eksempel scriptet")

     (set #startup_prompt "Tilføjer følgende kommandoer til s:user-startup:\n\n")
	  
     ))

;;;
;;; Engelsk/ukendt
;;;

(if (OR (= @language "english") (NOT (= #have_strings TRUE)))
    ((set #have_strings TRUE)

     (set #installask "Which parts should be installed?")
     (set #installchoice1 "rexxlocaldates.library")
     (set #installchoice2 "Amigaguide documentation")
     (set #installchoice3 "Example script")
     
     (set #installlib_where "Where should rexxlocaldates.library be installed?")
     (set #installlib-help (cat "For best results, the destination directory should be covered by the logical assign LIbS:\n\n" @askdir-help))
     
     (set #installguide_where "Where should the amigaguide documentationen be installed?")
     (set #installscript_where "Where should the example script be installed?")

     (set #copylib_info "Copying rexxlocaldates.library")
     
     (set #copyguide_info "Copying documentation")

     (set #copyscript_info "Copying the exaple script")

     (set #startup_prompt "Add the following commands to S:User-Startup:\n\n")
	  
     ))

;;;
;;; Default installations mål.
;;;

(set #defaultlibdir "LIBS:")
(set #defaultguidedir "HELP:")
(set #defaultscriptdir "REXX:")

(set @default-dest "")

;;;
;;; Og så til det egentlige ...
;;;
(complete 0)
(set #installwhat
     (askoptions 
      (prompt #installask)
      (help @askoptions-help)
      (choices #installchoice1 #installchoice2 #installchoice3)
      (default %111)
      ))

(complete 12)
(set #libdir 
     (if (BITAND #installwhat %001)
	 (askdir
	  (prompt #installlib_where)
	  (help #installib-help)
	  (default #defaultlibdir)
	  (newpath TRUE)
	  )
       )
     )
(complete 25)
(set #guidedir 
     (if (BITAND #installwhat %010)
	 (askdir
	  (prompt #installguide_where)
	  (help @askdir-help)
	  (default #defaultguidedir)
	  (newpath TRUE)
	  )
       )
     )
(complete 37)
(set #scriptdir 
     (if (BITAND #installwhat %010)
	 (askdir
	  (prompt #installscript_where)
	  (help @askdir-help)
	  (default #defaultscriptdir)
	  (newpath TRUE)
	  )
       )
     )
(complete 50)
(if (BITAND #installwhat %001)
    (copylib
     (prompt #copylib_info)
     (help @copylib-help)
     (source "rexxlocaldates.library")
     (dest #libdir)
     )
  )

(complete 62)
(if (BITAND #installwhat %010)
    (copyfiles
     (prompt #copyguide_info)
     (help @copyfiles-help)
     (source "RexxLocalDates.guide")
     (dest #guidedir)
     (infos TRUE)
     (noposition TRUE)
     (if (= @user-level 2)
	 (confirm))
     )
  )
(complete 75)
(if (BITAND #installwhat %100)
    (copyfiles
     (prompt #copyscript_info)
     (help @copyfiles-help)
     (source "RLD_demo.rexx")
     (dest #scriptdir)
     (if (= @user-level 2)
	 (confirm))
     )
  )
(complete 87)

(set #us-add1 "rxlib rexxlocaldates.library 1 -30 0")
(set #us-add2  (cat "\nAssign LIBS: \"" #libdir "\" ADD"))

(if (NOT (= #libdir #defaultlibdir))
    (set #us-add (cat #us-add1 #us-add2))
  (set #us-add (cat #us-add1 ""))
  )

(if (BITAND #installwhat %001)
    (startup "RexxLocalDates.library"
	     (command  #us-add)
	     (prompt  (cat #startup_prompt #us-add))
	     (help @startup-help)
	     )
  )
(complete 100)

