From ebb71068a4b8e8654a8924b0e3c438f17a138bdb Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Mon, 16 Jan 2023 12:02:08 -0300 Subject: Added password feedback with "*" --- install.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index c043829..4cca791 100755 --- a/install.sh +++ b/install.sh @@ -123,8 +123,32 @@ if [ $setup_vpn == "y" ]; then read -p "What's your VPN service? (with spaces) [mullvad]: " vpn_service vpn_service=${vpn_service:-"mullvad"} read -p "What's your VPN username? (without spaces): " vpn_user - read -sp "What's your VPN password? (if you are using mullvad, just enter your username again): " vpn_password + + unset vpn_password + charcount=0 + prompt="What's your VPN password? (if you are using mullvad, just enter your username again): " + while IFS= read -p "$prompt" -r -s -n 1 char + do + if [[ $char == $'\0' ]] + then + break + fi + if [[ $char == $'\177' ]] ; then + if [ $charcount -gt 0 ] ; then + charcount=$((charcount-1)) + prompt=$'\b \b' + vpn_password="${vpn_password%?}" + else + prompt='' + fi + else + charcount=$((charcount+1)) + prompt='*' + vpn_password+="$char" + fi + done echo + echo "What country do you want to use?" read -p "You can check the countries list for your VPN here: https://github.com/qdm12/gluetun/wiki/$vpn_service#servers [brazil]: " vpn_country vpn_country=${vpn_country:-"brazil"} -- cgit v1.2.3