Skip to content

Commit

Permalink
switch to using tedge-configuration-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenmiller committed Oct 29, 2023
1 parent 4d7a6d3 commit e3ebb65
Show file tree
Hide file tree
Showing 26 changed files with 54 additions and 213 deletions.
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 ||:
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.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh
#/etc/init.d/c8y-configuration-plugin: Thin-edge device configuration management for Cumulocity
#/etc/init.d/tedge-configuration-plugin: Thin-edge device configuration management

### BEGIN INIT INFO
# Provides: c8y-configuration-plugin
# Short-Description: Thin-edge device configuration management for Cumulocity
# Provides: tedge-configuration-plugin
# Short-Description: Thin-edge device configuration management
# Required-Start: $all
# Required-Stop: $all
# Should-Start:
Expand All @@ -19,24 +19,24 @@ set -e

PATH=/bin:/usr/bin:/sbin:/usr/sbin

test -x "/usr/bin/c8y-configuration-plugin" || exit 0
test -x "/usr/bin/tedge-configuration-plugin" || exit 0

# For configuration of the init script use the file
# /etc/default/c8y-configuration-plugin, do not edit this init script.
# /etc/default/tedge-configuration-plugin, do not edit this init script.

# Set run_service to 1 to start c8y-configuration-plugin or 0 to disable it.
# Set run_service to 1 to start tedge-configuration-plugin or 0 to disable it.
run_service=1

DAEMON_ARGS=""
DAEMON_USER="root"
LOG_FILE=/var/log/c8y-configuration-plugin.log
LOG_FILE=/var/log/tedge-configuration-plugin.log

export TEDGE_RUN_LOCK_FILES="false"

[ -e "/etc/default/c8y-configuration-plugin" ] && . "/etc/default/c8y-configuration-plugin"
[ -e "/etc/default/tedge-configuration-plugin" ] && . "/etc/default/tedge-configuration-plugin"

DAEMON=/usr/bin/c8y-configuration-plugin
PIDFILE=/run/lock/c8y-configuration-plugin.lock
DAEMON=/usr/bin/tedge-configuration-plugin
PIDFILE=/run/lock/tedge-configuration-plugin.lock

STOP_RETRY_SCHEDULE='TERM/30/KILL/1'

Expand Down Expand Up @@ -75,7 +75,7 @@ fi
do_start() {
if [ $run_service = 1 ]
then
log_begin_msg "Starting c8y-configuration-plugin daemon..."
log_begin_msg "Starting tedge-configuration-plugin daemon..."

# Create log file with given user so it can write to it (for non-root users)
touch "$LOG_FILE"
Expand All @@ -92,7 +92,7 @@ do_start() {
do_stop() {
if [ $run_service = 1 ]
then
log_begin_msg "Stopping c8y-configuration-plugin daemon..."
log_begin_msg "Stopping tedge-configuration-plugin daemon..."

if start-stop-daemon --stop --quiet --oknodo --retry "$STOP_RETRY_SCHEDULE" --pidfile "${PIDFILE}" --user "${DAEMON_USER}"; then
log_end_msg 0
Expand All @@ -119,7 +119,7 @@ case "$1" in

try-restart|force-reload)
if [ $run_service = 0 ]; then exit 0; fi
log_daemon_msg "Restarting c8y-configuration-plugin"
log_daemon_msg "Restarting tedge-configuration-plugin"
# force-reload is the same as reload or try-restart according
# to its definition, the reload is not implemented here, so
# force-reload is the alias of try-restart here, but it should
Expand All @@ -134,7 +134,7 @@ case "$1" in
;;

*)
echo "Usage: /etc/init.d/c8y-configuration-plugin {start|stop|status|restart|try-restart|force-reload}" >&2
echo "Usage: /etc/init.d/tedge-configuration-plugin {start|stop|status|restart|try-restart|force-reload}" >&2
exit 1

esac
Expand Down
File renamed without changes.
Loading

0 comments on commit e3ebb65

Please sign in to comment.