diff options
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 |