mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-12 02:10:54 +00:00
Add Arch .pkg
This commit is contained in:
@@ -53,6 +53,11 @@ makedeb.sh
|
||||
pkg/control
|
||||
makerpm.sh
|
||||
pkg/snapraid.spec
|
||||
makearch.sh
|
||||
makearchdist.sh
|
||||
pkg/.PKGINFO
|
||||
pkg/PKGBUILD
|
||||
pkg/.SRCINFO
|
||||
|
||||
# projects
|
||||
*.dst
|
||||
|
||||
+6
-1
@@ -180,7 +180,12 @@ EXTRA_DIST = \
|
||||
makedeb.sh.in \
|
||||
pkg/control.in \
|
||||
makerpm.sh.in \
|
||||
pkg/snapraid.spec.in
|
||||
pkg/snapraid.spec.in \
|
||||
makearch.sh.in \
|
||||
makearchdist.sh.in \
|
||||
pkg/.PKGINFO.in \
|
||||
pkg/PKGBUILD.in \
|
||||
pkg/.SRCINFO.in
|
||||
|
||||
man1_MANS = doc/snapraid.1 doc/snapraid_log.1
|
||||
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ fi
|
||||
# Apply common rules to all outputs:
|
||||
# 1. Replace "rc-" with "rc"
|
||||
# 2. Replace "beta-" with "beta"
|
||||
# 3. Replace all remaining dashes with "+"
|
||||
VERSION=$(echo "$VERSION" | sed 's/rc-/rc/g; s/beta-/beta/g; s/-/+/g')
|
||||
# 3. Replace all remaining dashes with "."
|
||||
VERSION=$(echo "$VERSION" | sed 's/rc-/rc/g; s/beta-/beta/g; s/-/./g')
|
||||
|
||||
printf '%s' "$VERSION"
|
||||
|
||||
+3
-1
@@ -403,11 +403,13 @@ AC_ARG_VAR([TESTENV_SSE42], [Test environment for SSE42])
|
||||
AC_ARG_VAR([TESTENV_AVX2], [Test environment for AVX2])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_CONFIG_FILES([pkg/snapraid.info pkg/control pkg/snapraid.spec])
|
||||
AC_CONFIG_FILES([pkg/snapraid.info pkg/control pkg/snapraid.spec pkg/.PKGINFO pkg/PKGBUILD pkg/.SRCINFO])
|
||||
AC_CONFIG_FILES([makeslackware.sh], [chmod a+x makeslackware.sh])
|
||||
AC_CONFIG_FILES([makeslackdist.sh], [chmod a+x makeslackdist.sh])
|
||||
AC_CONFIG_FILES([pkg/snapraid.SlackBuild], [chmod a+x pkg/snapraid.SlackBuild])
|
||||
AC_CONFIG_FILES([makedeb.sh], [chmod a+x makedeb.sh])
|
||||
AC_CONFIG_FILES([makerpm.sh], [chmod a+x makerpm.sh])
|
||||
AC_CONFIG_FILES([makearch.sh], [chmod a+x makearch.sh])
|
||||
AC_CONFIG_FILES([makearchdist.sh], [chmod a+x makearchdist.sh])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# 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
|
||||
|
||||
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"
|
||||
|
||||
if [[ ! -f "pkg/.PKGINFO" ]]; then
|
||||
echo "Error: .PKGINFO not found in the current directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Prefer local tarball
|
||||
if [[ -f "./${TARBALL}" ]]; then
|
||||
echo "Found ${TARBALL} locally."
|
||||
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 @[email protected] COPYING AUTHORS HISTORY README "../${PKG_ROOT}/usr/share/doc/@PACKAGE@/"
|
||||
|
||||
cd ..
|
||||
|
||||
# Copy Files
|
||||
echo "Copying into"
|
||||
BUILD_DATE=$(date -u +%s)
|
||||
PACKAGE_SIZE=$(du -sb "${PKG_ROOT}" | awk '{print $1}')
|
||||
sed -e "s/@BUILD_DATE@/${BUILD_DATE}/" \
|
||||
-e "s/@PACKAGE_SIZE@/${PACKAGE_SIZE}/" \
|
||||
pkg/.PKGINFO > "${PKG_ROOT}/.PKGINFO"
|
||||
|
||||
cd ${PKG_ROOT}
|
||||
|
||||
echo "Create .MTREE"
|
||||
bsdtar -czf .MTREE --format=mtree --options='!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link' .PKGINFO usr
|
||||
|
||||
# Build the .deb package
|
||||
echo "Building .PKG package..."
|
||||
tar --owner=0 --group=0 -cvf - .PKGINFO .MTREE usr | zstd -c -z -q - > ../${PKG_NAME}-${VERSION}-1-x86_64.pkg.tar.zst
|
||||
|
||||
cd ..
|
||||
|
||||
echo "Cleanup..."
|
||||
rm -rf "${PKG_ROOT}" @PACKAGE@-${VERSION}
|
||||
|
||||
echo ""
|
||||
echo "Build complete!"
|
||||
echo "The .pkg package should be in the current directory:"
|
||||
ls @PACKAGE@-${VERSION}-*-*.zst
|
||||
|
||||
echo ""
|
||||
echo "You can install it with:"
|
||||
echo " sudo pacman -U ${PKG_NAME}-${VERSION}-1-x86_64.pkg.tar.zst"
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
# makearchdist.sh - Creates the source distribution for Arch
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PRGNAM="@PACKAGE@"
|
||||
VERSION="@PACKAGE_VERSION@"
|
||||
TARBALL="@[email protected]"
|
||||
SOURCE_TARBALL="@PACKAGE@-${VERSION}.tar.gz"
|
||||
PKG_NAME="@PACKAGE@"
|
||||
PKG_ROOT="${PKG_NAME}-arch-dist-root"
|
||||
|
||||
echo "Calculating SHA256 sum..."
|
||||
SHA256SUM=$(sha256sum "$SOURCE_TARBALL" | cut -d' ' -f1)
|
||||
|
||||
# Clean previous builds
|
||||
rm -rf "${PKG_ROOT}"
|
||||
|
||||
# Create a temporary staging area
|
||||
mkdir -p $PKG_ROOT/$PRGNAM
|
||||
|
||||
# Copy Files
|
||||
echo "Copying into"
|
||||
cat pkg/.SRCINFO > "$PKG_ROOT/$PRGNAM/.SRCINFO"
|
||||
|
||||
# Process the PKGBUILD file and replace placeholders
|
||||
sed -e "s/@SHA256SUM@/$SHA256SUM/g" pkg/PKGBUILD > "$PKG_ROOT/$PRGNAM/PKGBUILD"
|
||||
|
||||
# We create the tarball in the current root directory
|
||||
echo "Building .SRC package..."
|
||||
tar --owner=0 --group=0 -czf "$TARBALL" -C $PKG_ROOT $PRGNAM/
|
||||
|
||||
echo "Cleanup..."
|
||||
rm -rf "${PKG_ROOT}"
|
||||
|
||||
echo ""
|
||||
echo "Success! The tarball is: $TARBALL"
|
||||
echo "SHA256SUM updated to: $SHA256SUM"
|
||||
echo ""
|
||||
echo "You can install it with:"
|
||||
echo " tar -xvf $TARBALL"
|
||||
echo " cd snapraid-daemon"
|
||||
echo " sudo makepkg -si"
|
||||
@@ -53,6 +53,8 @@ if ! make dist; then
|
||||
fi
|
||||
|
||||
sh makeslackdist.sh
|
||||
sh makearchdist.sh
|
||||
sudo sh makeslackware.sh
|
||||
sudo sh makearch.sh
|
||||
sudo sh makedeb.sh
|
||||
sudo sh makerpm.sh
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
pkgname = @PACKAGE@
|
||||
pkgver = @VERSION@-1
|
||||
pkgdesc = Disk array backup for many large rarely-changed files
|
||||
url = https://www.snapraid.it/
|
||||
builddate = @BUILD_DATE@
|
||||
packager = Andrea Mazzoleni <[email protected]>
|
||||
size = @PACKAGE_SIZE@
|
||||
arch = x86_64
|
||||
license = GPL3
|
||||
depend = zlib
|
||||
depend = zstd
|
||||
depend = systemd
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
pkgbase = @PACKAGE@
|
||||
pkgdesc = Disk array backup for many large rarely-changed files
|
||||
pkgver = @VERSION@
|
||||
pkgrel = 1
|
||||
url = https://www.snapraid.it/
|
||||
arch = x86_64
|
||||
license = GPL3
|
||||
makedepends = gcc
|
||||
makedepends = make
|
||||
depends = zlib
|
||||
depends = zstd
|
||||
depends = snapraid>=14.0
|
||||
depends = systemd
|
||||
source = https://github.com/amadvance/@PACKAGE@/releases/download/v@PACKAGE_VERSION@/@PACKAGE@-@[email protected]
|
||||
sha256sums = @SHA256@
|
||||
|
||||
pkgname = @PACKAGE@
|
||||
@@ -0,0 +1,30 @@
|
||||
# Maintainer: Andrea Mazzoleni <[email protected]>
|
||||
pkgname=@PACKAGE@
|
||||
pkgver=@VERSION@
|
||||
pkgrel=1
|
||||
pkgdesc="Disk array backup for many large rarely-changed files"
|
||||
arch=('x86_64')
|
||||
url="https://www.snapraid.it/"
|
||||
license=('GPL3')
|
||||
depends=('zlib' 'zstd' 'snapraid>=14.0' 'systemd')
|
||||
makedepends=('gcc' 'make')
|
||||
install="${pkgname}.install"
|
||||
source=("https://github.com/amadvance/@PACKAGE@/releases/download/v@PACKAGE_VERSION@/@PACKAGE@-@[email protected]")
|
||||
sha256sums=('@SHA256@')
|
||||
|
||||
build() {
|
||||
cd "$pkgname-$pkgver"
|
||||
./configure --prefix=/usr --sysconfdir=/etc --with-init-type=none
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$pkgname-$pkgver"
|
||||
make DESTDIR="$pkgdir/" install
|
||||
|
||||
# Add example config and docs (Matches your script's logic)
|
||||
install -Dm644 snapraid.conf.example "$pkgdir/usr/share/doc/$pkgname/snapraid.conf.example"
|
||||
|
||||
# Arch Policy: License must also be in the license directory
|
||||
install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
|
||||
}
|
||||
Reference in New Issue
Block a user