diff --git a/.gitignore b/.gitignore index 9ff0144..4da8154 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /v1.1.2.tar.gz /zmap-1.2.0.tar.gz /zmap-1.2.1.tar.gz +/zmap-2.1.0.tar.gz diff --git a/0001-Fix-broken-conf-installation.patch b/0001-Fix-broken-conf-installation.patch new file mode 100644 index 0000000..a217edf --- /dev/null +++ b/0001-Fix-broken-conf-installation.patch @@ -0,0 +1,44 @@ +From 7940d5311eb0f869bac2e7a9561ba22f69a05424 Mon Sep 17 00:00:00 2001 +From: Christopher Meng +Date: Sat, 5 Sep 2015 17:14:58 +0800 +Subject: [PATCH] Fix broken conf installation + +install(SCRIPT) doesn't read variable from project cmakefile, instead of hacking more on this single file with less than 10 lines, why not merge back to one file? +--- + CMakeLists.txt | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d2afb37..6a06cbf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -124,14 +124,24 @@ add_subdirectory(src) + + # Install conf files + +-FILE(GLOB CONF_FILES "${PROJECT_SOURCE_DIR}/conf/*") + if (RESPECT_INSTALL_PREFIX_CONFIG) + set(CONFIG_DESTINATION "etc/zmap") + else() + set(CONFIG_DESTINATION "/etc/zmap") + endif() + +-install(SCRIPT InstallConfFiles.cmake) ++FILE(GLOB CONF_FILES "${PROJECT_SOURCE_DIR}/conf/*") ++ ++foreach(EACH_CONF ${CONF_FILES}) ++ get_filename_component(CONF_BASENAME ${EACH_CONF} NAME) ++ message(STATUS "Default ZMap configuration file location is /etc/zmap") ++ message(STATUS "Checking if ${CONF_BASENAME} exists there...") ++ if(NOT EXISTS "/etc/zmap/${CONF_BASENAME}") ++ install(FILES ${EACH_CONF} DESTINATION ${CONFIG_DESTINATION}) ++ else() ++ message(WARNING "Existing configuration file detected at /etc/zmap/${CONF_BASENAME}, it will NOT be installed. Please check and install manually!") ++ endif() ++endforeach() + + # Allow Debian Packaging + INCLUDE (InstallRequiredSystemLibraries) +-- +2.5.1 + diff --git a/sources b/sources index e28dcd2..863207f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -3e740b54c88c29bb03494b986f440b51 zmap-1.2.1.tar.gz +0e6b9b0628eb1d3360fbd9ea56e36693 zmap-2.1.0.tar.gz diff --git a/zmap.spec b/zmap.spec index c83a7a7..c7f7d44 100644 --- a/zmap.spec +++ b/zmap.spec @@ -1,18 +1,29 @@ +%bcond_with pfring +%bcond_without hiredis +%bcond_with mongodb +%bcond_without debug + Name: zmap -Version: 1.2.1 +Version: 2.1.0 Release: 1%{?dist} Summary: Network scanner for Internet-wide network studies License: ASL 2.0 URL: https://zmap.io Source0: https://github.com/%{name}/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Patch0: 0001-Fix-broken-conf-installation.patch BuildRequires: byacc BuildRequires: cmake BuildRequires: flex BuildRequires: gengetopt BuildRequires: gmp-devel +%if %{with hiredis} BuildRequires: hiredis-devel +%endif BuildRequires: json-c-devel BuildRequires: libpcap-devel +%if %{with mongodb} +BuildRequires: pkgconfig(libmongoc-1.0) +%endif %description ZMap is an open-source network scanner that enables researchers to easily @@ -34,25 +45,44 @@ scanning. %prep %setup -q +%patch0 -p1 +# Custom flags from upstream should be put in the front as preferred. +sed -i 's|${CMAKE_C_FLAGS} ${GCCWARNINGS}|${GCCWARNINGS} ${CMAKE_C_FLAGS}|g;s|${CMAKE_EXE_LINKER_FLAGS} ${LDHARDENING}|${LDHARDENING} ${CMAKE_EXE_LINKER_FLAGS}|g' CMakeLists.txt %build -%cmake -DWITH_JSON=ON -DWITH_REDIS=ON +%cmake -DWITH_JSON=ON \ +%if %{with mongodb} + -DWITH_MONGO=ON \ +%endif +%if %{with hiredis} + -DWITH_REDIS=ON \ +%endif + -DWITH_PFRING=OFF + make %{?_smp_mflags} chmod 644 -v examples/udp-probes/* -find ./examples/ -type f -exec sed -i 's/\r$//' {} ";" +find ./examples/ -type f -exec sed -i 's/\r$//' {} \+ %install %make_install %files -%doc AUTHORS CHANGELOG LICENSE README examples/ +%doc AUTHORS CHANGELOG README* examples/ +%license LICENSE %dir %{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/* -%{_sbindir}/%{name} -%{_mandir}/man1/%{name}.1* +%{_sbindir}/zmap +%{_sbindir}/zblacklist +%{_sbindir}/ztee +%{_mandir}/man1/zmap.1* +%{_mandir}/man1/zblacklist.1* +%{_mandir}/man1/ztee.1* %changelog +* Thu Sep 03 2015 Christopher Meng - 2.1.0-1 +- Update to 2.1.0 + * Sun Jul 20 2014 Christopher Meng - 1.2.1-1 - Update to 1.2.1