forked from eclipse-kanto/kanto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eclipse-kanto#85] Provide RPM support
Aligned RPM support with the Debian packages one. Signed-off-by: Konstantina Gramatova <[email protected]>
- Loading branch information
1 parent
029dcd4
commit 43836f0
Showing
4 changed files
with
82 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,33 @@ | ||
systemctl_start_if_enabled () { | ||
if (systemctl -q is-enabled "$1"); then | ||
echo "Starting $1" | ||
systemctl start "$1" || : | ||
fi | ||
} | ||
|
||
if [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then | ||
# Initial installation | ||
|
||
# Configure Mosquitto to look for the suite-connector config file | ||
echo "include_dir /etc/mosquitto/conf.d" >> /etc/mosquitto/mosquitto.conf | ||
|
||
# Use a systemctl preset | ||
# instead of "systemctl enable" | ||
# as per Fedora's guidelines | ||
|
||
# Use `:` instead of `true` as this is the usual expansion of rpm scriptlets | ||
|
||
# If containerd and mosquitto aren't enabled, enable them | ||
systemctl unmask containerd.service >/dev/null || : | ||
/usr/lib/systemd/systemd-update-helper install-system-units containerd.service || : | ||
systemctl unmask mosquitto.service >/dev/null || : | ||
# Handle dependent services installation and start up | ||
/usr/lib/systemd/systemd-update-helper install-system-units mosquitto.service || : | ||
/usr/lib/systemd/systemd-update-helper install-system-units containerd.service || : | ||
|
||
# If mosquitto is already running, restart it to pick up the new configuration | ||
# Configure Mosquitto to look for the suite-connector config file | ||
echo "include_dir /etc/mosquitto/conf.d" >> /etc/mosquitto/mosquitto.conf | ||
/usr/lib/systemd/systemd-update-helper mark-restart-system-units mosquitto.service || : | ||
|
||
# Enable the Kanto services | ||
systemctl unmask suite-connector.service >/dev/null || : | ||
# Install the Kanto services | ||
/usr/lib/systemd/systemd-update-helper install-system-units suite-connector.service || : | ||
systemctl unmask container-management.service >/dev/null || : | ||
/usr/lib/systemd/systemd-update-helper install-system-units local-digital-twins.service || : | ||
/usr/lib/systemd/systemd-update-helper install-system-units suite-bootstrapping.service || : | ||
/usr/lib/systemd/systemd-update-helper install-system-units container-management.service || : | ||
systemctl unmask file-upload.service >/dev/null || : | ||
/usr/lib/systemd/systemd-update-helper install-system-units file-upload.service || : | ||
systemctl unmask software-update.service >/dev/null || : | ||
/usr/lib/systemd/systemd-update-helper install-system-units software-update.service || : | ||
systemctl unmask file-backup.service >/dev/null || : | ||
/usr/lib/systemd/systemd-update-helper install-system-units file-backup.service || : | ||
systemctl unmask system-metrics.service >/dev/null || : | ||
/usr/lib/systemd/systemd-update-helper install-system-units system-metrics.service || : | ||
|
||
# Start the containerd and mosquitto services, if enabled | ||
systemctl_start_if_enabled containerd.service || : | ||
systemctl_start_if_enabled mosquitto.service || : | ||
|
||
# Start the Kanto services, if enabled | ||
systemctl_start_if_enabled suite-connector.service || : | ||
systemctl_start_if_enabled container-management.service || : | ||
systemctl_start_if_enabled file-upload.service || : | ||
systemctl_start_if_enabled software-update.service || : | ||
systemctl_start_if_enabled file-backup.service || : | ||
systemctl_start_if_enabled system-metrics.service || : | ||
# Start the Kanto services if enabled | ||
if [ -d /run/systemd/system ]; then | ||
systemctl is-enabled -q suite-connector.service && systemctl start suite-connector.service >/dev/null || : | ||
systemctl is-enabled -q local-digital-twins.service && systemctl start local-digital-twins.service >/dev/null || : | ||
systemctl is-enabled -q suite-bootstrapping.service && systemctl start suite-bootstrapping.service >/dev/null || : | ||
systemctl is-enabled -q container-management.service && systemctl start container-management.service >/dev/null || : | ||
systemctl is-enabled -q file-upload.service && systemctl start file-upload.service >/dev/null || : | ||
systemctl is-enabled -q software-update.service && systemctl start software-update.service >/dev/null || : | ||
systemctl is-enabled -q file-backup.service && systemctl start file-backup.service >/dev/null || : | ||
systemctl is-enabled -q system-metrics.service && systemctl start system-metrics.service >/dev/null || : | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
if [ $1 -eq 0 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then | ||
# Package removal, not upgrade | ||
|
||
# Do not call remove-system-units on containerd and mosquitto, | ||
# they have their own scripts | ||
|
||
# Use `:` instead of `true` as this is the usual expansion of rpm scriptlets | ||
|
||
# /usr/lib/systemd/systemd-update-helper remove-system-units does the following: | ||
# Stops the service and disables it from automatically running. | ||
|
||
# The Kanto services, including ones that are usually disabled by default | ||
# Remove the Kanto services, including ones that are usually disabled by default | ||
/usr/lib/systemd/systemd-update-helper remove-system-units system-metrics.service || : | ||
/usr/lib/systemd/systemd-update-helper remove-system-units file-backup.service || : | ||
/usr/lib/systemd/systemd-update-helper remove-system-units software-update.service || : | ||
/usr/lib/systemd/systemd-update-helper remove-system-units file-upload.service || : | ||
/usr/lib/systemd/systemd-update-helper remove-system-units container-management.service || : | ||
/usr/lib/systemd/systemd-update-helper remove-system-units suite-connector.service || : | ||
/usr/lib/systemd/systemd-update-helper remove-system-units local-digital-twins.service || : | ||
/usr/lib/systemd/systemd-update-helper remove-system-units suite-bootstrapping.service || : | ||
/usr/lib/systemd/systemd-update-helper remove-system-units local-digital-twins.service || : | ||
/usr/lib/systemd/systemd-update-helper remove-system-units suite-connector.service || : | ||
|
||
# Reload systemd | ||
/usr/lib/systemd/systemd-update-helper system-reload | ||
fi |