More compliant Slackware package
Some checks failed
Build / build-mac (push) Has been cancelled
Build / build-linux (push) Has been cancelled
Build / build-win (push) Has been cancelled
CodeQL Advanced / Analyze (c-cpp) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled

This commit is contained in:
Andrea Mazzoleni 2026-03-07 17:26:11 +01:00
parent 26288de0f7
commit 5ad1a586b0
4 changed files with 102 additions and 19 deletions

View file

@ -19,6 +19,8 @@ mkdir -p $STAGING_DIR/$PRGNAM
# Copy Build Files from the pkg directory
cp pkg/$PRGNAM.SlackBuild $STAGING_DIR/$PRGNAM/
cp pkg/slack-desc $STAGING_DIR/$PRGNAM/
cp pkg/doinst.sh $STAGING_DIR/$PRGNAM/
cp pkg/README $STAGING_DIR/$PRGNAM/
# Process the .info file and replace placeholders
sed -e "s/@MD5SUM@/$MD5SUM/g" pkg/$PRGNAM.info > $STAGING_DIR/$PRGNAM/$PRGNAM.info

34
pkg/README Normal file
View file

@ -0,0 +1,34 @@
SnapRAID is a backup program for disk arrays. It stores parity
information of your data and recovers from up to six disk failures.
SnapRAID is targeted for a home media server, where you have a lot
of large files which rarely change.
Features:
- All your data is hashed to ensure data integrity and avoid silent
corruption.
- If the disk failures are too many to allow a recovery, you lose
the data only on the failed disks. All the data in the other
disks is safe.
- If you accidentally delete some files in a disk, you can recover
them.
- You can use disks of different sizes.
- You can add disks at any time.
- It does not lock-in your data. You can stop using SnapRAID at any
time without the need to reformat or move data.
Requirements:
- None
Configuration:
Before using SnapRAID, you must create a configuration file.
A template is provided at:
- /etc/snapraid.conf.new
Copy this to /etc/snapraid.conf and edit it to define your data
and parity disks.
Note:
This package does not include the snapraid-daemon. If you wish to
automate sync and scrub tasks with a Web UI, you should also
install the snapraid-daemon package.

14
pkg/doinst.sh Normal file
View file

@ -0,0 +1,14 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
config etc/snapraid.conf.new

View file

@ -1,14 +1,33 @@
#!/bin/bash
# SlackBuild script for @PACKAGE_NAME@
# Written for personal use / inspired by SlackBuilds.org templates
# Slackware build script for @PACKAGE_NAME@
# Copyright <year> <you> <where you live>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=@PACKAGE@
VERSION=@PACKAGE_VERSION@
VERSION=${VERSION:-@PACKAGE_VERSION@}
BUILD=${BUILD:-1}
TAG=${TAG:-_am}
PKGNAM=${PRGNAM}-${VERSION}
PKGTYPE=${PKGTYPE:-txz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
@ -18,7 +37,12 @@ if [ -z "$ARCH" ]; then
esac
fi
TMP=${TMP:-/tmp}
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/am}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
@ -31,6 +55,9 @@ elif [ "$ARCH" = "i686" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
elif [ "$ARCH" = "aarch64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
@ -42,7 +69,7 @@ rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/@PACKAGE@-$VERSION.tar.gz
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
@ -60,23 +87,29 @@ CXXFLAGS="$SLKCFLAGS" \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--build=$ARCH-slackware-linux
make -j4
--disable-static \
--build=$ARCH-slackware-linux \
--with-init-type=bsd
make -j
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?/*.?
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a COPYING AUTHORS HISTORY README snapraid.conf.example $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
cat $CWD/doinst.sh > $PKG/install/doinst.sh
mkdir -p $PKG/etc
rm -f $PKG/etc/snapraid.conf
cat snapraid.conf.example > $PKG/etc/snapraid.conf.new
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE