Merge pull request #893 from diginc/feature/defensiveTweaks

Feature/defensive tweaks tweaks
pull/895/head
Dan Schaper 8 years ago committed by GitHub
commit 6605c269cf

@ -14,7 +14,7 @@ Works on most Debian and CentOS/RHEL based distributions!
```bash
wget -O basic-install.sh https://install.pi-hole.net
cat basic-install.sh | bash
bash basic-install.sh
```
If you wish to read over the script before running it, then after the [`wget`](https://linux.die.net/man/1/wget) command, run `nano basic-install.sh` to open the file in a text viewer.

@ -33,15 +33,17 @@ getGitFiles() {
is_repo() {
# Use git to check if directory is currently under VCS
echo -n "::: Checking $1 is a repo..."
cd "${1}" &> /dev/null || return 1
if [[ $(git status --short) ]]; then
echo " OK!"
return 0
else
echo " not found!"
return 1
fi
local directory="${1}"
local gitRepo=0
echo -n "::: Checking if ${directory} is a repo... "
cd "${directory}" &> /dev/null || return 1
if [[ $(git status --short > /dev/null) ]]; then
echo "OK"
else
echo "not found!"
gitRepo=1
fi;
return ${gitRepo}
}
make_repo() {
@ -74,14 +76,14 @@ fi
echo "::: Checking for updates..."
# Checks Pi-hole version > pihole only > current local git repo version : returns string in format vX.X.X
piholeVersion=$(/usr/local/bin/pihole -v -p -c)
piholeVersion="$(/usr/local/bin/pihole -v -p -c)"
# Checks Pi-hole version > pihole only > remote upstream repo version : returns string in format vX.X.X
piholeVersionLatest=$(/usr/local/bin/pihole -v -p -l)
piholeVersionLatest="$(/usr/local/bin/pihole -v -p -l)"
# Checks Pi-hole version > admin only > current local git repo version : returns string in format vX.X.X
webVersion=$(/usr/local/bin/pihole -v -a -c)
webVersion="$(/usr/local/bin/pihole -v -a -c)"
# Checks Pi-hole version > admin only > remote upstream repo version : returns string in format vX.X.X
webVersionLatest=$(/usr/local/bin/pihole -v -a -l)
webVersionLatest="$(/usr/local/bin/pihole -v -a -l)"
echo ":::"
echo "::: Pi-hole version is $piholeVersion (Latest version is $piholeVersionLatest)"
@ -107,11 +109,11 @@ if [[ "${piholeVersion}" == "${piholeVersionLatest}" ]] && [[ "${webVersion}" ==
echo ""
exit 0
elif [[ "${piholeVersion} == ${piholeVersionLatest}" ]] && [[ "${webVersion}" != "${webVersionLatest}" ]]; then
elif [[ "${piholeVersion}" == "${piholeVersionLatest}" ]] && [[ "${webVersion}" != "${webVersionLatest}" ]]; then
echo "::: Pi-hole Web Admin files out of date"
getGitFiles "${WEBINTERFACEDIR}" "${WEBINTERFACEGITURL}"
echo ":::"
webVersion=$(/usr/local/bin/pihole -v -a -c)
webVersion="$(/usr/local/bin/pihole -v -a -c)"
echo "::: Web Admin version is now at ${webVersion}"
echo "::: If you had made any changes in '/var/www/html/admin', they have been stashed using 'git stash'"
echo ""
@ -122,7 +124,7 @@ elif [[ "${piholeVersion}" != "${piholeVersionLatest}" ]] && [[ "${webVersion}"
/etc/.pihole/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1
echo ":::"
piholeVersion=$(/usr/local/bin/pihole -v -p -c)
piholeVersion="$(/usr/local/bin/pihole -v -p -c)"
echo "::: Pi-hole version is now at ${piholeVersion}"
echo "::: If you had made any changes in '/etc/.pihole', they have been stashed using 'git stash'"
echo ""
@ -133,9 +135,9 @@ elif [[ "${piholeVersion}" != "${piholeVersionLatest}" ]] && [[ "${webVersion}"
/etc/.pihole/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1
# Checks Pi-hole version > admin only > current local git repo version : returns string in format vX.X.X
webVersion=$(/usr/local/bin/pihole -v -a -c)
webVersion="$(/usr/local/bin/pihole -v -a -c)"
# Checks Pi-hole version > admin only > current local git repo version : returns string in format vX.X.X
piholeVersion=$(/usr/local/bin/pihole -v -p -c)
piholeVersion="$(/usr/local/bin/pihole -v -p -c)"
echo ":::"
echo "::: Pi-hole version is now at ${piholeVersion}"
echo "::: If you had made any changes in '/etc/.pihole', they have been stashed using 'git stash'"

Loading…
Cancel
Save