package init

This commit is contained in:
chengzihan2 2021-01-20 16:58:26 +08:00
parent a10c4c3d4b
commit 45b1032769
13 changed files with 201 additions and 0 deletions

View File

@ -0,0 +1,12 @@
diff -up lsyncd-42413cabbedca429d55a5378f6e830f191f3cc86/CMakeLists.txt.LUA_COMPAT_5_3 lsyncd-42413cabbedca429d55a5378f6e830f191f3cc86/CMakeLists.txt
--- lsyncd-42413cabbedca429d55a5378f6e830f191f3cc86/CMakeLists.txt.LUA_COMPAT_5_3 2020-12-08 19:33:54.268016329 -0500
+++ lsyncd-42413cabbedca429d55a5378f6e830f191f3cc86/CMakeLists.txt 2020-12-08 20:39:49.941802873 -0500
@@ -4,6 +4,8 @@ cmake_minimum_required( VERSION 2.8 )
set( LSYNCD_VERSION 2.2.3 )
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/" )
+# Enable Lua 5.3 compatibility macros
+add_definitions(-DLUA_COMPAT_5_3)
# finding Lua
find_package( Lua REQUIRED )

View File

@ -0,0 +1,33 @@
From 5e08ea2cefd61cd50685c54b30d39845fcc485fe Mon Sep 17 00:00:00 2001
From: Torben Jaeger <torben@jit-central.com>
Date: Thu, 8 Aug 2019 17:37:05 +0200
Subject: [PATCH] fix different version format in lua.h
---
cmake/FindLua.cmake | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake
index 6d33dbe..ef9c685 100644
--- a/cmake/FindLua.cmake
+++ b/cmake/FindLua.cmake
@@ -102,9 +102,17 @@ ENDIF(LUA_LIBRARY)
# Determine Lua version
IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
- FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
+ FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_major_str REGEX "^#define[ \t]+LUA_VERSION_MAJOR[ \t]+\".+\"")
+ FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_minor_str REGEX "^#define[ \t]+LUA_VERSION_MINOR[ \t]+\".+\"")
+ FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_release_str REGEX "^#define[ \t]+LUA_VERSION_RELEASE[ \t]+\".+\"")
- STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
+ STRING(REGEX REPLACE "^#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([^\"]+)\".*" "\\1" LUA_VERSION_MAJOR "${lua_version_major_str}")
+ STRING(REGEX REPLACE "^#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([^\"]+)\".*" "\\1" LUA_VERSION_MINOR "${lua_version_minor_str}")
+ STRING(REGEX REPLACE "^#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([^\"]+)\".*" "\\1" LUA_VERSION_RELEASE "${lua_version_release_str}")
+
+ STRING(CONCAT LUA_VERSION_STRING ${LUA_VERSION_MAJOR} "." ${LUA_VERSION_MINOR} "." ${LUA_VERSION_RELEASE})
+
+ #STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
UNSET(lua_version_str)
ENDIF()

10
cmake-docpath.patch Normal file
View File

@ -0,0 +1,10 @@
diff -up lsyncd-release-2.2.3/CMakeLists.txt.orig lsyncd-release-2.2.3/CMakeLists.txt
--- lsyncd-release-2.2.3/CMakeLists.txt.orig 2018-03-09 07:39:11.000000000 -0500
+++ lsyncd-release-2.2.3/CMakeLists.txt 2020-12-08 15:00:44.112179103 -0500
@@ -107,5 +107,5 @@ add_executable( lsyncd ${LSYNCD_SRC} )
target_link_libraries( lsyncd ${LUA_LIBRARIES} )
install( TARGETS lsyncd RUNTIME DESTINATION bin )
-install( FILES doc/manpage/lsyncd.1 DESTINATION man )
+install( FILES doc/manpage/lsyncd.1 DESTINATION /usr/share/man/man1/ )

View File

@ -0,0 +1,24 @@
From 0af99d8d5ba35118e8799684a2d4a8ea4b0c6957 Mon Sep 17 00:00:00 2001
From: yokogawa-k <yokogawa-k@klab.com>
Date: Mon, 26 Mar 2018 17:11:29 +0900
Subject: [PATCH] fix non-versioned lua not search in cmake
"FOREACH" ignore empty elements, but "FOREACH IN LISTS" include emoty elements.
https://cmake.org/cmake/help/latest/command/foreach.html
---
cmake/FindLua.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake
index 1f95bf9..6d33dbe 100644
--- a/cmake/FindLua.cmake
+++ b/cmake/FindLua.cmake
@@ -39,7 +39,7 @@ SET(_POSSIBLE_LUA_INCLUDE include include/lua)
SET(_POSSIBLE_SUFFIXES "52" "5.2" "-5.2" "53" "5.3" "-5.3" "")
# Set up possible search names and locations
-FOREACH(_SUFFIX ${_POSSIBLE_SUFFIXES})
+FOREACH(_SUFFIX IN LISTS _POSSIBLE_SUFFIXES)
LIST(APPEND _POSSIBLE_LUA_INCLUDE "include/lua${_SUFFIX}")
LIST(APPEND _POSSIBLE_LUA_EXECUTABLE "lua${_SUFFIX}")
LIST(APPEND _POSSIBLE_LUA_COMPILER "luac${_SUFFIX}")

