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 { 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 while true
do do
data=$(mktemp 2>/dev/null) # shellcheck disable=SC2068
dialog --backtitle $"Freedombone Control Panel" \ 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)
--title $"Ad Blocker" \
--radiolist $"Choose an operation:" 16 70 7 \ if [ ! "$selection" ]; then
1 $"Edit ads list" off \ break
2 $"Edit blacklisted domain names" off \ fi
3 $"Edit whitelisted domain names" off \
4 $"Change upstream DNS servers" off \ case $selection in
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
1) editor $PIHOLE_CUSTOM_ADLIST 1) editor $PIHOLE_CUSTOM_ADLIST
update_pihole_interactive update_pihole_interactive
;; ;;
@ -292,10 +288,7 @@ function configure_interactive_pihole {
;; ;;
6) pihole_resume 6) pihole_resume
;; ;;
7) rm -f "$data"
break;;
esac esac
rm -f "$data"
done done
} }