.key hostname,rip/s,servers/s,syslog/s
.bra {
.ket }
;
; Sample Internet bootstrap script
; 
;stack should really be set before here
stack 20000

failat 21

;
; If inet: is missing, then things are surely not setup correctly.  Punt.
; 
assign >nil: inet: exists
if warn
   echo "Please assign inet: to directory where network software is loaded"
   quit 20
endif

;
; Check that c & db directories are present.  If they are missing anything
; we'll find out later..
;
if not exists inet:c
   echo "Internet boot fail:  inet:c directory missing"
   quit 20
endif
path inet:c add
if not exists inet:db
   echo "Internet boot fail: inet:db database directory missing"
   quit 20
endif

;
; Make sure env: is there
; 
assign >nil: env: exists
if warn
   if not exists ram:env
      makedir ram:env
   endif
   assign env: ram:env
endif

;
; Put up configuration menu
;
inet:c/config
inet:c/config >env:hostname -v hostname
if warn
   echo "Internet boot fail: Hostname is not set"
   quit 20
endif

;
; Check how user is set
;
inet:c/config >env:user -v user
if $user eq "nobody"
   echo "Warning: user configuration parameter set to nobody"
endif

;
; Config local loopback interface
;
inet:c/ifconfig >nil: lo0 127.1

;
; Configure first ethernet controller.  This will fail if the board is 
; missing.
;
inet:c/ifconfig >nil: ae0 $hostname -trailers
if warn 
   echo "Internet boot fail: could not configure first ethernet controller"
   echo "Is the controller installed properly?"
   quit 20
endif

;
; Test to see if second ethernet board is present.  
; 
inet:c/ifconfig >nil: ae1 
if not warn
   echo "Warning: second ethernet controller is present (not configured)"
endif

;
; If user specified he wants routing (ie by using "rip" keyword)
; start up the RIP router.
;
; NOTE: you only need RIP if your Amiga has two or more network
; cards and you want to be a gateway between networks
;
if not "{rip}" eq ""
   echo "Start routing daemon"
   run >nil: inet:serv/routed
endif

; enter routing information before mounting anything
; 
; route add default our-gateway 1

;
; Start NFS client software if fstab file is present
;
if exists inet:db/fstab
   inet:c/nfsmgr -i inet:db/fstab
   if warn
      echo "Warning: NFS mounts failed"
   endif
endif


;
; If user specified he wants servers (ie by using "servers" keyword)
; start up inetd & portmapd.
;
if not "{servers}" eq ""
   echo "Starting inetd and portmapd"
    run >nil: inet:serv/portmapd
   run >nil: inet:serv/inetd
endif

;
; If user wants syslogd start it here
;
if not "{syslog}" eq ""
   echo "Starting syslogd"
   run >nil: inet:serv/syslogd
endif