12
cmake-prefer-lua-54.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up lsyncd-42413cabbedca429d55a5378f6e830f191f3cc86/cmake/FindLua.cmake.lua54 lsyncd-42413cabbedca429d55a5378f6e830f191f3cc86/cmake/FindLua.cmake
--- lsyncd-42413cabbedca429d55a5378f6e830f191f3cc86/cmake/FindLua.cmake.lua54 2020-12-08 19:14:57.365310674 -0500
+++ lsyncd-42413cabbedca429d55a5378f6e830f191f3cc86/cmake/FindLua.cmake 2020-12-08 19:26:11.064284269 -0500
@@ -36,7 +36,7 @@ SET(_POSSIBLE_LUA_INCLUDE include includ
#SET(_POSSIBLE_LUA_LIBRARY lua)
# Determine possible naming suffixes (there is no standard for this)
-SET(_POSSIBLE_SUFFIXES "52" "5.2" "-5.2" "53" "5.3" "-5.3" "")
+SET(_POSSIBLE_SUFFIXES "54" "5.4" "-5.4" "53" "5.3" "-5.3" "52" "5.2" "-5.2" "")
# Set up possible search names and locations
FOREACH(_SUFFIX IN LISTS _POSSIBLE_SUFFIXES)

BIN
lsyncd-2.2.3.tar.gz Normal file

Binary file not shown.

8
lsyncd.conf Normal file
View File

@ -0,0 +1,8 @@
----
-- User configuration file for lsyncd.
--
-- Simple example for default rsync, but executing moves through on the target.
--
-- For more examples, see /usr/share/doc/lsyncd*/examples/
--
sync{default.rsyncssh, source="/var/www/html", host="localhost", targetdir="/tmp/htmlcopy/"}

5
lsyncd.logrotate Normal file
View File

@ -0,0 +1,5 @@
/var/log/lsyncd/*log {
missingok
notifempty
sharedscripts
}

13
lsyncd.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Live Syncing (Mirror) Daemon
Documentation=man:lsyncd(1) https://axkibe.github.io/lsyncd/
After=network.target
[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/lsyncd
ExecStart=/usr/bin/lsyncd -nodaemon $LSYNCD_OPTIONS
Restart=on-failure
[Install]
WantedBy=multi-user.target

78
lsyncd.spec Normal file
View File

@ -0,0 +1,78 @@
%global _hardened_build 1
%global gittag0 release-2.2.3
%global commit0 42413cabbedca429d55a5378f6e830f191f3cc86
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
Name: lsyncd
Version: 2.2.3
Release: 1
Summary: File change monitoring and synchronization daemon
License: GPLv2+
URL: https://github.com/axkibe/lsyncd/
Source0: https://github.com/axkibe/%{name}/archive/%{gittag0}/%{name}-%{version}.tar.gz
Patch0: cmake-docpath.patch
Patch1: cmake-define-LUA_COMPAT_5_3.patch
Patch3: cmake-find-lua-suffixes.patch
Patch2: cmake-prefer-lua-54.patch
Patch4: cmake-determine-lua-version.patch
Source1: lsyncd.sysconfig
Source2: lsyncd.logrotate
Source3: lsyncd.conf
Source4: lsyncd.service
Source5: lsyncd.sysctl
BuildRequires: asciidoc cmake gcc gcc-c++ lua lua-devel >= 5.1.3 systemd rsync
Requires: lua rsync
%description
Lsyncd watches a local directory trees event monitor interface (inotify).
It aggregates and combines events for a few seconds and then spawns one
(or more) process(es) to synchronize the changes. By default this is
rsync.
Lsyncd is thus a light-weight live mirror solution that is comparatively
easy to install not requiring new file systems or block devices and does
not hamper local file system performance.
%prep
%autosetup -n %{name}-release-%{version} -p1
%build
%cmake
%make_build
%install
%make_install
install -p -d -m 0755 %{buildroot}%{_var}/log/%{name}
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/lsyncd
install -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/lsyncd
install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/
install -p -D -m 0644 %{SOURCE4} %{buildroot}%{_unitdir}/lsyncd.service
install -p -D -m 0644 %{SOURCE5} %{buildroot}%{_sysctldir}/50-lsyncd.conf
%check
%cmake
make
%post
%sysctl_apply 50-lsyncd.conf
%systemd_post lsyncd.service
%preun
%systemd_preun lsyncd.service
%postun
%systemd_postun_with_restart lsyncd.service
%files
%license COPYING
%doc ChangeLog examples
%doc %{_mandir}/man1/lsyncd.1.*
%config(noreplace) %{_sysconfdir}/lsyncd.conf
%config(noreplace) %{_sysconfdir}/sysconfig/lsyncd
%config(noreplace) %{_sysconfdir}/logrotate.d/lsyncd
%{_sysctldir}/50-lsyncd.conf
%{_bindir}/lsyncd
%dir %{_var}/log/%{name}
%{_unitdir}/lsyncd.service
%changelog
* Wed Jan 20 2021 chengzihan <chengzihan2@huawei.com> - 2.2.3-1
- Package init

1
lsyncd.sysconfig Normal file
View File

@ -0,0 +1 @@
LSYNCD_OPTIONS="/etc/lsyncd.conf"

1
lsyncd.sysctl Normal file
View File

@ -0,0 +1 @@
fs.inotify.max_user_watches=262144

4
lsyncd.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: axkibe/lsyncd
tag_prefix: "release-"
separator: "."