aboutsummaryrefslogtreecommitdiff
path: root/multiconfig.sh
diff options
context:
space:
mode:
Diffstat (limited to 'multiconfig.sh')
-rwxr-xr-xmulticonfig.sh33
1 files changed, 14 insertions, 19 deletions
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")"