Change password logic completely to avoid any extra debug prints

Signed-off-by: Adam Hill <adam@diginc.us>
This commit is contained in:
Adam Hill 2018-10-16 19:55:52 -05:00
parent f1b34887f8
commit c290324185
No known key found for this signature in database
GPG Key ID: 2193804FCA429855
2 changed files with 11 additions and 6 deletions

View File

@ -49,7 +49,7 @@ docker run -d \
pihole/pihole:latest
echo -n "Your password for https://${IP}/admin/ is "
docker logs pihole 2> /dev/null | grep 'password:'
docker logs pihole 2> /dev/null | grep 'password'
```
**This is just an example and might need changing.** Volumes are stored in the directory `$DOCKER_CONFIGS` and are recommended for persisting data across docker re-creations for updating images. As mentioned on line 2, the auto `IP_LOOKUP` variable may not work for VPN tunnel interfaces.

View File

@ -242,16 +242,21 @@ generate_password() {
setup_web_password() {
PASS="$1"
# Turn bash debug on while setting up password (to print it)
set -x
if [[ "$PASS" == "" ]] ; then
echo "" | pihole -a -p
else
echo "Setting password: ${PASS}"
set -x
pihole -a -p "$PASS" "$PASS"
fi
if [ "${PH_VERBOSE:-0}" -lt 1 ] ; then
# Turn bash debug back off after print password setup
# (subshell to null hides printing output)
{ set +x; } 2>/dev/null
# Turn bash debug back off after print password setup
# (subshell to null hides printing output)
{ set +x; } 2>/dev/null
# To avoid printing this if conditional in bash debug, turn off debug above..
# then re-enable debug if necessary (more code but cleaner printed output)
if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
set -x
fi
}