diff options
author | chn | 2021-04-16 10:16:00 +0800 |
---|---|---|
committer | chn | 2021-04-16 10:17:34 +0800 |
commit | af43a9fa8547992dcaa7ef513c25da357b816834 (patch) | |
tree | 3cfc797851bfab67c6162d7311f8839c0338cde7 /qemu-guest-agent-bandwagonhost-kiwivm.bash | |
download | aur-af43a9fa8547992dcaa7ef513c25da357b816834.tar.gz |
init
Diffstat (limited to 'qemu-guest-agent-bandwagonhost-kiwivm.bash')
-rw-r--r-- | qemu-guest-agent-bandwagonhost-kiwivm.bash | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/qemu-guest-agent-bandwagonhost-kiwivm.bash b/qemu-guest-agent-bandwagonhost-kiwivm.bash new file mode 100644 index 000000000000..016da196734b --- /dev/null +++ b/qemu-guest-agent-bandwagonhost-kiwivm.bash @@ -0,0 +1,24 @@ +#!/bin/bash +SERIALSTDIO=/dev/virtio-ports/kiwicomm.port0 +SERIALSTDERR=/dev/virtio-ports/kiwicomm.port1 + +if [ ! -L "$SERIALSTDIO" ] || [ ! -L "$SERIALSTDERR" ]; then + echo "Serial device not found, aborting." + exit 1 +fi + +( +flock -x -w 3 188 || { exit 0; } + +while true; do + line="" + read -r line < $SERIALSTDIO + if [ ! -z "$line" ]; then + echo $line + eval $line > $SERIALSTDIO 2>$SERIALSTDERR + echo "EXIT CODE: $?" >$SERIALSTDERR + else + sleep 1 + fi +done +) 188> /var/lock/qemu-guest-agent-bandwagonhost-kiwivm.lock |