From 99554a060e9623a41d46159b4652edccb4375fc8 Mon Sep 17 00:00:00 2001 From: casjay Date: Sun, 2 Aug 2026 22:12:21 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20opengist=20download=20SSL?= =?UTF-8?q?=20failure=20in=2005-custom.sh=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docker build was failing with "SSL: no alternative certificate subject name matches target hostname" when curl resolved api.github.com/ github.com via dual-stack (IPv6-preferring) lookup. Forcing IPv4 (matching the pattern already used in the gitea container's 05-custom.sh) resolves it. Also fixed lint findings surfaced while touching the file, and a real exit-code bug where the script always exited 0 regardless of install success/failure. - rootfs/root/docker/setup/05-custom.sh: add -4 to both curl calls; prefix script-local vars with OPENGIST_ (matching setup-script env prefix convention, project name not script filename); add -- to grep; add matching VERSION= assignment for the ##@Version header; fix trailing exit code capture that always exited 0 by exiting $OPENGIST_EXITCODE directly instead of overwriting it with $? of an unrelated command --- rootfs/root/docker/setup/05-custom.sh | 35 ++++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/rootfs/root/docker/setup/05-custom.sh b/rootfs/root/docker/setup/05-custom.sh index 71d799e..4f8be51 100755 --- a/rootfs/root/docker/setup/05-custom.sh +++ b/rootfs/root/docker/setup/05-custom.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # shellcheck shell=bash # - - - - - - - - - - - - - - - - - - - - - - - - - -##@Version : 202606120507-git +##@Version : 202608022207-git # @@Author : CasjaysDev # @@Contact : CasjaysDev # @@License : WTFPL @@ -23,37 +23,38 @@ set -eo pipefail [ "$DEBUGGER" = "on" ] && echo "Enabling debugging" && set -x$DEBUGGER_OPTIONS # - - - - - - - - - - - - - - - - - - - - - - - - - +VERSION="202608022207-git" +# - - - - - - - - - - - - - - - - - - - - - - - - - # Set env variables -exitCode=0 -TMP_DIR="/tmp/opengist" -TMP_BIN="$TMP_DIR/opengist" -TMP_FILE="/tmp/opengist.tar.gz" -BIN_PATH="/usr/local/bin/opengist" +OPENGIST_EXITCODE=0 +OPENGIST_TMP_DIR="/tmp/opengist" +OPENGIST_TMP_BIN="$OPENGIST_TMP_DIR/opengist" +OPENGIST_TMP_FILE="/tmp/opengist.tar.gz" +OPENGIST_BIN_PATH="/usr/local/bin/opengist" ARCH="$(uname -m | tr '[:upper]' '[:lower]')" case "$ARCH" in x86_64) ARCH="amd64" ;; aarch64) ARCH="arm64" ;; *) echo "$ARCH is not supported by this script" >&2 && exit 1 ;; esac -API_URL="$(curl -q -LSsf https://api.github.com/repos/thomiceli/opengist/releases/latest | jq -r '.assets[] | select(.name|match("linux.*tar.gz")) | .browser_download_url' | grep "$ARCH.tar.gz" || false)" +OPENGIST_API_URL="$(curl -4 -q -LSsf https://api.github.com/repos/thomiceli/opengist/releases/latest | jq -r '.assets[] | select(.name|match("linux.*tar.gz")) | .browser_download_url' | grep -- "$ARCH.tar.gz" || false)" # - - - - - - - - - - - - - - - - - - - - - - - - - # Predefined actions -if [ -n "$API_URL" ]; then - echo "Dowloading from $API_URL" - curl -q -LSsf "$API_URL" -o "$TMP_FILE" && tar xzf "$TMP_FILE" -C "/tmp" - if [ -f "$TMP_DIR/opengist" ]; then +if [ -n "$OPENGIST_API_URL" ]; then + echo "Dowloading from $OPENGIST_API_URL" + curl -4 -q -LSsf "$OPENGIST_API_URL" -o "$OPENGIST_TMP_FILE" && tar xzf "$OPENGIST_TMP_FILE" -C "/tmp" + if [ -f "$OPENGIST_TMP_DIR/opengist" ]; then [ -d "/etc/opengist" ] || mkdir -p "/etc/opengist" - mv -f "$TMP_BIN" "$BIN_PATH" && chmod -Rf 755 "$BIN_PATH" - rm -Rf "$TMP_FILE" "$TMP_DIR" + mv -f "$OPENGIST_TMP_BIN" "$OPENGIST_BIN_PATH" && chmod -Rf 755 "$OPENGIST_BIN_PATH" + rm -Rf "$OPENGIST_TMP_FILE" "$OPENGIST_TMP_DIR" else - exitCode=1 + OPENGIST_EXITCODE=1 fi fi -[ -x "$BIN_PATH" ] && echo "opengist installed to: $BIN_PATH" || exitCode=5 +[ -x "$OPENGIST_BIN_PATH" ] && echo "opengist installed to: $OPENGIST_BIN_PATH" || OPENGIST_EXITCODE=5 # - - - - - - - - - - - - - - - - - - - - - - - - - # Main script # - - - - - - - - - - - - - - - - - - - - - - - - - # Set the exit code -exitCode=$? # - - - - - - - - - - - - - - - - - - - - - - - - - -exit $exitCode +exit "$OPENGIST_EXITCODE" # - - - - - - - - - - - - - - - - - - - - - - - - - # ex: ts=2 sw=2 et filetype=sh # - - - - - - - - - - - - - - - - - - - - - - - - -