Scripts: Update install-proxysql-admin.sh and install-devops-tools.sh

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-11-04 11:24:30 +01:00
parent 3290c9062c
commit 5afb634edf
2 changed files with 29 additions and 13 deletions

View File

@@ -104,12 +104,18 @@ install_helm() {
install_rancher_cli() {
local version="${RANCHER_CLI_VERSION:-2.12.3}"
local tarball="rancher-linux-${LINUX_ARCH}-v${version}.tar.gz"
local checksum_url="https://releases.rancher.com/cli2/v${version}/${tarball}.sha256sum"
local checksum_file="${TMPDIR}/${tarball}.sha256sum"
local base_url="https://github.com/rancher/cli/releases/download/v${version}"
local checksum_file="${TMPDIR}/rancher-cli-sha256sum.txt"
curl -fsSLo "${TMPDIR}/${tarball}" "https://releases.rancher.com/cli2/v${version}/${tarball}"
if curl -fsSLo "${checksum_file}" "${checksum_url}"; then
(cd "${TMPDIR}" && sha256sum --check "${tarball}.sha256sum")
curl -fsSLo "${TMPDIR}/${tarball}" "${base_url}/${tarball}"
if curl -fsSLo "${checksum_file}" "${base_url}/sha256sum.txt"; then
local expected
expected="$(awk -v name="${tarball}" '$2 == name {print $1}' "${checksum_file}")"
if [[ -z "${expected}" ]]; then
echo "Checksum entry for ${tarball} not found in sha256sum.txt; skipping verification." >&2
else
echo "${expected} ${TMPDIR}/${tarball}" | sha256sum --check --status -
fi
else
rm -f "${checksum_file}"
echo "Checksum file not available for Rancher CLI ${version}; skipping verification." >&2
@@ -143,16 +149,26 @@ install_k9s() {
local raw_tag="${K9S_VERSION:-$(fetch_latest_github_tag derailed/k9s)}"
local version="${raw_tag#v}"
local artifact="k9s_Linux_${LINUX_ARCH}.tar.gz"
local checksum_file="${TMPDIR}/checksums.txt"
local checksum_url="https://github.com/derailed/k9s/releases/download/${raw_tag}/checksums.txt"
local checksum_file
local checksum_url
local base_url="https://github.com/derailed/k9s/releases/download/${raw_tag}"
curl -fsSLo "${TMPDIR}/${artifact}" "https://github.com/derailed/k9s/releases/download/${raw_tag}/${artifact}"
if ! curl -fsSLo "${checksum_file}" "${checksum_url}"; then
curl -fsSLo "${TMPDIR}/${artifact}" "${base_url}/${artifact}"
if curl -sfI "${base_url}/checksums.sha256" >/dev/null; then
checksum_url="${base_url}/checksums.sha256"
checksum_file="${TMPDIR}/checksums.sha256"
checksum_url="https://github.com/derailed/k9s/releases/download/${raw_tag}/checksums.sha256"
curl -fsSLo "${checksum_file}" "${checksum_url}"
elif curl -sfI "${base_url}/checksums.txt" >/dev/null; then
checksum_url="${base_url}/checksums.txt"
checksum_file="${TMPDIR}/checksums.txt"
else
echo "Checksum file not found for k9s ${raw_tag}; skipping verification." >&2
checksum_file=""
fi
if [[ -n "${checksum_file}" ]]; then
curl -fsSLo "${checksum_file}" "${checksum_url}"
verify_with_checksums "${checksum_file}" "${TMPDIR}/${artifact}" "${artifact}"
fi
verify_with_checksums "${checksum_file}" "${TMPDIR}/${artifact}" "${artifact}"
tar -xzf "${TMPDIR}/${artifact}" -C "${TMPDIR}"
${SUDO} install -m 0755 "${TMPDIR}/k9s" "${BIN_DIR}/k9s"
}