summaryrefslogtreecommitdiffstats
path: root/configuration/debian/tedge_agent
diff options
context:
space:
mode:
authorLukasz Woznicki <75632179+makr11st@users.noreply.github.com>2021-11-15 09:47:43 +0000
committerGitHub <noreply@github.com>2021-11-15 09:47:43 +0000
commit3284e897b8ec53ca29ec63baecd5fcf56cd04aeb (patch)
tree49e22630010826a2f2797c58d6807b0bd43d14a0 /configuration/debian/tedge_agent
parent0d6460469d039e0221161144c077863544778416 (diff)
[CIT-671] Add more explicit message when service manager is not found (#568)
* Add more explicit message when service manager is not found * Add message on disconnect * Add conditional use of systemctl in deb scripts Signed-off-by: Lukasz Woznicki <lukasz.woznicki@softwareag.com>
Diffstat (limited to 'configuration/debian/tedge_agent')
-rw-r--r--configuration/debian/tedge_agent/postinst22
-rw-r--r--configuration/debian/tedge_agent/prerm8
2 files changed, 18 insertions, 12 deletions
diff --git a/configuration/debian/tedge_agent/postinst b/configuration/debian/tedge_agent/postinst
index fe466b69..67243e8b 100644
--- a/configuration/debian/tedge_agent/postinst
+++ b/configuration/debian/tedge_agent/postinst
@@ -28,14 +28,18 @@ install -g tedge-agent -o tedge-agent -m 754 -d /etc/tedge/.agent
# Create /var/log/tedge/agent directory
install -g tedge-agent -o tedge-agent -m 755 -d /var/log/tedge/agent
-### Enable the sm services if the device is connected to c8y cloud
-if [ -f "/etc/tedge/mosquitto-conf/c8y-bridge.conf" ]; then
- # start and enable tedge-agent
- systemctl start tedge-agent.service
- systemctl enable tedge-agent.service
-
- # start and enable tedge-mapper-sm-c8y
- systemctl start tedge-mapper-sm-c8y.service
- systemctl enable tedge-mapper-sm-c8y.service
+# Reenable the services only if systemctl is available
+if command -v systemctl >/dev/null; then
+ ### Enable the sm services if the device is connected to c8y cloud
+ if [ -f "/etc/tedge/mosquitto-conf/c8y-bridge.conf" ]; then
+ # start and enable tedge-agent
+ systemctl start tedge-agent.service
+ systemctl enable tedge-agent.service
+
+ # start and enable tedge-mapper-sm-c8y
+ systemctl start tedge-mapper-sm-c8y.service
+ systemctl enable tedge-mapper-sm-c8y.service
+ fi
fi
+
#DEBHELPER#
diff --git a/configuration/debian/tedge_agent/prerm b/configuration/debian/tedge_agent/prerm
index 9ba4c625..a07c057f 100644
--- a/configuration/debian/tedge_agent/prerm
+++ b/configuration/debian/tedge_agent/prerm
@@ -6,9 +6,11 @@ print_hint() {
echo "$1 is running. Stop $1 before installation, to stop it use: systemctl stop $1"
}
-if systemctl is-active --quiet tedge-agent; then
- print_hint "tedge-agent"
- exit 1
+if command -v systemctl >/dev/null; then
+ if systemctl is-active --quiet tedge-agent; then
+ print_hint "tedge-agent"
+ exit 1
+ fi
fi
#DEBHELPER#