Added automagic tool to acces virtualbox machines with serial console using minicom
authorHarvie <tomas@mudrunka.cz>
Fri, 20 Aug 2010 06:36:34 +0000 (08:36 +0200)
committerHarvie <tomas@mudrunka.cz>
Fri, 20 Aug 2010 06:36:34 +0000 (08:36 +0200)
bash/virtualbox-shell.sh [new file with mode: 0755]

diff --git a/bash/virtualbox-shell.sh b/bash/virtualbox-shell.sh
new file mode 100755 (executable)
index 0000000..cc082c0
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+dialog=$(which dialog);
+
+get_vbox_pipes() {
+       grep 'hostMode="HostPipe"' ~/.VirtualBox/Machines/*/*.xml | sed -e 's/.*path="\([^"]*\)".*/\1/g' | while read i; do
+       for prefix in '' "$HOME/" "$HOME/.VirtualBox/"; do
+       socket="$prefix""$i"
+       test -S "$socket" && {
+             echo "$socket";
+               }
+       done;
+       done;
+}
+
+tmp="$(mktemp)";
+get_vbox_pipes | while read socket; do
+       echo -n "$socket"; echo -ne '\0';
+       echo -n "${socket##*/}"; echo -ne '\0';
+done | xargs -0 "$dialog" --no-shadow --trim --title 'Sockets' --backtitle 'VirtualBox serial terminal' --menu -- "Select the socket" 0 0 0 2>"$tmp" || {
+       echo 'ERROR: No vbox sockets found or selected. :-( Bye.';
+       exit 1;
+}
+socket="$(cat "$tmp")";
+rm -f "$tmp";
+
+minicom -c on -o -D unix#"$socket";
This page took 0.115452 seconds and 4 git commands to generate.