#!/bin/bash # ------- # File: llxcfg-_@_SCRIPT_TYPE_@_-scripts # Description: Script to run llxcfg _@_SCRIPT_TYPE_@_ scripts # (template) Author: Luis Garcia Gisbert # # 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., # 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA # -------- set -e PATH="/usr/sbin:/usr/bin:/sbin:/bin" # --------- # variables # --------- # ---- # main # ---- usage(){ CMD_NAME="$(basename "$0")" echo "Usage: $CMD_NAME [OPTIONS] {_@_SCRIPT_ACTIONS_@_}" >&2 echo " $CMD_NAME {enable|disable} SCRIPT_NAME [RUN_ORDER]" >&2 echo " $CMD_NAME {allow|deny} SCRIPT_NAME" >&2 echo " OPTIONS: --stop-on-error, --log-dir=LOG_DIRECTORY" >&2 return 0 } # ---- # main # ---- SCRTYPE="_@_SCRIPT_TYPE_@_" SCRTOOL="/usr/sbin/llxcfg-script" SCROPTIONS="" while echo "$1" |grep -q "^--" ; do SCROPTIONS="$SCROPTIONS $1" shift done case "$1" in _@_SCRIPT_ACTIONS_@_) ${SCRTOOL} $SCROPTIONS "$SCRTYPE" run "$@" || exit $? ;; enable|disable|allow|deny) if [ -z "$2" ] ; then usage exit 1 fi ${SCRTOOL} "$SCRTYPE" "$@" || exit $? ;; *) usage exit 1 ;; esac exit 0