Skip to content

Commit 4db6880

Browse files
Restart agent if core plugin is disabled (#575)
1 parent 9891a87 commit 4db6880

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

packaging/debian/postinst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ if [ "$1" = "configure" ] ; then
1414
fi
1515
fi
1616

17-
# Disable and stop this service in favor of core plugin to be run on default.
18-
systemctl disable 'google-guest-agent.service' > /dev/null || true
19-
systemctl stop 'google-guest-agent.service' > /dev/null || true
17+
if grep -q "false" "/etc/google-guest-agent/core-plugin-enabled"; then
18+
# If the core plugin was disabled, honor that setting.
19+
systemctl enable google-guest-agent.service >/dev/null 2>&1 || :
20+
systemctl start google-guest-agent.service >/dev/null 2>&1 || :
21+
else
22+
# Disable and stop this service in favor of core plugin to be run on default.
23+
systemctl disable 'google-guest-agent.service' > /dev/null || true
24+
systemctl stop 'google-guest-agent.service' > /dev/null || true
25+
fi
2026
fi
2127

2228
#DEBHELPER#

packaging/google-guest-agent.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,12 @@ else
195195
if [ -d /run/systemd/system ]; then
196196
systemctl daemon-reload >/dev/null 2>&1 || :
197197
%if 0%{?build_plugin_manager}
198-
systemctl stop google-guest-agent.service >/dev/null 2>&1 || :
198+
if grep -q "false" "/etc/google-guest-agent/core-plugin-enabled"; then
199+
systemctl enable google-guest-agent.service >/dev/null 2>&1 || :
200+
systemctl start google-guest-agent.service >/dev/null 2>&1 || :
201+
else
202+
systemctl stop google-guest-agent.service >/dev/null 2>&1 || :
203+
fi
199204
systemctl restart google-guest-compat-manager.service >/dev/null 2>&1 || :
200205
systemctl restart google-guest-agent-manager.service >/dev/null 2>&1 || :
201206
%endif

0 commit comments

Comments
 (0)