Index: sysutils/Makefile =================================================================== --- sysutils/Makefile +++ sysutils/Makefile @@ -1356,6 +1356,7 @@ SUBDIR += znapzend SUBDIR += zogftw SUBDIR += zrep + SUBDIR += zrepl SUBDIR += zsd SUBDIR += zxfer Index: sysutils/zrepl/Makefile =================================================================== --- /dev/null +++ sysutils/zrepl/Makefile @@ -0,0 +1,62 @@ +# Created by: Nikolai Lifanov and Ben Woods +# $FreeBSD$ + +PORTNAME= zrepl +PORTVERSION= 0.0.1 +CATEGORIES= sysutils + +MAINTAINER= lifanov@FreeBSD.org +COMMENT= ZFS dataset replication tool + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= go +USE_RC_SUBR= zrepl +SUB_FILES= pkg-message + +USE_GITHUB= yes +GH_SUBDIR= src/github.com/zrepl/zrepl +GH_TUPLE= davecgh:go-spew:v1.1.0:go_spew/src/github.com/davecgh/go-spew \ + fsnotify:fsnotify:v1.4.2:fsnotify/src/github.com/fsnotify/fsnotify \ + ftrvxmtrx:fd:c6d8003:fd/src/github.com/ftrvxmtrx/fd \ + go-logfmt:logfmt:v0.3.0:go_logfmt/src/github.com/go-logfmt/logfmt \ + go-yaml:yaml:eb3733d:go_yaml/src/github.com/go-yaml/yaml \ + hashicorp:hcl:68e816d:hcl/src/github.com/hashicorp/hcl \ + inconshreveable:mousetrap:v1.0:mousetrap/src/github.com/inconshreveable/mousetrap \ + jinzhu:copier:db4671f:copier/src/github.com/jinzhu/copier \ + kr:logfmt:b84e30a:logfmt/src/github.com/kr/logfmt \ + kr:pretty:cfb55aa:pretty/src/github.com/kr/pretty \ + kr:text:7cafcd8:text/src/github.com/kr/text \ + magiconair:properties:v1.7.3:properties/src/github.com/magiconair/properties \ + mitchellh:go-homedir:b8bc1bf:go_homedir/src/github.com/mitchellh/go-homedir \ + mitchellh:mapstructure:d0303fe:mapstructure/src/github.com/mitchellh/mapstructure \ + pelletier:go-buffruneio:v0.2.0:go_buffruneio/src/github.com/pelletier/go-buffruneio \ + pelletier:go-toml:v1.0.0:go_toml/src/github.com/pelletier/go-toml \ + pkg:errors:v0.8.0:errors/src/github.com/pkg/errors \ + pmezard:go-difflib:v1.0.0:go_difflib/src/github.com/pmezard/go-difflib \ + spf13:afero:ee1bd8e:afero/src/github.com/spf13/afero \ + spf13:cast:v1.1.0:cast/src/github.com/spf13/cast \ + spf13:cobra:b787445:cobra/src/github.com/spf13/cobra \ + spf13:jWalterWeatherman:12bd96e:jwalterweatherman/src/github.com/spf13/jwalterweatherman \ + spf13:pflag:v1.0.0:pflag/src/github.com/spf13/pflag \ + spf13:viper:v1.0.0:viper/src/github.com/spf13/viper \ + stretchr:testify:v1.1.4:testify/src/github.com/stretchr/testify + +GO_PKGNAME= github.com/${GH_ACCOUNT}/${GH_PROJECT} + +post-extract: + ${LN} -sf ${WRKSRC}/src ${WRKDIR} + +do-install: + ${INSTALL_PROGRAM} ${WRKDIR}/bin/${PORTNAME} ${STAGEDIR}${PREFIX}/bin + +post-install: + @${MKDIR} ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d \ + ${STAGEDIR}${PREFIX}/etc/syslog.d \ + ${STAGEDIR}${PREFIX}/etc/zrepl + ${INSTALL_DATA} ${FILESDIR}/newsyslog-zrepl.conf ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d/zrepl.conf + ${INSTALL_DATA} ${FILESDIR}/syslog-zrepl.conf.sample ${STAGEDIR}${PREFIX}/etc/syslog.d/zrepl.conf.sample + ${INSTALL_DATA} ${FILESDIR}/zrepl.yml.sample ${STAGEDIR}${PREFIX}/etc/zrepl/zrepl.yml.sample + +.include Index: sysutils/zrepl/distinfo =================================================================== --- /dev/null +++ sysutils/zrepl/distinfo @@ -0,0 +1,53 @@ +TIMESTAMP = 1506825154 +SHA256 (zrepl-zrepl-0.0.1_GH0.tar.gz) = 33bc044745a22d9b4e4e8a7196668a0c414b1448205600a1d18b0a0102cebe29 +SIZE (zrepl-zrepl-0.0.1_GH0.tar.gz) = 65120 +SHA256 (davecgh-go-spew-v1.1.0_GH0.tar.gz) = 1f7e0bd2db0341925b5f2ee5834e99380f4c2b1bd36cf0fa62d7717899d39d62 +SIZE (davecgh-go-spew-v1.1.0_GH0.tar.gz) = 42337 +SHA256 (fsnotify-fsnotify-v1.4.2_GH0.tar.gz) = 4a1fd9beeb0496b9cf6084ac83654ece19188e9b2ffa041652d1071d4b225415 +SIZE (fsnotify-fsnotify-v1.4.2_GH0.tar.gz) = 29552 +SHA256 (ftrvxmtrx-fd-c6d8003_GH0.tar.gz) = cc6ff072f220c819fffde3b35edeba0183c827e8ff76f221acb6a6d71d257e90 +SIZE (ftrvxmtrx-fd-c6d8003_GH0.tar.gz) = 3283 +SHA256 (go-logfmt-logfmt-v0.3.0_GH0.tar.gz) = 74a958064177fc33cc66c60ae118f95faf9f986bcab0465c47f40d8cad978fce +SIZE (go-logfmt-logfmt-v0.3.0_GH0.tar.gz) = 11546 +SHA256 (go-yaml-yaml-eb3733d_GH0.tar.gz) = d2ae44f0e31f3a13a1b89a55ceaabcbab4d588d41951fd2243739b60b10146bb +SIZE (go-yaml-yaml-eb3733d_GH0.tar.gz) = 64686 +SHA256 (hashicorp-hcl-68e816d_GH0.tar.gz) = 288631e25ed9624a73ccd66b198f272fb50cc047d1705c22b3c42d3933e192dc +SIZE (hashicorp-hcl-68e816d_GH0.tar.gz) = 69764 +SHA256 (inconshreveable-mousetrap-v1.0_GH0.tar.gz) = a4d93289b6c62780bf78f221febe9e45dc3095f382336a166734ed294007ff1b +SIZE (inconshreveable-mousetrap-v1.0_GH0.tar.gz) = 2288 +SHA256 (jinzhu-copier-db4671f_GH0.tar.gz) = 3ae429e4a775545174f89591605f2775e3d52d9942ef1619019c84dfec65552f +SIZE (jinzhu-copier-db4671f_GH0.tar.gz) = 5039 +SHA256 (kr-logfmt-b84e30a_GH0.tar.gz) = 1fb415fdfeca3d607e0bd0474def2f76a1438abfea8e35f1cda052673e5967e0 +SIZE (kr-logfmt-b84e30a_GH0.tar.gz) = 6405 +SHA256 (kr-pretty-cfb55aa_GH0.tar.gz) = 5c8e2093298c7540a2707a34d283ce37f1b288497786d4f5725647a63ab2ac5c +SIZE (kr-pretty-cfb55aa_GH0.tar.gz) = 8499 +SHA256 (kr-text-7cafcd8_GH0.tar.gz) = 218bd56a3927283e4c9232b4ee15e0fcc989ace72a2a0be14863ce3795ad3c90 +SIZE (kr-text-7cafcd8_GH0.tar.gz) = 8584 +SHA256 (magiconair-properties-v1.7.3_GH0.tar.gz) = 984fdc5c5d303e4c85975e3a8e15ac7217f48998c262388b21dbceb94010b1a8 +SIZE (magiconair-properties-v1.7.3_GH0.tar.gz) = 27512 +SHA256 (mitchellh-go-homedir-b8bc1bf_GH0.tar.gz) = 4baa24d61eab2da480d6f11d1d6f2a1cb7601f7b634af2ad5a978c95452150b9 +SIZE (mitchellh-go-homedir-b8bc1bf_GH0.tar.gz) = 2993 +SHA256 (mitchellh-mapstructure-d0303fe_GH0.tar.gz) = 30e7697b7e321d8f14bff5f19b789cd38fd277518aae251c370ea53ddb53d1f7 +SIZE (mitchellh-mapstructure-d0303fe_GH0.tar.gz) = 15560 +SHA256 (pelletier-go-buffruneio-v0.2.0_GH0.tar.gz) = 2a838bbc3240d323549c9e6820cbf66199296d2706e72697685ee9576affd49f +SIZE (pelletier-go-buffruneio-v0.2.0_GH0.tar.gz) = 3028 +SHA256 (pelletier-go-toml-v1.0.0_GH0.tar.gz) = 068455531f9a8cb9cad590d2d9a02bc25180737868de640849d85a5b99a0ce37 +SIZE (pelletier-go-toml-v1.0.0_GH0.tar.gz) = 47009 +SHA256 (pkg-errors-v0.8.0_GH0.tar.gz) = bacf6c58e490911398cee61742ddc6a90c560733e4c9dcb3d867b17a894c9dd5 +SIZE (pkg-errors-v0.8.0_GH0.tar.gz) = 11344 +SHA256 (pmezard-go-difflib-v1.0.0_GH0.tar.gz) = 28f3dc1b5c0efd61203ab07233f774740d3bf08da4d8153fb5310db6cea0ebda +SIZE (pmezard-go-difflib-v1.0.0_GH0.tar.gz) = 11398 +SHA256 (spf13-afero-ee1bd8e_GH0.tar.gz) = 17fd67e75e894ac0dd8742aab75ab8937a5f95716e433c6e5af59a34669f5b3c +SIZE (spf13-afero-ee1bd8e_GH0.tar.gz) = 42558 +SHA256 (spf13-cast-v1.1.0_GH0.tar.gz) = 2758eb969dd8707c0ff165fda4191fd8811e19b0c5d29d3dced0fba1b4410ad4 +SIZE (spf13-cast-v1.1.0_GH0.tar.gz) = 9592 +SHA256 (spf13-cobra-b787445_GH0.tar.gz) = 2923b91766a9e68a22f81d3b46768dad963fd4ae3f6a5b2e137e2a7b87b37276 +SIZE (spf13-cobra-b787445_GH0.tar.gz) = 99833 +SHA256 (spf13-jWalterWeatherman-12bd96e_GH0.tar.gz) = 58740d954bd3cb9c3f3e34581a62403d8d32bab3491422276bc2b1c339f6ec85 +SIZE (spf13-jWalterWeatherman-12bd96e_GH0.tar.gz) = 6342 +SHA256 (spf13-pflag-v1.0.0_GH0.tar.gz) = 690b86ae5499fad84ada4644c85215d66d56f31934683e8543f4c57c5048e011 +SIZE (spf13-pflag-v1.0.0_GH0.tar.gz) = 38988 +SHA256 (spf13-viper-v1.0.0_GH0.tar.gz) = 50c1c336095ce0e7edf414c25f80f3f01b65457b092752252f2c47af85c8c99e +SIZE (spf13-viper-v1.0.0_GH0.tar.gz) = 30804 +SHA256 (stretchr-testify-v1.1.4_GH0.tar.gz) = f7a244ad38ee484296e8969356209e0d9fb35bd790f69fc5e7758b4e2a9e1874 +SIZE (stretchr-testify-v1.1.4_GH0.tar.gz) = 83325 Index: sysutils/zrepl/files/newsyslog-zrepl.conf =================================================================== --- /dev/null +++ sysutils/zrepl/files/newsyslog-zrepl.conf @@ -0,0 +1,7 @@ +# $FreeBSD$ +# +# Newsyslog configuration file for zrepl. +# See newsyslog.conf(5) for details. +# +# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] +/var/log/zrepl.log 644 7 1000 @T00 JNC Index: sysutils/zrepl/files/pkg-message.in =================================================================== --- /dev/null +++ sysutils/zrepl/files/pkg-message.in @@ -0,0 +1,15 @@ +------------------------------------------------------------------------ +zrepl must be configured before it is started the first time. +- Create the log file /var/log/zrepl.log: + # service newsyslog restart +- Teach syslogd to redirect facility local0 to the zrepl.log file: + # service syslogd reload +- Modify the %%PREFIX%%/etc/zrepl/zrepl.yml configuration file +- For remote backups, create the SSH key pair and authorized_keys file +- Enable the zrepl daemon to start automatically at boot: + # sysrc zrepl_enable="YES" +- Start the zrepl daemon: + # service zrepl start + +For documentation, refer to https://zrepl.github.io/. +------------------------------------------------------------------------ Index: sysutils/zrepl/files/syslog-zrepl.conf.sample =================================================================== --- /dev/null +++ sysutils/zrepl/files/syslog-zrepl.conf.sample @@ -0,0 +1,8 @@ +# $FreeBSD$ +# +# Syslog configuration file for zrepl. +# See syslog.conf(5) for details. +# +# SELECTOR ACTION +# FACILITY.[!<=>]LEVEL +local0.info /var/log/zrepl.log Index: sysutils/zrepl/files/zrepl.in =================================================================== --- /dev/null +++ sysutils/zrepl/files/zrepl.in @@ -0,0 +1,59 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: zrepl +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# zrepl_enable: Set to YES to enable the zrepl service. +# Default: NO +# zrepl_config: File containing zrepl configuration details. +# Default: %%PREFIX%%/etc/zrepl/zrepl.yml +# zrepl_user: The user account used to run the zrepl daemon. +# Do not specifically set this to an empty string as this +# will cause the daemon to run as root. +# Default: root +# zrepl_group: The group account used to run the zrepl daemon. +# Do not specifically set this to an empty string as this +# will cause the daemon to run with group wheel. +# Default: wheel + +. /etc/rc.subr +name=zrepl +rcvar=${name}_enable +load_rc_config $name + +: ${zrepl_enable:="NO"} +: ${zrepl_config:="%%PREFIX%%/etc/zrepl/zrepl.yml"} +: ${zrepl_user:="root"} +: ${zrepl_group:="wheel"} + +pidfile="/var/run/zrepl/daemon.pid" +command="/usr/sbin/daemon" +procname="%%PREFIX%%/bin/zrepl" +command_args="-p ${pidfile} -S -l local0 -s alert -T zrepl ${procname} --config ${zrepl_config} daemon" + +start_precmd=zrepl_precmd +zrepl_precmd() +{ + if [ ! -d "/var/run/zrepl/stdinserver" ]; then + install -d -g ${zrepl_group} -o ${zrepl_user} -m 0700 -- "/var/run/zrepl"; + install -d -g ${zrepl_group} -o ${zrepl_user} -m 0700 -- "/var/run/zrepl/stdinserver"; + fi + + if [ ! -e "${pidfile}" ]; then + install -g ${zrepl_group} -o ${zrepl_user} -- /dev/null "${pidfile}"; + fi +} + +stop_postcmd=zrepl_postcmd +zrepl_postcmd() +{ + rm -f -- "${pidfile}" +} + +run_rc_command "$1" Index: sysutils/zrepl/files/zrepl.yml.sample =================================================================== --- /dev/null +++ sysutils/zrepl/files/zrepl.yml.sample @@ -0,0 +1,12 @@ +# $FreeBSD$ +# +# zrepl main configuration file. +# For documentation, refer to https://zrepl.github.io/ +# +global: + logging: + syslog: + enable: true + format: logfmt + +# Add "jobs:" section(s) here for your specific use cases. Index: sysutils/zrepl/pkg-descr =================================================================== --- /dev/null +++ sysutils/zrepl/pkg-descr @@ -0,0 +1,4 @@ +zrepl is a cross-platform ZFS replication tool written in Go that supports +feature detection, bookmarks, and other new features, written in Go. + +WWW: https://zrepl.github.io/ Index: sysutils/zrepl/pkg-plist =================================================================== --- /dev/null +++ sysutils/zrepl/pkg-plist @@ -0,0 +1,4 @@ +bin/zrepl +etc/newsyslog.conf.d/zrepl.conf +@sample etc/syslog.d/zrepl.conf.sample +@sample etc/zrepl/zrepl.yml.sample