aboutsummaryrefslogtreecommitdiff
path: root/kvmx
diff options
context:
space:
mode:
Diffstat (limited to 'kvmx')
-rwxr-xr-xkvmx36
1 files changed, 35 insertions, 1 deletions
diff --git a/kvmx b/kvmx
index 91029a4..2814780 100755
--- a/kvmx
+++ b/kvmx
@@ -101,6 +101,7 @@ function __kvmx_initialize {
PORT="$(($RANDOM + 1024))"
SSH="$(($PORT + 22))"
GUEST_DISPLAY="$(((RANDOM % 10) + 1))"
+ XDMCP_PORT="$(($RANDOM + 10000))"
# Initalize
mkdir -p $GLOBAL_USER_CONFIG_FOLDER
@@ -156,12 +157,14 @@ function __kvmx_initialize {
LOG_DIR="$STORAGE/log"
PIDFILE="$STATE_DIR/pid"
PORTFILE="$STATE_DIR/port"
+ XDMCPPORTFILE="$STATE_DIR/xdmcp"
SSHFILE="$STATE_DIR/ssh"
DISPLAYFILE="$STATE_DIR/display"
SPICEFILE="$STATE_DIR/spice"
LOGFILE="$LOG_DIR/qemu"
SPICELOG="$LOG_DIR/spice"
XPRALOG="$LOG_DIR/xpra"
+ XDMCPLOG="$LOG_DIR/xdmcp"
if [ -e "$STORAGE/ssh/$VM.key" ]; then
mkdir -p "$STORAGE/ssh"
@@ -233,6 +236,10 @@ function kvmx_up {
$DIRNAME/$BASENAME xpra $VM
fi
+ if [ "$run_xephyr" == "1" ]; then
+ $DIRNAME/$BASENAME xephyr $VM
+ fi
+
exit
elif kvmx_running; then
echo "$BASENAME: guest $VM is already running"
@@ -308,7 +315,7 @@ function kvmx_up {
-chardev spicevmc,id=spicechannel0,name=vdagent \
-smp 2 -soundhw ac97 -cpu host -balloon virtio \
-net nic,model=virtio \
- -net user,hostfwd=tcp:127.0.0.1:$SSH-:22$hostfwd &> $LOGFILE < /dev/null &
+ -net user,hostfwd=tcp:127.0.0.1:$SSH-:22,hostfwd=udp:127.0.0.1:$XDMCP_PORT-:177$hostfwd &> $LOGFILE < /dev/null &
PID="$!"
@@ -317,6 +324,7 @@ function kvmx_up {
echo $PORT > $PORTFILE
echo $SSH > $SSHFILE
echo $GUEST_DISPLAY > $DISPLAYFILE
+ echo $XDMCP_PORT > $XDMCPPORTFILE
if [ "$run_spice_client" == "1" ]; then
kvmx_spice
@@ -361,6 +369,10 @@ function kvmx_up {
$DIRNAME/$BASENAME xpra $VM
fi
+ if [ "$run_xephyr" == "1" ]; then
+ $DIRNAME/$BASENAME xephyr $VM
+ fi
+
kvmx_status
}
@@ -907,6 +919,8 @@ function kvmx_vnc {
exit 1
fi
+ GUEST_DISPLAY="`cat $DISPLAYFILE`"
+
if [ -z "$vnc_client" ]; then
vnc_client="virt-viewer"
fi
@@ -924,6 +938,26 @@ function kvmx_vnc {
fi
}
+# Connect to the guest using XDMCP/Xephyr
+# See http://jeffskinnerbox.me/posts/2014/Apr/29/howto-using-xephyr-to-create-a-new-display-in-a-window/
+function kvmx_xephyr {
+ # Clipboard sharing
+ # https://ubuntuforums.org/showthread.php?t=1430363
+ GUEST_DISPLAY="`cat $DISPLAYFILE`"
+ XDMCP_PORT="`cat $XDMCPPORTFILE`"
+
+ if [ ! -z "$resolution" ]; then
+ resolution="-screen $resolution"
+ fi
+
+ if ! which Xephyr &> /dev/null; then
+ echo "$BASENAME: please install Xephyr"
+ exit 1
+ fi
+
+ Xephyr :$GUEST_DISPLAY -ac -port $XDMCP_PORT -query 127.0.0.1 $resolution &> $XDMCPLOG < /dev/null &
+}
+
# Dispatch
if type kvmx_$ACTION 2> /dev/null | grep -q 'function'; then
__kvmx_initialize