mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-08 00:20:37 +00:00
Use git
to determine if directory is repository. Flip logic of getGitFiles
to make sense.
This commit is contained in:
parent
fc9468dec5
commit
763c310778
1 changed files with 12 additions and 9 deletions
|
@ -646,29 +646,32 @@ getGitFiles() {
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: Checking for existing base files..."
|
echo "::: Checking for existing base files..."
|
||||||
if is_repo ${piholeFilesDir}; then
|
if is_repo ${piholeFilesDir}; then
|
||||||
make_repo ${piholeFilesDir} ${piholeGitUrl}
|
|
||||||
else
|
|
||||||
update_repo ${piholeFilesDir}
|
update_repo ${piholeFilesDir}
|
||||||
|
else
|
||||||
|
make_repo ${piholeFilesDir} ${piholeGitUrl}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: Checking for existing web interface..."
|
echo "::: Checking for existing web interface..."
|
||||||
if is_repo ${webInterfaceDir}; then
|
if is_repo ${webInterfaceDir}; then
|
||||||
make_repo ${webInterfaceDir} ${webInterfaceGitUrl}
|
|
||||||
else
|
|
||||||
update_repo ${webInterfaceDir}
|
update_repo ${webInterfaceDir}
|
||||||
|
else
|
||||||
|
make_repo ${webInterfaceDir} ${webInterfaceGitUrl}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
is_repo() {
|
is_repo() {
|
||||||
# If the directory does not have a .git folder it is not a repo
|
# If the directory does not have a .git folder it is not a repo
|
||||||
echo -n "::: Checking $1 is a repo..."
|
echo -n "::: Checking $1 is a repo..."
|
||||||
if [ -d "$1/.git" ]; then
|
cd "$1"
|
||||||
echo " OK!"
|
# returns 0 if in git repo, non-zero if not in a repo
|
||||||
return 1
|
git status > /dev/null & spinner $!
|
||||||
|
if [[ "$?" -eq 0 ]]; then
|
||||||
|
echo " repository found!"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
echo " not found!!"
|
echo " repository not found!!"
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
make_repo() {
|
make_repo() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue