source: llxcfg/trunk/fuentes/debian/llxcfg-scripts.in @ 98

Last change on this file since 98 was 96, checked in by hectorgh, 5 years ago

adding proyect files

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/bin/bash
2# -------
3# File:                llxcfg-_@_SCRIPT_TYPE_@_-scripts
4# Description:         Script to run llxcfg _@_SCRIPT_TYPE_@_ scripts
5# (template) Author:   Luis Garcia Gisbert <garcia_luigis@gva.es>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License along
18# with this program; if not, write to the Free Software Foundation, Inc.,
19# 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA
20# --------
21
22set -e
23
24PATH="/usr/sbin:/usr/bin:/sbin:/bin"
25
26
27# ---------
28# variables
29# ---------
30
31# ----
32# main
33# ----
34
35usage(){
36   CMD_NAME="$(basename "$0")"
37   echo "Usage: $CMD_NAME [OPTIONS] {_@_SCRIPT_ACTIONS_@_}" >&2
38   echo "       $CMD_NAME {enable|disable} SCRIPT_NAME [RUN_ORDER]" >&2
39   echo "       $CMD_NAME {allow|deny} SCRIPT_NAME" >&2
40   echo "       OPTIONS: --stop-on-error, --log-dir=LOG_DIRECTORY" >&2
41   return 0   
42} 
43
44# ----
45# main
46# ----
47
48SCRTYPE="_@_SCRIPT_TYPE_@_"
49SCRTOOL="/usr/sbin/llxcfg-script"
50SCROPTIONS=""
51
52while echo "$1" |grep -q "^--" ; do
53   SCROPTIONS="$SCROPTIONS $1"
54   shift
55done
56
57case "$1" in
58   _@_SCRIPT_ACTIONS_@_)
59      ${SCRTOOL} $SCROPTIONS "$SCRTYPE" run "$@" || exit $?
60      ;;
61   enable|disable|allow|deny)
62      if [ -z "$2" ] ; then
63         usage
64         exit 1
65      fi
66      ${SCRTOOL} "$SCRTYPE" "$@" || exit $?
67      ;;
68   *)
69      usage
70      exit 1
71      ;;
72esac
73
74exit 0
75
Note: See TracBrowser for help on using the repository browser.