mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
73 lines
2.2 KiB
Bash
73 lines
2.2 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Script to manually build a Debian .deb package for @PACKAGE_NAME@ on Slackware
|
|
# (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
|
|
|
|
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"
|
|
fi
|
|
|
|
# Clean previous builds
|
|
rm -rf "${PKG_ROOT}" @PACKAGE@-${VERSION}
|
|
|
|
# Extract source
|
|
echo "Extracting source..."
|
|
tar -xzf "${TARBALL}"
|
|
|
|
# Build the software
|
|
echo "Configuring and building @PACKAGE@..."
|
|
cd @PACKAGE@-${VERSION}
|
|
./configure --prefix=/usr --sysconfdir=/etc
|
|
make -j4
|
|
|
|
# Install into package root
|
|
echo "Installing into temporary package root..."
|
|
mkdir -p "../${PKG_ROOT}/usr"
|
|
make install DESTDIR="../${PKG_ROOT}"
|
|
|
|
# Add example config and docs
|
|
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"
|
|
|
|
cd ..
|
|
|
|
# Create DEBIAN directory and control file
|
|
echo "Copying DEBIAN/control..."
|
|
mkdir -p "${PKG_ROOT}/DEBIAN"
|
|
cp pkg/control "${PKG_ROOT}/DEBIAN/control"
|
|
|
|
# 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
|
|
rm -rf "${PKG_ROOT}" @PACKAGE@-${VERSION}
|
|
|
|
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."
|