aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Kortkamp <tobik@FreeBSD.org>2018-06-10 10:30:14 +0000
committerTobias Kortkamp <tobik@FreeBSD.org>2018-06-10 10:30:14 +0000
commit9a0723ba7897fbfabb2394e7f8d2ff0fef06927a (patch)
tree3ecc38f507372b7d6a314a66586eb46a18218fce
parenta93b9adeba5e5f764afa302043f86e0b6e4bc2e8 (diff)
downloadports-9a0723ba7897fbfabb2394e7f8d2ff0fef06927a.tar.gz
ports-9a0723ba7897fbfabb2394e7f8d2ff0fef06927a.zip
Notes
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/lsyncd/Makefile34
-rw-r--r--sysutils/lsyncd/distinfo3
-rw-r--r--sysutils/lsyncd/files/lsyncd.conf.sample19
-rw-r--r--sysutils/lsyncd/files/lsyncd.in33
-rw-r--r--sysutils/lsyncd/files/patch-CMakeLists.txt14
-rw-r--r--sysutils/lsyncd/files/patch-default-rsync.lua11
-rw-r--r--sysutils/lsyncd/files/patch-lsyncd.c66
-rw-r--r--sysutils/lsyncd/pkg-descr5
9 files changed, 186 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index 6eba56940d24..a056bf8afae5 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -626,6 +626,7 @@
SUBDIR += lscpu
SUBDIR += lsof
SUBDIR += lsop
+ SUBDIR += lsyncd
SUBDIR += ltrace
SUBDIR += lttng-tools
SUBDIR += lttng-ust
diff --git a/sysutils/lsyncd/Makefile b/sysutils/lsyncd/Makefile
new file mode 100644
index 000000000000..1d62701538f0
--- /dev/null
+++ b/sysutils/lsyncd/Makefile
@@ -0,0 +1,34 @@
+# $FreeBSD$
+
+PORTNAME= lsyncd
+DISTVERSIONPREFIX= release-
+DISTVERSION= 2.2.3
+CATEGORIES= sysutils
+
+MAINTAINER= junichi@junichi.org
+COMMENT= Live Syncing (Mirror) Daemon
+
+LICENSE= GPLv2+
+LICENSE_FILE= ${WRKSRC}/COPYING
+
+LIB_DEPENDS= libinotify.so:devel/libinotify
+
+USES= cmake:outsource localbase lua
+USE_GITHUB= yes
+GH_ACCOUNT= axkibe
+USE_RC_SUBR= lsyncd
+
+CFLAGS+= -D__BSD_VISIBLE # for DT_{UNKNOWN,DIR}
+PLIST_FILES= sbin/lsyncd \
+ man/man1/lsyncd.1.gz \
+ "@sample etc/lsyncd.conf.sample"
+
+post-patch:
+ @${REINPLACE_CMD} 's,/usr/local,${LOCALBASE},' \
+ ${WRKSRC}/CMakeLists.txt \
+ ${WRKSRC}/default-rsync.lua
+
+post-install:
+ ${INSTALL_DATA} ${FILESDIR}/lsyncd.conf.sample ${STAGEDIR}${PREFIX}/etc
+
+.include <bsd.port.mk>
diff --git a/sysutils/lsyncd/distinfo b/sysutils/lsyncd/distinfo
new file mode 100644
index 000000000000..4f4e98c824f6
--- /dev/null
+++ b/sysutils/lsyncd/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1528626572
+SHA256 (axkibe-lsyncd-release-2.2.3_GH0.tar.gz) = 7bcd0f4ae126040bb078c482ff856c87e61c22472c23fa3071798dcb1dc388dd
+SIZE (axkibe-lsyncd-release-2.2.3_GH0.tar.gz) = 85165
diff --git a/sysutils/lsyncd/files/lsyncd.conf.sample b/sysutils/lsyncd/files/lsyncd.conf.sample
new file mode 100644
index 000000000000..cbde65e3841b
--- /dev/null
+++ b/sysutils/lsyncd/files/lsyncd.conf.sample
@@ -0,0 +1,19 @@
+settings {
+ logfile = "/var/log/lsyncd.log",
+ statusFile = "/var/log/lsyncd.status",
+ statusInterval = 1,
+ maxProcesses = 2,
+ insist = 1,
+}
+
+sync{
+ default.rsync,
+ delay = 0,
+ source = "/data/test1",
+ target = "some_host::test1",
+ rsync = {
+ archive = true,
+ compress = true
+ },
+ delete = true
+}
diff --git a/sysutils/lsyncd/files/lsyncd.in b/sysutils/lsyncd/files/lsyncd.in
new file mode 100644
index 000000000000..34b731b7814f
--- /dev/null
+++ b/sysutils/lsyncd/files/lsyncd.in
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: lsyncd
+# REQUIRE: LOGIN
+# BEFORE: securelevel
+# KEYWORD: shutdown
+
+# Add the following lines to /etc/rc.conf to enable `lsyncd':
+#
+# lsyncd_enable="YES"
+#
+
+. /etc/rc.subr
+
+name="lsyncd"
+rcvar=lsyncd_enable
+
+command="%%PREFIX%%/sbin/lsyncd"
+pidfile="/var/run/$name.pid"
+
+# read configuration and set defaults
+load_rc_config "$name"
+: ${lsyncd_enable="NO"}
+: ${lsyncd_configfile:=%%PREFIX%%/etc/$name.conf}
+
+required_files="${lsyncd_configfile}"
+
+command_args="-pidfile $pidfile ${lsyncd_configfile}"
+
+run_rc_command "$1"
diff --git a/sysutils/lsyncd/files/patch-CMakeLists.txt b/sysutils/lsyncd/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..09d3601a1c2d
--- /dev/null
+++ b/sysutils/lsyncd/files/patch-CMakeLists.txt
@@ -0,0 +1,14 @@
+--- CMakeLists.txt.orig 2018-03-09 12:39:11 UTC
++++ CMakeLists.txt
+@@ -104,8 +104,8 @@ add_custom_target( tests
+
+ # compiling and linking it all together
+ add_executable( lsyncd ${LSYNCD_SRC} )
+-target_link_libraries( lsyncd ${LUA_LIBRARIES} )
++target_link_libraries( lsyncd ${LUA_LIBRARIES} /usr/local/lib/libinotify.so )
+
+-install( TARGETS lsyncd RUNTIME DESTINATION bin )
+-install( FILES doc/manpage/lsyncd.1 DESTINATION man )
++install( TARGETS lsyncd RUNTIME DESTINATION sbin )
++install( FILES doc/manpage/lsyncd.1 DESTINATION man/man1 )
+
diff --git a/sysutils/lsyncd/files/patch-default-rsync.lua b/sysutils/lsyncd/files/patch-default-rsync.lua
new file mode 100644
index 000000000000..df093d4ca3d2
--- /dev/null
+++ b/sysutils/lsyncd/files/patch-default-rsync.lua
@@ -0,0 +1,11 @@
+--- default-rsync.lua.orig 2018-03-09 12:39:11 UTC
++++ default-rsync.lua
+@@ -682,7 +682,7 @@ rsync.exitcodes = default.rsyncExitCode
+ rsync.rsync =
+ {
+ -- The rsync binary to be called.
+- binary = '/usr/bin/rsync',
++ binary = '/usr/local/bin/rsync',
+ links = true,
+ times = true,
+ protect_args = true
diff --git a/sysutils/lsyncd/files/patch-lsyncd.c b/sysutils/lsyncd/files/patch-lsyncd.c
new file mode 100644
index 000000000000..bfb7cd290da2
--- /dev/null
+++ b/sysutils/lsyncd/files/patch-lsyncd.c
@@ -0,0 +1,66 @@
+--- lsyncd.c.orig 2018-03-09 12:39:11 UTC
++++ lsyncd.c
+@@ -1614,10 +1614,21 @@ l_configure( lua_State *L )
+ openlog( log_ident, 0, settings.log_facility );
+ }
+
++#ifdef __FreeBSD__
++ if( !settings.nodaemon )
++ {
++ // daemonnize is already done before open_inotify with FreeBSD.
++ // just writing pidfile is needed at this time.
++ logstring( "Normal", "--- Startup, daemonizing ---" );
++ if (settings.pidfile)
++ {
++ write_pidfile( L, settings.pidfile );
++ }
++ }
++#endif
+ if( !settings.nodaemon && !is_daemon )
+ {
+ logstring( "Normal", "--- Startup, daemonizing ---" );
+-
+ daemonize( L, settings.pidfile );
+ }
+ else
+@@ -2433,6 +2444,10 @@ main1( int argc, char *argv[] )
+
+ int argp = 1;
+
++#ifdef __FreeBSD__
++ static bool call_daemonize = true;
++#endif
++
+ // load Lua
+ L = luaL_newstate( );
+
+@@ -2482,6 +2497,14 @@ main1( int argc, char *argv[] )
+
+ while( i < argc )
+ {
++#ifdef __FreeBSD__
++ if (!strcmp (argv[i], "-nodaemon" ))
++ {
++ call_daemonize = false;
++ i++;
++ continue;
++ }
++#endif
+ if(
+ strcmp( argv[ i ], "-log" ) &&
+ strcmp( argv[ i ], "--log" )
+@@ -2796,6 +2819,14 @@ main1( int argc, char *argv[] )
+ }
+ }
+
++#ifdef __FreeBSD__
++ // daemonize should be done before open_inofity with FreeBSD.
++ if( call_daemonize )
++ {
++ daemonize( L, NULL );
++ }
++#endif
++
+ #ifdef WITH_INOTIFY
+ open_inotify( L );
+ #endif
diff --git a/sysutils/lsyncd/pkg-descr b/sysutils/lsyncd/pkg-descr
new file mode 100644
index 000000000000..9bd26bb28f66
--- /dev/null
+++ b/sysutils/lsyncd/pkg-descr
@@ -0,0 +1,5 @@
+Lsyncd is designed to synchronize a local directory tree with low
+profile of expected changes to a remote mirror. Lsyncd is especially
+useful to sync data from a secure area to a not-so-secure area.
+
+WWW: https://axkibe.github.io/lsyncd/