diff --git a/makeslackdist.sh.in b/makeslackdist.sh.in index 3206d8a7..5d98da16 100644 --- a/makeslackdist.sh.in +++ b/makeslackdist.sh.in @@ -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 diff --git a/pkg/README b/pkg/README new file mode 100644 index 00000000..5ca917de --- /dev/null +++ b/pkg/README @@ -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. diff --git a/pkg/doinst.sh b/pkg/doinst.sh new file mode 100644 index 00000000..18f9d1b2 --- /dev/null +++ b/pkg/doinst.sh @@ -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 diff --git a/pkg/snapraid.SlackBuild.in b/pkg/snapraid.SlackBuild.in index 45915150..3b89dc72 100644 --- a/pkg/snapraid.SlackBuild.in +++ b/pkg/snapraid.SlackBuild.in @@ -1,24 +1,48 @@ -#!/bin/bash -# SlackBuild script for @PACKAGE_NAME@ -# Written for personal use / inspired by SlackBuilds.org templates + +# Slackware build script for @PACKAGE_NAME@ + +# Copyright +# 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 + case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; - *) ARCH=$(uname -m) ;; + *) ARCH=$( uname -m ) ;; 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,14 +69,14 @@ 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 . \ \( -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 {} \; + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ @@ -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