Remove curl fallback from packaging scripts and require local tarball

This commit is contained in:
Andrea Mazzoleni 2026-08-12 12:54:25 +02:00
parent cd4e06a215
commit bb1a08e950
4 changed files with 14 additions and 37 deletions

View file

@ -2,10 +2,6 @@
#
# Script to build a Arch .pkg package for @PACKAGE_NAME@
#
# This version:
# - Prefers a source tarball already present in the current directory
# - Only downloads it if not found locally
#
# Requirements:
# - Run as root (or with sudo) for proper ownership/permissions in package
@ -13,7 +9,6 @@ set -euo pipefail
VERSION="@PACKAGE_VERSION@"
TARBALL="@PACKAGE@-${VERSION}.tar.gz"
SOURCE_URL="https://github.com/amadvance/@PACKAGE@/releases/download/v${VERSION}/${TARBALL}"
PKG_NAME="@PACKAGE@"
PKG_ROOT="${PKG_NAME}-arch-root"
@ -22,12 +17,9 @@ if [[ ! -f "pkg/.PKGINFO" ]]; then
exit 1
fi
# Prefer local tarball
if [[ -f "./${TARBALL}" ]]; then
echo "Found ${TARBALL} locally."
else
echo "Downloading ${TARBALL}..."
curl -L -O "$SOURCE_URL"
if [[ ! -f "${TARBALL}" ]]; then
echo "Error: ${TARBALL} not found in the current directory."
exit 1
fi
# Clean previous builds

View file

@ -14,17 +14,12 @@ set -euo pipefail
VERSION="@PACKAGE_VERSION@"
TARBALL="@PACKAGE@-${VERSION}.tar.gz"
SOURCE_URL="https://github.com/amadvance/@PACKAGE@/releases/download/v${VERSION}/${TARBALL}"
PKG_NAME="@PACKAGE@"
PKG_ROOT="${PKG_NAME}-deb-root"
CONTROL_FILE="${PKG_ROOT}/DEBIAN/control"
# Prefer local tarball
if [[ -f "./${TARBALL}" ]]; then
echo "Using local ${TARBALL}"
else
echo "Downloading ${TARBALL}..."
curl -L -O "$SOURCE_URL"
if [[ ! -f "${TARBALL}" ]]; then
echo "Error: ${TARBALL} not found in the current directory."
exit 1
fi
# Clean previous builds

View file

@ -6,8 +6,6 @@
#
# This version:
# - Works without rpmdevtools
# - Prefers a source tarball already present in the current directory
# - Only downloads it if not found locally
#
# Requirements:
# - rpmbuild available
@ -32,7 +30,6 @@ fi
echo "SnapRAID version: $VERSION"
TARBALL="@PACKAGE@-${VERSION}.tar.gz"
SOURCE_URL="https://github.com/amadvance/@PACKAGE@/releases/download/v${VERSION}/${TARBALL}"
# Set up rpmbuild tree manually in ~/rpmbuild if it doesn't exist
RPMBUILD_DIR="$HOME/rpmbuild"
@ -43,15 +40,13 @@ else
echo "rpmbuild directory structure already exists in $RPMBUILD_DIR"
fi
# Look for the tarball first in the current directory, then in ~/rpmbuild/SOURCES
# Look for the tarball in the current directory
if [[ -f "./$TARBALL" ]]; then
echo "Found $TARBALL in the current directory. Copying to ~/rpmbuild/SOURCES..."
cp "./$TARBALL" "$RPMBUILD_DIR/SOURCES/"
elif [[ ! -f "$RPMBUILD_DIR/SOURCES/$TARBALL" ]]; then
echo "Downloading $TARBALL (not found locally or in ~/rpmbuild/SOURCES)..."
curl -L -o "$RPMBUILD_DIR/SOURCES/$TARBALL" "$SOURCE_URL"
else
echo "$TARBALL already present in ~/rpmbuild/SOURCES"
echo "Error: $TARBALL not found in the current directory."
exit 1
fi
# Copy spec file to SPECS directory (preserving the original filename)

View file

@ -4,8 +4,6 @@
# using the @PACKAGE@.SlackBuild and related files in the current directory.
#
# This version:
# - Prefers a source tarball already present in the current directory
# - Only downloads it if not found locally
# - Runs the SlackBuild (as root recommended for makepkg)
#
# Requirements:
@ -15,7 +13,6 @@ set -euo pipefail
VERSION="@PACKAGE_VERSION@"
TARBALL="@PACKAGE@-${VERSION}.tar.gz"
SOURCE_URL="https://github.com/amadvance/@PACKAGE@/releases/download/v${VERSION}/${TARBALL}"
if [[ ! -f "pkg/@PACKAGE@.SlackBuild" ]]; then
echo "Error: @PACKAGE@.SlackBuild not found in the current directory."
@ -27,15 +24,13 @@ if [[ ! -f "pkg/slack-desc" ]]; then
exit 1
fi
# Prefer local tarball
if [[ -f "./${TARBALL}" ]]; then
echo "Found ${TARBALL} locally."
cp ${TARBALL} pkg/
else
echo "Downloading ${TARBALL}..."
curl -L -O "$SOURCE_URL"
if [[ ! -f "${TARBALL}" ]]; then
echo "Error: ${TARBALL} not found in the current directory."
exit 1
fi
cp ${TARBALL} pkg/
# Set environment variables for SlackBuild
export VERSION BUILD=1 TAG=_am OUTPUT=$(pwd) # Package output in current dir