From df5e288aef4856c982b7ddf7a90a6e2ee05683d4 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 10 Feb 2022 16:30:11 -0800 Subject: [PATCH] compiler_vm: add-serials can be configured with env --- applets/compiler_vm/host/devices/add-serials | 17 +++++++++++++++-- applets/compiler_vm/host/devices/serial-2.xml | 2 +- applets/compiler_vm/host/devices/serial-3.xml | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/applets/compiler_vm/host/devices/add-serials b/applets/compiler_vm/host/devices/add-serials index b321cf58..26d143ca 100755 --- a/applets/compiler_vm/host/devices/add-serials +++ b/applets/compiler_vm/host/devices/add-serials @@ -1,2 +1,15 @@ -virsh attach-device --config pbot-vm serial-2.xml -virsh attach-device --config pbot-vm serial-3.xml +#!/bin/sh + +DOMAIN="${PBOTVM_DOMAIN:-pbot-vm}" +SERIAL="${PBOTVM_SERIAL:-5555}" +HEART="${PBOTVM_HEART:-5556}" + +install_serial() { + file=$1 port=$2 + sed -i.1 "s/[\$]PORT[\$]/$port/" $file + virsh attach-device --config $DOMAIN $file + mv $file.1 $file +} + +install_serial serial-2.xml $SERIAL +install_serial serial-3.xml $HEART diff --git a/applets/compiler_vm/host/devices/serial-2.xml b/applets/compiler_vm/host/devices/serial-2.xml index 45ec745f..7d9e08ef 100644 --- a/applets/compiler_vm/host/devices/serial-2.xml +++ b/applets/compiler_vm/host/devices/serial-2.xml @@ -1,5 +1,5 @@ - + diff --git a/applets/compiler_vm/host/devices/serial-3.xml b/applets/compiler_vm/host/devices/serial-3.xml index 229be48d..34f0e1b7 100644 --- a/applets/compiler_vm/host/devices/serial-3.xml +++ b/applets/compiler_vm/host/devices/serial-3.xml @@ -1,5 +1,5 @@ - +