38 lines
1.8 KiB
Bash
38 lines
1.8 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
case "$1" in
|
|
configure)
|
|
if ! getent passwd mission-core-node >/dev/null; then
|
|
adduser --system --group --home /var/lib/mission-core-node --no-create-home --disabled-login mission-core-node
|
|
fi
|
|
if ! getent passwd mission-core-sensors >/dev/null; then
|
|
adduser --system --group --home /var/lib/mission-core-sensors --no-create-home --disabled-login mission-core-sensors
|
|
fi
|
|
# Only bootstrap required to open the GUI. Operational configuration is a
|
|
# versioned job started by «Настройка окружения → Сконфигурировать».
|
|
if [ -d /run/systemd/system ]; then
|
|
systemctl daemon-reload
|
|
systemctl enable mission-core-node.service
|
|
systemctl restart mission-core-node.service
|
|
systemctl try-restart mission-core-realsense.service
|
|
if [ -f /run/mission-core-node-k1-upgrade-active ]; then
|
|
# A jointly upgraded plugin starts itself after its own configuration.
|
|
# Restore it here only when that package is already configured.
|
|
if [ "$(dpkg-query -W -f='${Status}' mission-core-xgrids-k1 2>/dev/null || true)" = "install ok installed" ]; then
|
|
systemctl start mission-core-k1.service
|
|
fi
|
|
rm -f /run/mission-core-node-k1-upgrade-active
|
|
fi
|
|
# A diagnostic service must not leave Node half-configured and prevent
|
|
# dpkg from configuring the separately packaged acquisition plugin.
|
|
if /usr/lib/mission-core-node/setup-monitor; then
|
|
rm -f /run/mission-core-monitor-setup-failed
|
|
else
|
|
mc_monitor_result=$?
|
|
printf '%s\n' "$mc_monitor_result" > /run/mission-core-monitor-setup-failed
|
|
echo "Mission Core Node: monitoring setup failed; device services remain independent." >&2
|
|
fi
|
|
fi
|
|
;;
|
|
esac
|