Build .deb, .rpm, and .tgz

This commit is contained in:
Henri DF 2016-03-31 18:54:52 -07:00
parent 8ae908fe85
commit 37d0f7d3e0
6 changed files with 53 additions and 0 deletions

4
CMakeCPackOptions.cmake Normal file
View File

@ -0,0 +1,4 @@
if(CPACK_GENERATOR MATCHES "TGZ")
set(CPACK_SET_DESTDIR "ON")
set(CPACK_STRIP_FILES "OFF")
endif()

View File

@ -6,6 +6,10 @@ if(NOT DEFINED DIGWATCH_VERSION)
set(DIGWATCH_VERSION "0.1.1dev") set(DIGWATCH_VERSION "0.1.1dev")
endif() endif()
if(NOT DEFINED DIR_ETC)
set(DIR_ETC "${CMAKE_INSTALL_PREFIX}/etc")
endif()
set(DRAIOS_DEBUG_FLAGS "-D_DEBUG") set(DRAIOS_DEBUG_FLAGS "-D_DEBUG")
set(CMAKE_C_FLAGS "-Wall -ggdb ${DRAIOS_FEATURE_FLAGS}") set(CMAKE_C_FLAGS "-Wall -ggdb ${DRAIOS_FEATURE_FLAGS}")
@ -142,3 +146,29 @@ add_subdirectory(${SYSDIG_DIR}/userspace/libsinsp ${PROJECT_BINARY_DIR}/userspac
add_subdirectory(userspace/digwatch) add_subdirectory(userspace/digwatch)
set(CPACK_PACKAGE_NAME "${PACKAGE_NAME}")
set(CPACK_PACKAGE_VENDOR "Sysdig Inc.")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "digwatch, a system-level activity monitoring tool")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/scripts/description.txt")
set(CPACK_PACKAGE_VERSION "${DIGWATCH_VERSION}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_SOURCE_DIR}/CMakeCPackOptions.cmake")
set(CPACK_STRIP_FILES "ON")
set(CPACK_GENERATOR DEB)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Sysdig <support@sysdig.com>")
set(CPACK_DEBIAN_PACKAGE_SECTION "utils")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.sysdig.org")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "dkms (>= 2.1.0.0)")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_BINARY_DIR}/scripts/debian/postinst;${CMAKE_BINARY_DIR}/scripts/debian/prerm")
set(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
set(CPACK_RPM_PACKAGE_URL "http://www.sysdig.org")
set(CPACK_RPM_PACKAGE_REQUIRES "dkms, gcc, make, kernel-devel, perl")
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/scripts/rpm/postinstall")
set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/scripts/rpm/preuninstall")
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/src /usr/share/man /usr/share/man/man8)
include(CPack)

3
scripts/description.txt Normal file
View File

@ -0,0 +1,3 @@
Digwatch instruments your physical and virtual machines at the OS level by installing into the Linux kernel and capturing system calls and other OS events.
Then, using a rule-based configuration, you can specify filters for events of interest that you would like to log or be notified of.

13
scripts/rpm/postinstall Executable file
View File

@ -0,0 +1,13 @@
dkms add -m sysdig -v %{version} --rpm_safe_upgrade
if [ `uname -r | grep -c "BOOT"` -eq 0 ] && [ -e /lib/modules/`uname -r`/build/include ]; then
dkms build -m sysdig -v %{version}
dkms install --force -m sysdig -v %{version}
elif [ `uname -r | grep -c "BOOT"` -gt 0 ]; then
echo -e ""
echo -e "Module build for the currently running kernel was skipped since you"
echo -e "are running a BOOT variant of the kernel."
else
echo -e ""
echo -e "Module build for the currently running kernel was skipped since the"
echo -e "kernel source for this kernel does not seem to be installed."
fi

1
scripts/rpm/preuninstall Executable file
View File

@ -0,0 +1 @@
dkms remove -m sysdig -v %{version} --all --rpm_safe_upgrade

View File

@ -12,3 +12,5 @@ target_link_libraries(digwatch sinsp)
set(DIGWATCH_LUA_MAIN "rule_loader.lua") set(DIGWATCH_LUA_MAIN "rule_loader.lua")
configure_file(config_digwatch.h.in config_digwatch.h) configure_file(config_digwatch.h.in config_digwatch.h)
install(TARGETS digwatch DESTINATION bin)