From 5f98ac3003954490ecb8bf908cc3f4ff0d943422 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sat, 5 Oct 2024 00:44:04 +0000 Subject: [PATCH] chore: Remove user/repo abstraction from install script --- assets/scripts/install-local-bin.sh | 9 +++------ assets/scripts/install.sh | 9 +++------ internal/cmds/generate-install.sh/install.sh.tmpl | 9 +++------ 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/assets/scripts/install-local-bin.sh b/assets/scripts/install-local-bin.sh index 1a4b23bc289..4ae2a1cfeaa 100644 --- a/assets/scripts/install-local-bin.sh +++ b/assets/scripts/install-local-bin.sh @@ -8,12 +8,9 @@ set -e BINDIR="${BINDIR:-.local/bin}" -CHEZMOI_USER_REPO="${CHEZMOI_USER_REPO:-twpayne/chezmoi}" TAGARG=latest LOG_LEVEL=2 -GITHUB_DOWNLOAD="https://github.com/${CHEZMOI_USER_REPO}/releases/download" - tmpdir="$(mktemp -d)" trap 'rm -rf -- "${tmpdir}"' EXIT trap 'exit' INT TERM @@ -76,12 +73,12 @@ main() { # download tarball NAME="chezmoi_${VERSION}_${GOOS}${GOOS_EXTRA}_${arch}" TARBALL="${NAME}.${FORMAT}" - TARBALL_URL="${GITHUB_DOWNLOAD}/${TAG}/${TARBALL}" + TARBALL_URL="https://github.com/twpayne/chezmoi/releases/download/${TAG}/${TARBALL}" http_download "${tmpdir}/${TARBALL}" "${TARBALL_URL}" || exit 1 # download checksums CHECKSUMS="chezmoi_${VERSION}_checksums.txt" - CHECKSUMS_URL="${GITHUB_DOWNLOAD}/${TAG}/${CHECKSUMS}" + CHECKSUMS_URL="https://github.com/twpayne/chezmoi/releases/download/${TAG}/${CHECKSUMS}" http_download "${tmpdir}/${CHECKSUMS}" "${CHECKSUMS_URL}" || exit 1 # verify checksums @@ -211,7 +208,7 @@ get_libc() { real_tag() { tag="${1}" log_debug "checking GitHub for tag ${tag}" - release_url="https://github.com/${CHEZMOI_USER_REPO}/releases/${tag}" + release_url="https://github.com/twpayne/chezmoi/releases/${tag}" json="$(http_get "${release_url}" "Accept: application/json")" if [ -z "${json}" ]; then log_err "real_tag error retrieving GitHub release ${tag}" diff --git a/assets/scripts/install.sh b/assets/scripts/install.sh index a0748da68ed..73294b70446 100644 --- a/assets/scripts/install.sh +++ b/assets/scripts/install.sh @@ -8,12 +8,9 @@ set -e BINDIR="${BINDIR:-./bin}" -CHEZMOI_USER_REPO="${CHEZMOI_USER_REPO:-twpayne/chezmoi}" TAGARG=latest LOG_LEVEL=2 -GITHUB_DOWNLOAD="https://github.com/${CHEZMOI_USER_REPO}/releases/download" - tmpdir="$(mktemp -d)" trap 'rm -rf -- "${tmpdir}"' EXIT trap 'exit' INT TERM @@ -76,12 +73,12 @@ main() { # download tarball NAME="chezmoi_${VERSION}_${GOOS}${GOOS_EXTRA}_${arch}" TARBALL="${NAME}.${FORMAT}" - TARBALL_URL="${GITHUB_DOWNLOAD}/${TAG}/${TARBALL}" + TARBALL_URL="https://github.com/twpayne/chezmoi/releases/download/${TAG}/${TARBALL}" http_download "${tmpdir}/${TARBALL}" "${TARBALL_URL}" || exit 1 # download checksums CHECKSUMS="chezmoi_${VERSION}_checksums.txt" - CHECKSUMS_URL="${GITHUB_DOWNLOAD}/${TAG}/${CHECKSUMS}" + CHECKSUMS_URL="https://github.com/twpayne/chezmoi/releases/download/${TAG}/${CHECKSUMS}" http_download "${tmpdir}/${CHECKSUMS}" "${CHECKSUMS_URL}" || exit 1 # verify checksums @@ -211,7 +208,7 @@ get_libc() { real_tag() { tag="${1}" log_debug "checking GitHub for tag ${tag}" - release_url="https://github.com/${CHEZMOI_USER_REPO}/releases/${tag}" + release_url="https://github.com/twpayne/chezmoi/releases/${tag}" json="$(http_get "${release_url}" "Accept: application/json")" if [ -z "${json}" ]; then log_err "real_tag error retrieving GitHub release ${tag}" diff --git a/internal/cmds/generate-install.sh/install.sh.tmpl b/internal/cmds/generate-install.sh/install.sh.tmpl index 406639f9080..d31205adfe9 100644 --- a/internal/cmds/generate-install.sh/install.sh.tmpl +++ b/internal/cmds/generate-install.sh/install.sh.tmpl @@ -8,12 +8,9 @@ set -e BINDIR="${BINDIR:-{{ .BinDir }}}" -CHEZMOI_USER_REPO="${CHEZMOI_USER_REPO:-twpayne/chezmoi}" TAGARG=latest LOG_LEVEL=2 -GITHUB_DOWNLOAD="https://github.com/${CHEZMOI_USER_REPO}/releases/download" - tmpdir="$(mktemp -d)" trap 'rm -rf -- "${tmpdir}"' EXIT trap 'exit' INT TERM @@ -76,12 +73,12 @@ main() { # download tarball NAME="chezmoi_${VERSION}_${GOOS}${GOOS_EXTRA}_${arch}" TARBALL="${NAME}.${FORMAT}" - TARBALL_URL="${GITHUB_DOWNLOAD}/${TAG}/${TARBALL}" + TARBALL_URL="https://github.com/twpayne/chezmoi/releases/download/${TAG}/${TARBALL}" http_download "${tmpdir}/${TARBALL}" "${TARBALL_URL}" || exit 1 # download checksums CHECKSUMS="chezmoi_${VERSION}_checksums.txt" - CHECKSUMS_URL="${GITHUB_DOWNLOAD}/${TAG}/${CHECKSUMS}" + CHECKSUMS_URL="https://github.com/twpayne/chezmoi/releases/download/${TAG}/${CHECKSUMS}" http_download "${tmpdir}/${CHECKSUMS}" "${CHECKSUMS_URL}" || exit 1 # verify checksums @@ -186,7 +183,7 @@ get_libc() { real_tag() { tag="${1}" log_debug "checking GitHub for tag ${tag}" - release_url="https://github.com/${CHEZMOI_USER_REPO}/releases/${tag}" + release_url="https://github.com/twpayne/chezmoi/releases/${tag}" json="$(http_get "${release_url}" "Accept: application/json")" if [ -z "${json}" ]; then log_err "real_tag error retrieving GitHub release ${tag}"