Add zrepl 0.6.0
This commit is contained in:
parent
fca05eda46
commit
e2071aa9d3
9 changed files with 226 additions and 0 deletions
66
sysutils/zrepl/Makefile
Normal file
66
sysutils/zrepl/Makefile
Normal file
|
@ -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 <bsd.port.options.mk>
|
||||
|
||||
.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 <bsd.port.mk>
|
5
sysutils/zrepl/distinfo
Normal file
5
sysutils/zrepl/distinfo
Normal file
|
@ -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
|
5
sysutils/zrepl/files/newsyslog.conf
Normal file
5
sysutils/zrepl/files/newsyslog.conf
Normal file
|
@ -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
|
27
sysutils/zrepl/files/pkg-message.in
Normal file
27
sysutils/zrepl/files/pkg-message.in
Normal file
|
@ -0,0 +1,27 @@
|
|||
[
|
||||
{ type: install
|
||||
message: <<EOM
|
||||
Messages from sysutils/zrepl:
|
||||
|
||||
SETUP BEFORE FIRST USE:
|
||||
- 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
|
||||
|
||||
Documentation: https://zrepl.github.io/
|
||||
Changelog: https://zrepl.github.io/master/changelog.html
|
||||
|
||||
DANGER - SNAPSHOT PRUNING REQUIRES EXPLICIT KEEP RULES:
|
||||
For any ZFS snapshot that you want to keep, at least one rule must match.
|
||||
This also applies to snapshots taken by means other than zrepl
|
||||
(e.g. snapshots taken manually or via boot environment tools).
|
||||
EOM
|
||||
}
|
||||
]
|
6
sysutils/zrepl/files/syslog.conf
Normal file
6
sysutils/zrepl/files/syslog.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Syslog configuration file for zrepl.
|
||||
# See syslog.conf(5) for details.
|
||||
#
|
||||
# SELECTOR ACTION
|
||||
# FACILITY.[!<=>]LEVEL
|
||||
local0.info /var/log/zrepl.log
|
79
sysutils/zrepl/files/zrepl.in
Normal file
79
sysutils/zrepl/files/zrepl.in
Normal file
|
@ -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"
|
13
sysutils/zrepl/files/zrepl.yml
Normal file
13
sysutils/zrepl/files/zrepl.yml
Normal file
|
@ -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.
|
2
sysutils/zrepl/pkg-descr
Normal file
2
sysutils/zrepl/pkg-descr
Normal file
|
@ -0,0 +1,2 @@
|
|||
Cross-platform ZFS replication tool written in Go that supports
|
||||
feature detection, bookmarks, and other new features.
|
23
sysutils/zrepl/pkg-plist
Normal file
23
sysutils/zrepl/pkg-plist
Normal file
|
@ -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
|
Loading…
Reference in a new issue