blob: 1ed47dd444dc6528aeab1558d50c62fea0b53fc6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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 -type f); 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
|