Skip to content

Commit ff02323

Browse files
author
Sean Nyekjaer
committed
python3-labgrid: add systemd service
The systemd service reads the environment file and sets the ip and port for the coordinator. Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
1 parent 105a710 commit ff02323

File tree

4 files changed

+54
-1
lines changed

4 files changed

+54
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
### This is an example labgrid exporter configuration. This file will be installed
2+
### into /etc/labgrid/configuration.yaml on your target and describes your exporter
3+
### services.
4+
###
5+
### Adapt and extend the below configuration to your needs and place it in the
6+
### BSP layer of you project. Create a python3-labgrid.bbappend file that adds this
7+
### file to your build:
8+
###
9+
### FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
10+
###
11+
### SRC_URI_append := " file://configuration.yaml"
12+
###
13+
### ---
14+
###
15+
#
16+
#example-group1-remote:
17+
# location: example-location-1-remote
18+
# USBSerialPort:
19+
# match:
20+
# 'ID_SERIAL_SHORT': 'FTA8E2HP'
21+
# speed: 115200
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### This is an example labgrid exporter ip configuration. This file will be installed
2+
### into /etc/labgrid/environment and read by the labgrid exporter systemd service.
3+
4+
LABGRID_COORDINATOR_IP=127.0.0.1
5+
LABGRID_COORDINATOR_PORT=20408
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Labgrid exporter
3+
After=network-online.target
4+
Wants=network-online.target
5+
6+
[Service]
7+
Type=simple
8+
EnvironmentFile=/etc/labgrid/environment
9+
ExecStart=/usr/bin/python3 /usr/bin/labgrid-exporter -d -x ws://${LABGRID_COORDINATOR_IP}:${LABGRID_COORDINATOR_PORT}/ws /etc/labgrid/configuration.yaml
10+
11+
[Install]
12+
WantedBy=multi-user.target

recipes-devtools/python/python3-labgrid_git.bb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ RDEPENDS_${PN} = " \
2323

2424
SRC_URI = " \
2525
git://github.com/labgrid-project/labgrid.git;branch=master \
26+
file://configuration.yaml \
27+
file://labgrid-exporter.service \
28+
file://environment \
2629
"
2730

2831
SRCREV = "30c6cb61e6292f36847e80ec3e5f730ddc4bac72"
@@ -31,4 +34,16 @@ S = "${WORKDIR}/git"
3134
DEPENDS += "python3-setuptools-scm-native"
3235
DEPENDS += "python3-pytest-runner-native"
3336

34-
inherit setuptools3
37+
inherit setuptools3 systemd
38+
39+
SYSTEMD_SERVICE_${PN} = "labgrid-exporter.service"
40+
41+
do_install_append() {
42+
install -d ${D}${sysconfdir}/labgrid
43+
install -m 0644 ${WORKDIR}/configuration.yaml ${D}${sysconfdir}/labgrid
44+
install -m 0644 ${WORKDIR}/environment ${D}${sysconfdir}/labgrid
45+
install -d ${D}${systemd_system_unitdir}
46+
install -m 0644 ${WORKDIR}/labgrid-exporter.service ${D}${systemd_system_unitdir}/
47+
}
48+
49+
FILES_${PN} += "${sysconfdir} ${systemd_system_unitdir}"

0 commit comments

Comments
 (0)