diff options
2 files changed, 32 insertions, 10 deletions
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service index 5dd352a553..0b7601d494 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service | |||
| @@ -1,13 +1,17 @@ | |||
| 1 | [Unit] | 1 | [Unit] |
| 2 | Description = Systemd service for Thingsboard Gateway | 2 | Description=ThingsBoard Gateway |
| 3 | After = network.target | 3 | After=network-online.target |
| 4 | Wants=network-online.target | ||
| 5 | ConditionPathExists=/etc/thingsboard-gateway/config/tb_gateway.json | ||
| 4 | 6 | ||
| 5 | [Service] | 7 | [Service] |
| 6 | ExecStart = /usr/bin/python3 /usr/bin/thingsboard-gateway | 8 | Type=simple |
| 7 | ExecStop = /bin/kill -INT $MAINPID | 9 | User=thingsboard_gateway |
| 8 | ExecReload = /bin/kill -TERM $MAINPID | 10 | Group=thingsboard_gateway |
| 9 | Restart = always | 11 | ExecStart=/usr/bin/python3 /usr/bin/thingsboard-gateway |
| 10 | Type = simple | 12 | ExecStop=/bin/kill -INT $MAINPID |
| 13 | ExecReload=/bin/kill -TERM $MAINPID | ||
| 14 | Restart=on-failure | ||
| 11 | 15 | ||
| 12 | [Install] | 16 | [Install] |
| 13 | WantedBy=multi-user.target | 17 | WantedBy=multi-user.target |
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_3.7.4.bb b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_3.7.4.bb index 8ff06285f9..7a82414937 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_3.7.4.bb +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_3.7.4.bb | |||
| @@ -43,21 +43,39 @@ RDEPENDS:${PN} += " python3-jsonpath-rw \ | |||
| 43 | 43 | ||
| 44 | SRC_URI += "file://thingsboard-gateway.service" | 44 | SRC_URI += "file://thingsboard-gateway.service" |
| 45 | 45 | ||
| 46 | 46 | inherit systemd useradd | |
| 47 | inherit systemd | ||
| 48 | 47 | ||
| 49 | SYSTEMD_PACKAGES = "${PN}" | 48 | SYSTEMD_PACKAGES = "${PN}" |
| 50 | SYSTEMD_SERVICE:${PN} = "thingsboard-gateway.service" | 49 | SYSTEMD_SERVICE:${PN} = "thingsboard-gateway.service" |
| 51 | 50 | ||
| 51 | USERADD_PACKAGES = "${PN}" | ||
| 52 | USERADD_PARAM:${PN} = " \ | ||
| 53 | --system --no-create-home \ | ||
| 54 | --comment 'ThingsBoard-Gateway Service' \ | ||
| 55 | --home-dir ${localstatedir}/lib/${BPN} \ | ||
| 56 | --shell ${base_sbindir}/nologin \ | ||
| 57 | --gid thingsboard_gateway thingsboard_gateway" | ||
| 58 | GROUPADD_PARAM:${PN} = "--system thingsboard_gateway" | ||
| 59 | |||
| 52 | FILES:${PN} += "/etc \ | 60 | FILES:${PN} += "/etc \ |
| 53 | /lib \ | 61 | /lib \ |
| 54 | /usr \ | 62 | /usr \ |
| 63 | ${localstatedir} \ | ||
| 55 | " | 64 | " |
| 56 | 65 | ||
| 57 | do_install:append(){ | 66 | do_install:append(){ |
| 58 | install -d ${D}${sysconfdir}/${BPN}/config | 67 | install -d ${D}${sysconfdir}/${BPN}/config |
| 59 | install -m 0644 ${S}/thingsboard_gateway/config/*.json ${D}${sysconfdir}/${BPN}/config | 68 | install -m 0644 ${S}/thingsboard_gateway/config/*.json ${D}${sysconfdir}/${BPN}/config |
| 69 | chown -R thingsboard_gateway:thingsboard_gateway ${D}${sysconfdir}/${BPN} | ||
| 60 | 70 | ||
| 61 | install -d ${D}${systemd_unitdir}/system/ | 71 | install -d ${D}${systemd_system_unitdir}/ |
| 62 | install -m 0644 ${UNPACKDIR}/thingsboard-gateway.service ${D}${systemd_system_unitdir}/thingsboard-gateway.service | 72 | install -m 0644 ${UNPACKDIR}/thingsboard-gateway.service ${D}${systemd_system_unitdir}/thingsboard-gateway.service |
| 73 | |||
| 74 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
| 75 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
| 76 | echo "d ${localstatedir}/log/${BPN} 0755 thingsboard_gateway thingsboard_gateway -" \ | ||
| 77 | > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf | ||
| 78 | echo "d ${localstatedir}/lib/${BPN} 0755 thingsboard_gateway thingsboard_gateway -" \ | ||
| 79 | >> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf | ||
| 80 | fi | ||
| 63 | } | 81 | } |
