diff options
author | Karel Kočí <cynerd@email.cz> | 2018-09-12 00:24:36 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-09-12 00:24:36 +0200 |
commit | e1a1d9932921abadf17785c380a7a8f2e1f043f6 (patch) | |
tree | ab246b3c5db3027752e0659b92eb17a6d2a00618 /tools | |
parent | a8bfe6abb693150e9ee01ea6e8d672fc074d1f1c (diff) | |
download | multiconfig-e1a1d9932921abadf17785c380a7a8f2e1f043f6.tar.gz multiconfig-e1a1d9932921abadf17785c380a7a8f2e1f043f6.tar.bz2 multiconfig-e1a1d9932921abadf17785c380a7a8f2e1f043f6.zip |
Add multiconfig calling scriptv0.2
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/multiconfig | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/tools/multiconfig b/tools/multiconfig new file mode 100755 index 0000000..e65b51e --- /dev/null +++ b/tools/multiconfig @@ -0,0 +1,62 @@ +#!/bin/sh +set -e +MODDIR="/usr/lib/multiconfig" + +MODS="" + +# TODO email notifications + +EXPANDED_ARGS=false +for ARG in "$@"; do + $EXPANDED_ARGS || { + shift $# + EXPANDED_ARGS=true + } + case "$ARG" in + -h|--help) + echo "Usage: multiconfig [OPTION]... [MODULE]..." + echo "Multiconfig system launching script" + echo + echo "Options:" + echo " -h, --help" + echo " Print this help text." + echo " -l, --list" + echo " List all available mods and exit." + exit 0 + ;; + -l|--list) + cd "$MODDIR" + for MOD in $(find -maxdepth 1 -executable); do + echo "$MOD: $($MOD --description)" + done + exit + ;; + *) + if [ \! -x "$ARG" ]; then + echo "Requested unknown mod: $1" + exit 1 + fi + set "$@" "$ARG" + ;; + esac +done + +[ "$(id -u)" == 0 ] || { + echo "Please run this script only as root." + exit 1 +} +cd "$MODDIR" + +# No modules given means to process all modules +if [ $# -eq 0 ]; then + for M in $(find -maxdepth 1 -executable); do + set "$@" "$M" + done +fi + +while [ $# -gt 0 ]; do + M="$1" + "$M" 2>&1 | logger -s -t "multiconfig-$M" || { + echo "TODO send email!" + } +done |