diff --git a/CMakeLists.txt b/CMakeLists.txt index 60b3a044a96..83b81611c38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1485,9 +1485,10 @@ if(DPKG_PROGRAM) ${PROJECT_SOURCE_DIR}/cpack/debian/conffiles ) + set(LDCONFIG_SCRIPT_CMDS "") if(FLB_RUN_LDCONFIG) set(LDCONFIG_DIR ${FLB_INSTALL_LIBDIR}) - file(WRITE ${PROJECT_BINARY_DIR}/scripts/postinst " + set(LDCONFIG_SCRIPT_CMDS " mkdir -p /etc/ld.so.conf.d echo \"${LDCONFIG_DIR}\" > /etc/ld.so.conf.d/libfluent-bit.conf ldconfig @@ -1496,9 +1497,16 @@ ldconfig rm -f -- /etc/ld.so.conf.d/libfluent-bit.conf ldconfig ") - set(CPACK_DEBIAN_RUNTIME_PACKAGE_CONTROL_EXTRA "${PROJECT_BINARY_DIR}/scripts/postinst;${PROJECT_BINARY_DIR}/scripts/prerm") + list(APPEND CPACK_DEBIAN_RUNTIME_PACKAGE_CONTROL_EXTRA "${PROJECT_BINARY_DIR}/scripts/postinst;${PROJECT_BINARY_DIR}/scripts/prerm") endif(FLB_RUN_LDCONFIG) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/cpack/debian/postinst.in + ${PROJECT_BINARY_DIR}/scripts/postinst + ) + + list(APPEND CPACK_DEBIAN_RUNTIME_PACKAGE_CONTROL_EXTRA "${PROJECT_BINARY_DIR}/scripts/postinst;${PROJECT_BINARY_DIR}/scripts/prerm") + endif() # RPM Generation information diff --git a/cpack/debian/postinst.in b/cpack/debian/postinst.in new file mode 100644 index 00000000000..78d22cdaa53 --- /dev/null +++ b/cpack/debian/postinst.in @@ -0,0 +1,9 @@ +#!/bin/sh +set -e +@LDCONFIG_POSTINST_CMDS@ +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + systemctl try-restart @FLB_OUT_NAME@.service >/dev/null || true + fi +fi