Skip to content

Commit

Permalink
* Add RPM pre-install script via CPack parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre F de Miranda committed Sep 21, 2015
1 parent 29b6709 commit 2327fea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ elseif(UNIX)
set(CPACK_GENERATOR ${CPACK_GENERATOR} "RPM")
set(CPACK_RPM_PACKAGE_LICENSE "MPLv2.0")
set(CPACK_RPM_PACKAGE_DESCRIPTION "Heka is a tool for collecting and collating data from a number of different sources, performing 'in-flight' processing of collected data, and delivering the results to any number of destinations for further analysis.")
# todo we should pull lua_sandbox out of the heka/build and packaging
set(CPACK_RPM_PACKAGE_PROVIDES "libluasb.so.0()(64bit), libluasandbox.so.0()(64bit)")
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/man)
# todo we should pull lua_sandbox out of the heka/build and packaging
set(CPACK_RPM_PACKAGE_PROVIDES "libluasb.so.0()(64bit), libluasandbox.so.0()(64bit)")
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/man)
set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils")
set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/rpm/heka.preinst.in")
endif()
endif()

Expand Down
8 changes: 8 additions & 0 deletions rpm/heka.preinst.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
USER="heka"
GROUP=$USER
HOMEBASE=/var/cache/hekad

getent group $GROUP >/dev/null || groupadd -r $GROUP
getent passwd $USER >/dev/null || useradd -r -g $GROUP -M -d $HOMEBASE -s /sbin/nologin -c "heka daemon" $USER
install -d -m0755 -o$USER -g$GROUP $HOMEBASE
exit 0

0 comments on commit 2327fea

Please sign in to comment.