snapraid/makeslackware.sh.in

57 lines
1.5 KiB
Bash
Raw Normal View History

2025-12-25 23:58:55 +01:00
#!/bin/bash
#
2026-02-13 11:37:07 +01:00
# Script to build a Slackware .txz package for @PACKAGE_NAME@
# using the @PACKAGE@.SlackBuild and related files in the current directory.
2025-12-25 23:58:55 +01:00
#
# 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:
# - Run as root (or with sudo) for proper ownership/permissions in package
set -euo pipefail
2026-02-13 11:37:07 +01:00
VERSION="@PACKAGE_VERSION@"
TARBALL="@PACKAGE@-${VERSION}.tar.gz"
SOURCE_URL="https://github.com/amadvance/@PACKAGE@/releases/download/v${VERSION}/${TARBALL}"
2025-12-25 23:58:55 +01:00
2026-02-13 11:37:07 +01:00
if [[ ! -f "pkg/@PACKAGE@.SlackBuild" ]]; then
echo "Error: @PACKAGE@.SlackBuild not found in the current directory."
2025-12-25 23:58:55 +01:00
exit 1
fi
2026-02-13 11:37:07 +01:00
if [[ ! -f "pkg/slack-desc" ]]; then
2025-12-25 23:58:55 +01:00
echo "Error: slack-desc not found in the current directory."
exit 1
fi
# Prefer local tarball
if [[ -f "./${TARBALL}" ]]; then
echo "Found ${TARBALL} locally."
2026-02-13 11:37:07 +01:00
cp ${TARBALL} pkg/
2025-12-25 23:58:55 +01:00
else
echo "Downloading ${TARBALL}..."
curl -L -O "$SOURCE_URL"
fi
# Set environment variables for SlackBuild
2026-02-13 11:37:07 +01:00
export VERSION BUILD=1 TAG=_am OUTPUT=$(pwd) # Package output in current dir
2025-12-25 23:58:55 +01:00
echo "Running SlackBuild..."
2026-02-13 11:37:07 +01:00
bash pkg/@PACKAGE@.SlackBuild
echo "Cleanup..."
rm -f pkg/${TARBALL}
2025-12-25 23:58:55 +01:00
echo ""
echo "Build complete!"
echo "The .txz package should be in the current directory:"
2026-02-13 11:37:07 +01:00
ls @PACKAGE@-${VERSION}-*-*.txz
2025-12-25 23:58:55 +01:00
echo ""
echo "You can install it with:"
2026-02-13 11:37:07 +01:00
echo " installpkg @PACKAGE@-${VERSION}-*-*.txz"
2025-12-25 23:58:55 +01:00
echo " or upgradepkg if replacing an older version."