mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 06:10:20 +00:00
Use git diff to determine if code has changed (no need to run the installer if it hasn't changed at all)
This commit is contained in:
parent
1d60b62e7a
commit
febdb4a190
1 changed files with 9 additions and 3 deletions
|
@ -9,13 +9,15 @@
|
||||||
# Please see LICENSE file for your rights under this license.
|
# Please see LICENSE file for your rights under this license.
|
||||||
|
|
||||||
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
||||||
PH_TEST="true" source ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh
|
PH_TEST="true" source "${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh"
|
||||||
|
|
||||||
# webInterfaceGitUrl set in basic-install.sh
|
# webInterfaceGitUrl set in basic-install.sh
|
||||||
# webInterfaceDir set in basic-install.sh
|
# webInterfaceDir set in basic-install.sh
|
||||||
# piholeGitURL set in basic-install.sh
|
# piholeGitURL set in basic-install.sh
|
||||||
# is_repo() sourced from basic-install.sh
|
# is_repo() sourced from basic-install.sh
|
||||||
|
|
||||||
|
update=false
|
||||||
|
|
||||||
fully_fetch_repo() {
|
fully_fetch_repo() {
|
||||||
# Add upstream branches to shallow clone
|
# Add upstream branches to shallow clone
|
||||||
local directory="${1}"
|
local directory="${1}"
|
||||||
|
@ -64,6 +66,10 @@ checkout_pull_branch() {
|
||||||
local branch="${2}"
|
local branch="${2}"
|
||||||
|
|
||||||
cd "${directory}" || return 1
|
cd "${directory}" || return 1
|
||||||
|
if [ "$(git diff "${branch}" | grep -c "^")" -gt "0" ]; then
|
||||||
|
update=true
|
||||||
|
fi
|
||||||
|
|
||||||
git checkout "${branch}" || return 1
|
git checkout "${branch}" || return 1
|
||||||
git pull || return 1
|
git pull || return 1
|
||||||
return 0
|
return 0
|
||||||
|
@ -169,9 +175,9 @@ checkout()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Force updating everything
|
# Force updating everything
|
||||||
if [[ ! "${1}" == "web" ]]; then
|
if [[ ! "${1}" == "web" && ${update} ]]; then
|
||||||
echo "::: Running installer to upgrade your installation"
|
echo "::: Running installer to upgrade your installation"
|
||||||
if ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --unattended; then
|
if "${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh" --unattended; then
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Unable to complete update, contact Pi-hole"
|
echo "Unable to complete update, contact Pi-hole"
|
||||||
|
|
Loading…
Reference in a new issue