From 8a14a63d5d81a9bfbab049a6568596c55cfa692b Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 8 Mar 2017 13:16:40 +0100 Subject: [PATCH 01/11] Pi-hole checkout feature --- advanced/Scripts/piholeCheckout.sh | 163 +++++++++++++++++++++++++++++ advanced/bash-completion/pihole | 2 +- pihole | 10 +- 3 files changed, 172 insertions(+), 3 deletions(-) create mode 100644 advanced/Scripts/piholeCheckout.sh diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh new file mode 100644 index 00000000..7d1df415 --- /dev/null +++ b/advanced/Scripts/piholeCheckout.sh @@ -0,0 +1,163 @@ +#!/usr/bin/env bash +# Pi-hole: A black hole for Internet advertisements +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# +# Checkout other branches than master +# +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + +readonly WEB_INTERFACE_GIT_URL="https://github.com/pi-hole/AdminLTE.git" +readonly WEB_INTERFACE_DIR="/var/www/html/admin" +readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git" +readonly PI_HOLE_FILES_DIR="/etc/.pihole" + +is_repo() { + # Use git to check if directory is currently under VCS, return the value + local directory="${1}" + local curdir + local rc + + curdir="${PWD}" + cd "${directory}" || return 1 + # Capture any possible output + git status --short &> /dev/null + rc=$? + cd "${curdir}" || return 1 + return $rc +} + +fully_fetch_repo() { + # Add upstream branches to shallow clone + local directory="${1}" + local curdir + local rc + + curdir="${PWD}" + cd "${directory}" || return 1 + git remote set-branches origin '*' || return 1 + git fetch --quiet || return 1 + cd "${curdir}" || return 1 + return +} + +get_available_branches(){ + # Return available branches + local directory="${1}" + local curdir + + curdir="${PWD}" + cd "${directory}" || return 1 + # Get reachable remote branches + git remote show origin | grep 'tracked' | sed 's/tracked//;s/ //g' + cd "${curdir}" || return 1 + return +} + +checkout_pull_branch() { + # Check out specified branch + local directory="${1}" + local branch="${2}" + local curdir + + curdir="${PWD}" + cd "${directory}" || return 1 + git checkout "${branch}" + git pull + cd "${curdir}" || return 1 + return +} + +warning1() { + echo "::: Note that changing the branch is a severe change of your Pi-hole system." + echo "::: This is not supported unless one of the developers explicitly asks you to do this!" + read -r -p "::: Have you read and understood this? [y/N] " response + case ${response} in + [yY][eE][sS]|[yY]) + echo "::: Continuing." + return 0 + ;; + *) + echo "::: Aborting." + return 1 + ;; + esac +} + +checkout() +{ + local corebranches + local webbranches + + # Avoid globbing + set -f + + #This is unlikely + if ! is_repo "${PI_HOLE_FILES_DIR}" || ! is_repo "${WEB_INTERFACE_DIR}" ; then + echo "::: Critical Error: One or more Pi-Hole repos are missing from your system!" + echo "::: Please re-run the install script from https://github.com/pi-hole/pi-hole" + exit 1 + fi + + if ! warning1 ; then + exit 1 + fi + + echo -n "::: Fetching remote branches for Pi-hole core from ${PI_HOLE_GIT_URL} ... " + if ! fully_fetch_repo "${PI_HOLE_FILES_DIR}" ; then + echo "::: Fetching all branches for Pi-hole core repo failed!" + exit 1 + fi + corebranches=($(get_available_branches "${PI_HOLE_FILES_DIR}")) + echo " done!" + echo "::: ${#corebranches[@]} branches available" + echo ":::" + + echo -n "::: Fetching remote branches for the web interface from ${WEB_INTERFACE_GIT_URL} ... " + if ! fully_fetch_repo "${WEB_INTERFACE_DIR}" ; then + echo "::: Fetching all branches for Pi-hole web interface repo failed!" + exit 1 + fi + webbranches=($(get_available_branches "${WEB_INTERFACE_DIR}")) + echo " done!" + echo "::: ${#webbranches[@]} branches available" + echo ":::" + + if [[ "${2}" == "dev" ]] ; then + # Shortcut to check out development version + echo "::: Shortcut \"dev\" detected - checking out development / devel branches ..." + echo "::: Pi-hole core" + checkout_pull_branch "${PI_HOLE_FILES_DIR}" "development" + echo "::: Web interface" + checkout_pull_branch "${WEB_INTERFACE_DIR}" "devel" + echo "::: done!" + elif [[ "${2}" == "core" ]] ; then + # Have to user chosing the branch he wants + if ! (for e in "${corebranches[@]}"; do [[ "$e" == "${3}" ]] && exit 0; done); then + echo "::: Requested branch \"${3}\" is not available!" + echo "::: Available branches for core are:" + for e in "${corebranches[@]}"; do echo "::: $e"; done + exit 1 + fi + checkout_pull_branch "${PI_HOLE_FILES_DIR}" "${3}" + elif [[ "${2}" == "web" ]] ; then + # Have to user chosing the branch he wants + if ! (for e in "${webbranches[@]}"; do [[ "$e" == "${3}" ]] && exit 0; done); then + echo "::: Requested branch \"${3}\" is not available!" + echo "::: Available branches for web are:" + for e in "${webbranches[@]}"; do echo "::: $e"; done + exit 1 + fi + checkout_pull_branch "${WEB_INTERFACE_DIR}" "${3}" + else + echo "::: Requested option \"${2}\" is not available!" + exit 1 + fi + + # Force updating everything + echo "::: Running installer to upgrade your installation" + /etc/.pihole/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 + + exit 0 +} diff --git a/advanced/bash-completion/pihole b/advanced/bash-completion/pihole index 05baa820..fc8f2162 100644 --- a/advanced/bash-completion/pihole +++ b/advanced/bash-completion/pihole @@ -3,7 +3,7 @@ _pihole() { COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" - opts="admin blacklist chronometer debug disable enable flush help logging query reconfigure restartdns setupLCD status tail uninstall updateGravity updatePihole version whitelist" + opts="admin blacklist chronometer debug disable enable flush help logging query reconfigure restartdns setupLCD status tail uninstall updateGravity updatePihole version whitelist checkout" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 diff --git a/pihole b/pihole index 324c03c9..38c7160f 100755 --- a/pihole +++ b/pihole @@ -8,9 +8,8 @@ # This file is copyright under the latest version of the EUPL. # Please see LICENSE file for your rights under this license. +readonly PI_HOLE_SCRIPT_DIR="/opt/pihole" - -PI_HOLE_SCRIPT_DIR="/opt/pihole" readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf" # Must be root to use this tool if [[ ! $EUID -eq 0 ]];then @@ -280,6 +279,11 @@ tailFunc() { exit 0 } +piholeCheckoutFunc() { + source "${PI_HOLE_SCRIPT_DIR}"/piholeCheckout.sh + checkout "$@" +} + helpFunc() { cat << EOM ::: Control all PiHole specific functions! @@ -313,6 +317,7 @@ helpFunc() { ::: Blocking can also be disabled only temporarily, e.g., ::: 'pihole disable 5m' - will disable blocking for 5 minutes ::: restartdns Restart dnsmasq +::: checkout Check out different branches EOM exit 0 } @@ -343,5 +348,6 @@ case "${1}" in "restartdns" ) restartDNS;; "-a" | "admin" ) webpageFunc "$@";; "-t" | "tail" ) tailFunc;; + "checkout" ) piholeCheckoutFunc "$@";; * ) helpFunc;; esac From d2ab0694b7ce31b1a8fca6d1d6b06102b90f68b2 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 8 Mar 2017 13:18:34 +0100 Subject: [PATCH 02/11] Add "master" shortcut --- advanced/Scripts/piholeCheckout.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh index 7d1df415..e32c8e06 100644 --- a/advanced/Scripts/piholeCheckout.sh +++ b/advanced/Scripts/piholeCheckout.sh @@ -125,13 +125,21 @@ checkout() echo ":::" if [[ "${2}" == "dev" ]] ; then - # Shortcut to check out development version + # Shortcut to check out development branches echo "::: Shortcut \"dev\" detected - checking out development / devel branches ..." echo "::: Pi-hole core" checkout_pull_branch "${PI_HOLE_FILES_DIR}" "development" echo "::: Web interface" checkout_pull_branch "${WEB_INTERFACE_DIR}" "devel" echo "::: done!" + elif [[ "${2}" == "master" ]] ; then + # Shortcut to check out master branches + echo "::: Shortcut \"master\" detected - checking out master branches ..." + echo "::: Pi-hole core" + checkout_pull_branch "${PI_HOLE_FILES_DIR}" "master" + echo "::: Web interface" + checkout_pull_branch "${WEB_INTERFACE_DIR}" "master" + echo "::: done!" elif [[ "${2}" == "core" ]] ; then # Have to user chosing the branch he wants if ! (for e in "${corebranches[@]}"; do [[ "$e" == "${3}" ]] && exit 0; done); then From 56e17d1010c8bc4f25816fa986cbacd8ed175caf Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 8 Mar 2017 13:27:48 -0800 Subject: [PATCH 03/11] Source functions and variables from basic-install.sh Signed-off-by: Dan Schaper --- advanced/Scripts/piholeCheckout.sh | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh index e32c8e06..4133facb 100644 --- a/advanced/Scripts/piholeCheckout.sh +++ b/advanced/Scripts/piholeCheckout.sh @@ -8,25 +8,15 @@ # This file is copyright under the latest version of the EUPL. # Please see LICENSE file for your rights under this license. +readonly PI_HOLE_FILES_DIR="/etc/.pihole" +PH_TEST=true source ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh + readonly WEB_INTERFACE_GIT_URL="https://github.com/pi-hole/AdminLTE.git" readonly WEB_INTERFACE_DIR="/var/www/html/admin" readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git" -readonly PI_HOLE_FILES_DIR="/etc/.pihole" -is_repo() { - # Use git to check if directory is currently under VCS, return the value - local directory="${1}" - local curdir - local rc - curdir="${PWD}" - cd "${directory}" || return 1 - # Capture any possible output - git status --short &> /dev/null - rc=$? - cd "${curdir}" || return 1 - return $rc -} +# is_repo() sourced from basic-install.sh fully_fetch_repo() { # Add upstream branches to shallow clone From 89ff99322d598027eb615c02779466afd08b5303 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 8 Mar 2017 13:30:08 -0800 Subject: [PATCH 04/11] Don't need to remember `pwd` inside a function, calling function doesn't change directories. Signed-off-by: Dan Schaper --- advanced/Scripts/piholeCheckout.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh index 4133facb..732434a1 100644 --- a/advanced/Scripts/piholeCheckout.sh +++ b/advanced/Scripts/piholeCheckout.sh @@ -21,15 +21,10 @@ readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git" fully_fetch_repo() { # Add upstream branches to shallow clone local directory="${1}" - local curdir - local rc - curdir="${PWD}" cd "${directory}" || return 1 - git remote set-branches origin '*' || return 1 - git fetch --quiet || return 1 - cd "${curdir}" || return 1 - return + git fetch --quiet --unshallow || return 1 + return 0 } get_available_branches(){ From b522d8eaf6fa897529dfe1eef5f04d3cf1257f7d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 8 Mar 2017 13:41:11 -0800 Subject: [PATCH 05/11] Source and reuse existing variables, centralize code. Signed-off-by: Dan Schaper --- advanced/Scripts/piholeCheckout.sh | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh index 732434a1..1c6711f4 100644 --- a/advanced/Scripts/piholeCheckout.sh +++ b/advanced/Scripts/piholeCheckout.sh @@ -11,11 +11,9 @@ readonly PI_HOLE_FILES_DIR="/etc/.pihole" PH_TEST=true source ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh -readonly WEB_INTERFACE_GIT_URL="https://github.com/pi-hole/AdminLTE.git" -readonly WEB_INTERFACE_DIR="/var/www/html/admin" -readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git" - - +# webInterfaceGitUrl set in basic-install.sh +# webInterfaceDir set in basic-install.sh +# piholeGitURL set in basic-install.sh # is_repo() sourced from basic-install.sh fully_fetch_repo() { @@ -79,7 +77,7 @@ checkout() set -f #This is unlikely - if ! is_repo "${PI_HOLE_FILES_DIR}" || ! is_repo "${WEB_INTERFACE_DIR}" ; then + if ! is_repo "${PI_HOLE_FILES_DIR}" || ! is_repo "${webInterfaceDir}" ; then echo "::: Critical Error: One or more Pi-Hole repos are missing from your system!" echo "::: Please re-run the install script from https://github.com/pi-hole/pi-hole" exit 1 @@ -89,7 +87,7 @@ checkout() exit 1 fi - echo -n "::: Fetching remote branches for Pi-hole core from ${PI_HOLE_GIT_URL} ... " + echo -n "::: Fetching remote branches for Pi-hole core from ${piholeGitUrl} ... " if ! fully_fetch_repo "${PI_HOLE_FILES_DIR}" ; then echo "::: Fetching all branches for Pi-hole core repo failed!" exit 1 @@ -99,12 +97,12 @@ checkout() echo "::: ${#corebranches[@]} branches available" echo ":::" - echo -n "::: Fetching remote branches for the web interface from ${WEB_INTERFACE_GIT_URL} ... " - if ! fully_fetch_repo "${WEB_INTERFACE_DIR}" ; then + echo -n "::: Fetching remote branches for the web interface from ${webInterfaceGitUrl} ... " + if ! fully_fetch_repo "${webInterfaceDir}" ; then echo "::: Fetching all branches for Pi-hole web interface repo failed!" exit 1 fi - webbranches=($(get_available_branches "${WEB_INTERFACE_DIR}")) + webbranches=($(get_available_branches "${webInterfaceDir}")) echo " done!" echo "::: ${#webbranches[@]} branches available" echo ":::" @@ -115,7 +113,7 @@ checkout() echo "::: Pi-hole core" checkout_pull_branch "${PI_HOLE_FILES_DIR}" "development" echo "::: Web interface" - checkout_pull_branch "${WEB_INTERFACE_DIR}" "devel" + checkout_pull_branch "${webInterfaceDir}" "devel" echo "::: done!" elif [[ "${2}" == "master" ]] ; then # Shortcut to check out master branches @@ -123,7 +121,7 @@ checkout() echo "::: Pi-hole core" checkout_pull_branch "${PI_HOLE_FILES_DIR}" "master" echo "::: Web interface" - checkout_pull_branch "${WEB_INTERFACE_DIR}" "master" + checkout_pull_branch "${webInterfaceDir}" "master" echo "::: done!" elif [[ "${2}" == "core" ]] ; then # Have to user chosing the branch he wants @@ -142,7 +140,7 @@ checkout() for e in "${webbranches[@]}"; do echo "::: $e"; done exit 1 fi - checkout_pull_branch "${WEB_INTERFACE_DIR}" "${3}" + checkout_pull_branch "${webInterfaceDir}" "${3}" else echo "::: Requested option \"${2}\" is not available!" exit 1 @@ -150,7 +148,7 @@ checkout() # Force updating everything echo "::: Running installer to upgrade your installation" - /etc/.pihole/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 + ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 exit 0 } From b8f1eadb7f2bd82d552deaab6086230bca634420 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 8 Mar 2017 13:57:35 -0800 Subject: [PATCH 06/11] Shift off `checkout` from being passed to script from `pihole` Signed-off-by: Dan Schaper --- advanced/Scripts/piholeCheckout.sh | 17 +++++++++++------ pihole | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh index 1c6711f4..94ae5a16 100644 --- a/advanced/Scripts/piholeCheckout.sh +++ b/advanced/Scripts/piholeCheckout.sh @@ -9,7 +9,7 @@ # Please see LICENSE file for your rights under this license. 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 # webInterfaceDir set in basic-install.sh @@ -21,7 +21,11 @@ fully_fetch_repo() { local directory="${1}" cd "${directory}" || return 1 - git fetch --quiet --unshallow || return 1 + if is_repo "${directory}"; then + git fetch --quiet --unshallow &> /dev/null || true # Deep repo's cause errors but are valid repos. + else + return 1 + fi return 0 } @@ -107,7 +111,7 @@ checkout() echo "::: ${#webbranches[@]} branches available" echo ":::" - if [[ "${2}" == "dev" ]] ; then + if [[ "${1}" == "dev" ]] ; then # Shortcut to check out development branches echo "::: Shortcut \"dev\" detected - checking out development / devel branches ..." echo "::: Pi-hole core" @@ -115,7 +119,7 @@ checkout() echo "::: Web interface" checkout_pull_branch "${webInterfaceDir}" "devel" echo "::: done!" - elif [[ "${2}" == "master" ]] ; then + elif [[ "${1}" == "master" ]] ; then # Shortcut to check out master branches echo "::: Shortcut \"master\" detected - checking out master branches ..." echo "::: Pi-hole core" @@ -123,7 +127,7 @@ checkout() echo "::: Web interface" checkout_pull_branch "${webInterfaceDir}" "master" echo "::: done!" - elif [[ "${2}" == "core" ]] ; then + elif [[ "${1}" == "core" ]] ; then # Have to user chosing the branch he wants if ! (for e in "${corebranches[@]}"; do [[ "$e" == "${3}" ]] && exit 0; done); then echo "::: Requested branch \"${3}\" is not available!" @@ -132,7 +136,7 @@ checkout() exit 1 fi checkout_pull_branch "${PI_HOLE_FILES_DIR}" "${3}" - elif [[ "${2}" == "web" ]] ; then + elif [[ "${1}" == "web" ]] ; then # Have to user chosing the branch he wants if ! (for e in "${webbranches[@]}"; do [[ "$e" == "${3}" ]] && exit 0; done); then echo "::: Requested branch \"${3}\" is not available!" @@ -152,3 +156,4 @@ checkout() exit 0 } + diff --git a/pihole b/pihole index 38c7160f..dda6d750 100755 --- a/pihole +++ b/pihole @@ -281,6 +281,7 @@ tailFunc() { piholeCheckoutFunc() { source "${PI_HOLE_SCRIPT_DIR}"/piholeCheckout.sh + shift checkout "$@" } From 87da40068ccfb09118927b7ebf9c471d519c28e8 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 8 Mar 2017 14:17:20 -0800 Subject: [PATCH 07/11] Always `exit`ed with value 1, now exits with proper value. Signed-off-by: Dan Schaper --- advanced/Scripts/piholeCheckout.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh index 94ae5a16..cabafc04 100644 --- a/advanced/Scripts/piholeCheckout.sh +++ b/advanced/Scripts/piholeCheckout.sh @@ -152,8 +152,11 @@ checkout() # Force updating everything echo "::: Running installer to upgrade your installation" - ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 - - exit 0 + if ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --unattended; then + exit 0 + else + echo "Unable to complete update, contact Pi-hole" + exit 1 + fi } From a9b52518bf44eb47f2c9dc9e7b53b0803ea546eb Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 8 Mar 2017 14:29:51 -0800 Subject: [PATCH 08/11] Shift numbers for argument identifiers, functions are called after `shift` Signed-off-by: Dan Schaper --- advanced/Scripts/piholeCheckout.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh index cabafc04..c1eacd6d 100644 --- a/advanced/Scripts/piholeCheckout.sh +++ b/advanced/Scripts/piholeCheckout.sh @@ -129,24 +129,24 @@ checkout() echo "::: done!" elif [[ "${1}" == "core" ]] ; then # Have to user chosing the branch he wants - if ! (for e in "${corebranches[@]}"; do [[ "$e" == "${3}" ]] && exit 0; done); then - echo "::: Requested branch \"${3}\" is not available!" + if ! (for e in "${corebranches[@]}"; do [[ "$e" == "${2}" ]] && exit 0; done); then + echo "::: Requested branch \"${2}\" is not available!" echo "::: Available branches for core are:" for e in "${corebranches[@]}"; do echo "::: $e"; done exit 1 fi - checkout_pull_branch "${PI_HOLE_FILES_DIR}" "${3}" + checkout_pull_branch "${PI_HOLE_FILES_DIR}" "${2}" elif [[ "${1}" == "web" ]] ; then # Have to user chosing the branch he wants - if ! (for e in "${webbranches[@]}"; do [[ "$e" == "${3}" ]] && exit 0; done); then - echo "::: Requested branch \"${3}\" is not available!" + if ! (for e in "${webbranches[@]}"; do [[ "$e" == "${2}" ]] && exit 0; done); then + echo "::: Requested branch \"${2}\" is not available!" echo "::: Available branches for web are:" for e in "${webbranches[@]}"; do echo "::: $e"; done exit 1 fi checkout_pull_branch "${webInterfaceDir}" "${3}" else - echo "::: Requested option \"${2}\" is not available!" + echo "::: Requested option \"${1}\" is not available!" exit 1 fi From fd310c6445e63d1a86dbde5c385d0eb89e9d1993 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 9 Mar 2017 00:28:02 +0100 Subject: [PATCH 09/11] Back to how we had it before, because --unshallow does not work at all --- advanced/Scripts/piholeCheckout.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh index c1eacd6d..c0ac62e1 100644 --- a/advanced/Scripts/piholeCheckout.sh +++ b/advanced/Scripts/piholeCheckout.sh @@ -22,7 +22,8 @@ fully_fetch_repo() { cd "${directory}" || return 1 if is_repo "${directory}"; then - git fetch --quiet --unshallow &> /dev/null || true # Deep repo's cause errors but are valid repos. + git remote set-branches origin '*' || return 1 + git fetch --quiet || return 1 else return 1 fi From 81a1057cac768bc592f2b2676ecfb16a8921a6cf Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 9 Mar 2017 00:30:36 +0100 Subject: [PATCH 10/11] Fix something Dan has overlooked --- advanced/Scripts/piholeCheckout.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh index c0ac62e1..86ea9a2b 100644 --- a/advanced/Scripts/piholeCheckout.sh +++ b/advanced/Scripts/piholeCheckout.sh @@ -145,7 +145,7 @@ checkout() for e in "${webbranches[@]}"; do echo "::: $e"; done exit 1 fi - checkout_pull_branch "${webInterfaceDir}" "${3}" + checkout_pull_branch "${webInterfaceDir}" "${2}" else echo "::: Requested option \"${1}\" is not available!" exit 1 From 273728b481c131d1010f662f533278e4903d91d2 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 8 Mar 2017 15:32:06 -0800 Subject: [PATCH 11/11] One more argument to shift. Signed-off-by: Dan Schaper --- advanced/Scripts/piholeCheckout.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh index c1eacd6d..fa835c00 100644 --- a/advanced/Scripts/piholeCheckout.sh +++ b/advanced/Scripts/piholeCheckout.sh @@ -144,7 +144,7 @@ checkout() for e in "${webbranches[@]}"; do echo "::: $e"; done exit 1 fi - checkout_pull_branch "${webInterfaceDir}" "${3}" + checkout_pull_branch "${webInterfaceDir}" "${2}" else echo "::: Requested option \"${1}\" is not available!" exit 1