summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLlorenç Garcia Martinez <github@siot.es>2015-10-23 13:37:42 +0200
committerLlorenç Garcia Martinez <github@siot.es>2015-10-23 13:37:42 +0200
commit861cb06de563aed2f2afe759898b4a7ff2b116b8 (patch)
tree7944bc2352d059192188ccaaa05bacc9a2376901
parent1e61325deaf01771b661e3fa3fbe658ff6539147 (diff)
downloadtigervnc-861cb06de563aed2f2afe759898b4a7ff2b116b8.tar.gz
tigervnc-861cb06de563aed2f2afe759898b4a7ff2b116b8.zip
new option -noxstartup to not load any xstartup script file
-rwxr-xr-xunix/vncserver41
1 files changed, 28 insertions, 13 deletions
diff --git a/unix/vncserver b/unix/vncserver
index 64d10c5b..093d9acd 100755
--- a/unix/vncserver
+++ b/unix/vncserver
@@ -53,6 +53,7 @@ $vncJavaFiles = (((-d "$vncClasses") && "$vncClasses") ||
((-d "/usr/local/vnc/classes") && "/usr/local/vnc/classes"));
$vncUserDir = "$ENV{HOME}/.vnc";
+$skipxstartup = 0;
$xauthorityFile = "$ENV{XAUTHORITY}" || "$ENV{HOME}/.Xauthority";
$defaultXStartup
@@ -122,7 +123,7 @@ if ($fontPath eq "") {
# Check command line options
&ParseOptions("-geometry",1,"-depth",1,"-pixelformat",1,"-name",1,"-kill",1,
- "-help",0,"-h",0,"--help",0,"-fp",1,"-list",0,"-fg",0,"-autokill",0);
+ "-help",0,"-h",0,"--help",0,"-fp",1,"-list",0,"-fg",0,"-autokill",0,"-noxstartup",0);
&Usage() if ($opt{'-help'} || $opt{'-h'} || $opt{'--help'});
@@ -144,6 +145,9 @@ if ($opt{'-depth'}) {
if ($opt{'-pixelformat'}) {
$pixelformat = $opt{'-pixelformat'};
}
+if ($opt{'-noxstartup'}) {
+ $skipxstartup = 1;
+}
if ($opt{'-fp'}) {
$fontPath = $opt{'-fp'};
$fpArgSpecified = 1;
@@ -313,17 +317,21 @@ warn "\nNew '$desktopName' desktop is $host:$displayNumber\n\n";
# Create the user's xstartup script if necessary.
-if (!(-e "$vncUserDir/xstartup")) {
- warn "Creating default startup script $vncUserDir/xstartup\n";
- open(XSTARTUP, ">$vncUserDir/xstartup");
- print XSTARTUP $defaultXStartup;
- close(XSTARTUP);
- chmod 0755, "$vncUserDir/xstartup";
+if (! $skipxstartup) {
+ if (!(-e "$vncUserDir/xstartup")) {
+ warn "Creating default startup script $vncUserDir/xstartup\n";
+ open(XSTARTUP, ">$vncUserDir/xstartup");
+ print XSTARTUP $defaultXStartup;
+ close(XSTARTUP);
+ chmod 0755, "$vncUserDir/xstartup";
+ }
}
# Run the X startup script.
-warn "Starting applications specified in $vncUserDir/xstartup\n";
+if (! $skipxstartup) {
+ warn "Starting applications specified in $vncUserDir/xstartup\n";
+}
warn "Log file is $desktopLog\n\n";
# If the unix domain socket exists then use that (DISPLAY=:n) otherwise use
@@ -341,18 +349,24 @@ $ENV{VNCDESKTOP}= $desktopName;
system($exedir."vncconfig -nowin >> " . &quotedString($desktopLog) . " 2>&1 &");
if ($opt{'-fg'}) {
- system("$vncUserDir/xstartup >> " . &quotedString($desktopLog) . " 2>&1");
+ if (! $skipxstartup) {
+ system("$vncUserDir/xstartup >> " . &quotedString($desktopLog) . " 2>&1");
+ }
if (kill 0, `cat $pidFile`) {
$opt{'-kill'} = ':'.$displayNumber;
&Kill();
}
} else {
if ($opt{'-autokill'}) {
- system("($vncUserDir/xstartup; $0 -kill :$displayNumber) >> "
- . &quotedString($desktopLog) . " 2>&1 &");
+ if (! $skipxstartup) {
+ system("($vncUserDir/xstartup; $0 -kill :$displayNumber) >> "
+ . &quotedString($desktopLog) . " 2>&1 &");
+ }
} else {
- system("$vncUserDir/xstartup >> " . &quotedString($desktopLog)
- . " 2>&1 &");
+ if (! $skipxstartup) {
+ system("$vncUserDir/xstartup >> " . &quotedString($desktopLog)
+ . " 2>&1 &");
+ }
}
}
@@ -569,6 +583,7 @@ sub Usage
" [-fp <font-path>]\n".
" [-fg]\n".
" [-autokill]\n".
+ " [-noxstartup]\n".
" <Xvnc-options>...\n\n".
" $prog -kill <X-display>\n\n".
" $prog -list\n\n");