X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_usr%2Fv3_vncserver;h=cc030e0bbba18cefcfe08a543e568329bb4bbb56;hb=3c8719220338a2d91af469c6e6df9075b46b7d3e;hp=82ef652ded341ee3930e40e08a155e7308a8ecde;hpb=384394434d203f0c19d2ef8f1bc45a446759e270;p=palacios.git 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; + } +} +