## -*- mode: shell-script; -*- 
##
## To be able to make changes to the part of configuration created
## from this configlet you need to copy this file to the directory
## fwbuilder/configlets/linux24/ in your home directory and modify it.
## Double "##" comments are removed during processing but single "#"
## comments are be retained and appear in the generated script. Empty
## lines are removed as well.  
##
## Configlets support simple macro language with these constructs:
## {{$var}} is variable expansion
## {{if var}} is conditional operator.
##
## About using "command" to find programs:
##
## apparently "command" is POSIX compliant and should be widely
## available. Another tool that could be used is "type -P" but that is
## bash built-in
##
## Verified DD-WRT v24 and OpenWRT kamikaze 8.09.2 both have command
## and type (both use busybox)

find_program() {
  PGM=$1
  command -v $PGM >/dev/null 2>&1 || {
    echo "$PGM not found"
    exit 1
  }
}

check_tools() {
  find_program $IP 
{{if need_vconfig}}  find_program $VCONFIG {{endif}}
{{if need_brctl}}  find_program $BRCTL {{endif}}
{{if need_ifenslave}}  find_program $IFENSLAVE {{endif}}
}

