# shorewall
#
# starts shorewall

description	"Start shorewall"
author		"Arjan Bouter <abouter@sourcemage.org>"

start on network-start

task

pre-start script
  . /etc/sysconfig/shorewall

  # Shorewall needs /var/lock/subsys
  if  [[  !  -d  /var/lock/subsys/  ]]
  then
    mkdir  -p  /var/lock/subsys/
  fi

  # Shorewall needs /var/log/messages to exist
  if  [[  !  -f  /var/log/messages  ]]
  then
    touch  /var/log/messages
  fi
end script

script
  SHOREWALL_STATUS="$(awk '{print $1}' /var/lib/shorewall/state)"
  if [[ "$SHOREWALL_STATUS" = "Stopped" ]]; then
    shorewall start
  else
    shorewall restart
  fi
end script
