system/sanoid: Added (zfs snapshot mgmt).

Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Matt Egger 2023-07-22 09:58:48 +09:00 committed by Willy Sudiarto Raharjo
parent a0b4038839
commit 1c5c510e7a
No known key found for this signature in database
GPG key ID: 3F617144D7238786
5 changed files with 173 additions and 0 deletions

48
system/sanoid/README Normal file
View file

@ -0,0 +1,48 @@
Policy-driven snapshot management and replication tools. Using ZFS for
underlying next-gen storage. Primarily intended for Linux, but BSD use
is supported and reasonably frequently tested.
You can use sanoid to create, automatically thin, and monitor
snapshots and pool health from a single eminently human-readable TOML
config file at /etc/sanoid/sanoid.conf.
DEPENDENCIES
SANOID depends on the Perl module Config::IniFiles and will not
operate without it. Config::IniFiles may be installed from CPAN,
though the project strongly recommends using your distribution's
repositories instead.
SYNCOID depends on ssh, pv, gzip, lzop, and mbuffer. It can run with
reduced functionality in the absence of any or all of the above. SSH
is only required for remote synchronization.
CRON
If you use cron there is the need to ensure that only one instance of
sanoid is run at any time (or else there will be funny error messages
about missing snapshots, ...). It's also good practice to separate
the snapshot taking and pruning so the later won't block the former
in case of long running pruning operations. Following is the
recommend setup for a standard install:
*/15 * * * * root flock -n /var/run/sanoid/cron-take.lock -c \
"TZ=UTC sanoid --take-snapshots"
*/15 * * * * root flock -n /var/run/sanoid/cron-prune.lock -c \
"sanoid --prune-snapshots"
Adapt the timer interval to the lowest configured snapshot interval.
CONFIGURATION
SANOID won't do anything useful unless you tell it how to handle your
ZFS datasets in `/etc/sanoid/sanoid.conf`.
Take a look at the files `sanoid.defaults.conf` and `sanoid.conf` for
all possible configuration options.
Also have a look at the README.md for a simpler suggestion for
`sanoid.conf`.
SYNCOID is a command line utility that doesn't require any
configuration, with all of its switches set at runtime.

19
system/sanoid/doinst.sh Normal file
View file

@ -0,0 +1,19 @@
# $RCSfile: doinst.sh,v $
# $Revision: 1.9 $
# $Date: 2023-05-11 07:58:15+01 $
# DW
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/sanoid/sanoid.conf.new

View file

@ -0,0 +1,77 @@
#!/bin/bash
# Slackware build script for sanoid
# Copyright 2023 Matt Egger USA
# 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=sanoid
VERSION=${VERSION:-2.2.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
ARCH=noarch
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
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 {} \;
mkdir -p $PKG/etc/sanoid
cp -a sanoid.defaults.conf $PKG/etc/sanoid/sanoid.defaults.conf
cp -a sanoid.conf $PKG/etc/sanoid/sanoid.conf.new
mkdir -p $PKG/usr/bin
cp -a sanoid syncoid findoid sleepymutex $PKG/usr/bin
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a CHANGELIST README.md $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/usr/share/$PRGNAM
echo "* * * * * /usr/bin/sanoid --cron" > $PKG/usr/share/$PRGNAM/sanoid.cron
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

10
system/sanoid/sanoid.info Normal file
View file

@ -0,0 +1,10 @@
PRGNAM="sanoid"
VERSION="2.2.0"
HOMEPAGE="https://github.com/jimsalterjrs/sanoid"
DOWNLOAD="https://github.com/jimsalterjrs/sanoid/archive/v2.2.0/sanoid-2.2.0.tar.gz"
MD5SUM="d525ca629960a02611a2f5dc15f6652a"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="%README% openzfs perl-Config-IniFiles perl-Capture-Tiny"
MAINTAINER="Matt Egger"
EMAIL="bru.barwal@sdf.org"

19
system/sanoid/slack-desc Normal file
View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
sanoid: sanoid (policy-driven snapshot management tool for ZFS filesystems)
sanoid:
sanoid: Policy-driven snapshot management and replication tools. Using ZFS for
sanoid: underlying next-gen storage. Primarily intended for Linux, but BSD use
sanoid: is supported and reasonably frequently tested.
sanoid:
sanoid: You can use sanoid to create, automatically thin, and monitor
sanoid: snapshots and pool health from a single eminently human-readable TOML
sanoid: config file at /etc/sanoid/sanoid.conf.
sanoid:
sanoid: https://github.com/jimsalterjrs/sanoid