forked from Bitmessage/sysdeploy
Use Gitea latest release for IPXE download
This commit is contained in:
parent
6cb980775b
commit
964f047c1d
23
ipxe.inc
23
ipxe.inc
|
@ -7,14 +7,27 @@ function download_and_verify_ipxe()
|
||||||
local ipxeshasum1='a'
|
local ipxeshasum1='a'
|
||||||
local ipxeshasum2='b'
|
local ipxeshasum2='b'
|
||||||
|
|
||||||
which wget || /bin/false
|
which wget && which jq && which curl || /bin/false
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
apt update -yq && apt -yq install wget
|
apt update -yq && apt -yq install wget jq curl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# This will actually be a Gitea release download for the lastest master
|
# This gets the info for the most current release, in JSON format
|
||||||
wget https://images.sysdeploy.org/path/to/buildbot/latest/ipxe.lkrn -O "$ipxe_path" || echo "download failed" > "$ipxe_path"
|
release_info=$(curl "https://git.bitmessage.org/api/v1/repos/maxweiss/ipxe_scripts/releases?per_page=1&page=1&limit=1")
|
||||||
wget https://images.sysdeploy.org/path/to/buildbot/latest/SHA256SUMS -O "${ipxe_path}.sha256sums" || echo "z ipxe.lkrn" > "${ipxe_path}.sha256sums"
|
|
||||||
|
lkrn_url=$(echo ${release_info} | jq '.[0].assets[] | select(.name=="ipxe.lkrn")' | jq -r .browser_download_url | tr -d '\n')
|
||||||
|
shasums_url=$(echo ${release_info} | jq '.[0].assets[] | select(.name=="SHA256SUMS")' | jq -r .browser_download_url | tr -d '\n')
|
||||||
|
|
||||||
|
if [[ -z $lkrn_url ]] || [[ $lkrn_url = *[^[:space:]]* ]]; then
|
||||||
|
echo "download failed" > "$ipxe_path"
|
||||||
|
else
|
||||||
|
wget "${lkrn_url}" -O "$ipxe_path" || echo "download failed" > "$ipxe_path"
|
||||||
|
fi
|
||||||
|
if [[ -z $shasums_url ]] || [[ $shasums_url = *[^[:space:]]* ]]; then
|
||||||
|
echo "z ipxe.lkrn" > "${ipxe_path}.sha256sums"
|
||||||
|
else
|
||||||
|
wget "${shasums_url}" -O "${ipxe_path}.sha256sums" || echo "z ipxe.lkrn" > "${ipxe_path}.sha256sums"
|
||||||
|
fi
|
||||||
|
|
||||||
ipxeshasum1=$(cat "${ipxe_path}.sha256sums" | grep "ipxe.lkrn" | awk '{print $1}' | tr -d '\n')
|
ipxeshasum1=$(cat "${ipxe_path}.sha256sums" | grep "ipxe.lkrn" | awk '{print $1}' | tr -d '\n')
|
||||||
ipxeshasum2=$(sha256sum "$ipxe_path" | awk '{print $1}' | tr -d '\n')
|
ipxeshasum2=$(sha256sum "$ipxe_path" | awk '{print $1}' | tr -d '\n')
|
||||||
|
|
Loading…
Reference in New Issue