snapraid/makedeb.sh.in

74 lines
2.2 KiB
Bash
Raw Normal View History

2025-12-26 00:24:48 +01:00
#!/bin/bash
#
2026-02-13 11:37:07 +01:00
# Script to manually build a Debian .deb package for @PACKAGE_NAME@ on Slackware
2025-12-26 00:24:48 +01:00
# (using only dpkg-deb; no dpkg-buildpackage or debhelper needed)
#
# This avoids the /var/lib/dpkg/status issue entirely by:
# - Building the source directly
# - Installing into a temporary package root directory
# - Creating minimal DEBIAN/control manually
# - Packaging with dpkg-deb --root-owner-group
#
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}"
PKG_NAME="@PACKAGE@"
2025-12-26 00:24:48 +01:00
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"
fi
# Clean previous builds
2026-02-13 11:37:07 +01:00
rm -rf "${PKG_ROOT}" @PACKAGE@-${VERSION}
2025-12-26 00:24:48 +01:00
# Extract source
echo "Extracting source..."
tar -xzf "${TARBALL}"
# Build the software
2026-02-13 11:37:07 +01:00
echo "Configuring and building @PACKAGE@..."
cd @PACKAGE@-${VERSION}
2026-03-09 16:21:53 +01:00
./configure --prefix=/usr --sysconfdir=/etc
make -j4
2025-12-26 00:24:48 +01:00
# Install into package root
echo "Installing into temporary package root..."
mkdir -p "../${PKG_ROOT}/usr"
2026-03-09 16:21:53 +01:00
make install DESTDIR="../${PKG_ROOT}"
2025-12-26 00:24:48 +01:00
# Add example config and docs
2026-02-13 11:37:07 +01:00
mkdir -p "../${PKG_ROOT}/usr/share/doc/@PACKAGE@"
cp @PACKAGE@.conf.example AUTHORS HISTORY README "../${PKG_ROOT}/usr/share/doc/@PACKAGE@/"
cp LICENSES/GPL-3.0 "../${PKG_ROOT}/usr/share/doc/@PACKAGE@/COPYING"
2025-12-26 00:24:48 +01:00
cd ..
# Create DEBIAN directory and control file
2026-02-13 11:37:07 +01:00
echo "Copying DEBIAN/control..."
2025-12-26 00:24:48 +01:00
mkdir -p "${PKG_ROOT}/DEBIAN"
2026-02-13 11:37:07 +01:00
cp pkg/control "${PKG_ROOT}/DEBIAN/control"
2025-12-26 00:24:48 +01:00
# Build the .deb package
echo "Building .deb package with dpkg-deb..."
dpkg-deb --root-owner-group --build "${PKG_ROOT}" "${PKG_NAME}_${VERSION}-1_amd64.deb"
# Cleanup
2026-02-13 11:37:07 +01:00
rm -rf "${PKG_ROOT}" @PACKAGE@-${VERSION}
2025-12-26 00:24:48 +01:00
echo ""
echo "Build complete!"
echo "Package created: ${PKG_NAME}_${VERSION}-1_amd64.deb"
echo ""
echo "Note: This is a basic binary .deb package (no advanced features like scripts or full dependency checking)."
echo "To install on a Debian/Ubuntu system: sudo dpkg -i ${PKG_NAME}_${VERSION}-1_amd64.deb"
echo "All man pages (including localized ones) and the example config are included."