Skip to content

Commit

Permalink
chore: Update from twpayne/chezmoi@2f7b26d
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Oct 10, 2024
1 parent c465dd4 commit 92cc38e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
13 changes: 5 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -76,12 +73,12 @@
# 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
Expand Down Expand Up @@ -211,7 +208,7 @@
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}"
Expand Down Expand Up @@ -242,9 +239,9 @@
source_url="${2}"
header="${3}"
if [ -z "${header}" ]; then
code="$(curl -w '%{http_code}' -sL -o "${local_file}" "${source_url}")"
code="$(curl -w '%{http_code}' -fsSL -o "${local_file}" "${source_url}")"
else
code="$(curl -w '%{http_code}' -sL -H "${header}" -o "${local_file}" "${source_url}")"
code="$(curl -w '%{http_code}' -fsSL -H "${header}" -o "${local_file}" "${source_url}")"
fi
if [ "${code}" != "200" ]; then
log_debug "http_download_curl received HTTP status ${code}"
Expand Down
13 changes: 5 additions & 8 deletions lb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -242,9 +239,9 @@ http_download_curl() {
source_url="${2}"
header="${3}"
if [ -z "${header}" ]; then
code="$(curl -w '%{http_code}' -sL -o "${local_file}" "${source_url}")"
code="$(curl -w '%{http_code}' -fsSL -o "${local_file}" "${source_url}")"
else
code="$(curl -w '%{http_code}' -sL -H "${header}" -o "${local_file}" "${source_url}")"
code="$(curl -w '%{http_code}' -fsSL -H "${header}" -o "${local_file}" "${source_url}")"
fi
if [ "${code}" != "200" ]; then
log_debug "http_download_curl received HTTP status ${code}"
Expand Down

0 comments on commit 92cc38e

Please sign in to comment.