From e2071aa9d31e22b823607875b17f3b7448e1b249 Mon Sep 17 00:00:00 2001 From: Dan Ponte Date: Mon, 21 Nov 2022 06:33:16 -0500 Subject: [PATCH] Add zrepl 0.6.0 --- sysutils/zrepl/Makefile | 66 ++++++++++++++++++++++++ sysutils/zrepl/distinfo | 5 ++ sysutils/zrepl/files/newsyslog.conf | 5 ++ sysutils/zrepl/files/pkg-message.in | 27 ++++++++++ sysutils/zrepl/files/syslog.conf | 6 +++ sysutils/zrepl/files/zrepl.in | 79 +++++++++++++++++++++++++++++ sysutils/zrepl/files/zrepl.yml | 13 +++++ sysutils/zrepl/pkg-descr | 2 + sysutils/zrepl/pkg-plist | 23 +++++++++ 9 files changed, 226 insertions(+) create mode 100644 sysutils/zrepl/Makefile create mode 100644 sysutils/zrepl/distinfo create mode 100644 sysutils/zrepl/files/newsyslog.conf create mode 100644 sysutils/zrepl/files/pkg-message.in create mode 100644 sysutils/zrepl/files/syslog.conf create mode 100644 sysutils/zrepl/files/zrepl.in create mode 100644 sysutils/zrepl/files/zrepl.yml create mode 100644 sysutils/zrepl/pkg-descr create mode 100644 sysutils/zrepl/pkg-plist diff --git a/sysutils/zrepl/Makefile b/sysutils/zrepl/Makefile new file mode 100644 index 0000000..617557b --- /dev/null +++ b/sysutils/zrepl/Makefile @@ -0,0 +1,66 @@ +PORTNAME= zrepl +DISTVERSIONPREFIX= v +DISTVERSION= 0.6.0 +CATEGORIES= sysutils + +MAINTAINER= lcook@FreeBSD.org +COMMENT= ZFS dataset replication tool +WWW= https://zrepl.github.io/ + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= go:modules +USE_RC_SUBR= zrepl + +GO_MODULE= github.com/${PORTNAME}/${PORTNAME}@v0.6.0 +GO_BUILDFLAGS= -ldflags "\ + -s -w\ + -X ${GO_MODULE}/version.${PORTNAME}Version=${DISTVERSIONFULL}" + +SUB_FILES= pkg-message + +OPTIONS_DEFINE= EXAMPLES MANPAGES +OPTIONS_DEFAULT= MANPAGES + +MANPAGES_BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sphinx>=1.8.5,1:textproc/py-sphinx@${PY_FLAVOR} +MANPAGES_USES= gmake python:build,3.6+ +MANPAGES_PLIST_FILES= man/man1/zrepl.1.gz + +.include + +.if ${OPSYS} == "FreeBSD" && ${OSVERSION} >= 1300079 +USES+= ncurses +.else +USES+= ncurses:port +CFLAGS+= -I${LOCALBASE}/include/ncurses +.endif + +.if ${OPSYS} == "FreeBSD" +SUB_LIST+= DAEMON_LOGGING="-S -l \$${zrepl_facility} -s \$${zrepl_priority} -T \$${name}" +.else +SUB_LIST+= DAEMON_LOGGING="" +.endif + +post-build-MANPAGES-on: + @${MAKE_CMD} -C ${WRKSRC}/docs SPHINXBUILD=sphinx-build-${PYTHON_VER} man + +post-install: + @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} \ + ${STAGEDIR}${ETCDIR} \ + ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d \ + ${STAGEDIR}${PREFIX}/etc/syslog.d \ + ${STAGEDIR}/var/run/zrepl + ${INSTALL_DATA} ${FILESDIR}/newsyslog.conf ${STAGEDIR}${EXAMPLESDIR}/newsyslog.conf + ${INSTALL_DATA} ${FILESDIR}/syslog.conf ${STAGEDIR}${EXAMPLESDIR}/syslog.conf + ${INSTALL_DATA} ${FILESDIR}/zrepl.yml ${STAGEDIR}${ETCDIR}/zrepl.yml.sample + +post-install-EXAMPLES-on: + @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/hooks + (cd ${WRKSRC}/config/samples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}) + ${INSTALL_DATA} ${WRKSRC}/dist/grafana/grafana-prometheus-zrepl.json ${STAGEDIR}${EXAMPLESDIR} + +post-install-MANPAGES-on: + ${INSTALL_MAN} ${WRKSRC}/docs/_build/man/zrepl.1 ${STAGEDIR}${PREFIX}/man/man1 + +.include diff --git a/sysutils/zrepl/distinfo b/sysutils/zrepl/distinfo new file mode 100644 index 0000000..db2fcc5 --- /dev/null +++ b/sysutils/zrepl/distinfo @@ -0,0 +1,5 @@ +TIMESTAMP = 1669030202 +SHA256 (go/sysutils_zrepl/zrepl-v0.6.0/v0.6.0.mod) = 27760d04eb9b7c3c1ca35069afde9f3855f2491f80412bd3aba6cccb557fb009 +SIZE (go/sysutils_zrepl/zrepl-v0.6.0/v0.6.0.mod) = 2186 +SHA256 (go/sysutils_zrepl/zrepl-v0.6.0/v0.6.0.zip) = b7c5584aaba5c909f3830e629823dc1ecb595f6ece2f20fe57241c0ff62d23b6 +SIZE (go/sysutils_zrepl/zrepl-v0.6.0/v0.6.0.zip) = 582766 diff --git a/sysutils/zrepl/files/newsyslog.conf b/sysutils/zrepl/files/newsyslog.conf new file mode 100644 index 0000000..647b872 --- /dev/null +++ b/sysutils/zrepl/files/newsyslog.conf @@ -0,0 +1,5 @@ +# 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 diff --git a/sysutils/zrepl/files/pkg-message.in b/sysutils/zrepl/files/pkg-message.in new file mode 100644 index 0000000..f011000 --- /dev/null +++ b/sysutils/zrepl/files/pkg-message.in @@ -0,0 +1,27 @@ +[ +{ type: install + message: <]LEVEL +local0.info /var/log/zrepl.log diff --git a/sysutils/zrepl/files/zrepl.in b/sysutils/zrepl/files/zrepl.in new file mode 100644 index 0000000..095a43f --- /dev/null +++ b/sysutils/zrepl/files/zrepl.in @@ -0,0 +1,79 @@ +#!/bin/sh + +# 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 (bool): Set to YES to enable the zrepl service. +# Default: NO +# zrepl_config (str): File containing zrepl configuration details. +# Default: %%PREFIX%%/etc/zrepl/zrepl.yml +# zrepl_user (str): 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 (str): 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 +# zrepl_flags (str): Extra flags passed to zrepl +# Default: "" +# zrepl_facility (str): Syslog facility to use +# Default: local0 +# zrepl_priority (str): Syslog priority to use +# Default: alert + +. /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"} +: ${zrepl_flags:=""} +: ${zrepl_facility:="local0"} +: ${zrepl_priority:="alert"} +: ${zrepl_options:="${zrepl_flags} --config ${zrepl_config}"} + +pidfile="/var/run/zrepl.pid" +command="/usr/sbin/daemon" +procname="%%PREFIX%%/bin/zrepl" +command_args="-p ${pidfile} %%DAEMON_LOGGING%% ${procname} ${zrepl_options} daemon" + +start_precmd="zrepl_precmd" +stop_postcmd="zrepl_postcmd" +restart_precmd="zrepl_checkconfig" +configtest_cmd="zrepl_checkconfig" +extra_commands="configtest" + +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 + + zrepl_checkconfig +} + +zrepl_postcmd() +{ + rm -f -- "${pidfile}" +} + +zrepl_checkconfig() +{ + echo "Performing sanity check on zrepl configuration:" + eval ${procname} ${zrepl_options} configcheck +} + +run_rc_command "$1" diff --git a/sysutils/zrepl/files/zrepl.yml b/sysutils/zrepl/files/zrepl.yml new file mode 100644 index 0000000..94e924c --- /dev/null +++ b/sysutils/zrepl/files/zrepl.yml @@ -0,0 +1,13 @@ +# zrepl main configuration file. +# For documentation, refer to https://zrepl.github.io/ +# +global: + logging: + - type: "stdout" + level: "error" + format: "human" + - type: "syslog" + level: "info" + format: "logfmt" + +# Add "jobs:" section(s) here for your specific use cases. diff --git a/sysutils/zrepl/pkg-descr b/sysutils/zrepl/pkg-descr new file mode 100644 index 0000000..4913c21 --- /dev/null +++ b/sysutils/zrepl/pkg-descr @@ -0,0 +1,2 @@ +Cross-platform ZFS replication tool written in Go that supports +feature detection, bookmarks, and other new features. diff --git a/sysutils/zrepl/pkg-plist b/sysutils/zrepl/pkg-plist new file mode 100644 index 0000000..717dee7 --- /dev/null +++ b/sysutils/zrepl/pkg-plist @@ -0,0 +1,23 @@ +bin/zrepl +@sample %%ETCDIR%%/zrepl.yml.sample +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/bandwidth_limit.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/grafana-prometheus-zrepl.json +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/hooks/template.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/local.yml +@sample %%EXAMPLESDIR%%/newsyslog.conf etc/newsyslog.conf.d/zrepl.conf +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pull.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pull_ssh.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/push.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/quickstart_backup_to_external_disk.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/quickstart_continuous_server_backup_receiver.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/quickstart_continuous_server_backup_sender.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/quickstart_fan_out_replication_source.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/quickstart_fan_out_replication_target.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/sink.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/snap.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/source.yml +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/source_ssh.yml +@sample %%EXAMPLESDIR%%/syslog.conf etc/syslog.d/zrepl.conf +@dir etc/newsyslog.conf.d +@dir etc/syslog.d +@dir(root,wheel,0750) /var/run/zrepl