New menu style for pihole

This commit is contained in:
Bob Mottram 2018-06-03 14:14:45 +01:00
parent c8791dcad3
commit c6c72d4b38
1 changed files with 15 additions and 22 deletions

View File

@ -255,27 +255,23 @@ function pihole_resume {
}
function configure_interactive_pihole {
W=(1 $"Edit ads list"
2 $"Edit blacklisted domain names"
3 $"Edit whitelisted domain names"
4 $"Change upstream DNS servers"
5 $"Pause blocker"
6 $"Resume blocker")
while true
do
data=$(mktemp 2>/dev/null)
dialog --backtitle $"Freedombone Control Panel" \
--title $"Ad Blocker" \
--radiolist $"Choose an operation:" 16 70 7 \
1 $"Edit ads list" off \
2 $"Edit blacklisted domain names" off \
3 $"Edit whitelisted domain names" off \
4 $"Change upstream DNS servers" off \
5 $"Pause blocker" off \
6 $"Resume blocker" off \
7 $"Exit" on 2> "$data"
sel=$?
case $sel in
1) rm -f "$data"
exit 1;;
255) rm -f "$data"
exit 1;;
esac
case $(cat "$data") in
# shellcheck disable=SC2068
selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Ad blocker" --menu $"Choose an operation, or ESC for main menu:" 19 70 12 "${W[@]}" 3>&2 2>&1 1>&3)
if [ ! "$selection" ]; then
break
fi
case $selection in
1) editor $PIHOLE_CUSTOM_ADLIST
update_pihole_interactive
;;
@ -292,10 +288,7 @@ function configure_interactive_pihole {
;;
6) pihole_resume
;;
7) rm -f "$data"
break;;
esac
rm -f "$data"
done
}