1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

Merge pull request #1587 from pi-hole/fix/1430

Show text typed when pressing Ctrl+C after using pihole -a -p
This commit is contained in:
Jacob Salmela 2017-07-06 20:59:41 -05:00 committed by GitHub
commit 7ef751f96d

View File

@ -31,7 +31,7 @@ Options:
-k, kelvin Set Kelvin as preferred temperature unit -k, kelvin Set Kelvin as preferred temperature unit
-h, --help Show this help dialog -h, --help Show this help dialog
-i, interface Specify dnsmasq's interface listening behavior -i, interface Specify dnsmasq's interface listening behavior
Add '-h' for more info on interface usage" Add '-h' for more info on interface usage"
exit 0 exit 0
} }
@ -89,6 +89,9 @@ SetWebPassword() {
readonly PASSWORD="${args[2]}" readonly PASSWORD="${args[2]}"
readonly CONFIRM="${PASSWORD}" readonly CONFIRM="${PASSWORD}"
else else
# Prevents a bug if the user presses Ctrl+C and it continues to hide the text typed.
# So we reset the terminal via stty if the user does press Ctrl+C
trap '{ echo -e "\nNo password will be set" ; stty sane ; exit 1; }' INT
read -s -p "Enter New Password (Blank for no password): " PASSWORD read -s -p "Enter New Password (Blank for no password): " PASSWORD
echo "" echo ""
@ -225,7 +228,7 @@ RestartDNS() {
else else
service dnsmasq restart service dnsmasq restart
fi fi
if [[ "$?" == 0 ]]; then if [[ "$?" == 0 ]]; then
echo -e "${OVER} ${TICK} ${str}" echo -e "${OVER} ${TICK} ${str}"
else else
@ -402,7 +405,7 @@ SetHostRecord() {
SetListeningMode() { SetListeningMode() {
source "${setupVars}" source "${setupVars}"
if [[ "$3" == "-h" ]] || [[ "$3" == "--help" ]]; then if [[ "$3" == "-h" ]] || [[ "$3" == "--help" ]]; then
echo "Usage: pihole -a -i [interface] echo "Usage: pihole -a -i [interface]
Example: 'pihole -a -i local' Example: 'pihole -a -i local'
@ -415,7 +418,7 @@ Interfaces:
all Listen on all interfaces, permit all origins" all Listen on all interfaces, permit all origins"
exit 0 exit 0
fi fi
if [[ "${args[2]}" == "all" ]]; then if [[ "${args[2]}" == "all" ]]; then
echo -e " ${INFO} Listening on all interfaces, permiting all origins. Please use a firewall!" echo -e " ${INFO} Listening on all interfaces, permiting all origins. Please use a firewall!"
change_setting "DNSMASQ_LISTENING" "all" change_setting "DNSMASQ_LISTENING" "all"