#!/bin/bash # ------- # File: llxcfg-[SERVICE] # replace with service name # # Description: LliureX [SERVICE] command line utility # Author: #put your name/email here# # # 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 # variables # --------- # fill this variable with related cpkg list (space delimited) CPKGS="" # functions # --------- usage(){ CMD="$(basename "$0")" exit_message \ "Usage: $CMD {start|stop|restart|reload|allow|deny|info|listfiles|update|revert|cpkgs}\n\ $CMD grepinfo FIELD\n\ # add specific options here #\n\ options: -u|--update" } exit_message() { echo -e "$1" >&2 exit 1 } # main # --------- case "$1" in -u|--update) AUTOUPDATE="Y" shift ;; esac ACTION="$1" rc=0 case "$ACTION" in start|stop|restart|reload) llxcfg-cpkg invoke "$ACTION" $CPKGS || rc=$? exit $rc ;; cpkgs) for c in $CPKGS ; do echo $c done exit 0 ;; allow|deny|listfiles|update|revert|info) llxcfg-cpkg "$ACTION" $CPKGS || rc=$? exit $rc ;; grepinfo) [ "$2" ] || usage llxcfg-cpkg grepinfo "$2" $CPKGS || rc=$? exit $rc ;; # add specific options here *) usage ;; esac [ -z "$AUTOUPDATE" ] || llxcfg-cpkg update $CPKGS || rc=$? exit $rc