use function in install script

This commit is contained in:
Adam Warner 2017-05-02 22:25:47 +01:00
parent 9c136a5579
commit 61ec7723f6
No known key found for this signature in database
GPG key ID: 7C062498C7FA6E49

View file

@ -1413,9 +1413,8 @@ main() {
pw="" pw=""
if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then
pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8) pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
hash=$(echo -n ${pw} | sha256sum | sed 's/\s.*$//' | sha256sum | sed 's/\s.*$//') . /opt/pihole/webpage.sh
hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//') echo "WEBPASSWORD=$(HashPassword ${1})
echo "WEBPASSWORD=$(echo -n ${pw} | sha256sum | sed 's/\s.*$//' | sha256sum | sed 's/\s.*$//')" >> ${setupVars}
fi fi
fi fi