mirror of
https://github.com/pi-hole/pi-hole
synced 2024-11-18 06:08:21 +00:00
Just delete, no need to cd there first.
This commit is contained in:
parent
a0d9a1133c
commit
8dc9143b34
@ -20,9 +20,9 @@ readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git"
|
|||||||
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
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, do not exit if failed
|
||||||
local directory="${1}"
|
local directory="${1}"
|
||||||
cd "${directory}" &> /dev/null || false
|
cd "${directory}" &> /dev/null || false
|
||||||
git status --short &> /dev/null
|
git status --short &> /dev/null
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -30,17 +30,18 @@ is_repo() {
|
|||||||
prep_dirs() {
|
prep_dirs() {
|
||||||
# Prepare directory for local repository building
|
# Prepare directory for local repository building
|
||||||
local dir_to_clean="${1}"
|
local dir_to_clean="${1}"
|
||||||
cd "${dir_to_clean}" &> /dev/null || (echo "Unable to prepare directory, please contact support"; exit false)
|
rm -rf "${dir_to_clean}" &> /dev/null
|
||||||
rm -rf "${dir_to_clean}" &> /dev/null || (echo "Unable to prepare directory, please contact support"; exit false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
make_repo() {
|
make_repo() {
|
||||||
# Remove the non-repod interface and clone the interface
|
# Remove the non-repod interface and clone the interface
|
||||||
local source_repo="${2}"
|
local source_repo="${2}"
|
||||||
local dest_dir="${1}"
|
local dest_dir="${1}"
|
||||||
|
|
||||||
echo -n "::: Cloning ${source_repo} into ${dest_dir}..."
|
echo -n "::: Cloning ${source_repo} into ${dest_dir}..."
|
||||||
rm -rf "${dest_dir}"
|
prep_dirs "${dest_dir}"
|
||||||
git clone -q --depth 1 "${2}" "${1}" > /dev/null || exit 1
|
git clone -q --depth 1 "${source_repo}" "${dest_dir}" > /dev/null \
|
||||||
|
|| (echo "Unable to clone directory, please contact support"; exit false)
|
||||||
echo " done!"
|
echo " done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ getGitFiles() {
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
||||||
if ! is_repo "${PI_HOLE_FILES_DIR}" && ! is_repo "${ADMIN_INTERFACE_DIR}" ; then #This is unlikely
|
if ! is_repo "${PI_HOLE_FILES_DIR}" || ! is_repo "${ADMIN_INTERFACE_DIR}" ; then #This is unlikely
|
||||||
echo "::: Critical Error: One or more Pi-Hole repos are missing from system!"
|
echo "::: Critical Error: One or more Pi-Hole repos are 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"
|
||||||
exit 1;
|
exit 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user