diff options
Diffstat (limited to '')
-rw-r--r-- | freebsd/cmake/PkgCreate.cmake | 56 | ||||
-rwxr-xr-x | freebsd/rspamd.sh.in | 52 |
2 files changed, 108 insertions, 0 deletions
diff --git a/freebsd/cmake/PkgCreate.cmake b/freebsd/cmake/PkgCreate.cmake new file mode 100644 index 0000000..547e8c9 --- /dev/null +++ b/freebsd/cmake/PkgCreate.cmake @@ -0,0 +1,56 @@ +# PkgCreate creates FreeBSD package for cmake +# USAGE : ADD_FREEBSD_PACKAGE ( PKG_TARGET_NAME [DESCRIPTION] ) + +FIND_PROGRAM(PKGCREATE + NAMES pkg_create + PATHS "/usr/sbin") + +IF ( PKGCREATE ) + GET_FILENAME_COMPONENT(PKGCREATE_PATH ${PKGCREATE} ABSOLUTE) + MESSAGE(STATUS "Found pkg_create : ${PKGCREATE_PATH}") + SET(PKGCREATE_FOUND "YES") +ELSE ( PKGCREATE ) + MESSAGE(STATUS "pkg_create NOT found. package generation will not be available") + SET(PKGCREATE_FOUND "NO") +ENDIF ( PKGCREATE ) + +MACRO(ADD_FREEBSD_PACKAGE PKGNAME PLIST_FILE) + # let's create a directory to call 'make install DESTDIR=...' into: + SET ( FREEBSD_DIR ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}_${PACKAGE_VERSION}-${PACKAGE_RELEASE} ) + FILE ( REMOVE ${FREEBSD_DIR} ) + FILE ( MAKE_DIRECTORY ${FREEBSD_DIR} ) + FILE ( MAKE_DIRECTORY ${FREEBSD_DIR}/pkg ) + # Calling "make install DESTDIR=${FREEBSD_DIR}" + ADD_CUSTOM_TARGET(pkg_destdir_install + COMMAND ${CMAKE_MAKE_PROGRAM} install CMAKE_INSTALL_PREFIX=/ DESTDIR=${FREEBSD_DIR} + DEPENDS ${CMAKE_BINARY_DIR}/cmake_install.cmake + COMMENT "Installing with DESTDIR = ${FREEBSD_DIR}" + ) + ADD_DEPENDENCIES(pkg_destdir_install pkg_destdir_preinstall) + ADD_CUSTOM_TARGET(pkg_destdir_preinstall + COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=/ -DDESTDIR=${FREEBSD_DIR} . + DEPENDS ${CMAKE_BINARY_DIR}/cmake_install.cmake + COMMENT "Configuring with DESTDIR = ${FREEBSD_DIR}" + ) + ADD_DEPENDENCIES(pkg_destdir_preinstall all preinstall) + + + ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}_${PACKAGE_VERSION}-${PACKAGE_RELEASE}.tbz + COMMAND ${PKGCREATE_PATH} -c -"${PACKAGE_DESCRIPTION_SUMMARY}" + -d -"${PACKAGE_DESCRIPTION}" + -f ${PLIST_FILE} + -p ${FREEBSD_DIR} + ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}_${PACKAGE_VERSION}-${PACKAGE_RELEASE}.tbz + # removing control, so its (re)generated each time we need to build the package + DEPENDS ${PLIST_FILE} + COMMENT "Generating freebsd package" + ) + + # the final target: + ADD_CUSTOM_TARGET(${PKGNAME}_pkg + DEPENDS ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}_${PACKAGE_VERSION}-${PACKAGE_RELEASE}.tbz + ) + + ADD_DEPENDENCIES(${PKGNAME}_pkg pkg_destdir_install) +ENDMACRO(ADD_FREEBSD_PACKAGE PKGNAME)
\ No newline at end of file diff --git a/freebsd/rspamd.sh.in b/freebsd/rspamd.sh.in new file mode 100755 index 0000000..c527a6d --- /dev/null +++ b/freebsd/rspamd.sh.in @@ -0,0 +1,52 @@ +#!/bin/sh +# +# $Id$ +# +# PROVIDE: rspamd +# REQUIRE: LOGIN +# KEYWORD: shutdown + +# +# Add the following line to /etc/rc.conf to enable countd: +# rspamd (bool): Set to "NO" by default. +# Set it to "YES" to enable rspamd. + +. /etc/rc.subr + +name="rspamd" +rcvar=`set_rcvar` +procname="@CMAKE_INSTALL_PREFIX@/bin/rspamd" +restart_precmd="rspamd_checkconfig" +reload_precmd="rspamd_checkconfig" +configtest_cmd="rspamd_checkconfig" +reopenlog_cmd="reopenlog_cmd" + +load_rc_config $name + +: ${rspamd_enable="NO"} +: ${rspamd_pidfile="/var/run/rspamd/rspamd.pid"} +: ${rspamd_run_user="@RSPAMD_USER@"} +: ${rspamd_run_group="@RSPAMD_GROUP@"} + +pidfile="$rspamd_pidfile" + +stop_postcmd="rm -f $rspamd_pidfile" + +rspamd_checkconfig() +{ + echo "Performing sanity check on rspamd configuration:" + eval ${command} -t +} + +reopenlog_cmd() +{ + pkill -USR1 -F $rspamd_pidfile +} + +extra_commands="reload configtest reopenlog" +sig_reload="HUP" + +command="$procname" +command_args="-u ${rspamd_run_user} -g ${rspamd_run_group} -c @CMAKE_INSTALL_PREFIX@/etc/rspamd.xml" + +run_rc_command "$1" |