diff --git a/makeslackware.sh b/makeslackware.sh new file mode 100755 index 00000000..ffb6b331 --- /dev/null +++ b/makeslackware.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# +# Script to build a Slackware .txz package for snapraid +# using the snapraid.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: +# - Run as root (or with sudo) for proper ownership/permissions in package + +set -euo pipefail + +VERSION="13.1" # Update if needed; must match tarball and SlackBuild +TARBALL="snapraid-${VERSION}.tar.gz" +SOURCE_URL="https://github.com/amadvance/snapraid/releases/download/v${VERSION}/${TARBALL}" + +if [[ ! -f "snapraid.SlackBuild" ]]; then + echo "Error: snapraid.SlackBuild not found in the current directory." + exit 1 +fi + +if [[ ! -f "slack-desc" ]]; then + echo "Error: slack-desc 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 + +# Set environment variables for SlackBuild +export VERSION BUILD=1 TAG=_AM OUTPUT=$(pwd) # Package output in current dir + +echo "Running SlackBuild..." +bash snapraid.SlackBuild + +echo "" +echo "Build complete!" +echo "The .txz package should be in the current directory:" +ls snapraid-${VERSION}-*-*.txz + +echo "" +echo "You can install it with:" +echo " installpkg snapraid-${VERSION}-*-*.txz" +echo " or upgradepkg if replacing an older version." diff --git a/slack-desc b/slack-desc new file mode 100644 index 00000000..edec148d --- /dev/null +++ b/slack-desc @@ -0,0 +1,11 @@ +snapraid: snapraid (Disk array backup for many large rarely-changed files) +snapraid: +snapraid: SnapRAID is a backup program for disk arrays. It stores parity +snapraid: information of your data and it's able to recover from up to six disk +snapraid: failures. SnapRAID is mainly targeted for a home media center, with a +snapraid: lot of big files that rarely change. +snapraid: +snapraid: +snapraid: +snapraid: +snapraid: diff --git a/snapraid.SlackBuild b/snapraid.SlackBuild new file mode 100755 index 00000000..dd76e650 --- /dev/null +++ b/snapraid.SlackBuild @@ -0,0 +1,82 @@ +#!/bin/bash +# SlackBuild script for snapraid +# Written for personal use / inspired by SlackBuilds.org templates + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=snapraid +VERSION=${VERSION:-13.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_AM} +PKGNAM=${PRGNAM}-${VERSION} + +if [ -z "$ARCH" ]; then + case "$(uname -m)" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$(uname -m) ;; + esac +fi + +TMP=${TMP:-/tmp} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/snapraid-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --build=$ARCH-slackware-linux + +make + +make install DESTDIR=$PKG + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +gzip -9 $PKG/usr/man/man?/*.? + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a COPYING AUTHORS HISTORY README snapraid.conf.example $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} diff --git a/snapraid.info b/snapraid.info new file mode 100644 index 00000000..d6bd43a5 --- /dev/null +++ b/snapraid.info @@ -0,0 +1,10 @@ +PRGNAM="snapraid" +VERSION="13.0" +HOMEPAGE="https://www.snapraid.it/" +DOWNLOAD="https://github.com/amadvance/snapraid/releases/download/v${VERSION}/snapraid-${VERSION}.tar.gz" +MD5SUM="UNSUPPORTED" # Optional; compute manually if needed +DOWNLOAD_x86_64="$DOWNLOAD" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Andrea Mazzoleni" +EMAIL="amadnvace@gmail.com"