summaryrefslogtreecommitdiffstats
path: root/configuration
diff options
context:
space:
mode:
authorPradeepKiruvale <pradeepkumar.kj@softwareag.com>2022-03-24 13:35:38 +0530
committerGitHub <noreply@github.com>2022-03-24 13:35:38 +0530
commit59142ef60484ddc7b103c841d34b308b9444f316 (patch)
treed7b8f89179d2244a1e116081b11a28e7c3a141fa /configuration
parentd9ca6aedfad3de7931964200f26e40fdd577b48a (diff)
[#761] tedge init (#993)
* tedge init #Closes 761 * add file/directory creation errors * add the clear session to az and collectd mappers * refactor tedgecomponent * remove redundant code * subscribe to az/collectd topics in init_session * remove duplicate init_sessions
Diffstat (limited to 'configuration')
-rwxr-xr-xconfiguration/debian/tedge/postinst18
-rw-r--r--configuration/debian/tedge_agent/postinst8
-rw-r--r--configuration/debian/tedge_mapper/postinst13
3 files changed, 6 insertions, 33 deletions
diff --git a/configuration/debian/tedge/postinst b/configuration/debian/tedge/postinst
index 2f0dfee1..788fb369 100755
--- a/configuration/debian/tedge/postinst
+++ b/configuration/debian/tedge/postinst
@@ -17,21 +17,6 @@ if ! getent passwd tedge >/dev/null; then
adduser --quiet --system --gecos "" --no-create-home --disabled-login --shell /sbin/nologin --ingroup tedge tedge
fi
-### Create directories
-# thin-edge.io uses `/etc/tedge` directory as its main configuration directory.
-# This directory contains mqtt bus configuration directory under `mosquitto-conf`
-# and device certificates under `device-certs` so both have to be created in the directory structure.
-install -g tedge -o tedge -m 755 -d /etc/tedge
-install -g tedge -o tedge -m 755 -d /etc/tedge/mosquitto-conf
-install -g mosquitto -o mosquitto -m 755 -d /etc/tedge/device-certs
-
-# Create a directory for the operations added by the user.
-install -g tedge -o tedge -m 755 -d /etc/tedge/operations
-install -g tedge -o tedge -m 755 -d /etc/tedge/plugins
-
-# Create directory for logs
-install -g tedge -o tedge -m 755 -d /var/log/tedge
-
### Add include to mosquitto.conf so tedge specific conf will be loaded
if ! grep -q "/etc/tedge/mosquitto-conf" "/etc/mosquitto/mosquitto.conf"; then
echo "include_dir /etc/tedge/mosquitto-conf" >>/etc/mosquitto/mosquitto.conf
@@ -44,5 +29,8 @@ if [ -f "/etc/sudoers.d/010_pi-nopasswd" ]; then
echo "%tedge-users ALL = (ALL) NOPASSWD: /usr/bin/tedge" >/etc/sudoers.d/tedge-users-nopasswd
fi
+# Initialize the tedge
+tedge --init
+
### Below are automatically created script parts by cargo deb (Search for cargo deb DEBHELPER)
#DEBHELPER#
diff --git a/configuration/debian/tedge_agent/postinst b/configuration/debian/tedge_agent/postinst
index 774c3b09..7430e3dc 100644
--- a/configuration/debian/tedge_agent/postinst
+++ b/configuration/debian/tedge_agent/postinst
@@ -11,6 +11,7 @@ fi
# Create user tedge-agent with no home(--no-create-home), no login(--shell) and in group tedge-agent(--ingroup)
if ! getent passwd tedge-agent >/dev/null; then
adduser --quiet --system --no-create-home --ingroup tedge-agent --shell /usr/sbin/nologin tedge-agent
+ adduser tedge-agent tedge
fi
### Create file in /etc/sudoers.d directory
@@ -21,13 +22,6 @@ if [ -f "/etc/sudoers.d/010_pi-nopasswd" ]; then
echo "%tedge-agent ALL = (ALL) NOPASSWD: /etc/tedge/sm-plugins/[a-zA-Z0-9]*, /bin/sync, /sbin/init" >/etc/sudoers.d/tedge-agent-nopasswd
fi
-### Create directories
-# Create tedge-agent state directory /etc/tedge/.agent
-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
-
# 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
diff --git a/configuration/debian/tedge_mapper/postinst b/configuration/debian/tedge_mapper/postinst
index dbfcd140..a8625f3f 100644
--- a/configuration/debian/tedge_mapper/postinst
+++ b/configuration/debian/tedge_mapper/postinst
@@ -11,19 +11,10 @@ fi
# Create user tedge-mapper with no home(--no-create-home), no login(--shell) and in group tedge(--ingroup)
if ! getent passwd tedge-mapper >/dev/null; then
adduser --quiet --system --no-create-home --ingroup tedge-mapper --shell /usr/sbin/nologin tedge-mapper
+ adduser tedge-mapper tedge
fi
-### Create supported cloud operations directories
-install -g tedge -o tedge -m 755 -d /etc/tedge/operations/c8y
-install -g tedge -o tedge -m 755 -d /etc/tedge/operations/az
-
-### Create operation file.
-# This allows thin-edge.io components to list and declare supported operations for the cloud provider.
-# Some of the examples for Cumulocity IoT supported opertations: https://cumulocity.com/api/10.11.0/#section/Device-management-library/Miscellaneous
-install -g tedge -o tedge -m 644 /dev/null /etc/tedge/operations/c8y/c8y_SoftwareUpdate
-install -g tedge -o tedge -m 644 /dev/null /etc/tedge/operations/c8y/c8y_Restart
-
### Initialize the sm mapper
runuser -u tedge-mapper -- tedge_mapper --init c8y
-
+runuser -u tedge-mapper -- tedge_mapper --init az
#DEBHELPER#