mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Merge branch 'feature/defensiveTweaks' of https://github.com/pi-hole/pi-hole into feature/defensiveTweaks
This commit is contained in:
commit
9c83825cb8
2 changed files with 20 additions and 18 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -21,15 +21,17 @@ readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
|||
|
||||
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
|
||||
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!"
|
||||
return 1
|
||||
fi
|
||||
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)"
|
||||
|
@ -111,7 +113,7 @@ elif [[ "${piholeVersion}" == "${piholeVersionLatest}" ]] && [[ "${webVersion}"
|
|||
echo "::: Pi-hole Web Admin files out of date"
|
||||
getGitFiles "${ADMIN_INTERFACE_DIR}" "${ADMIN_INTERFACE_GIT_URL}"
|
||||
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…
Reference in a new issue