#!/bin/bash
#
# rFW - This file sets up internal variables and gets everything started.
#
# Curt Rebelein, Junior
# fw@rebby.com
#

######################
### user variables ###
######################

FW_HOME="/etc/firewall"

#####################################
### grab the user variables first ###
#####################################

# where config lives
CONFIGURATION_FILE="$FW_HOME/config"

# check if the firewall config file exists
[ ! -f $CONFIGURATION_FILE ] && echo -e "$CONFIGURATION_FILE does not exist!\nExiting!" && exit 0

# get the user defined variables
. $CONFIGURATION_FILE

#####################################
### set internally used variables ###
#####################################

# set the version here
VERSION="1.10.18.0 (alpha)"

# where the functions live
FUNCTIONS="$FW_HOME/bin/functions"

#########################
### let's get started ###
#########################

# source the functions
. $FUNCTIONS

# see how we care called & do something about it
case "$1" in
   -help)
      displayhelp  # provide the user w/some help
      ;;
   -restart)   # restart the firewall
      restart
      ;;
   -start)     # start the firewall
      start
      ;;
   -status)    # display the status of the firewall
      status
      ;;
   -stop)      # flush the tables/policies
      stopfw
      ;;
   -version)   # display the program version
      displayversion
      ;;
   *)
      cd $PWD
      $0 -help
      exit 1
esac

# we're done!!! :-)
