-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[#22] Add azure-connector recipe. Signed-off-by: Ivan Marinov <ivan.marinov@bosch.io>
- Loading branch information
1 parent
77212e5
commit 4c44700
Showing
5 changed files
with
104 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Common configuration variables to set the binaries and resources allocation directories for Eclipse Kanto Azure connector component | ||
# The destination directory where the required configuration files for the proper connectivity establishment of the Azure connector will be placed | ||
SC_CFG_DD ?= "${sysconfdir}" | ||
# The destination directory where the generated service file will be placed | ||
SC_SYSUNIT_DD ?= "${systemd_unitdir}/system" | ||
# The destination directory where the Azure connector binaries will be placed | ||
SC_BIN_DD ?= "${bindir}" | ||
# The destination directory where the Azure connector logs will be placed | ||
SC_LOG_DD ?= "${localstatedir}/log" |
72 changes: 72 additions & 0 deletions
72
recipes-connectivity/azure-connector/azure-connector_git.bb
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
DESCRIPTION = "Eclipse Kanto - Azure Connector" | ||
|
||
LICENSE = "EPL-2.0 | Apache-2.0" | ||
LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=54cd967551e55d39f55006d3344c22fc" | ||
|
||
SRC_URI = "git://github.com/eclipse-kanto/azure-connector;protocol=https;branch=main \ | ||
file://config.json \ | ||
file://service.template \ | ||
" | ||
|
||
SRCREV = "${AUTOREV}" | ||
|
||
PV = "0.1.0-git${SRCPV}" | ||
|
||
GO_IMPORT = "github.com/eclipse-kanto/azure-connector" | ||
GO_INSTALL = "${GO_IMPORT}/cmd/azure-connector" | ||
|
||
require azure-connector.inc | ||
|
||
inherit go-mod | ||
inherit systemd | ||
|
||
SYSTEMD_AUTO_ENABLE = "enable" | ||
SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | ||
SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','azure-connector.service','',d)}" | ||
|
||
# workaround for network issue | ||
do_compile[network] = "1" | ||
|
||
FILES:${PN} += "${SC_SYSUNIT_DD}/azure-connector.service" | ||
FILES:${PN} += "${SC_BIN_DD}/azure-connector" | ||
# ensure all additional resources are properly packed in the resulting package if provided | ||
FILES:${PN} += "${SC_CFG_DD}/azure-connector/config.json" | ||
FILES:${PN} += "${SC_CFG_DD}/azure-connector/iothub.crt" | ||
|
||
|
||
RDEPENDS:${PN} += "mosquitto" | ||
|
||
PROVIDES:${PN} += "kanto/azure-connector" | ||
RPROVIDES:${PN} += "kanto/azure-connector" | ||
|
||
do_install() { | ||
install -d "${D}/${SC_BIN_DD}" | ||
|
||
install -m 0755 "${GO_BUILD_BINDIR}/azure-connector" "${D}${SC_BIN_DD}/azure-connector" | ||
|
||
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
install -d ${D}${SC_SYSUNIT_DD} | ||
|
||
# azure-connector | ||
install -d ${D}${SC_CFG_DD}/azure-connector | ||
|
||
# iothub.crt | ||
install -m 0644 ${S}/src/${GO_IMPORT}/cmd/azure-connector/iothub.crt ${D}${SC_CFG_DD}/azure-connector | ||
|
||
# config.json | ||
install -m 0644 ${WORKDIR}/config.json ${D}${SC_CFG_DD}/azure-connector | ||
|
||
# service.template as service | ||
install -m 0644 ${WORKDIR}/service.template ${D}${SC_SYSUNIT_DD}/azure-connector.service | ||
|
||
# fill in the azure-connector systemd service template with the custom configs provided | ||
sed -e 's,@SC_BIN_DD@,${SC_BIN_DD},g' \ | ||
-e 's,@SC_CFG_DD@,${SC_CFG_DD},g' \ | ||
-i ${D}${SC_SYSUNIT_DD}/azure-connector.service | ||
|
||
# fill in the config.json template with the custom configs provided | ||
sed -e 's,@SC_CFG_DD@,${SC_CFG_DD},g' \ | ||
-e 's,@SC_LOG_DD@,${SC_LOG_DD},g' \ | ||
-i ${D}${SC_CFG_DD}/azure-connector/config.json | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"caCert": "@SC_CFG_DD@/azure-connector/iothub.crt", | ||
"logFile": "@SC_LOG_DD@/azure-connector/azure-connector.log" | ||
} |
15 changes: 15 additions & 0 deletions
15
recipes-connectivity/azure-connector/files/service.template
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[Unit] | ||
Description=Eclipse Kanto - Azure Connector | ||
Documentation=https://eclipse.org/kanto/docs/ | ||
After=network.target mosquitto.service | ||
Requires=network.target | ||
Requires=mosquitto.service | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=@SC_BIN_DD@/azure-connector -configFile @SC_CFG_DD@/azure-connector/config.json | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
|