--- a/unix/vncserver/vncserver.in 2022-02-14 17:09:13.818945751 +0000 +++ b/unix/vncserver/vncserver.in 2022-02-14 20:30:24.823104744 +0000 @@ -27,8 +27,12 @@ # vncserver - wrapper script to start an X VNC server. # +# Get the args +my ($display, $xsession) = @ARGV; + # First make sure we're operating in a sane environment. -&SanityCheck(); + +&SanityCheck($xsession); # # Global variables. You may want to configure some of these for @@ -83,7 +87,7 @@ } # Find display number. -if ((@ARGV == 1) && ($ARGV[0] =~ /^:(\d+)$/)) { +if ( ( (@ARGV == 1) || (@ARGV == 2) ) && ($ARGV[0] =~ /^:(\d+)$/)) { $displayNumber = $1; if (!&CheckDisplayNumber($displayNumber)) { die "A VNC server is already running as :$displayNumber\n"; @@ -411,13 +415,15 @@ sub Usage { - die("\nusage: $prog \n\n"); + die("\nusage: $prog []\n\n"); } # Routine to make sure we're operating in a sane environment. sub SanityCheck { + my($xsessionfile) = @_; + local ($cmd); # Get the program name @@ -437,12 +443,16 @@ die "$prog: couldn't find \"$cmd\" on your PATH.\n"; } - foreach $cmd ("/etc/X11/xinit/Xsession", "/etc/X11/Xsession") { - if (-x "$cmd") { - $Xsession = $cmd; - last; + if (-x "$xsessionfile"){ + $Xsession = $xsessionfile + } else { + foreach $cmd ("/etc/X11/xinit/Xsession", "/etc/X11/Xsession") { + if (-x "$cmd") { + $Xsession = $cmd; + last; + } } - } + } if (not defined $Xsession) { die "$prog: Couldn't find suitable Xsession.\n"; }