make_repo more defensive.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
Dan Schaper 2016-12-31 23:59:07 -08:00
parent ffb8a74111
commit ab9c8f4859
No known key found for this signature in database
GPG key ID: 572E999E385B7BFC

View file

@ -161,11 +161,8 @@ make_repo() {
if [[ -d "${directory}" ]]; then if [[ -d "${directory}" ]]; then
rm -rf "${directory}" rm -rf "${directory}"
fi fi
if ! git clone -q --depth 1 "${remoteRepo}" "${directory}" &> /dev/null; then git clone -q --depth 1 "${remoteRepo}" "${directory}" &> /dev/null || return $?
return $? echo " done!"
else
echo " done!"
fi
return 0 return 0
} }
@ -189,7 +186,10 @@ getGitFiles() {
if is_repo "${directory}"; then if is_repo "${directory}"; then
update_repo "${directory}" update_repo "${directory}"
else else
make_repo "${directory}" "${remoteRepo}" || { echo "!!! Unable to clone ${remoteRepo}"; return 1; } make_repo "${directory}" "${remoteRepo}" || \
{ echo "!!! Unable to clone ${remoteRepo} into ${directory}"; \
return 1; \
}
fi fi
return 0 return 0
} }
@ -1091,8 +1091,8 @@ main() {
echo "::: --reconfigure passed to install script. Not downloading/updating local repos" echo "::: --reconfigure passed to install script. Not downloading/updating local repos"
else else
# Get Git files for Core and Admin # Get Git files for Core and Admin
getGitFiles ${PI_HOLE_LOCAL_REPO} ${piholeGitUrl} getGitFiles ${PI_HOLE_LOCAL_REPO} ${piholeGitUrl} || { echo "Unable to clone ${piholeGitUrl}"; exit 1; }
getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl} getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl} || { echo "Unable to clone ${webInterfaceGitUrl}"; exit 1; }
fi fi
if [[ ${useUpdateVars} == false ]]; then if [[ ${useUpdateVars} == false ]]; then