mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-21 21:53:43 +00:00
Exit 1 on failure (#5803)
This commit is contained in:
commit
1a4870690b
3 changed files with 10 additions and 7 deletions
|
@ -192,7 +192,7 @@ GetComment() {
|
||||||
comment="$1"
|
comment="$1"
|
||||||
if [[ "${comment}" =~ [^a-zA-Z0-9_\#:/\.,\ -] ]]; then
|
if [[ "${comment}" =~ [^a-zA-Z0-9_\#:/\.,\ -] ]]; then
|
||||||
echo " ${CROSS} Found invalid characters in domain comment!"
|
echo " ${CROSS} Found invalid characters in domain comment!"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,13 @@ GitCheckUpdateAvail() {
|
||||||
local curBranch
|
local curBranch
|
||||||
directory="${1}"
|
directory="${1}"
|
||||||
curdir=$PWD
|
curdir=$PWD
|
||||||
cd "${directory}" || return
|
cd "${directory}" || exit 1
|
||||||
|
|
||||||
# Fetch latest changes in this repo
|
# Fetch latest changes in this repo
|
||||||
git fetch --quiet origin
|
if ! git fetch --quiet origin ; then
|
||||||
|
echo -e "\\n ${COL_LIGHT_RED}Error: Unable to update local repository. Contact Pi-hole Support.${COL_NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Check current branch. If it is master, then check for the latest available tag instead of latest commit.
|
# Check current branch. If it is master, then check for the latest available tag instead of latest commit.
|
||||||
curBranch=$(git rev-parse --abbrev-ref HEAD)
|
curBranch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
@ -71,17 +74,17 @@ GitCheckUpdateAvail() {
|
||||||
echo -e "\\n ${COL_LIGHT_RED}Error: Local revision could not be obtained, please contact Pi-hole Support"
|
echo -e "\\n ${COL_LIGHT_RED}Error: Local revision could not be obtained, please contact Pi-hole Support"
|
||||||
echo -e " Additional debugging output:${COL_NC}"
|
echo -e " Additional debugging output:${COL_NC}"
|
||||||
git status
|
git status
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ "${#REMOTE}" == 0 ]]; then
|
if [[ "${#REMOTE}" == 0 ]]; then
|
||||||
echo -e "\\n ${COL_LIGHT_RED}Error: Remote revision could not be obtained, please contact Pi-hole Support"
|
echo -e "\\n ${COL_LIGHT_RED}Error: Remote revision could not be obtained, please contact Pi-hole Support"
|
||||||
echo -e " Additional debugging output:${COL_NC}"
|
echo -e " Additional debugging output:${COL_NC}"
|
||||||
git status
|
git status
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change back to original directory
|
# Change back to original directory
|
||||||
cd "${curdir}" || exit
|
cd "${curdir}" || exit 1
|
||||||
|
|
||||||
if [[ "${LOCAL}" != "${REMOTE}" ]]; then
|
if [[ "${LOCAL}" != "${REMOTE}" ]]; then
|
||||||
# Local branch is behind remote branch -> Update
|
# Local branch is behind remote branch -> Update
|
||||||
|
|
|
@ -409,7 +409,7 @@ package_manager_detect() {
|
||||||
# we cannot install required packages
|
# we cannot install required packages
|
||||||
printf " %b No supported package manager found\\n" "${CROSS}"
|
printf " %b No supported package manager found\\n" "${CROSS}"
|
||||||
# so exit the installer
|
# so exit the installer
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue