.key idir,p2,p3,p4,p5,p6,p7,p8
.bra {
.ket }

; Amiga TCP/IP Install script.
;
; USAGES:   Double click the Install_Now icon,
;               or click it once then double click the destination drawer.
;
;  In a Shell window, type either
;                amigatcp_1:install disk:drawer
;            or  amigatcp_1:install



if not "{idir}" eq ""
  if not "{idir}" eq "inet:"

    if "{idir}" eq "q"
      echo "Installation cancelled."
      skip to_end
    endif

    if "{idir}" eq "n"
      echo "Installation cancelled."
      skip to_end
    endif

    if not "{p2}" eq ""
      echo "*N*N*N **** ERROR ****  No double quotes around: {idir} {p2}..."
      skip to_redo
    endif

    echo >ram:tcpfname {idir}
    search >nil: ram:tcpfname ":"
    if warn
      delete >nil: ram:tcpfname
      echo "*N*N*N **** ERROR ****  Missing *":*" in {idir}."
      skip to_redo
    endif
    delete >nil: ram:tcpfname

    if exists "{idir}"
      echo "*N{idir} already exists!"
      ask "Assign inet: to it and continue (y/n)?"
      if not warn
        skip to_redo
      endif
      assign inet: "{idir}"
      if not exists {idir}.info
        copy >nil: AmigaTCP_1:docs.info {idir}.info nopro
      endif
      skip to_install
    else
      ask "*NCreate {idir}, assign inet: to it and continue (y/n)?"
      if not warn
        skip to_redo
      endif
      makedir {idir}
      if warn
        skip to_redo
      endif
      copy >nil: AmigaTCP_1:docs.info {idir}.info nopro
      assign inet: "{idir}"
      skip to_install
    endif
  endif
endif


assign >nil: inet: exists
if not warn
  echo "*NThe existing inet assignment is:"
  assign inet: exists
  ask "Do you want to install Amiga TCP/IP in this directory (y/n)? "
  if warn
    skip to_install
  endif
endif
skip to_redo

lab to_install

echo "*NDirectory inet:s"
if exists inet:s
  copy AmigaTCP_1:s inet:s nopro
  echo "The Inet:s directory already existed!"
  echo "NOT overwriting files you may have edited:"
  dir amigatcp_1:s.user
  wait 5 secs
else
  copy AmigaTCP_1:s inet:s nopro
  copy AmigaTCP_1:s.user inet:s nopro
endif
protect >nil: inet:s/start-inet +s

if not exists inet:log
  echo   "*NDirectory inet:log"
  copy AmigaTCP_1:log inet:log nopro
endif

echo  "*NDirectory inet:db"
if exists inet:db
  copy AmigaTCP_1:db inet:db nopro
  echo "The Inet:db directory already exists!"
  echo "NOT overwriting files you may have edited:"
  dir amigatcp_1:db.user
  wait 5 secs
else
  copy AmigaTCP_1:db inet:db nopro
  copy AmigaTCP_1:db.user inet:db nopro
endif
wait 2 secs

echo "*NDirectory inet:"
copy AmigaTCP_1:README#? inet: nopro
copy AmigaTCP_1:COPYRIGHTS#? inet: nopro
copy AmigaTCP_1:DISCLAIMER#? inet: nopro

echo "*NDirectory inet:Docs"
if not exists inet:Docs.info
  copy AmigaTCP_1:Docs.info inet:Docs.info nopro
endif
copy AmigaTCP_1:Docs inet:Docs nopro

echo    "*NDirectory inet:libs"
copy AmigaTCP_1:libs inet:libs nopro

echo    "*NDirectory inet:serv"
copy AmigaTCP_1:serv inet:serv nopro

echo "*NDirectory devs:"
copy AmigaTCP_1:devs devs: nopro

echo "*NDirectory inet:c"
copy AmigaTCP_2:c inet:c nopro

echo "*NInstallation complete."
echo "You now must edit configuration files in the s and db directories"
echo "See the README file and the User's Guide for instructions."
ask "*NPress return to continue."
skip to_end

lab to_redo
echo "*NEnter the name of the disk and drawer"
echo "where you want to install Amiga TCP/IP.  Type a colon between"
echo "disk and drawer parts and enclose it all in double quotes."
echo "Example: *"Work:Inet*" (q=quit): " noline
execute >nil: amigatcp_1:install ?
lab to_end

