From 63da4cb3d258222ff1b11052951c7e5d7ca8e02c Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Tue, 2 Jul 2019 11:14:07 +0200 Subject: Upgrade to 2019.07 This patch upgrade LAVA to 2019.07 via their official docker images. Along with the change of the baseimage from our lava-xx-base to official 2019.07, some minor changes are needed: - Activate the en_US.UTF-8 locale needed for postgresql - chown to lavaserver all copied device-types - Fix the start scripts for using the official entrypoints --- lava-slave/Dockerfile | 4 ++-- lava-slave/scripts/start.sh | 51 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100755 lava-slave/scripts/start.sh (limited to 'lava-slave') diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index 5fdae2f..3877404 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -1,4 +1,4 @@ -FROM baylibre/lava-slave-base:2019.03_stretch +FROM lavasoftware/lava-dispatcher:2019.07 RUN apt-get update @@ -74,4 +74,4 @@ COPY zmq_auth/ /etc/lava-dispatcher/certificates.d/ EXPOSE 69/udp 80 -CMD /start.sh +CMD /usr/local/bin/start.sh diff --git a/lava-slave/scripts/start.sh b/lava-slave/scripts/start.sh new file mode 100755 index 0000000..f88b816 --- /dev/null +++ b/lava-slave/scripts/start.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +/setup.sh || exit $? + +# Set LAVA Master IP +if [[ -n "$LAVA_MASTER" ]]; then + sed -i -e "s/{LAVA_MASTER}/$LAVA_MASTER/g" /etc/lava-dispatcher/lava-slave +fi + +echo "LOGFILE=/var/log/lava-dispatcher/lava-slave.log" >> /etc/lava-dispatcher/lava-slave + +service tftpd-hpa start || exit 4 +if [ -s /etc/ser2net.conf ];then + service ser2net start || exit 7 +fi + +touch /var/run/conmux-registry +/usr/sbin/conmux-registry 63000 /var/run/conmux-registry& +sleep 2 +for item in $(ls /etc/conmux/*cf) +do + echo "Add $item" + # On some OS, the rights/user from host are not duplicated on guest + grep -o '/dev/[a-zA-Z0-9_-]*' $item | xargs chown uucp + /usr/sbin/conmux $item & +done + +HAVE_SCREEN=0 +while read screenboard +do + echo "Start screen for $screenboard" + TERM=xterm screen -d -m -S $screenboard /dev/$screenboard 115200 -ixoff -ixon || exit 9 + HAVE_SCREEN=1 +done < /root/lava-screen.conf +if [ $HAVE_SCREEN -eq 1 ];then + sed -i 's,UsePAM.*yes,UsePAM no,' /etc/ssh/sshd_config || exit 10 + service ssh start || exit 11 +fi + + +# start an http file server for boot/transfer_overlay support +(cd /var/lib/lava/dispatcher; python -m SimpleHTTPServer 80) & + +# FIXME lava-slave does not run if old pid is present +rm -f /var/run/lava-slave.pid +#service lava-slave start || exit 5 +#/etc/init.d/lava-slave start + +/root/entrypoint.sh + +sleep 3650d -- cgit 1.2.3-korg From 12aa09489580123698d1f791b01daf8371fa0228 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Tue, 2 Jul 2019 11:22:51 +0200 Subject: Add support for device-type alias This patch adds support for the device-type aliases. --- README.md | 3 +++ lava-slave/Dockerfile | 1 + lava-slave/aliases/.empty | 0 lava-slave/scripts/setup.sh | 16 ++++++++++++++++ lavalab-gen.py | 6 ++++++ 5 files changed, 26 insertions(+) create mode 100644 lava-slave/aliases/.empty (limited to 'lava-slave') diff --git a/README.md b/README.md index 5b8b361..04e9b73 100644 --- a/README.md +++ b/README.md @@ -299,6 +299,9 @@ boards: tags: (optional) List of tag to set on this device - tag1 - tag2 + aliases: (optional) List of aliases to set on the DEVICE TYPE. + - alias1 + - alias2 user: (optional) Name of user owning the board (LAVA default is admin) user is exclusive with group group: (optional) Name of group owning the board (no LAVA default) group is exclusive with user # One of uart or connection_command must be choosen diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index 3877404..b93e310 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -61,6 +61,7 @@ RUN mkdir -p /root/.config COPY devices/ /root/devices/ COPY tags/ /root/tags/ +COPY aliases/ /root/aliases/ COPY deviceinfo/ /root/deviceinfo/ RUN if [ -x /usr/local/bin/extra_actions ] ; then /usr/local/bin/extra_actions ; fi diff --git a/lava-slave/aliases/.empty b/lava-slave/aliases/.empty new file mode 100644 index 0000000..e69de29 diff --git a/lava-slave/scripts/setup.sh b/lava-slave/scripts/setup.sh index 1fb0bb3..4bf2f67 100755 --- a/lava-slave/scripts/setup.sh +++ b/lava-slave/scripts/setup.sh @@ -143,6 +143,22 @@ do done done +for devicetype in $(ls /root/aliases/) +do + lavacli $LAVACLIOPTS device-types aliases list $devicetype > /tmp/device-types-aliases-$devicetype.list + while read alias + do + grep -q " $alias$" /tmp/device-types-aliases-$devicetype.list + if [ $? -eq 0 ];then + echo "DEBUG: $alias for $devicetype already present" + continue + fi + echo "DEBUG: Add alias $alias to $devicetype" + lavacli $LAVACLIOPTS device-types aliases add $devicetype $alias || exit $? + echo " $alias" >> /tmp/device-types-aliases-$devicetype.list + done < /root/aliases/$devicetype +done + if [ -e /etc/lava-dispatcher/certificates.d/$(hostname).key ];then echo "INFO: Enabling encryption" sed -i 's,.*ENCRYPT=.*,ENCRYPT="--encrypt",' /etc/lava-dispatcher/lava-slave diff --git a/lavalab-gen.py b/lavalab-gen.py index 28a3a22..2346689 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -626,6 +626,12 @@ def main(): for tag in board["tags"]: ftag.write("%s\n" % tag) ftag.close() + if "aliases" in board: + aliases_dir = "%s/aliases/" % workerdir + falias = open("%s/%s" % (aliases_dir, board["type"]), 'a') + for alias in board["aliases"]: + falias.write("%s\n" % alias) + falias.close() if "user" in board: deviceinfo = open("%s/deviceinfo/%s" % (workerdir, board_name), 'w') deviceinfo.write("DEVICE_USER=%s\n" % board["user"]) -- cgit 1.2.3-korg