mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 23:08:07 +00:00
Remove temp dir created when downloading FTL
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
2841a33b81
commit
123ba1f154
@ -1777,7 +1777,8 @@ FTLinstall() {
|
|||||||
|
|
||||||
# Move into the temp ftl directory
|
# Move into the temp ftl directory
|
||||||
pushd "$(mktemp -d)" > /dev/null || { printf "Unable to make temporary directory for FTL binary download\\n"; return 1; }
|
pushd "$(mktemp -d)" > /dev/null || { printf "Unable to make temporary directory for FTL binary download\\n"; return 1; }
|
||||||
|
local tempdir
|
||||||
|
tempdir="$(pwd)"
|
||||||
local ftlBranch
|
local ftlBranch
|
||||||
local url
|
local url
|
||||||
|
|
||||||
@ -1819,12 +1820,19 @@ FTLinstall() {
|
|||||||
|
|
||||||
# Installed the FTL service
|
# Installed the FTL service
|
||||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
|
|
||||||
|
# Remove temp dir
|
||||||
|
remove_dir "${tempdir}"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
# Otherwise, the hash download failed, so print and exit.
|
# Otherwise, the hash download failed, so print and exit.
|
||||||
popd > /dev/null || { printf "Unable to return to original directory after FTL binary download.\\n"; return 1; }
|
popd > /dev/null || { printf "Unable to return to original directory after FTL binary download.\\n"; return 1; }
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
printf " %b Error: Download of %s/%s failed (checksum error)%b\\n" "${COL_LIGHT_RED}" "${url}" "${binary}" "${COL_NC}"
|
printf " %b Error: Download of %s/%s failed (checksum error)%b\\n" "${COL_LIGHT_RED}" "${url}" "${binary}" "${COL_NC}"
|
||||||
|
|
||||||
|
# Remove temp dir
|
||||||
|
remove_dir "${tempdir}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -1833,10 +1841,19 @@ FTLinstall() {
|
|||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
# The URL could not be found
|
# The URL could not be found
|
||||||
printf " %b Error: URL %s/%s not found%b\\n" "${COL_LIGHT_RED}" "${url}" "${binary}" "${COL_NC}"
|
printf " %b Error: URL %s/%s not found%b\\n" "${COL_LIGHT_RED}" "${url}" "${binary}" "${COL_NC}"
|
||||||
|
|
||||||
|
# Remove temp dir
|
||||||
|
remove_dir "${tempdir}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_dir() {
|
||||||
|
# Delete dir
|
||||||
|
rm -r "${1}" > /dev/null 2>&1 || \
|
||||||
|
echo -e " ${CROSS} Unable to remove ${1}"
|
||||||
|
}
|
||||||
|
|
||||||
get_binary_name() {
|
get_binary_name() {
|
||||||
# Get the OS architecture (we cannot use uname -m as this may return an incorrect architecture when buildx-compiling with QEMU for arm)
|
# Get the OS architecture (we cannot use uname -m as this may return an incorrect architecture when buildx-compiling with QEMU for arm)
|
||||||
local machine
|
local machine
|
||||||
|
Loading…
Reference in New Issue
Block a user