; Barney Installer Script
; by Jrgen Schmitz

;--------------------------------------------------------------------
;set text vars
;

(set #inst
  (cat "Installation script of Barney.\n\n"
       "Barney is published as SHAREWARE.\n"
       "for more details read the manual.\n\n"
       "The program is copyright (c) by J.Schmitz [SOFT]\n"
       "all rights reserved\n\n"
       "Barney supports traplist.library and reqtools.library which are not part of this package."
))

(set #barneyDrawer
  (cat "Select a drawer for Barney"
))

(set #barneyPhoneExample
  (cat "\n\nDo you want to install a phonebook example?"
       "\n\n(for more infos press HELP button)"
))

(set #barneyPhoneYes
  (cat "Yes"
))

(set #barneyPhoneNo
  (cat "No"
))

(set #barneyPhoneEx-help
  (cat "\nIn this example phonebook are some nodes included to show you "
       "the useage of the phonebook fields and switches and "
       "how to use the extras window and the jump area function."
))

(set #barneyPhoneExAlready
  (cat "\n\n\nATTENTION!\nThere is already a Barney phonebook installed!\n"
       "You will overwrite it if you select YES."
))

(set #barneyLanguages
  (cat "Select languages to install for Barney"
))

(set #barneyLanguagesDefault -1)

(set #2barneyInfo
  (cat "Barney has a special freature called \"NLV-EXTERNAL-PROGRAM_PORT\".\n\n"
       "This port allows you to send Fido addresses direct to Barney's phonebook. "
       "(otherwise you have to enter this by hand will all the mistaces you can make....)\n\n"
       "To get an address from your tosser to Barney the \"ToBarney\" system was made, "
       "a AmigaDOS program to send an address to this port and an ARexx script to get an address from any tosser and start the DOS program."
))

(set #2barneyDrawer
  (cat "Select a drawer for the 2Barney DOS program"
))

(set #2barneyRexx
  (cat "Select an ARexx program to start 2Barney from a tosser"
))

(set #2barneySpot
  (cat "Select a drawer for 2Barney.spot"
))

(set #2barneySpotInfo
  (cat "\nATTENTION!\n\nPlease change in 2Barney.spot in drawer \"%s\" the 2Barney path to \"%s\"."
))


(set #exit
  (cat "Barney is installed now!\nLike it, use it..."
))

;--------------------------------------------------------------------
;install
;

(message #inst)

(welcome)

(set @default-dest
     (askdir (prompt #barneyDrawer)
             (default @default-dest)
             (help @askdir-help)))

(copyfiles (source "//Barney")
           (dest @default-dest)
           (infos))

(copyfiles (source "//fonts/")
           (dest "fonts:")
           (all))
           
(if (exists "envarc:Barney.phone" (noreq))
 (set #barneyPhoneExample
   (cat #barneyPhoneExample #barneyPhoneExAlready
 ))
)

(if (exists "//envarc")
(
  (if (exists "//envarc/Barney.phone")
  (

    (if (askbool (prompt #barneyPhoneExample)
                 (choices #barneyPhoneYes #barneyPhoneNo)
                 (help #barneyPhoneEx-help))
             
      (copyfiles (source "//envarc/Barney.phone")
                 (dest "envarc:"))
    )             
  ))
))


(if (exists "SYS:Locale" (noreq))
(
  (if (exists "Locale:" (noreq))
  (
   (set res
    (askoptions (prompt #barneyLanguages)
                (help @askchoice-help)
                (default #barneyLanguagesDefault)
                (choices "deutsch" "english")
    )
   )

; deutscher Catalog wird nicht kopiert!
;   (if (in res 0)
;     (copyfiles (source "//Catalogs/deutsch/Barney.catalog")
;                (dest "Locale:Catalogs/deutsch")
;     )
;    )

    (if (in res 1)
      (copyfiles (source "//Catalogs/english/Barney.catalog")
                 (dest "Locale:Catalogs/english")
      )
    )
  ))  
))

(message #2barneyInfo)


(set toBarneyDir
     (askdir (prompt #2barneyDrawer)
             (default "C:")
             (help @askdir-help)))

(copyfiles (source "//Extras/2Barney")
           (dest toBarneyDir)
           (infos))

(set res
 (askoptions (prompt #2barneyRexx)
             (help @askchoice-help)
             (default 0)
             (choices "Spot")
 )
)

(if (in res 0)
 ( (set toBarneyDirRx
     (askdir (prompt #2barneySpot)
             (default "rexx:Spot")
             (help @askdir-help))
  )

  (copyfiles (source "//Extras/2Barney.spot")
             (dest toBarneyDirRX))

  (set barneySpotInfo (#2barneySpotInfo toBarneyDirRX toBarneyDir))
  (message barneySpotInfo)
 )
)

(exit #exit)
