Files
openssh-deb/pullsrc.sh
boypt d58fe29375 fix: orig tarball gz→xz for 10.5p1-1 (sid switched to xz, drop .asc)
sid 10.5p1-1 pool only provides orig.tar.xz and no .asc; previous
hard-coded gz/.asc caused wget 404 and set -e abort in pullsrc.sh
(failing Create release 33487065147 19s quick fail across all codenames).
Parse .dsc for actual orig filename dynamically with fallback to xz,
and make compile.sh SOURCES expect xz with compat fallback to gz for old
caches (e.g. 10.4).
2026-09-01 16:35:26 +08:00

61 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Bash3 Boilerplate. Copyright (c) 2014, kvz.io
set -o errexit
set -o pipefail
set -o nounset
# set -o xtrace
trap 'echo -e "Aborted, error $? in command: $BASH_COMMAND"; trap ERR; exit 1' ERR
# Set magic variables for current file & dir
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename ${__file} .sh)"
__root="$(cd "$(dirname "${__dir}")" && pwd)" # <-- change this as it depends on your app
arg1="${1:-}"
source $__dir/version.env
# debhelper .debs for old distros: downloaded here on the host (current CA and
# network), installed by install_deps.sh from builddep/ (gitignored). Old
# distros cannot build the sid OpenSSH source with their own debhelper
# (dh-sequence-movetousr needs >= 13.11.7), and adding sid apt sources inside
# old containers is fragile, so we just fetch the two arch-all .debs directly.
DEBHELPER_LINKS=(
$DEBMIRROR/pool/main/d/debhelper/debhelper_${DEBHELPER_SIDPKG}_all.deb
$DEBMIRROR/pool/main/d/debhelper/libdebhelper-perl_${DEBHELPER_SIDPKG}_all.deb
)
# `./pullsrc.sh debhelper` fetches only the .debs (used by the deps-image CI
# before docker build, where the openssh sources are not needed).
if [[ "$arg1" == "debhelper" ]]; then
mkdir -p $__dir/builddep
echo "> INFO: downloading debhelper ${DEBHELPER_SIDPKG} .debs into builddep/."
wget --continue -P "$__dir/builddep" "${DEBHELPER_LINKS[@]}"
exit 0
fi
DOWNLOADLINKS=(
$DEBMIRROR/pool/main/o/openssh/openssh_${OPENSSH_SIDPKG}.{debian.tar.xz,dsc}
)
# Dynamic orig detection: parse .dsc for actual orig filename(s) to handle gz→xz switch (10.5p1+ uses .xz, no .asc)
DSC_URL=$DEBMIRROR/pool/main/o/openssh/openssh_${OPENSSH_SIDPKG}.dsc
ORIG_FILES=$(wget -qO- "$DSC_URL" 2>/dev/null | awk '/^ [0-9a-f]+ [0-9]+ openssh.*\.orig\./{print $3}' | sort -u || true)
if [[ -n "$ORIG_FILES" ]]; then
for f in $ORIG_FILES; do DOWNLOADLINKS+=("$DEBMIRROR/pool/main/o/openssh/$f"); done
else
DOWNLOADLINKS+=("$DEBMIRROR/pool/main/o/openssh/openssh_${OPENSSHVER}.orig.tar.xz")
fi
DOWNLOADLINKS+=("${OPENSSLMIR}/${OPENSSLSRC}")
mkdir -p $__dir/downloads $__dir/builddep && cd $__dir/downloads
echo "> INFO: downloading the following sources."
echo "${DOWNLOADLINKS[@]}" | tr " " "\n"
wget --continue "${DOWNLOADLINKS[@]}"
echo "> INFO: downloading debhelper ${DEBHELPER_SIDPKG} .debs into builddep/."
wget --continue -P "$__dir/builddep" "${DEBHELPER_LINKS[@]}"