summaryrefslogtreecommitdiffstats
path: root/configuration/debian/tedge_agent
diff options
context:
space:
mode:
authorPradeepKiruvale <PRADEEPKIRUVALE@gmail.com>2021-08-26 13:48:45 +0530
committerGitHub <noreply@github.com>2021-08-26 13:48:45 +0530
commit2b733d9c840e56c11797556f321e6242f1604049 (patch)
tree645c35afdb60a18d915f11ccc8f9338d6b206836 /configuration/debian/tedge_agent
parent3b7cf7afa77b2f779fc1d991b90323384104e549 (diff)
[CIT-525] enable sm services (#396)
* [CIT-525] extend tedge dis/connect to dis/enable sm services * enable services postinstall * fix minor issues * address review comments * update the println * remove to_do macro * add system tests * add use_agent flag * refactor common code * address review comments * address review comment * Update tedge/src/cli/connect/command.rs * update log Co-authored-by: Pradeep Kumar K J <pradeepkumar.kj@sofwareag.com> Co-authored-by: Sebastian Büttner <sebastian.buettner@softwareag.com>
Diffstat (limited to 'configuration/debian/tedge_agent')
-rw-r--r--configuration/debian/tedge_agent/postinst17
1 files changed, 17 insertions, 0 deletions
diff --git a/configuration/debian/tedge_agent/postinst b/configuration/debian/tedge_agent/postinst
index 5673b8f4..ce9bb699 100644
--- a/configuration/debian/tedge_agent/postinst
+++ b/configuration/debian/tedge_agent/postinst
@@ -12,4 +12,21 @@ if ! getent passwd tedge-agent > /dev/null; then
adduser --quiet --system --no-create-home --ingroup tedge-agent --shell /usr/sbin/nologin tedge-agent
fi
+### Create file in /etc/sudoers.d directory
+echo "%tedge-agent ALL = (ALL) /usr/bin/tedge_agent" > /etc/sudoers.d/tedge-agent
+
+if [ -f "/etc/sudoers.d/010_pi-nopasswd" ]; then
+ echo "%tedge-agent ALL = (ALL) NOPASSWD: /usr/bin/tedge_agent" > /etc/sudoers.d/tedge-agent-nopasswd
+fi
+
+## 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
#DEBHELPER#