mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Check sha1 of transferred file.
This commit is contained in:
parent
057cecb3e0
commit
b36a44a954
1 changed files with 7 additions and 5 deletions
|
@ -1157,7 +1157,7 @@ FTLinstall() {
|
||||||
local binary="${1}"
|
local binary="${1}"
|
||||||
local latesttag
|
local latesttag
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo -n "::: Installing FTL ... "
|
echo -n "::: Installing FTL... "
|
||||||
|
|
||||||
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.
|
||||||
|
@ -1165,10 +1165,12 @@ FTLinstall() {
|
||||||
echo "failed (error in getting latest release location from GitHub)"
|
echo "failed (error in getting latest release location from GitHub)"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if curl -sSL --fail "https://github.com/pi-hole/FTL/releases/download/${latesttag%$'\r'}/${binary}" -o "/tmp/pihole-FTL"; then
|
if curl -sSL --fail "https://github.com/pi-hole/FTL/releases/download/${latesttag%$'\r'}/${binary}" -o "/tmp/${binary}"; then
|
||||||
|
# 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"
|
||||||
# Check if we just downloaded text, or a binary file.
|
# Check if we just downloaded text, or a binary file.
|
||||||
if ! grep -qI '.' /tmp/pihole-FTL; then
|
if sha1sum -c "${binary}".sha1; then
|
||||||
echo "done"
|
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
|
||||||
|
@ -1177,7 +1179,7 @@ FTLinstall() {
|
||||||
echo "failed (download of binary from Github failed)"
|
echo "failed (download of binary from Github failed)"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo "done"
|
echo "done."
|
||||||
else
|
else
|
||||||
echo "failed (URL not found.)"
|
echo "failed (URL not found.)"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue