aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorMatt Egger <bru.barwal@sdf.org>2023-07-22 09:58:48 +0900
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2023-07-22 15:52:47 +0700
commit1c5c510e7a34ed24990689908f29a198e2f83c16 (patch)
treec2fd71121dc09490bce1a9ed181fdf6e33a95052 /system
parenta0b403883916d2388f579f2763d79c97ebf87849 (diff)
system/sanoid: Added (zfs snapshot mgmt).
Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system')
-rw-r--r--system/sanoid/README48
-rw-r--r--system/sanoid/doinst.sh19
-rw-r--r--system/sanoid/sanoid.SlackBuild77
-rw-r--r--system/sanoid/sanoid.info10
-rw-r--r--system/sanoid/slack-desc19
5 files changed, 173 insertions, 0 deletions
diff --git a/system/sanoid/README b/system/sanoid/README
new file mode 100644
index 000000000000..b620a57bfb15
--- /dev/null
+++ b/system/sanoid/README
@@ -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.
diff --git a/system/sanoid/doinst.sh b/system/sanoid/doinst.sh
new file mode 100644
index 000000000000..f117ed7e9902
--- /dev/null
+++ b/system/sanoid/doinst.sh
@@ -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
diff --git a/system/sanoid/sanoid.SlackBuild b/system/sanoid/sanoid.SlackBuild
new file mode 100644
index 000000000000..ab1315aec765
--- /dev/null
+++ b/system/sanoid/sanoid.SlackBuild
@@ -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
diff --git a/system/sanoid/sanoid.info b/system/sanoid/sanoid.info
new file mode 100644
index 000000000000..d01b4b318430
--- /dev/null
+++ b/system/sanoid/sanoid.info
@@ -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"
diff --git a/system/sanoid/slack-desc b/system/sanoid/slack-desc
new file mode 100644
index 000000000000..a7da7c6f83eb
--- /dev/null
+++ b/system/sanoid/slack-desc
@@ -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