-
Notifications
You must be signed in to change notification settings - Fork 1.8k
cmake: execute daemon-reload and restart postinst in deb #10899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
910bdc0
ba29ff5
a712a28
3c3a743
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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") | ||||||
|
||||||
Comment on lines
+1508
to
+1509
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Avoid duplicate appends and unconditional prerm reference. Append postinst once, and only append prerm when it exists (already done inside the FLB_RUN_LDCONFIG block above). Apply this diff: - list(APPEND 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") 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||
endif() | ||||||
|
||||||
# RPM Generation information | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
set -e | ||
@LDCONFIG_POSTINST_CMDS@ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainFix variable name mismatch: template expects LDCONFIG_POSTINST_CMDS but CMake sets LDCONFIG_SCRIPT_CMDS. As written, ldconfig commands will never be injected into postinst. Align the variable names (I suggest fixing CMake to set LDCONFIG_POSTINST_CMDS). Run this to confirm the mismatch: 🏁 Script executed: #!/bin/bash
rg -n -C1 'LDCONFIG_.*CMDS' cpack/debian/postinst.in CMakeLists.txt Length of output: 518 Align CMake variable with postinst template 🤖 Prompt for AI Agents
|
||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
postinst generation lacks executable bit; ensure correct perms and use the corrected variable.
configure_file writes 0644 by default; Debian maintainer scripts must be executable. Also switch to the corrected LDCONFIG_POSTINST_CMDS.
Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents