From: Peter Dinda Date: Fri, 21 Dec 2012 20:28:02 +0000 (-0600) Subject: Friendlier user-space build/run for graphical components (gui, vnc) X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=1fcc40a92f8cadc3d6ed3f56abc316c11043bc80 Friendlier user-space build/run for graphical components (gui, vnc) --- diff --git a/linux_usr/Makefile b/linux_usr/Makefile index a53892d..e314209 100644 --- a/linux_usr/Makefile +++ b/linux_usr/Makefile @@ -12,7 +12,7 @@ STATIC = 0 # BASE_EXECS = v3_mem \ v3_mem_free \ - v3_create \ + v3_create \ v3_create_bind \ v3_free \ v3_launch \ @@ -58,7 +58,7 @@ EXPERIMENTAL_EXECS = v3_simulate \ # PRECOMPILED_EXECS = x0vncserver -COPIED_EXECS = v3_x0vncserver +COPIED_EXECS = v3_x0vncserver v3_x0gui # # Libraries that we need to build @@ -153,9 +153,27 @@ v3_user_keyed_stream_file : v3_user_keyed_stream_file.c libv3_user_keyed_stream. # # VNC support is compiled separately # -v3_x0vncserver : x0vncserver - cp x0vncserver v3_x0vncserver - +v3_x0vncserver : + @if [ -a x0vncserver ] ; \ + then \ + cp x0vncserver v3_x0vncserver ; \ + else \ + echo "In order to use v3_vncclient/server you must have" ; \ + echo "previously built or received palacios/linux_usr/x0vncserver" ; \ + fi; + +# +# GUI is compiled separately +# +v3_x0gui : + @if [ -a gui/Palacios ] ; \ + then \ + cp gui/Palacios v3_x0gui ; \ + else \ + echo "In order to use v3_gui (the graphical interface)" ;\ + echo "you must first cd to palacios/linux_usr/gui" ;\ + echo "and compile it according to the README given there";\ + fi; # # Cleanup and dependency builds are automated diff --git a/linux_usr/v3_gui b/linux_usr/v3_gui new file mode 100755 index 0000000..f4f77b4 --- /dev/null +++ b/linux_usr/v3_gui @@ -0,0 +1,28 @@ +#!/usr/bin/perl -w + +if (!on_path("v3_x0gui")) { + print "You do not have v3_x0gui available on your PATH.\n"; + print "This probably means you have not built the GUI,\n"; + print "or have not put .../palacios/linux_usr on your PATH\n"; + exit -1; +} + +if (!on_path("xterm")) { + print "You do not have xterm available on your PATH.\n"; + print "v3_gui requires this functionality.\n"; + print "You probably need to install xterm (e.g., yum install xterm)\n"; + exit -1; +} + +system "v3_x0gui"; + +sub on_path { + my $x = `which $_[0] 2>&1`; + if (!defined($x) || $x=~/no $_[0] in/) { + return 0; + } else { + return 1; + } +} + + diff --git a/linux_usr/v3_vncclient b/linux_usr/v3_vncclient index 3aca886..c84a288 100755 --- a/linux_usr/v3_vncclient +++ b/linux_usr/v3_vncclient @@ -8,6 +8,24 @@ $password = ""; &GetOptions("port=i"=>\$port, "password=s"=>\$password); +if (!on_path("vncviewer")) { + print "You do not have vncviewer available on your PATH.\n"; + print "v3_vncclient requires this functionality.\n"; + print "You probably need to install vncviewer (e.g., yum install vncviewer)\n"; + exit -1; +} + system "vncviewer localhost:$port\n"; + + +sub on_path { + my $x = `which $_[0] 2>&1`; + if (!defined($x) || $x=~/no $_[0] in/) { + return 0; + } else { + return 1; + } +} + diff --git a/linux_usr/v3_vncserver b/linux_usr/v3_vncserver index 82ef652..cc030e0 100755 --- a/linux_usr/v3_vncserver +++ b/linux_usr/v3_vncserver @@ -7,10 +7,21 @@ $password = ""; &GetOptions("port=i"=>\$port, "password=s"=>\$password); +if (!on_path("v3_x0vncserver")) { + print "You do not have v3_x0vncserver available on your PATH.\n"; + print "v3_vncserver requires this functionality.\n"; + print "You probably need to add .../palacios/linux_usr to your path\n"; + print "Or you need to build v3_x0vncserver.\n"; + exit -1; +} + $#ARGV==0 or die "usage: v3_vncserver [--port=port] [--password=password] /dev/v3-vmN\n"; + $vm=shift; + + system "echo \"$password\" | vncpasswd -f > ./.vncpasswd"; system "v3_x0vncserver --PasswordFile=./.vncpasswd -rfbport $port $vm >/dev/null 2>&1 & echo \$! > ./.vncpid"; @@ -18,3 +29,12 @@ system "v3_x0vncserver --PasswordFile=./.vncpasswd -rfbport $port $vm >/dev/null print STDERR "pid of server is stored in ./.vncpid\n"; print "You can now connect to port $port with password \"$password\"\n"; +sub on_path { + my $x = `which $_[0] 2>&1`; + if (!defined($x) || $x=~/no $_[0] in/) { + return 0; + } else { + return 1; + } +} +