vncserver: refactor

This commit is contained in:
Dmitry Maksyoma 2021-07-31 00:02:01 +12:00
parent a3b9a96df7
commit f903fd6c9d

View File

@ -50,32 +50,6 @@ $skipxstartup = 0;
$xauthorityFile = "$ENV{XAUTHORITY}" || "$ENV{HOME}/.Xauthority";
$xstartupFile = $vncUserDir . "/xstartup";
$defaultXStartup
= ("#!/bin/sh\n\n".
"unset SESSION_MANAGER\n".
"unset DBUS_SESSION_BUS_ADDRESS\n".
"OS=`uname -s`\n".
"if [ \$OS = 'Linux' ]; then\n".
" case \"\$WINDOWMANAGER\" in\n".
" \*gnome\*)\n".
" if [ -e /etc/SuSE-release ]; then\n".
" PATH=\$PATH:/opt/gnome/bin\n".
" export PATH\n".
" fi\n".
" ;;\n".
" esac\n".
"fi\n".
"if [ -x /etc/X11/xinit/xinitrc ]; then\n".
" exec /etc/X11/xinit/xinitrc\n".
"fi\n".
"if [ -f /etc/X11/xinit/xinitrc ]; then\n".
" exec sh /etc/X11/xinit/xinitrc\n".
"fi\n".
"[ -r \$HOME/.Xresources ] && xrdb \$HOME/.Xresources\n".
"xsetroot -solid grey\n".
"xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n".
"twm\n");
$defaultConfig
= ("## Supported server options to pass to vncserver upon invocation can be listed\n".
"## in this file. See the following manpages for more: vncserver(1) Xvnc(1).\n".
@ -875,6 +849,32 @@ sub CreateXstartup
return;
}
my $defaultXStartup
= ("#!/bin/sh\n\n".
"unset SESSION_MANAGER\n".
"unset DBUS_SESSION_BUS_ADDRESS\n".
"OS=`uname -s`\n".
"if [ \$OS = 'Linux' ]; then\n".
" case \"\$WINDOWMANAGER\" in\n".
" \*gnome\*)\n".
" if [ -e /etc/SuSE-release ]; then\n".
" PATH=\$PATH:/opt/gnome/bin\n".
" export PATH\n".
" fi\n".
" ;;\n".
" esac\n".
"fi\n".
"if [ -x /etc/X11/xinit/xinitrc ]; then\n".
" exec /etc/X11/xinit/xinitrc\n".
"fi\n".
"if [ -f /etc/X11/xinit/xinitrc ]; then\n".
" exec sh /etc/X11/xinit/xinitrc\n".
"fi\n".
"[ -r \$HOME/.Xresources ] && xrdb \$HOME/.Xresources\n".
"xsetroot -solid grey\n".
"xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n".
"twm\n");
warn "Creating default startup script $xstartupFile\n";
open(XSTARTUP, ">$xstartupFile");
print XSTARTUP $defaultXStartup;