diff options
author | Mike Swanson | 2015-09-02 19:48:48 -0700 |
---|---|---|
committer | Mike Swanson | 2015-09-02 19:48:48 -0700 |
commit | b15ebcfb444f3eb031771d6ce5cb9964a00a591b (patch) | |
tree | 96d66f0e0025196b526081a1ab33abfc82f2f809 | |
download | aur-b15ebcfb444f3eb031771d6ce5cb9964a00a591b.tar.gz |
Initial package
-rw-r--r-- | .SRCINFO | 17 | ||||
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | PKGBUILD | 84 |
3 files changed, 106 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..6a2c5ac0bea4 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,17 @@ +pkgbase = zfs-auto-snapshot-git + pkgdesc = Implementation of a snapshotting service for ZFS + pkgver = 1.2.1.1.r0.63e4438 + pkgrel = 1 + epoch = 1 + arch = any + license = GPL2 + makedepends = git + depends = systemd>=212 + depends = zfs + provides = zfs-auto-snapshot + conflicts = zfs-auto-snapshot + source = git+https://github.com/zfsonlinux/zfs-auto-snapshot#branch=debian + sha256sums = SKIP + +pkgname = zfs-auto-snapshot-git + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..3e5648de80eb --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.pkg.tar* +*.src.tar* +/zfs-auto-snapshot/ +src +pkg diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..68bd388a43c6 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,84 @@ +# Maintainer: Mike Swanson <mikeonthecomputer@gmail.com> + +pkgname=zfs-auto-snapshot-git +pkgdesc="Implementation of a snapshotting service for ZFS" +pkgver=1.2.1.1.r0.63e4438 +pkgrel=1 +epoch=1 +arch=('any') +url="" +license=('GPL2') +depends=('systemd>=212' 'zfs') +makedepends=('git') +provides=("${pkgname%-git}") +conflicts=("${pkgname%-git}") +source=('git+https://github.com/zfsonlinux/zfs-auto-snapshot#branch=debian') +sha256sums=('SKIP') + +pkgver() { + cd "$srcdir/${pkgname%-git}" + + printf "%s\n" "$(git describe --tags --long | sed 's|debian/||g' | sed 's/\([^-]*-\)g/r\1/;s/-/./g')" +} + +build() { + cd "$srcdir/${pkgname%-git}" + + ### COMMENT the following 4 lines to NOT change the snapshot name to + ### @PREFIX_DATE_LABEL instead of @PREFIX-LABEL_DATE + ### (the following makes the snapshots nicely sorted by time) + sed -r -i \ + -e 's@^(SNAPNAME="\$)(opt_prefix)(.*)-\$DATE@\1{\2}_$DATE\3@' \ + -e 's@^(SNAPGLOB="\$)(opt_prefix)(.*})([?]+)@\1{\2}\4\3@' \ + src/zfs-auto-snapshot.sh + + mkdir systemd + ### "Label|NumberOfKeptSnapshots|systemd-timer-spec" of snapshots, + ### eg. timer and service files, being created adjust/extend if required + declare -a arr=( + "frequent|4|*:0/15" + "hourly|24|hourly" + "daily|31|daily" + "weekly|8|weekly" + "monthly|12|monthly") + + for i in "${arr[@]}" + do + _label="$(echo $i | cut -d'|' -f1)" + _keep="$(echo $i | cut -d'|' -f2)" + _OnCalendarSpec="$(echo $i | cut -d'|' -f3)" + _prefix="--prefix=znap" + cat > systemd/zfs-auto-snapshot-${_label}.service <<EOF +[Unit] +Description=ZFS $_label snapshot service + +[Service] +ExecStart=$_PREFIX/bin/zfs-auto-snapshot --skip-scrub $_prefix --label=$_label --keep=$_keep // +EOF + + # write timer files + cat > systemd/zfs-auto-snapshot-${_label}.timer <<EOF +# See systemd.timers and systemd.time manpages for details +[Unit] +Description=ZFS $_label snapshot timer + +[Timer] +OnCalendar=$_OnCalendarSpec +Persistent=true + +[Install] +WantedBy=timers.target +EOF + done +} + +package() { + cd "$srcdir/${pkgname%-git}" + + install -d "$pkgdir/usr/bin" + install -d "$pkgdir/usr/lib/systemd/system" + install -d "$pkgdir/usr/share/man/man8" + install -m 755 src/zfs-auto-snapshot.sh "$pkgdir/usr/bin/zfs-auto-snapshot" + install -m 644 src/zfs-auto-snapshot.8 "$pkgdir/usr/share/man/man8" + install -m 644 systemd/* "$pkgdir/usr/lib/systemd/system" +} |