dot

packages and services management
Log | Files | Refs | README

commit 985968bfc70095883489e2dc1f96cda2c4333fc3
parent ca1e98ff3cf43d52577cb345c9418710e8b2e118
Author: Josuah Demangeon <mail@josuah.net>
Date:   Thu,  8 Feb 2018 13:38:58 +0100

[fix] qemu: compatibility with linux netstat

Diffstat:
Mbin/qemu | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/bin/qemu b/bin/qemu @@ -17,7 +17,7 @@ case "${1}" in end='10100' port="$(netstat -natl | awk -v b="${beg}" -v e="${end}" \ - '$6 == "LISTEN" && sub(".*\\.", "", $4) && b <= $4 + 0 && $4 + 0 <= e { + '$6 == "LISTEN" && sub(".*[.:]", "", $4) && b <= $4 + 0 && $4 + 0 <= e { print($4); }' | sort -ru | sed q)" port="${port:+$((${port} + 1))}" @@ -42,7 +42,10 @@ case "${1}" in ls "${VAR}/qemu" | sed 's/^/ /' 1>&2 echo 'running:' 1>&2 - pgrep -lf 'qemu-system-.*hostfwd=tcp::' | - sed -r 's|.*hostfwd=tcp::([0-9]+).*/(.+)$| \1 \2|' + { + ps -ax || ps + } 2> /dev/null | sed -rn ' + s/.*qemu-system-.*::([0-9]+).*[/](.+)$/ \1 \2/p + ' 1>&2 ;; esac