mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
cd
to directory to sha1sum
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
parent
d76e761d0b
commit
a0c17368ed
1 changed files with 7 additions and 1 deletions
|
@ -1156,9 +1156,11 @@ FTLinstall() {
|
||||||
# Download and Install FTL binary
|
# Download and Install FTL binary
|
||||||
local binary="${1}"
|
local binary="${1}"
|
||||||
local latesttag
|
local latesttag
|
||||||
|
local orig_dir
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo -n "::: Installing FTL... "
|
echo -n "::: Installing FTL... "
|
||||||
|
|
||||||
|
orig_dir="${PWD}"
|
||||||
latesttag=$(curl -sI https://github.com/pi-hole/FTL/releases/latest | grep "Location" | awk -F '/' '{print $NF}')
|
latesttag=$(curl -sI https://github.com/pi-hole/FTL/releases/latest | grep "Location" | awk -F '/' '{print $NF}')
|
||||||
# Tags should always start with v, check for that.
|
# Tags should always start with v, check for that.
|
||||||
if [[ ! "${latesttag}" == v* ]]; then
|
if [[ ! "${latesttag}" == v* ]]; then
|
||||||
|
@ -1169,16 +1171,20 @@ FTLinstall() {
|
||||||
# Get sha1 of the binary we just downloaded for verification.
|
# Get sha1 of the binary we just downloaded for verification.
|
||||||
curl -sSL --fail "https://github.com/pi-hole/FTL/releases/download/${latesttag%$'\r'}/${binary}.sha1" -o "/tmp/${binary}.sha1"
|
curl -sSL --fail "https://github.com/pi-hole/FTL/releases/download/${latesttag%$'\r'}/${binary}.sha1" -o "/tmp/${binary}.sha1"
|
||||||
# Check if we just downloaded text, or a binary file.
|
# Check if we just downloaded text, or a binary file.
|
||||||
if sha1sum -c /tmp/"${binary}".sha1 /tmp/"${binary}" &> /dev/null; then
|
cd /tmp
|
||||||
|
if sha1sum --status --quiet -c "${binary}".sha1; then
|
||||||
echo -n "transferred... "
|
echo -n "transferred... "
|
||||||
install -m 0755 /tmp/pihole-FTL /usr/bin
|
install -m 0755 /tmp/pihole-FTL /usr/bin
|
||||||
touch /var/log/pihole-FTL.log /var/run/pihole-FTL.pid /var/run/pihole-FTL.port
|
touch /var/log/pihole-FTL.log /var/run/pihole-FTL.pid /var/run/pihole-FTL.port
|
||||||
chmod 0666 /var/log/pihole-FTL.log /var/run/pihole-FTL.pid /var/run/pihole-FTL.port
|
chmod 0666 /var/log/pihole-FTL.log /var/run/pihole-FTL.pid /var/run/pihole-FTL.port
|
||||||
|
cd "${orig_dir}"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
echo "failed (download of binary from Github failed)"
|
echo "failed (download of binary from Github failed)"
|
||||||
|
cd "${orig_dir}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
cd "${orig_dir}"
|
||||||
echo "done."
|
echo "done."
|
||||||
else
|
else
|
||||||
echo "failed (URL not found.)"
|
echo "failed (URL not found.)"
|
||||||
|
|
Loading…
Reference in a new issue