vncserver: YAML config spike

This commit is contained in:
Dmitry Maksyoma 2021-10-28 22:02:50 +13:00
parent aefbb4d143
commit bc2e2512e3
6 changed files with 73 additions and 3 deletions

View File

@ -37,6 +37,7 @@ RUN yum install -y epel-release && yum groupinstall xfce -y
RUN yum erase -y pm-utils xscreensaver*
RUN yum install -y redhat-lsb-core
RUN yum install -y vim less
RUN yum localinstall -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc

View File

@ -7,7 +7,7 @@ License: GPLv2+
URL: https://github.com/kasmtech/KasmVNC
BuildRequires: rsync
Requires: xorg-x11-xauth, xorg-x11-xkb-utils, xkeyboard-config, xorg-x11-server-utils, openssl, perl, perl-Switch
Requires: xorg-x11-xauth, xorg-x11-xkb-utils, xkeyboard-config, xorg-x11-server-utils, openssl, perl, perl-Switch, rpmfusion-free-release, perl-Hash-Merge-Simple
Conflicts: tigervnc-server, tigervnc-server-minimal
%description
@ -48,11 +48,12 @@ DESTDIR=$RPM_BUILD_ROOT
DST_MAN=$DESTDIR/usr/share/man/man1
mkdir -p $DESTDIR/usr/bin $DESTDIR/usr/share/man/man1 \
$DESTDIR/usr/share/doc/kasmvncserver
$DESTDIR/usr/share/doc/kasmvncserver $DESTDIR/usr/lib
cp $SRC_BIN/Xvnc $DESTDIR/usr/bin;
cp $SRC_BIN/vncserver $DESTDIR/usr/bin;
cp $SRC_BIN/vncconfig $DESTDIR/usr/bin;
cp $SRC_BIN/kasmvncpasswd $DESTDIR/usr/bin;
cp -r $SRC/lib/kasmvnc/ $DESTDIR/usr/lib/kasmvncserver
cd $DESTDIR/usr/bin && ln -s kasmvncpasswd vncpasswd;
cp -r $SRC/share/doc/kasmvnc*/* $DESTDIR/usr/share/doc/kasmvncserver/
rsync -r --exclude '.git*' --exclude po2js --exclude xgettext-html \
@ -66,6 +67,7 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1;
%files
/usr/bin/*
/usr/lib/kasmvncserver
/usr/share/man/man1/*
/usr/share/kasmvnc/www

3
debian/control vendored
View File

@ -12,7 +12,8 @@ Homepage: https://github.com/kasmtech/KasmVNC
Package: kasmvncserver
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, ssl-cert, xauth,
x11-xkb-utils, xkb-data, procps, libswitch-perl
x11-xkb-utils, xkb-data, procps, libswitch-perl, libyaml-tiny-perl,
libhash-merge-simple-perl
Provides: vnc-server
Description: VNC server accessible from a web browser
VNC stands for Virtual Network Computing. It is, in essence, a remote

View File

@ -29,6 +29,9 @@ use v5.10;
use Time::HiRes qw (sleep);
use Switch;
use File::Basename;
use YAML::Tiny;
use Hash::Merge::Simple;
use constant {
NO_ARG_VALUE => 0,
@ -39,6 +42,8 @@ use constant {
CheckWeCanRunInThisEnvironment();
DefineFilePathsAndStuff();
LoadYAMLConfig();
exit;
ParseAndProcessCliOptions();
@ -1081,6 +1086,8 @@ sub DefineFilePathsAndStuff {
$de_was_selected_file="$ENV{HOME}/.vnc/.de-was-selected";
$vncSystemConfigDir = "/etc/kasmvnc";
$vncDefaultsConfig = "/src/unix/vncserver_defaults.yaml";
$vncSystemConfig = "/src/unix/vncserver.yaml";
$vncSystemConfigDefaultsFile = "$vncSystemConfigDir/vncserver-config-defaults";
$vncSystemConfigMandatoryFile = "$vncSystemConfigDir/vncserver-config-mandatory";
$defaultWebsocketPort = 8443;
@ -1245,3 +1252,12 @@ sub LocalSelectDePath {
my $dirname = dirname($0);
"$dirname/../builder/startup/deb/select-de.sh";
}
sub LoadYAMLConfig {
my $defaultsConfig = YAML::Tiny->read($vncDefaultsConfig)->[0];
my $systemConfig = YAML::Tiny->read($vncSystemConfig)->[0];
my %mergedConfig = %{ Hash::Merge::Simple::merge($defaultsConfig, $systemConfig) };
say $mergedConfig{framerate};
say $mergedConfig{dlp}{region}{x1};
}

25
unix/vncserver.yaml Normal file
View File

@ -0,0 +1,25 @@
---
# geometry: 1024x768
# interface: 192.168.0.1
framerate: 40
# dynamic_quality:
# min: 7
# max: 8
# treat_lossless: 10
# prefer_bandwidth: true
# max_video_resolution:
# width: 640
# height: 480
dlp:
region:
x1: 11
y1: 11
allow_click: false
# clipboard:
# send_max: 10000
# accept_max: 10000
# delay: 1000
# keyboard:
# ratelimit: 30
# logging:
# level: verbose

View File

@ -0,0 +1,25 @@
---
geometry: 1024x768
interface: 192.168.0.1
framerate: 30
dynamic_quality:
min: 7
max: 8
treat_lossless: 10
prefer_bandwidth: true
max_video_resolution:
width: 640
height: 480
dlp:
region:
x1: 10
y1: 10
allow_click: false
clipboard:
send_max: 10000
accept_max: 10000
delay: 1000
keyboard:
ratelimit: 30
logging:
level: verbose