mirror of
https://github.com/casjaysdevdocker/opengist
synced 2026-08-14 14:01:17 -04:00
🐛 Fix opengist download SSL failure in 05-custom.sh 🐛
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
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202606120507-git
|
||||
##@Version : 202608022207-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@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
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
Reference in New Issue
Block a user