From c5f307a330c141c955d4bc99f4675d816b28e223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 13 Oct 2017 13:44:11 +0200 Subject: Some update --- multiconfig.sh | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'multiconfig.sh') diff --git a/multiconfig.sh b/multiconfig.sh index e85f0c0..500d0de 100755 --- a/multiconfig.sh +++ b/multiconfig.sh @@ -1,5 +1,6 @@ #!/bin/sh set -e +MODDIR="/usr/lib/multiconfig" MODS="" LOCAL=false @@ -21,7 +22,14 @@ while [ $# -gt 0 ]; do LOCAL=true ;; *) - MODS="$MODS $1" + if [ -x "$1" ]; then + MODS="$MODS $(pwd)/$1" + elif [ -x "$MODDIR/$1" ]; then + MODS="$MODS $MODDIR/$1" + else + echo "Requested unknown mod: $1" + exit 1 + fi ;; esac shift @@ -38,6 +46,8 @@ if ! $LOCAL; then exit 1 fi cd "/root/.multiconfig" + # Ensure that we have correct access rights on private key + chmod 600 ssh_key # Update git repository git fetch git reset --hard origin/master @@ -47,30 +57,15 @@ if ! $LOCAL; then #git verify-commit HEAD fi -MODDIR="/usr/lib/multiconfig" # No modules given means to process all modules if [ -z "$MODS" ]; then for M in $(find "$MODDIR" -executable); do - MODS="$MODS $M" + MODS="$MODS $MODDIR/$M" done -else - # Go trough all given modules and check if we have such module - NMODS="" - for M in $MODS; do - if [ ! -x "$M" ]; then # Is not path directly to script - if [ ! -x "$MODDIR/$M" ]; then - echo "No such mode: $M" - exit 1 - else - NMODS="$NMODS $MODDIR/$M" - fi - else - NMODS="$NMODS $M" - fi - done - MODS="$NMODS" fi +[ -n "$MODS" ] || exit 0 + mkdir -p /var/log/multiconfig for M in $MODS; do LOG="/var/log/multiconfig/$(basename "$M")" -- cgit v1.2.3