Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jun 2018 10:30:14 +0000 (UTC)
From:      Tobias Kortkamp <tobik@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r472128 - in head/sysutils: . lsyncd lsyncd/files
Message-ID:  <201806101030.w5AAUE9b028954@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tobik
Date: Sun Jun 10 10:30:14 2018
New Revision: 472128
URL: https://svnweb.freebsd.org/changeset/ports/472128

Log:
  New port: sysutils/lsyncd
  
  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/
  
  PR:		228714
  Submitted by:	Junichi Satoh <junichi@junichi.org>

Added:
  head/sysutils/lsyncd/
  head/sysutils/lsyncd/Makefile   (contents, props changed)
  head/sysutils/lsyncd/distinfo   (contents, props changed)
  head/sysutils/lsyncd/files/
  head/sysutils/lsyncd/files/lsyncd.conf.sample   (contents, props changed)
  head/sysutils/lsyncd/files/lsyncd.in   (contents, props changed)
  head/sysutils/lsyncd/files/patch-CMakeLists.txt   (contents, props changed)
  head/sysutils/lsyncd/files/patch-default-rsync.lua   (contents, props changed)
  head/sysutils/lsyncd/files/patch-lsyncd.c   (contents, props changed)
  head/sysutils/lsyncd/pkg-descr   (contents, props changed)
Modified:
  head/sysutils/Makefile

Modified: head/sysutils/Makefile
==============================================================================
--- head/sysutils/Makefile	Sun Jun 10 10:28:59 2018	(r472127)
+++ head/sysutils/Makefile	Sun Jun 10 10:30:14 2018	(r472128)
@@ -626,6 +626,7 @@
     SUBDIR += lscpu
     SUBDIR += lsof
     SUBDIR += lsop
+    SUBDIR += lsyncd
     SUBDIR += ltrace
     SUBDIR += lttng-tools
     SUBDIR += lttng-ust

Added: head/sysutils/lsyncd/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/lsyncd/Makefile	Sun Jun 10 10:30:14 2018	(r472128)
@@ -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>

Added: head/sysutils/lsyncd/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/lsyncd/distinfo	Sun Jun 10 10:30:14 2018	(r472128)
@@ -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

Added: head/sysutils/lsyncd/files/lsyncd.conf.sample
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/lsyncd/files/lsyncd.conf.sample	Sun Jun 10 10:30:14 2018	(r472128)
@@ -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
+}

Added: head/sysutils/lsyncd/files/lsyncd.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/lsyncd/files/lsyncd.in	Sun Jun 10 10:30:14 2018	(r472128)
@@ -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"

Added: head/sysutils/lsyncd/files/patch-CMakeLists.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/lsyncd/files/patch-CMakeLists.txt	Sun Jun 10 10:30:14 2018	(r472128)
@@ -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 )
+ 

Added: head/sysutils/lsyncd/files/patch-default-rsync.lua
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/lsyncd/files/patch-default-rsync.lua	Sun Jun 10 10:30:14 2018	(r472128)
@@ -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

Added: head/sysutils/lsyncd/files/patch-lsyncd.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/lsyncd/files/patch-lsyncd.c	Sun Jun 10 10:30:14 2018	(r472128)
@@ -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

Added: head/sysutils/lsyncd/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/lsyncd/pkg-descr	Sun Jun 10 10:30:14 2018	(r472128)
@@ -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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806101030.w5AAUE9b028954>