-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.sh
More file actions
executable file
·39 lines (39 loc) · 794 Bytes
/
config.sh
File metadata and controls
executable file
·39 lines (39 loc) · 794 Bytes
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
#!/bin/sh
set --
LANG=C
while read line; do
name="${line%%#*}"
value="${name#*=}"
name="${name%%=*}"
name="${name#CONFIG_}"
help="${line#*#}"
case "$value" in
1)
value=on
;;
*)
value=off
;;
esac
set -- "$@" "$name" "$help" "$value"
done < .config
which whiptail && DIALOG=whiptail || DIALOG=dialog
exec 3>&1
ret="`$DIALOG --checklist \"VMM Configuration\" 0 78 0 -- \"$@\" 2>&1 1>&3 3>&-`" || exit 1
exec 3>&-
set -- $ret
mv .config .config.bak || exit 1
while read line; do
name="${line%%#*}"
value="${name#*=}"
name="${name%%=*}"
name="${name#CONFIG_}"
help="${line#*#}"
value=0
for i; do
case "$i" in \""$name"\")
value=1
esac
done
echo "CONFIG_$name=$value#$help"
done < .config.bak > .config