Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: switch to tedge-configuration-plugin #35

Merged
merged 2 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ The service definitions are also available via a tarball which can be manually i
tedgectl enable tedge-agent
tedgectl start tedge-agent
tedgectl enable c8y-configuration-plugin
tedgectl start c8y-configuration-plugin
tedgectl enable tedge-configuration-plugin
tedgectl start tedge-configuration-plugin
tedgectl enable tedge-log-plugin
tedgectl start tedge-log-plugin
Expand Down
2 changes: 1 addition & 1 deletion images/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ start_enable() {

start_enable tedge-agent
#start_enable tedge-mapper-c8y "tedge-mapper c8y"
#start_enable c8y-configuration-plugin
#start_enable tedge-configuration-plugin
#start_enable c8y-firmware-plugin
#start_enable tedge-log-plugin

Expand Down
6 changes: 3 additions & 3 deletions packages/_scripts/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ if command -V tedge-agent >/dev/null 2>&1; then
tedgectl start tedge-agent 2>/dev/null ||:
fi

if command -V c8y-configuration-plugin >/dev/null 2>&1; then
tedgectl enable c8y-configuration-plugin ||:
tedgectl start c8y-configuration-plugin 2>/dev/null ||:
if command -V tedge-configuration-plugin >/dev/null 2>&1; then
tedgectl enable tedge-configuration-plugin ||:
tedgectl start tedge-configuration-plugin 2>/dev/null ||:
fi

if command -V tedge-log-plugin >/dev/null 2>&1; then
Expand Down
4 changes: 2 additions & 2 deletions packages/_scripts/preremove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ set -e
# disable services (ignore if not found)
tedgectl disable tedge-agent 2>/dev/null ||:
tedgectl disable tedge-mapper-c8y 2>/dev/null ||:
tedgectl disable c8y-configuration-plugin 2>/dev/null ||:
tedgectl disable tedge-configuration-plugin 2>/dev/null ||:
tedgectl disable tedge-log-plugin 2>/dev/null ||:
tedgectl disable c8y-firmware-plugin 2>/dev/null ||:

# stop services (ignore if not found)
tedgectl stop tedge-agent 2>/dev/null ||:
tedgectl stop tedge-mapper-c8y 2>/dev/null ||:
tedgectl stop c8y-configuration-plugin 2>/dev/null ||:
tedgectl stop tedge-configuration-plugin 2>/dev/null ||:
tedgectl stop tedge-log-plugin 2>/dev/null ||:
tedgectl stop c8y-firmware-plugin 2>/dev/null ||:
9 changes: 7 additions & 2 deletions services/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

pushd "$SCRIPT_DIR" || exit 1

SED="sed"
if command -v gsed; then
SED="gsed"
fi

execute_template() {
input_file="$1"

sed \
"$SED" \
-e "s|\\\$NAME|${NAME:-}|g" \
-e "s|\\\$LOG_NAME|${NAME:-}|g" \
-e "s|\\\$COMMAND_ARGS|${COMMAND_ARGS:-}|g" \
Expand All @@ -22,7 +27,7 @@ execute_template() {
execute_template_inplace() {
input_file="$1"

sed -i \
"$SED" -i \
-e "s|\\\$NAME|${NAME:-}|g" \
-e "s|\\\$LOG_NAME|${NAME:-}|g" \
-e "s|\\\$COMMAND_ARGS|${COMMAND_ARGS:-}|g" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration file for /etc/init.d/c8y-configuration-plugin
# Configuration file for /etc/init.d/tedge-configuration-plugin

# Additional arguments to pass to /usr/bin/c8y-configuration-plugin.
# Additional arguments to pass to /usr/bin/tedge-configuration-plugin.
#command_args=

# Overwrite user
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/sbin/openrc-run
description="Thin-edge device configuration management for Cumulocity"
command="/usr/bin/c8y-configuration-plugin"
description="Thin-edge device configuration management"
command="/usr/bin/tedge-configuration-plugin"
: ${command_args=}
: ${command_user=root}
pidfile="/run/lock/${RC_SVCNAME}.lock"
Expand Down
15 changes: 0 additions & 15 deletions services/runit/runsvdir/c8y-configuration-plugin/run

This file was deleted.

15 changes: 15 additions & 0 deletions services/runit/runsvdir/tedge-configuration-plugin/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh -e
touch "/var/log/tedge-configuration-plugin.log"
DAEMON_USER="root"
LOG_FILE="/var/log/tedge-configuration-plugin.log"
PIDFILE="/run/lock/tedge-configuration-plugin.lock"

mkdir -p /run/lock
chown 1777 /run/lock
touch "$PIDFILE"

if [ -n "$DAEMON_USER" ]; then
chown "$DAEMON_USER" "$PIDFILE"
chown "$DAEMON_USER" "/var/log/tedge-configuration-plugin.log"
fi
exec chpst -u "$DAEMON_USER" "/usr/bin/tedge-configuration-plugin" >> "$LOG_FILE" 2>&1

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions services/s6-overlay/s6-rc.d/c8y-configuration-plugin-log/run

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tedge-configuration-plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tedge-configuration-plugin-pipeline
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
sed 's/^/\x1b[34mtedge-configuration-plugin |\x1b[0m /' --unbuffered
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tedge-configuration-plugin-log
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/command/with-contenv sh
if [ "${SERVICE_C8Y_CONFIGURATION_PLUGIN:-1}" -eq 0 ]; then
if [ "${SERVICE_TEDGE_CONFIGURATION_PLUGIN:-1}" -eq 0 ]; then
# Disable service and don't start again
# https://github.com/just-containers/s6-overlay/issues/394
s6-svc -O .
exit 0
fi

exec 2>&1
exec /usr/bin/c8y-configuration-plugin
exec /usr/bin/tedge-configuration-plugin
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[program:c8y-configuration-plugin]
command=/usr/bin/c8y-configuration-plugin
[program:tedge-configuration-plugin]
command=/usr/bin/tedge-configuration-plugin
user=root
startsecs=5
autostart=true
Expand Down
159 changes: 0 additions & 159 deletions services/sysvinit-yocto/init.d/c8y-configuration-plugin

This file was deleted.

Loading