diff options
Diffstat (limited to 'filesystems/zfsnap')
| -rw-r--r-- | filesystems/zfsnap/Makefile | 37 | ||||
| -rw-r--r-- | filesystems/zfsnap/distinfo | 3 | ||||
| -rw-r--r-- | filesystems/zfsnap/files/patch-zfSnap.sh | 11 | ||||
| -rw-r--r-- | filesystems/zfsnap/pkg-descr | 8 | ||||
| -rw-r--r-- | filesystems/zfsnap/pkg-message | 55 | ||||
| -rw-r--r-- | filesystems/zfsnap/pkg-plist | 10 |
6 files changed, 124 insertions, 0 deletions
diff --git a/filesystems/zfsnap/Makefile b/filesystems/zfsnap/Makefile new file mode 100644 index 000000000000..65385b1144fc --- /dev/null +++ b/filesystems/zfsnap/Makefile @@ -0,0 +1,37 @@ +PORTNAME= zfsnap +PORTVERSION= 1.11.1 +DISTVERSIONPREFIX= v +PORTREVISION= 1 +CATEGORIES= filesystems sysutils + +MAINTAINER= yamagi@yamagi.org +COMMENT= Simple sh script to make zfs rolling snaphosts with cron +WWW= https://github.com/zfsnap/zfsnap + +LICENSE= BSD3CLAUSE + +NO_BUILD= yes +USE_GITHUB= yes + +PERIODICDIR?= ${PREFIX}/etc/periodic +PLIST_SUB+= PERIODICDIR="${PERIODICDIR:S,^${PREFIX}/,,}" + +post-extract: +.for period in hourly daily weekly monthly reboot + @${SED} -e "s/xPERIODICx/${period}/g" -e "s#xPREFIXx#${PREFIX}/sbin#g" ${WRKSRC}/xPERIODICx_zfSnap.sh > ${WRKSRC}/${period}_zfSnap.sh +.endfor +.for period in hourly daily weekly monthly + @${SED} -e "s/xPERIODICx/${period}/g" -e "s#xPREFIXx#${PREFIX}/sbin#g" ${WRKSRC}/xPERIODICx_zfSnap_delete.sh > ${WRKSRC}/${period}_zfSnap_delete.sh +.endfor + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/zfSnap.sh ${STAGEDIR}${PREFIX}/sbin/zfSnap +.for period in hourly daily weekly monthly + @${MKDIR} ${STAGEDIR}${PERIODICDIR}/${period} + ${INSTALL_SCRIPT} ${WRKSRC}/${period}_zfSnap.sh ${STAGEDIR}${PERIODICDIR}/${period}/402.zfSnap + ${INSTALL_SCRIPT} ${WRKSRC}/${period}_zfSnap_delete.sh ${STAGEDIR}${PERIODICDIR}/${period}/403.zfSnap_delete +.endfor + @${MKDIR} ${STAGEDIR}${PERIODICDIR}/reboot + ${INSTALL_SCRIPT} ${WRKSRC}/reboot_zfSnap.sh ${STAGEDIR}${PERIODICDIR}/reboot/402.zfSnap + +.include <bsd.port.mk> diff --git a/filesystems/zfsnap/distinfo b/filesystems/zfsnap/distinfo new file mode 100644 index 000000000000..195e29ee0742 --- /dev/null +++ b/filesystems/zfsnap/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1730905205 +SHA256 (zfsnap-zfsnap-v1.11.1_GH0.tar.gz) = dd533d5faff9fa98deeb9ae0909784b67b0dc43d3870f259eeb390fbc1d03bcf +SIZE (zfsnap-zfsnap-v1.11.1_GH0.tar.gz) = 4969 diff --git a/filesystems/zfsnap/files/patch-zfSnap.sh b/filesystems/zfsnap/files/patch-zfSnap.sh new file mode 100644 index 000000000000..1cdd609dd8b3 --- /dev/null +++ b/filesystems/zfsnap/files/patch-zfSnap.sh @@ -0,0 +1,11 @@ +--- zfSnap.sh.orig 2013-01-18 03:37:09.000000000 +0700 ++++ zfSnap.sh 2018-01-22 23:20:20.257104000 +0700 +@@ -199,6 +199,8 @@ rm_zfs_snapshot() { + } + + skip_pool() { ++ local i ++ + # more like skip pool??? + if is_true $scrub_skip; then + for i in $scrub_pools; do diff --git a/filesystems/zfsnap/pkg-descr b/filesystems/zfsnap/pkg-descr new file mode 100644 index 000000000000..16d0cef6da58 --- /dev/null +++ b/filesystems/zfsnap/pkg-descr @@ -0,0 +1,8 @@ +zfSnap is a simple sh script for creating ZFS snapshots. When called from +cron rolling snapshots can be created and deleted automatically. The main +advantage of zfSnap is that it is written in 100% pure /bin/sh, does not +require any additional software to run, and is simple to use. + +zfSnap keeps all information about snapshot in snapshot name. zfs snapshot +names are in form: Timestamp--TTL where timestamp is date and time of +snapshot creation and TTL is Time To Live in human readable form. diff --git a/filesystems/zfsnap/pkg-message b/filesystems/zfsnap/pkg-message new file mode 100644 index 000000000000..927cda7debfd --- /dev/null +++ b/filesystems/zfsnap/pkg-message @@ -0,0 +1,55 @@ +[ +{ type: install + message: <<EOM + To run zfSnap periodically you can add these options to your + /etc/periodic.conf + + xPERIODICx_zfsnap_enable - Enable xPERIODICx snapshots + (values: YES | NO) + xPERIODICx_zfsnap_fs - Space separated zfs filesystems + to create non-recursive snapshots + xPERIODICx_zfsnap_recursive_fs - Space separated zfs filesystems + to create recursive snapshots + xPERIODICx_zfsnap_ttl - Set Time To Live + xPERIODICx_zfsnap_verbose - Verbose output (values: YES | NO) + xPERIODICx_zfsnap_flags - zfSnap generic flags + (except -v and -d) + xPERIODICx_zfsnap_enable_prefix - Create snapshots with prefix + (Default = YES) + xPERIODICx_zfsnap_prefix - Set prefix to use for new snapshots + (Default = "xPERIODICx-") + (where xPERIODICx is any of hourly, daily, weekly, monthly, reboot) + + xPERIODICx_zfsnap_delete_enable - Delete old snapshots periodically + (values: YES | NO) + xPERIODICx_zfsnap_delete_flags - zfSnap generic flags + (except -v and -d) + xPERIODICx_zfsnap_delete_verbose - Verbose output (values: YES | NO) + xPERIODICx_zfsnap_delete_prefixes - Space separated list of prefixes + of old zfSnap snapshots to delete + 'hourly-', 'daily-', 'weekly-', + 'monthly-' and 'reboot-' prefixes + are hard-coded + (where xPERIODICx is any of daily, weekly, monthly) + + + Add these lines to your /etc/crontab + 4 * * * * root periodic hourly + @reboot root periodic reboot + + NOTE: it is not recommended to delete zfSnap snapshots every hour. + Deleting zfs snapshots takes more time than creating them. + There for it's better to delete snapshots once per day... + + + Periodic scripts provide very limited feature set. If you want to use + more advanced setup, you need to call zfSnap from crontab directly. + This way you can combine all sort of parameter combinations. + + Don't forget to check https://github.com/graudeejs/zfSnap/wiki for more + info. + + Feedback welcomed: graudeejs@gmail.com +EOM +} +] diff --git a/filesystems/zfsnap/pkg-plist b/filesystems/zfsnap/pkg-plist new file mode 100644 index 000000000000..048f85a2e8f1 --- /dev/null +++ b/filesystems/zfsnap/pkg-plist @@ -0,0 +1,10 @@ +sbin/zfSnap +%%PERIODICDIR%%/daily/402.zfSnap +%%PERIODICDIR%%/daily/403.zfSnap_delete +%%PERIODICDIR%%/hourly/402.zfSnap +%%PERIODICDIR%%/hourly/403.zfSnap_delete +%%PERIODICDIR%%/monthly/402.zfSnap +%%PERIODICDIR%%/monthly/403.zfSnap_delete +%%PERIODICDIR%%/reboot/402.zfSnap +%%PERIODICDIR%%/weekly/402.zfSnap +%%PERIODICDIR%%/weekly/403.zfSnap_delete |
