6d0883d177
Aptly mixes the all debs into the folders for the other arches, unless the all arch is explicitly added. This workaround tries to find the package in the aarch64 Packages file if the all Packages file is not found.
55 lines
2.0 KiB
Bash
Executable File
55 lines
2.0 KiB
Bash
Executable File
termux_download_deb() {
|
|
local PACKAGE=$1
|
|
local PACKAGE_ARCH=$2
|
|
local VERSION=$3
|
|
|
|
if [ "$TERMUX_ON_DEVICE_BUILD" = "true" ]; then
|
|
apt install -y "${PACKAGE}=${VERSION}"
|
|
return "$?"
|
|
fi
|
|
|
|
local DEB_FILE="${PACKAGE}_${VERSION}_${PACKAGE_ARCH}.deb"
|
|
PKG_HASH=""
|
|
|
|
for idx in $(seq ${#TERMUX_REPO_URL[@]}); do
|
|
local TERMUX_REPO_NAME=$(echo ${TERMUX_REPO_URL[$idx-1]} | sed -e 's%https://%%g' -e 's%http://%%g' -e 's%/%-%g')
|
|
local PACKAGE_FILE_PATH="${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-${TERMUX_REPO_COMPONENT[$idx-1]}-Packages"
|
|
if [ ! -f "${TERMUX_COMMON_CACHEDIR}-${PACKAGE_ARCH}/${PACKAGE_FILE_PATH}" ] && \
|
|
[ -f "${TERMUX_COMMON_CACHEDIR}-aarch64/${PACKAGE_FILE_PATH}" ]; then
|
|
# Packages file for $PACKAGE_ARCH did not
|
|
# exist. Could be an aptly mirror where the
|
|
# all arch is mixed into the other arches,
|
|
# check for package in aarch64 Packages
|
|
# instead.
|
|
read -d "\n" PKG_PATH PKG_HASH <<<$(./scripts/get_hash_from_file.py "${TERMUX_COMMON_CACHEDIR}-aarch64/$PACKAGE_FILE_PATH" $PACKAGE $VERSION)
|
|
if [ -n "$PKG_HASH" ]; then
|
|
if [ ! "$TERMUX_QUIET_BUILD" = true ]; then
|
|
echo "Found $PACKAGE in ${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}"
|
|
fi
|
|
break
|
|
fi
|
|
elif [ -f "${TERMUX_COMMON_CACHEDIR}-${PACKAGE_ARCH}/${PACKAGE_FILE_PATH}" ]; then
|
|
read -d "\n" PKG_PATH PKG_HASH <<<$(./scripts/get_hash_from_file.py "${TERMUX_COMMON_CACHEDIR}-${PACKAGE_ARCH}/$PACKAGE_FILE_PATH" $PACKAGE $VERSION)
|
|
if [ -n "$PKG_HASH" ]; then
|
|
if [ ! "$TERMUX_QUIET_BUILD" = true ]; then
|
|
echo "Found $PACKAGE in ${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}"
|
|
fi
|
|
break
|
|
fi
|
|
fi
|
|
done
|
|
|
|
if [ "$PKG_HASH" = "" ]; then
|
|
return 1
|
|
fi
|
|
|
|
termux_download "${TERMUX_REPO_URL[${idx}-1]}/${PKG_PATH}" \
|
|
"${TERMUX_COMMON_CACHEDIR}-${PACKAGE_ARCH}/${DEB_FILE}" \
|
|
"$PKG_HASH"
|
|
}
|
|
|
|
# Make script standalone executable as well as sourceable
|
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
|
termux_download "$@"
|
|
fi
|