1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-02 06:03:50 +00:00

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>
This commit is contained in:
Tobias Kortkamp 2018-06-10 10:30:14 +00:00
parent a93b9adeba
commit 9a0723ba78
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=472128
9 changed files with 186 additions and 0 deletions

View File

@ -626,6 +626,7 @@
SUBDIR += lscpu
SUBDIR += lsof
SUBDIR += lsop
SUBDIR += lsyncd
SUBDIR += ltrace
SUBDIR += lttng-tools
SUBDIR += lttng-ust

34
sysutils/lsyncd/Makefile Normal file
View File

@ -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>

3
sysutils/lsyncd/distinfo Normal file
View File

@ -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

View File

@ -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
}

View File

@ -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"

View File

@ -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 )

View File

@ -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

View File

@ -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

View File

@ -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/