Skip to content

Commit

Permalink
deb: tweak side effect of needrestart
Browse files Browse the repository at this point in the history
Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
  • Loading branch information
kenhys committed Oct 25, 2024
1 parent 45cd5a6 commit 293dc0f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,20 @@ if [ "$status_before_update" = active ]; then
# The service should NOT restart automatically after update
# (The process before update should continue to run)
systemctl is-active fluentd
test $main_pid -eq $(systemctl show --value --property=MainPID fluentd)
. /etc/os-release
case $VERSION_CODENAME in
noble)
if dpkg-query --show --showformat '${Version}' needrestart; then
# If needrestart is available, restart will be fired out of maintainer script
(! test $main_pid -eq $(systemctl show --value --property=MainPID fluentd))
else
test $main_pid -eq $(systemctl show --value --property=MainPID fluentd)
fi
;;
*)
test $main_pid -eq $(systemctl show --value --property=MainPID fluentd)
;;
esac
elif [ "$enabled_before_update" = enabled ]; then
# The service should start automatically
systemctl is-active fluentd
Expand Down
15 changes: 14 additions & 1 deletion fluent-package/apt/systemd-test/update-to-next-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,20 @@ test $(eval $env_vars && echo $FLUENT_PLUGIN) = "/etc/fluent/plugin"
test $(eval $env_vars && echo $FLUENT_SOCKET) = "/var/run/fluent/fluentd.sock"
# FLUENT_PACKAGE_VERSION will be updated after the next restart
# TODO: consider how to test the update of version info
(! test $(eval $env_vars && echo $FLUENT_PACKAGE_VERSION) = "$next_package_ver")
. /etc/os-release
case $VERSION_CODENAME in
noble)
if dpkg-query --show --showformat '${Version}' needrestart; then
# If needrestart is available, restart will be fired out of maintainer script
test $(eval $env_vars && echo $FLUENT_PACKAGE_VERSION) = "$next_package_ver"
else
(! test $(eval $env_vars && echo $FLUENT_PACKAGE_VERSION) = "$next_package_ver")
fi
;;
*)
(! test $(eval $env_vars && echo $FLUENT_PACKAGE_VERSION) = "$next_package_ver")
;;
esac

# Test: fluent-diagtool
sudo fluent-gem install fluent-plugin-concat
Expand Down

0 comments on commit 293dc0f

Please sign in to comment.