diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-10-09 13:49:13 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-10-09 13:49:13 +0000 |
commit | b17c1633e668e33ba86f5347fb209d3f9af9649c (patch) | |
tree | 81ac03e96447c3ab9ec554f2ad8f9a64f589e703 | |
parent | 1ec067f64cc9ebaa9e03c80651ff20449f128b97 (diff) | |
download | gsc-b17c1633e668e33ba86f5347fb209d3f9af9649c.tar.gz gsc-b17c1633e668e33ba86f5347fb209d3f9af9649c.tar.bz2 |
Minor changes.
* upload/gnupload, rc.d/rc.local: Use ${X#... where necessary.
* rc.d/rc.local: Accept optional component names on the command
line.
git-svn-id: file:///svnroot/gsc/trunk@332 d2de0444-eb31-0410-8365-af798a554d48
-rw-r--r-- | ChangeLog | 6 | ||||
-rwxr-xr-x | rc.d/rc.local | 47 | ||||
-rwxr-xr-x | upload/gnupload | 2 |
3 files changed, 39 insertions, 16 deletions
@@ -1,3 +1,9 @@ +2008-10-09 Sergey Poznyakoff <gray@gnu.org.ua> + + * upload/gnupload, rc.d/rc.local: Use ${X#... where necessary. + * rc.d/rc.local: Accept optional component names on the command + line. + 2008-10-07 Sergey Poznyakoff <gray@gnu.org.ua> * rc.d/start-stop: New option -P diff --git a/rc.d/rc.local b/rc.d/rc.local index 2aee01b..0697f38 100755 --- a/rc.d/rc.local +++ b/rc.d/rc.local @@ -32,7 +32,7 @@ reverse() { run_comp() { case $2 in *@*) user=${2%%@*} - prog=${2##*@} + prog=${2#*@} ;; *) user= prog=$2 @@ -89,9 +89,16 @@ do esac done -case $1 in +command=$1 +shift +if [ $# -ne 0 ]; then + components="$*" +else + components= +fi + +case $command in -r|--re|--res|--rest|--resta|--restar|--restart) - shift for module in $* do restart $module @@ -99,29 +106,39 @@ case $1 in ;; restart) - modules=`read_section components` - run_list stop `reverse $modules` - run_list start $modules + if [ -n "$components" ]; then + for module in $components + do + restart $module + done + else + components=`read_section components` + run_list stop `reverse $components` + run_list start $components + fi ;; start|stop|reload|reconfigure|hup|status) - modules=`read_section components` - if [ "$1" = stop ]; then - modules=`reverse $modules` - fi - - run_list ${1:-start} $modules + if [ -z "$components" ]; then + components=`read_section components` + if [ "$1" = stop ]; then + components=`reverse $components` + fi + fi + run_list $command $components ;; help|-h|--h|--he|--hel|--help) cat <<EOT -Usage: $0 [OPTIONS] {start|stop|restart|reload|reconfigure|hup|status} - or: $0 [OPTIONS] {-r|--restart} components +Usage: $0 [OPTIONS] {start|stop|restart|reload|reconfigure|hup|status} \ + [components] OPTIONS are: -d, --debug Print everything, do nothing -D, --directory DIR Search for components in DIR (default $DIR) - -c, --config FILE Use configuration FILE (default $CONFIG) + -c, --config FILE Use configuration FILE (default $CONFIG) + +[Components] is an optional list of components to apply the operation to. EOT exit 0 ;; diff --git a/upload/gnupload b/upload/gnupload index 2a46c1a..6cdffe8 100755 --- a/upload/gnupload +++ b/upload/gnupload @@ -174,7 +174,7 @@ EOF rm -f $file.directive $file.directive.asc cat >$file.directive<<EOF version: 1.1 -directory: ${destdir##*/} +directory: ${destdir#*/} filename: $file EOF echo "$passphrase" | $GPG --passphrase-fd 0 --clearsign $file.directive |