#!/bin/sh
#
# LES 0.2 [les@r-fx.org]
###
# Copyright (C) 2004, Ryan MacDonald <ryan@r-fx.org>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
###
#
VER=0.2
opt=$1
st=$2
cnf=/usr/local/les/conf.les

head() {
        echo "LES version $VER <se@r-fx.org>"
        echo "Copyright (C) 2004, R-fx Networks"
        echo "              2004, Ryan MacDonald"
        echo "This program may be freely redistributed under the terms of the GNU GPL"
        echo ""
}

if [ -f "$cnf" ]; then
        . $cnf
else
	head
	echo "error loading $cnf; aborting."
	exit 1
fi

if [ -f "$DAT" ]; then
	. $DAT
else
	head
	echo "error loading $DAT; aboriting."
	exit 1
fi

if [ "$1" == "" ]; then
	head
	usage
	exit 1
elif [ ! "$1" == "" ] && [ "$2" == "" ] && [ ! "$1" == "-da" ] && [ ! "$1" == "--disable-all" ] && [ ! "$1" == "-ea" ] && [ ! "$1" == "--enable-all" ]; then
	head
	usage
	exit 1
elif [ "$1" == "" ] && [ "$2" == "" ] && [ ! "$1" == "-da" ] && [ ! "$1" == "--disable-all" ] && [ ! "$1" == "-ea" ] && [ ! "$1" == "--enable-all" ]; then
	head
	usage
	exit 1
fi

case "$1" in
	-da|--disable-all)
	head
	secure_bin 0
	secure_path 0
	secure_rpmpkg 0
	secure_prof 0
	;;
	-ea|--enable-all)
        head
        secure_bin 1
        secure_path 1
        secure_rpmpkg 1
        secure_prof 1
	;;
	-sb|--secure-bin)
	head
	secure_bin $st
	;;
	-sp|--secure-path)
	head
	secure_path $st
	;;
	-sr|--secure-rpmpkg)
	head
	secure_rpmpkg $st
	;;
	-so|--secure-prof)
	head
	secure_prof $st
	;;
	*)
	head
	usage
	;;
esac
exit 0
