1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-18 06:08:21 +00:00

Update is_repo() to use git status for validity checks.

This commit is contained in:
Dan Schaper 2016-10-09 23:53:18 -07:00
parent dac2b8942e
commit 8a15fd44d5

View File

@ -632,36 +632,31 @@ 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} update_repo ${piholeFilesDir}
else else
update_repo ${piholeFilesDir} 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} # make_repo ${webInterfaceDir} ${webInterfaceGitUrl}
else #else
update_repo ${webInterfaceDir} # update_repo ${webInterfaceDir}
fi # fi
} }
is_repo() { is_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 || return 1
echo " OK!" git status && echo " OK!"; return 0 || echo " not found!"; return 1
return 1
fi
echo " not found!!"
return 0
} }
make_repo() { make_repo() {
# Remove the non-repod interface and clone the interface # Remove the non-repod interface and clone the interface
echo -n "::: Cloning $2 into $1..." echo -n "::: Cloning $2 into $1..."
rm -rf "$1" rm -rf "$1"
git clone -q "$2" "$1" > /dev/null & spinner $! git clone -q --depth 1 "$2" "$1" > /dev/null & spinner $!
echo " done!" echo " done!"
} }
@ -788,11 +783,10 @@ installPihole() {
chmod 775 /var/www/html chmod 775 /var/www/html
usermod -a -G ${LIGHTTPD_GROUP} pihole usermod -a -G ${LIGHTTPD_GROUP} pihole
if [ -x "$(command -v lighty-enable-mod)" ]; then if [ -x "$(command -v lighty-enable-mod)" ]; then
lighty-enable-mod fastcgi fastcgi-php > /dev/null lighty-enable-mod fastcgi fastcgi-php > /dev/null || true
else else
printf "\n:::\tWarning: 'lighty-enable-mod' utility not found. Please ensure fastcgi is enabled if you experience issues.\n" printf "\n:::\tWarning: 'lighty-enable-mod' utility not found. Please ensure fastcgi is enabled if you experience issues.\n"
fi fi
getGitFiles getGitFiles
installScripts installScripts
installConfigs installConfigs