Modified is_repo

This commit is contained in:
Dan Schaper 2016-11-02 03:09:59 -07:00
parent 7d414b5628
commit 34482c5ed6

View file

@ -22,16 +22,15 @@ readonly PI_HOLE_FILES_DIR="/etc/.pihole"
is_repo() { is_repo() {
# Use git to check if directory is currently under VCS # Use git to check if directory is currently under VCS
local directory="${1}" local directory="${1}"
local gitRepo=0
echo -n "::: Checking if ${directory} is a repo... " echo -n "::: Checking if ${directory} is a repo... "
cd "${directory}" &> /dev/null || return 1 cd "${directory}" &> /dev/null || false
if [[ $(git status --short &> /dev/null) ]]; then if [[ $(git status --short &> /dev/null) -eq 0 ]]; then
echo "OK" echo "OK"
true
else else
echo "not found!" echo "not found!"
gitRepo=1 false
fi; fi;
return ${gitRepo}
} }
make_repo() { make_repo() {
@ -65,7 +64,7 @@ getGitFiles() {
main() { main() {
is_repo "${PI_HOLE_FILES_DIR}" &> /dev/null is_repo "${PI_HOLE_FILES_DIR}"
if [[ $? -eq 1 ]]; then #This is unlikely if [[ $? -eq 1 ]]; then #This is unlikely
echo "::: Critical Error: Pi-Hole repo missing from system!" echo "::: Critical Error: Pi-Hole repo missing from system!"
echo "::: Please re-run install script from https://github.com/pi-hole/pi-hole" echo "::: Please re-run install script from https://github.com/pi-hole/pi-hole"