Compare commits

..

212 Commits

Author SHA1 Message Date
Dmitry Maksyoma
0a81e4be72 vncserver: fix case of -websocketPort not specified 2021-10-30 00:53:46 +13:00
Dmitry Maksyoma
1bc53710c7 Deb/Rpm: set package versions to 0.9.3~beta 2021-10-29 19:33:06 +13:00
Dmitry Maksyoma
991e839408 Refactor vnc_startup.sh 2021-10-29 19:04:31 +13:00
Dmitry Maksyoma
b682457093 vnc_startup.sh: select XFCE by default 2021-10-29 18:59:12 +13:00
Dmitry Maksyoma
4d34a083be vnc_startup.sh: remove temporary hack 2021-10-29 18:57:27 +13:00
Dmitry Maksyoma
54cfcccd1b vncserver test image: Python specs require a newer Python
Newer Python is available in Ubuntu Focal.
2021-10-29 18:39:43 +13:00
Dmitry Maksyoma
923b05803e Don't check www.x.org certificate for now (wget) 2021-10-29 18:32:29 +13:00
Dmitry Maksyoma
0844c10674 vncserver: fix -websocketPort being ignored 2021-10-29 18:31:50 +13:00
Dmitry Maksyoma
991bf3c773 vncserver: CentOS support 2021-10-28 23:03:10 +13:00
Dmitry Maksyoma
9a82b7debe vncserver: fix -debug 2021-10-28 23:02:41 +13:00
Dmitry Maksyoma
c2d18f3829 vncserver: fix display :0 being ignored on CLI 2021-10-28 22:56:32 +13:00
Dmitry Maksyoma
3e843eea8d vncserver: fix heredoc to work on CentOS 2021-10-28 22:55:56 +13:00
Dmitry Maksyoma
aefbb4d143 vncserver: update comment 2021-10-14 22:04:28 +13:00
Dmitry Maksyoma
b34fe08786 vncserver refactor: use standard way of calling functions
For somebody coming from Python/Ruby/JavaScript, foo() is easier to
understand than &foo. Also, less noise.
2021-10-14 21:47:26 +13:00
Dmitry Maksyoma
ee3b7f9aa5 vncserver: add easy -debug option to pass -log to Xvnc 2021-10-13 22:45:47 +13:00
Dmitry Maksyoma
f7254e9708 vncserver: fix -select-de 2021-10-13 22:38:40 +13:00
Dmitry Maksyoma
e3a41bc055 vncserver: use IP when printing browser url 2021-10-09 18:59:53 +13:00
Dmitry Maksyoma
1bda8ab452 Specs: add comments 2021-10-06 23:56:34 +13:00
Dmitry Maksyoma
02ef620f67 vncserver: print browser url to connect to
Add 0.0.0.0 as default interface. Xvnc fails if -interface isn't passed.
2021-10-06 23:44:35 +13:00
Dmitry Maksyoma
e453c7d73b vncserver: swallow -interface and pass through to Xvnc 2021-10-04 22:52:59 +13:00
Dmitry Maksyoma
ca42870585 Specs: refactor 2021-09-21 22:27:15 +12:00
Dmitry Maksyoma
0b53e9f0a6 Specs: extract start_xvnc_pexpect() 2021-09-21 22:15:00 +12:00
Dmitry Maksyoma
3f69b7bd33 Specs: extract clean_kasm_users() 2021-09-21 22:13:34 +12:00
Dmitry Maksyoma
4cb75459ed Specs: run vncserver with debug on 2021-09-21 21:45:28 +12:00
Dmitry Maksyoma
8a424a0463 Update README 2021-09-19 00:32:22 +12:00
Dmitry Maksyoma
a9d85aa99b Update README 2021-09-19 00:29:15 +12:00
Dmitry Maksyoma
cca1dabb71 Update README 2021-09-19 00:25:28 +12:00
Dmitry Maksyoma
183917d046 Update README 2021-09-19 00:14:30 +12:00
Dmitry Maksyoma
a31601de9a Update README 2021-09-18 23:24:29 +12:00
Dmitry Maksyoma
e21366cc7b Update README 2021-09-18 23:02:37 +12:00
Dmitry Maksyoma
76a5b18748 vncserver: remove obsolete code 2021-09-18 22:56:19 +12:00
Dmitry Maksyoma
04379056af vncserver: refactor 2021-09-18 22:50:49 +12:00
Dmitry Maksyoma
49908e1867 vncserver: detect select-de.sh location 2021-09-18 22:46:01 +12:00
Dmitry Maksyoma
df4a5ac910 Put select-de.sh in /usr/lib 2021-09-18 22:45:23 +12:00
Dmitry Maksyoma
606075ddc0 vncserver: refactor 2021-09-18 22:31:32 +12:00
Dmitry Maksyoma
17fa6911c1 vncserver: extract IsDebian() 2021-09-18 22:30:34 +12:00
Dmitry Maksyoma
5f7d3ad43a Specs: pexpect starts Xvnc now 2021-09-18 22:09:50 +12:00
Dmitry Maksyoma
f857d47ccf vncserver: fix generated xstartup indentation 2021-09-17 06:09:33 +12:00
Dmitry Maksyoma
3b3c8d0881 vncserver: refactor 2021-09-17 03:39:40 +12:00
Dmitry Maksyoma
fe3569c6e8 vncserver: check user is in ssl-cert group on Debian-based distros 2021-09-16 22:57:35 +12:00
Dmitry Maksyoma
90d9cbe65b Specs: WIP 2021-09-16 22:25:11 +12:00
Dmitry Maksyoma
f0e63b2e3d Specs: require Python 3.8 2021-09-16 22:23:55 +12:00
Dmitry Maksyoma
b5eaf71248 Specs: unfocus tests 2021-09-16 19:23:17 +12:00
Dmitry Maksyoma
e643cf4115 Specs: improve test 2021-09-16 18:38:09 +12:00
Dmitry Maksyoma
df35fadc9b Specs: test specifying custom user name for guided user creation 2021-09-16 18:37:08 +12:00
Dmitry Maksyoma
a27ad89677 Spec: add user creation test 2021-09-16 18:33:17 +12:00
Dmitry Maksyoma
04e93956b5 vncserver test image: add strace 2021-09-16 18:32:32 +12:00
Dmitry Maksyoma
5de1b80ca7 Spec refactoring 2021-09-16 17:16:55 +12:00
Dmitry Maksyoma
d3e209c9ba vncserver test image based on Ubuntu Focal 2021-09-16 17:13:54 +12:00
Dmitry Maksyoma
ff8ab63aab Spec: extract start_xvnc(), kill only if running 2021-09-15 19:20:05 +12:00
Dmitry Maksyoma
a51444257a Spec: no overwrite is possible on the first run 2021-09-15 18:51:07 +12:00
Dmitry Maksyoma
e23e5cc63b Spec refactoring 2021-09-15 18:48:22 +12:00
Dmitry Maksyoma
043438e2e0 Spec: vncserver 2nd run tests 2021-09-15 18:47:08 +12:00
Dmitry Maksyoma
8152596519 Spec refactoring 2021-09-15 18:39:39 +12:00
Dmitry Maksyoma
fe2bd6c6d6 Specs: extract select_de() 2021-09-15 18:16:27 +12:00
Dmitry Maksyoma
5d0e8b1b03 Spec refactoring 2021-09-15 18:15:42 +12:00
Dmitry Maksyoma
9faf87389f vncserver: no xstartup overwrite confirmation if it doesn't exist 2021-09-15 18:01:47 +12:00
Dmitry Maksyoma
ec948ab20f Spec refactoring 2021-09-15 17:56:28 +12:00
Dmitry Maksyoma
2fa381a3fe Spec add "first run" test 2021-09-15 17:55:48 +12:00
Dmitry Maksyoma
9161015aca Spec refactoring 2021-09-15 17:47:28 +12:00
Dmitry Maksyoma
3fe52a84ba Spec refactoring 2021-09-15 17:39:35 +12:00
Dmitry Maksyoma
0c26c4cb85 Specs: fix file/dir removal 2021-09-15 17:39:15 +12:00
Dmitry Maksyoma
177da18fc8 vncserver: update Bionic image 2021-09-15 17:22:38 +12:00
Dmitry Maksyoma
0b495fd3f9 Specs: clean environment before each test 2021-09-14 20:40:57 +12:00
Dmitry Maksyoma
0011fa6afd Specs: extract check_de_was_setup_to_run() 2021-09-14 20:24:37 +12:00
Dmitry Maksyoma
ed78c9dcc5 Specs: extract kill_xvnc() 2021-09-14 20:20:55 +12:00
Dmitry Maksyoma
dca392eafd Specs: extract add_kasmvnc_user_docker() 2021-09-14 20:19:06 +12:00
Dmitry Maksyoma
28c06893e3 Specs: add -select-de test spike 2021-09-14 20:16:44 +12:00
Dmitry Maksyoma
0f23baa647 Specs: run_cmd() add **kwargs 2021-09-14 20:12:27 +12:00
Dmitry Maksyoma
d1f0d6f7e7 Spec refactoring 2021-09-14 19:27:53 +12:00
Dmitry Maksyoma
d522457723 Add spec runner 2021-09-14 19:10:33 +12:00
Dmitry Maksyoma
d8bbb9884d vncserver: spec creates password file 2021-09-10 23:35:47 +12:00
Dmitry Maksyoma
7cb1ea9ebc vncserver: Python spec spike 2021-09-10 23:15:32 +12:00
Dmitry Maksyoma
dbd54fe35c vncserver: add -select-de 2021-09-10 22:31:48 +12:00
Dmitry Maksyoma
6287114cbf Merge branch 'master' into KASM-1609_select_de_to_run 2021-09-10 03:22:29 +12:00
Dmitry Maksyoma
f999acc490 vncserver: extract ForgetSelectedDe() 2021-09-09 20:46:49 +12:00
Dmitry Maksyoma
71c420fc86 Deb/Rpm: add Perl Switch dependency 2021-09-09 20:45:56 +12:00
Dmitry Maksyoma
f766c3a8c0 Fix test-vncserver 2021-09-09 20:26:53 +12:00
Dmitry Maksyoma
c96d38bbe5 select-de.sh: refactor 2021-09-09 20:26:22 +12:00
Dmitry Maksyoma
c2a5876127 select-de.sh: use exec with XFCE 2021-09-09 20:24:30 +12:00
Dmitry Maksyoma
64c190e2bb select-de.sh: fix -s <DE> 2021-09-09 20:22:41 +12:00
Dmitry Maksyoma
4ed2c57ce3 select-de.sh: fix MATE DE 2021-09-09 20:08:11 +12:00
Dmitry Maksyoma
3a528b94e6 select-de.sh: -s supports mangled DE names like CiNnAmOn 2021-09-09 00:31:43 +12:00
Dmitry Maksyoma
fbdda196b8 select-de.sh: make -s <DE> work 2021-09-09 00:31:05 +12:00
Dmitry Maksyoma
75b42e4f3f select-de.sh: assume -y if -s <DE> was given 2021-09-09 00:25:21 +12:00
Dmitry Maksyoma
003958dd9f select-de.sh: fix -s 2021-09-09 00:21:25 +12:00
Dmitry Maksyoma
69a9ba66cd vncserver test env: install MATE 2021-09-09 00:20:23 +12:00
Dmitry Maksyoma
279e91dcb1 select-de.sh: add -y, --assume-yes option 2021-09-08 23:51:53 +12:00
Dmitry Maksyoma
91eb953f62 Feature/kasm 1838 libjpeg turbo from source (#49)
New build option with latest stable libjpeg-turbo library
2021-09-07 08:11:21 -04:00
Dmitry Maksyoma
102d9b9a6c Merge branch 'master' into KASM-1609_select_de_to_run 2021-08-20 22:46:08 +12:00
Dmitry Maksyoma
3eb1ffd94b vncserver: -select-de spike 2021-08-20 22:35:12 +12:00
Dmitry Maksyoma
551f292144 vncserver: CLI optional option arg support (-select-de=[DE]) 2021-08-20 22:33:34 +12:00
Dmitry Maksyoma
36ffbe1572 test-vncserver: ns alias for netstat -nltp 2021-08-20 22:27:30 +12:00
Dmitry Maksyoma
c775f7198b select-de.sh: process --select-de with arg spike 2021-08-20 22:26:50 +12:00
Dmitry Maksyoma
0fa98100f8 select-de.sh: process --select-de spike 2021-08-19 21:47:23 +12:00
Dmitry Maksyoma
b0ffc6a27e vncserver: use unique -websocketPort for each display 2021-08-18 23:51:47 +12:00
Dmitry Maksyoma
fa7b3492da test-vncserver: export port for display :2 2021-08-18 23:49:05 +12:00
Dmitry Maksyoma
4a4e1d65b8 vncserver: Dockerfile and script for testing 2021-08-18 23:39:29 +12:00
Dmitry Maksyoma
cb08058d34 vncserver: print empty line before guided user creation 2021-08-18 23:34:26 +12:00
Dmitry Maksyoma
b4612d548f Merge branch 'master' into KASM-1609_select_de_to_run 2021-08-17 00:06:36 +12:00
Dmitry Maksyoma
d0fe229684 vncserver: refactor 2021-08-16 23:17:51 +12:00
Dmitry Maksyoma
ded3840f6b vncserver: extract PrintLogFilenameAndConfiguredUsersAndStuff() 2021-08-13 19:17:44 +12:00
Dmitry Maksyoma
c6f7d2eff0 vncserver: refactor 2021-08-13 19:17:30 +12:00
Dmitry Maksyoma
7e854294a2 vncserver: refactor 2021-08-13 19:06:24 +12:00
Dmitry Maksyoma
5635096978 vncserver: refactor 2021-08-13 19:02:25 +12:00
Dmitry Maksyoma
34565c5950 vncserver: extract AllowXProgramsToConnectToXvnc() 2021-08-13 19:00:35 +12:00
Dmitry Maksyoma
3522000d1f vncserver: extract PrepareLoggingAndXvncKillingFramework() 2021-08-13 18:49:01 +12:00
Dmitry Maksyoma
3f23bddb6b vncserver: refactor 2021-08-13 18:43:08 +12:00
Dmitry Maksyoma
b350557afd vncserver: refactor 2021-08-13 18:32:02 +12:00
Dmitry Maksyoma
7dc12ccb8a vncserver: refactor 2021-08-13 18:27:46 +12:00
Dmitry Maksyoma
f187aa9540 vncserver: remove obsolete code 2021-08-13 18:26:22 +12:00
Dmitry Maksyoma
79a21347f1 vncserver: extract DefineLogAndPidFilesForDisplayNumber() 2021-08-13 18:17:44 +12:00
Dmitry Maksyoma
0c1423f0b1 vncserver: remove obsolete code 2021-08-13 18:09:05 +12:00
Dmitry Maksyoma
1e21e09754 vncserver: remove obsolete code 2021-08-13 18:02:35 +12:00
Dmitry Maksyoma
6e0d272946 vncserver: enable "say" 2021-08-13 17:57:32 +12:00
Dmitry Maksyoma
c64e83732d vncserver: fix indentation 2021-08-13 01:24:39 +12:00
Dmitry Maksyoma
acb9793841 vncserver: refactor 2021-08-13 01:18:09 +12:00
Dmitry Maksyoma
9a6ea64e0f vncserver: refactor 2021-08-13 00:24:30 +12:00
Dmitry Maksyoma
68554d84d6 vncserver: refactor 2021-08-13 00:16:32 +12:00
Dmitry Maksyoma
ac51bd1d57 vncserver: refactor 2021-08-13 00:10:40 +12:00
Dmitry Maksyoma
3ef297a7cd vncserver: refactor 2021-08-13 00:07:59 +12:00
Dmitry Maksyoma
0ca46888a0 vncserver: replace -kill sleep with a faster busyloop 2021-08-12 23:33:57 +12:00
Dmitry Maksyoma
8ca36e349e vncserver: extract StartXvncOrExit() 2021-08-10 22:21:52 +12:00
Dmitry Maksyoma
cc90fe9ff6 vncserver: slice start time from 3 seconds to ~170ms 2021-08-10 22:18:31 +12:00
Dmitry Maksyoma
2b4f01f5ae vncserver: extract EnsureAtLeastOneKasmUserExists() 2021-08-10 21:45:41 +12:00
Dmitry Maksyoma
65f957695e vncserver: extract DeleteLogLeftFromPreviousXvncRun() 2021-08-10 21:32:13 +12:00
Dmitry Maksyoma
06e9e92ee1 vncserver: refactor 2021-08-10 21:19:07 +12:00
Dmitry Maksyoma
13f4ce0fba vncserver: refactor 2021-08-10 21:11:51 +12:00
Dmitry Maksyoma
349a33e402 vncserver: refactor 2021-08-10 20:59:50 +12:00
Dmitry Maksyoma
a44241971e vncserver: extract PrepareDefaultsForPassingToXvnc() 2021-08-09 23:38:20 +12:00
Dmitry Maksyoma
b26a20d44d vncserver: refactor 2021-08-09 23:28:52 +12:00
Dmitry Maksyoma
f15aae2db8 vncserver: refactor 2021-08-09 23:26:16 +12:00
Dmitry Maksyoma
895f8bc10d vncserver: refactor 2021-08-09 23:24:30 +12:00
Dmitry Maksyoma
649868241c vncserver: refactor 2021-08-09 23:24:10 +12:00
Dmitry Maksyoma
8a3cf76f82 vncserver: refactor 2021-08-09 23:02:17 +12:00
Dmitry Maksyoma
cfac63aec5 vncserver: refactor 2021-08-09 23:00:51 +12:00
Dmitry Maksyoma
59f990b372 vncserver: extract ParseAndProcessCliOptions() 2021-08-09 22:57:56 +12:00
Dmitry Maksyoma
aa5fd48852 vncserver: extract SetGlobalVariables() 2021-08-09 22:53:42 +12:00
Dmitry Maksyoma
a2a748a582 vncserver: extract DetectEnvironment() 2021-08-09 22:48:00 +12:00
Dmitry Maksyoma
5f3fcddcde vncserver: refactor 2021-08-09 22:42:21 +12:00
Dmitry Maksyoma
fa4308c542 vncserver: print user permissions 2021-08-06 22:25:09 +12:00
Dmitry Maksyoma
db2901e673 vncserver: print configured Kasm users 2021-08-06 22:08:58 +12:00
Dmitry Maksyoma
a0f09dea15 vncserver: refactor 2021-08-06 22:00:26 +12:00
Dmitry Maksyoma
21b42e462b vncserver: extract CheckCliOptionsForBeingValid() 2021-08-06 21:27:06 +12:00
Dmitry Maksyoma
27f7f823fe vncserver: fix DISPLAY detection 2021-08-06 00:08:48 +12:00
Dmitry Maksyoma
93d2c6c716 vncserver: guide user to create a KasmVNC user 2021-08-05 18:40:22 +12:00
Dmitry Maksyoma
fa342f624f vncserver: extract AtLeastOneUserConfigured() 2021-08-03 20:32:09 +12:00
Dmitry Maksyoma
a6e9f94e27 vncserver: load .kasmpasswd users 2021-08-03 00:16:16 +12:00
Dmitry Maksyoma
ffb88ee8e6 vncserver: extract $kasmPasswdFile 2021-08-02 23:48:05 +12:00
Dmitry Maksyoma
c99d82fd8b vncserver: refactor 2021-08-02 23:38:00 +12:00
Dmitry Maksyoma
69a2f9a13b vncserver: extract CreateUserConfigIfNeeded() 2021-08-02 23:26:17 +12:00
Dmitry Maksyoma
08ede14dfe vncserver: refactor 2021-08-02 23:23:31 +12:00
Dmitry Maksyoma
79c9c7157b vncserver: remove obsolete comment 2021-08-02 23:20:24 +12:00
Dmitry Maksyoma
8f58d9bc92 vncserver: split IfXvncDidntStartTryFixingFontPathAndStartXvncAgain() 2021-08-02 23:19:36 +12:00
Dmitry Maksyoma
7ee1522143 vncserver: extract WaitForXvncToStart() 2021-08-02 23:05:29 +12:00
Dmitry Maksyoma
df5d3e506d vncserver: extract WarnUserXvncNotStartedAndExit() 2021-08-02 00:27:11 +12:00
Dmitry Maksyoma
7954cc506c vncserver: extract IsXvncRunning() 2021-08-01 22:46:12 +12:00
Dmitry Maksyoma
84764bac80 vncserver: refactor 2021-08-01 22:37:43 +12:00
Dmitry Maksyoma
bc54f75226 vncserver: extract IfXvncDidntStartTryFixingFontPathAndStartXvncAgain() 2021-08-01 22:36:58 +12:00
Dmitry Maksyoma
42eadfe784 vncserver: convert tabs -> spaces 2021-08-01 22:27:35 +12:00
Dmitry Maksyoma
1bea4d0a41 vncserver: extract StartXAndRecordPID() 2021-08-01 22:23:51 +12:00
Dmitry Maksyoma
6181c249d7 vncserver: extract ConstructXvncCmd() 2021-08-01 21:57:36 +12:00
Dmitry Maksyoma
4a63e93582 vncserver: extract SetupXauthorityFile() and others 2021-08-01 21:36:55 +12:00
Dmitry Maksyoma
f6667e99be vncserver: remove obsolete code 2021-08-01 21:11:43 +12:00
Dmitry Maksyoma
d6fa4b55d7 vncserver: extract DisableVncAuth() 2021-08-01 21:11:19 +12:00
Dmitry Maksyoma
dc1850f1e7 vncserver: remove obsolete code 2021-08-01 21:07:54 +12:00
Dmitry Maksyoma
a6b3eb1f24 vncserver: extract LoadSystemThenUserThenMandatoryConfigs() 2021-08-01 21:04:19 +12:00
Dmitry Maksyoma
efbf401c8e vncserver: refactor 2021-08-01 20:53:07 +12:00
Dmitry Maksyoma
c79da47c21 vncserver: extract DetectDisplayNumberFromCliArgs() 2021-07-31 01:11:26 +12:00
Dmitry Maksyoma
55525a627b vncserver: fix formatting 2021-07-31 00:39:20 +12:00
Dmitry Maksyoma
c435e6ba7d vncserver: refactor 2021-07-31 00:37:00 +12:00
Dmitry Maksyoma
59d53dbb19 vncserver: extract AskUserToChooseDeOrManualXstartup() 2021-07-31 00:30:21 +12:00
Dmitry Maksyoma
8da1612d4c vncserver: extract CreateDotVncDir() 2021-07-31 00:23:45 +12:00
Dmitry Maksyoma
a560276817 vncserver: extract ProcessCliOptions() 2021-07-31 00:19:37 +12:00
Dmitry Maksyoma
2cb5098060 vncserver: extract DetectFontPath 2021-07-31 00:09:31 +12:00
Dmitry Maksyoma
ed51231b4e vncserver: remove obsolete code 2021-07-31 00:02:42 +12:00
Dmitry Maksyoma
f903fd6c9d vncserver: refactor 2021-07-31 00:02:01 +12:00
Dmitry Maksyoma
a3b9a96df7 vncserver: extract DetectUserName 2021-07-31 00:01:45 +12:00
Dmitry Maksyoma
5811e14b42 vncserver: extract DetectBinariesDir() 2021-07-30 23:55:44 +12:00
Dmitry Maksyoma
fc732f3603 vncserver: refactor 2021-07-30 23:40:51 +12:00
Dmitry Maksyoma
b330856d67 vncserver: improve readability 2021-07-28 22:28:51 +12:00
Dmitry Maksyoma
1165159180 vncserver: extract DetectDisplay() and RunXstartup() 2021-07-28 22:18:59 +12:00
Dmitry Maksyoma
25e761326f vncserver: extract CreateXstartup() 2021-07-28 22:04:56 +12:00
Dmitry Maksyoma
53c545a9ad vncserver: better test env detection 2021-07-28 22:01:45 +12:00
Dmitry Maksyoma
7c28908722 vncserver: ask to choose DE spike 2021-07-25 23:21:05 +12:00
Dmitry Maksyoma
6bdcbc32b1 vncserver: enable local testing
It uses the dir it was ran from to find other binaries. If I run it
locally as unix/vncserver, I want to use /usr/bin for other binaries.
2021-07-25 23:07:29 +12:00
Dmitry Maksyoma
fe736c8a2b Easy start script: split shell code into modules 2021-07-24 14:53:34 +12:00
Dmitry Maksyoma
b13698eb56 Easy start script: code formatting 2021-07-22 01:48:14 +12:00
Dmitry Maksyoma
7941e10b0a Easy start script: document --help in README 2021-07-22 00:27:35 +12:00
Dmitry Maksyoma
fc1aa63a44 Easy start script: use long GNU options -k, --kill, etc 2021-07-22 00:20:34 +12:00
Dmitry Maksyoma
1bd14fe881 Update xstartup modification documentation in README 2021-07-21 23:56:13 +12:00
Dmitry Maksyoma
8deac5cfa7 Easy start script: add -select-de to README 2021-07-21 23:55:26 +12:00
Dmitry Maksyoma
ba942e102e Easy start script: remove obsolete code 2021-07-21 22:48:36 +12:00
Dmitry Maksyoma
c4cc856e56 Revert "vncserver: add magic text to signify that the file can be replaced"
This reverts commit b8fd6a28a4.
2021-07-21 19:20:38 +12:00
Dmitry Maksyoma
7d842fe3d2 Easy start script: warn xstartup will be overwritten 2021-07-21 19:18:07 +12:00
Dmitry Maksyoma
7c4896ac66 Easy start script: refactor 2021-07-21 19:10:49 +12:00
Dmitry Maksyoma
24336b236a Early start script: add -select-de support 2021-07-21 19:08:20 +12:00
Dmitry Maksyoma
8a11d171d5 Easy start script: fail if unsupported option is given 2021-07-21 19:03:30 +12:00
Dmitry Maksyoma
892c285963 Easy start script: refactor and correct option processing 2021-07-21 18:53:24 +12:00
Dmitry Maksyoma
26cc3845b0 Easy start script: sort DEs presented to user 2021-07-19 00:07:20 +12:00
Dmitry Maksyoma
f046e3340c Easy start script: remember DE choice 2021-07-18 23:30:37 +12:00
Dmitry Maksyoma
bd144b71bf Easy start script: add manual xstartup choice 2021-07-18 23:30:13 +12:00
Dmitry Maksyoma
66d999beaf Refactor easy start script 2021-07-18 23:16:03 +12:00
Dmitry Maksyoma
3584d8c3cb Refactor easy start script 2021-07-18 23:05:11 +12:00
Dmitry Maksyoma
f8bcfcc493 Easy start script: add did_user_forbid_replacing_xstartup() 2021-07-18 23:04:36 +12:00
Dmitry Maksyoma
22654f7ab6 Easy start script: handle incorrect DE number selection 2021-07-18 22:20:20 +12:00
Dmitry Maksyoma
33327c1159 Easy start script: can choose DE and run it via xstartup 2021-07-18 01:04:33 +12:00
Dmitry Maksyoma
aeec23bd68 test-deb: add temporary volume of . 2021-07-18 01:03:56 +12:00
Dmitry Maksyoma
34a389f714 Add temporary DE installations to Buster dockerfile 2021-07-18 01:03:00 +12:00
Dmitry Maksyoma
b8fd6a28a4 vncserver: add magic text to signify that the file can be replaced 2021-07-18 01:02:04 +12:00
Dmitry Maksyoma
240b1342fd Easy start script: DE -> Desktop Environment 2021-07-17 18:28:32 +12:00
Dmitry Maksyoma
640a195e3e Easy start script: choose DE to run spike 2021-07-03 18:13:59 +12:00
61 changed files with 2135 additions and 1369 deletions

View File

@@ -1,16 +1,33 @@
#!/bin/bash
is_kasmvnc() {
local package="$1";
echo "$package" | grep -q 'kasmvncserver_'
}
function prepare_upload_filename() {
local package="$1";
if ! is_kasmvnc "$package"; then
export upload_filename="$package"
return
fi
.ci/detect_os_arch_package_format "$package" > /tmp/os_arch_package_format;
source /tmp/os_arch_package_format;
detect_release_branch
detect_revision "$package" "$OS_ARCH"
if [ -n "$REVISION" ]; then
REVISION="_${REVISION}"
fi
if [ -n "$RELEASE_BRANCH" ]; then
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}_${OS_ARCH}.${PACKAGE_FORMAT}";
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}${REVISION}_${OS_ARCH}.${PACKAGE_FORMAT}";
else
export SANITIZED_BRANCH="$(echo $CI_COMMIT_REF_NAME | sed 's/\//_/g')";
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}_${SANITIZED_BRANCH}_${CI_COMMIT_SHA:0:6}_${OS_ARCH}.${PACKAGE_FORMAT}";
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}_${SANITIZED_BRANCH}_${CI_COMMIT_SHA:0:6}${REVISION}_${OS_ARCH}.${PACKAGE_FORMAT}";
fi
};
@@ -25,6 +42,7 @@ function upload_to_s3() {
export BUILD_STATUS="{\"key\":\"doc\", \"state\":\"SUCCESSFUL\", \"name\":\"${upload_filename}\", \"url\":\"${S3_URL}\"}";
curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=build-url&target_url=${S3_URL}";
};
function prepare_to_run_scripts_and_s3_uploads() {
export DEBIAN_FRONTEND=noninteractive;
apt-get update;
@@ -38,3 +56,16 @@ detect_release_branch() {
export RELEASE_BRANCH=1;
fi
}
detect_revision() {
local package="$1"
local arch="$2"
REVISION=
if ! echo "$package" | grep -q '+'; then
return
fi
REVISION=$(echo "$package" | sed "s/_${arch}.\+//" | sed 's/.\++//')
}

View File

@@ -1 +0,0 @@
builder/build

View File

@@ -34,6 +34,18 @@ build_ubuntu_bionic:
paths:
- output/
build_ubuntu_bionic_libjpeg_turbo:
stage: build
before_script:
- *prepare_build
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu bionic +libjpeg-turbo_latest
artifacts:
paths:
- output/
build_ubuntu_focal:
stage: build
before_script:
@@ -103,7 +115,7 @@ upload:
- export S3_BUILD_DIRECTORY="kasmvnc/${CI_COMMIT_SHA}"
- prepare_to_run_scripts_and_s3_uploads
- export RELEASE_VERSION=$(.ci/next_release_version "$CI_COMMIT_REF_NAME")
- for package in `find output/ -type f -name 'kasmvncserver_*.deb' -or -name '*.rpm'`; do
- for package in `find output/ -type f -name '*.deb' -or -name '*.rpm'`; do
prepare_upload_filename "$package";
echo;
echo "File to upload $upload_filename";

15
Pipfile Normal file
View File

@@ -0,0 +1,15 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
mamba = "*"
expects = "*"
"path.py" = "*"
pexpect = "*"
[dev-packages]
[requires]
python_version = "3.8"

136
Pipfile.lock generated Normal file
View File

@@ -0,0 +1,136 @@
{
"_meta": {
"hash": {
"sha256": "6745d5e5d90e44a18d73a0e23bc3d3e68acb950af0b87df50b45272d25b9e615"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.8"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.python.org/simple",
"verify_ssl": true
}
]
},
"default": {
"args": {
"hashes": [
"sha256:a785b8d837625e9b61c39108532d95b85274acd679693b71ebb5156848fcf814"
],
"version": "==0.1.0"
},
"clint": {
"hashes": [
"sha256:05224c32b1075563d0b16d0015faaf9da43aa214e4a2140e51f08789e7a4c5aa"
],
"version": "==0.5.1"
},
"coverage": {
"hashes": [
"sha256:004d1880bed2d97151facef49f08e255a20ceb6f9432df75f4eef018fdd5a78c",
"sha256:01d84219b5cdbfc8122223b39a954820929497a1cb1422824bb86b07b74594b6",
"sha256:040af6c32813fa3eae5305d53f18875bedd079960822ef8ec067a66dd8afcd45",
"sha256:06191eb60f8d8a5bc046f3799f8a07a2d7aefb9504b0209aff0b47298333302a",
"sha256:13034c4409db851670bc9acd836243aeee299949bd5673e11844befcb0149f03",
"sha256:13c4ee887eca0f4c5a247b75398d4114c37882658300e153113dafb1d76de529",
"sha256:184a47bbe0aa6400ed2d41d8e9ed868b8205046518c52464fde713ea06e3a74a",
"sha256:18ba8bbede96a2c3dde7b868de9dcbd55670690af0988713f0603f037848418a",
"sha256:1aa846f56c3d49205c952d8318e76ccc2ae23303351d9270ab220004c580cfe2",
"sha256:217658ec7187497e3f3ebd901afdca1af062b42cfe3e0dafea4cced3983739f6",
"sha256:24d4a7de75446be83244eabbff746d66b9240ae020ced65d060815fac3423759",
"sha256:2910f4d36a6a9b4214bb7038d537f015346f413a975d57ca6b43bf23d6563b53",
"sha256:2949cad1c5208b8298d5686d5a85b66aae46d73eec2c3e08c817dd3513e5848a",
"sha256:2a3859cb82dcbda1cfd3e6f71c27081d18aa251d20a17d87d26d4cd216fb0af4",
"sha256:2cafbbb3af0733db200c9b5f798d18953b1a304d3f86a938367de1567f4b5bff",
"sha256:2e0d881ad471768bf6e6c2bf905d183543f10098e3b3640fc029509530091502",
"sha256:30c77c1dc9f253283e34c27935fded5015f7d1abe83bc7821680ac444eaf7793",
"sha256:3487286bc29a5aa4b93a072e9592f22254291ce96a9fbc5251f566b6b7343cdb",
"sha256:372da284cfd642d8e08ef606917846fa2ee350f64994bebfbd3afb0040436905",
"sha256:41179b8a845742d1eb60449bdb2992196e211341818565abded11cfa90efb821",
"sha256:44d654437b8ddd9eee7d1eaee28b7219bec228520ff809af170488fd2fed3e2b",
"sha256:4a7697d8cb0f27399b0e393c0b90f0f1e40c82023ea4d45d22bce7032a5d7b81",
"sha256:51cb9476a3987c8967ebab3f0fe144819781fca264f57f89760037a2ea191cb0",
"sha256:52596d3d0e8bdf3af43db3e9ba8dcdaac724ba7b5ca3f6358529d56f7a166f8b",
"sha256:53194af30d5bad77fcba80e23a1441c71abfb3e01192034f8246e0d8f99528f3",
"sha256:5fec2d43a2cc6965edc0bb9e83e1e4b557f76f843a77a2496cbe719583ce8184",
"sha256:6c90e11318f0d3c436a42409f2749ee1a115cd8b067d7f14c148f1ce5574d701",
"sha256:74d881fc777ebb11c63736622b60cb9e4aee5cace591ce274fb69e582a12a61a",
"sha256:7501140f755b725495941b43347ba8a2777407fc7f250d4f5a7d2a1050ba8e82",
"sha256:796c9c3c79747146ebd278dbe1e5c5c05dd6b10cc3bcb8389dfdf844f3ead638",
"sha256:869a64f53488f40fa5b5b9dcb9e9b2962a66a87dab37790f3fcfb5144b996ef5",
"sha256:8963a499849a1fc54b35b1c9f162f4108017b2e6db2c46c1bed93a72262ed083",
"sha256:8d0a0725ad7c1a0bcd8d1b437e191107d457e2ec1084b9f190630a4fb1af78e6",
"sha256:900fbf7759501bc7807fd6638c947d7a831fc9fdf742dc10f02956ff7220fa90",
"sha256:92b017ce34b68a7d67bd6d117e6d443a9bf63a2ecf8567bb3d8c6c7bc5014465",
"sha256:970284a88b99673ccb2e4e334cfb38a10aab7cd44f7457564d11898a74b62d0a",
"sha256:972c85d205b51e30e59525694670de6a8a89691186012535f9d7dbaa230e42c3",
"sha256:9a1ef3b66e38ef8618ce5fdc7bea3d9f45f3624e2a66295eea5e57966c85909e",
"sha256:af0e781009aaf59e25c5a678122391cb0f345ac0ec272c7961dc5455e1c40066",
"sha256:b6d534e4b2ab35c9f93f46229363e17f63c53ad01330df9f2d6bd1187e5eaacf",
"sha256:b7895207b4c843c76a25ab8c1e866261bcfe27bfaa20c192de5190121770672b",
"sha256:c0891a6a97b09c1f3e073a890514d5012eb256845c451bd48f7968ef939bf4ae",
"sha256:c2723d347ab06e7ddad1a58b2a821218239249a9e4365eaff6649d31180c1669",
"sha256:d1f8bf7b90ba55699b3a5e44930e93ff0189aa27186e96071fac7dd0d06a1873",
"sha256:d1f9ce122f83b2305592c11d64f181b87153fc2c2bbd3bb4a3dde8303cfb1a6b",
"sha256:d314ed732c25d29775e84a960c3c60808b682c08d86602ec2c3008e1202e3bb6",
"sha256:d636598c8305e1f90b439dbf4f66437de4a5e3c31fdf47ad29542478c8508bbb",
"sha256:deee1077aae10d8fa88cb02c845cfba9b62c55e1183f52f6ae6a2df6a2187160",
"sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c",
"sha256:f030f8873312a16414c0d8e1a1ddff2d3235655a2174e3648b4fa66b3f2f1079",
"sha256:f0b278ce10936db1a37e6954e15a3730bea96a0997c26d7fee88e6c396c2086d",
"sha256:f11642dddbb0253cc8853254301b51390ba0081750a8ac03f20ea8103f0c56b6"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
"version": "==5.5"
},
"expects": {
"hashes": [
"sha256:419902ccafe81b7e9559eeb6b7a07ef9d5c5604eddb93000f0642b3b2d594f4c"
],
"index": "pypi",
"version": "==0.9.0"
},
"mamba": {
"hashes": [
"sha256:75cfc6dfd287dcccaf86dd753cf48e0a7337487c7c3fafda05a6a67ded6da496"
],
"index": "pypi",
"version": "==0.11.2"
},
"path": {
"hashes": [
"sha256:2de925e8d421f93bcea80d511b81accfb6a7e6b249afa4a5559557b0cf817097",
"sha256:340054c5bb459fc9fd40e7eb6768c5989f3e599d18224238465b5333bc8faa7d"
],
"markers": "python_version >= '3.6'",
"version": "==16.2.0"
},
"path.py": {
"hashes": [
"sha256:8d885e8b2497aed005703d94e0fd97943401f035e42a136810308bff034529a8",
"sha256:a43e82eb2c344c3fd0b9d6352f6b856f40b8b7d3d65cc05978b42c3715668496"
],
"index": "pypi",
"version": "==12.5.0"
},
"pexpect": {
"hashes": [
"sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937",
"sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"
],
"index": "pypi",
"version": "==4.8.0"
},
"ptyprocess": {
"hashes": [
"sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35",
"sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"
],
"version": "==0.7.0"
}
},
"develop": {}
}

View File

@@ -44,28 +44,28 @@ Future Goals:
```sh
wget -qO- https://github.com/kasmtech/KasmVNC/releases/download/v0.9.1-beta/kasmvncserver_0.9.1~beta-1_amd64.deb
sudo dpkg -i kasmvncserver_0.9.1~beta-1_amd64.deb
sudo apt-get -f install
# We provide an example script to run KasmVNC at #
# /usr/share/doc/kasmvncserver/examples/kasmvncserver-easy-start. It runs a VNC
# server on display :10 and on interface 0.0.0.0. If you're happy with those
# defaults you can just use it as is:
sudo ln -s /usr/share/doc/kasmvncserver/examples/kasmvncserver-easy-start /usr/bin/
sudo apt-get install ./kasmvncserver_0.9.1~beta-1_amd64.deb
# Add your user to the ssl-cert group
sudo addgroup $USER ssl-cert
# You will need to re-connect in order to pick up the group change
# Create ~/.vnc directory and corresponding files.
kasmvncserver-easy-start -d && kasmvncserver-easy-start -kill
# Run KasmVNC on display :10 and on interface 0.0.0.0:
KASMVNC_OPTIONS=':10 -depth 24 -geometry 1280x1050
-cert /etc/ssl/certs/ssl-cert-snakeoil.pem
-key /etc/ssl/private/ssl-cert-snakeoil.key -sslOnly -FrameRate=24
-interface 0.0.0.0 -httpd /usr/share/kasmvnc/www'
vncserver $KASMVNC_OPTIONS
# Modify vncstartup to launch your environment of choice, in this example LXDE
# This may be optional depending on your system configuration
echo '/usr/bin/lxsession -s LXDE &' >> ~/.vnc/xstartup
# On the first run, vncserver will ask you to create a KasmVNC user and choose a desktop
# environment you want to run. It can detect Cinnamon, Mate, LXDE, KDE, Gnome,
# XFCE. You can also choose to manually edit xstartup.
# After you chose a desktop environment or to manually edit xstartup,
# vncserver won't ask you again, unless you run it as:
vncserver $KASMVNC_OPTIONS -select-de
# Start KasmVNC with debug logging:
kasmvncserver-easy-start -d
# You can select a specific Desktop Environment like this:
vncserver $KASMVNC_OPTIONS -select-de mate
# Tail the logs
tail -f ~/.vnc/`hostname`:10.log
@@ -73,10 +73,10 @@ tail -f ~/.vnc/`hostname`:10.log
Now navigate to your system at https://[ip-address]:8443/
To stop a running KasmVNC:
To stop the KasmVNC you started earlier on display 10:
```sh
kasmvncserver-easy-start -kill
vncserver -kill :10
```
The options for vncserver:

View File

@@ -3,8 +3,17 @@ Docker CE
# Build a deb/rpm package
```
# builder/build-package <os> <os_codename>
# builder/build-package <os> <os_codename> <build_tag>
# os_codename is what "lsb_release -c" outputs, e.g. buster, focal.
#
# build_tag allows building multiple versions of deb package (rpm not supported)
# targeting a single distro release (e.g. Ubuntu Bionic). If build_tag is given,
# the package name will include build_tag as part of Debian revision. For
# example:
# * with build_tag: kasmvncserver_0.9.1~beta-1+libjpeg-turbo-latest_amd64.deb
# * without build_tag: kasmvncserver_0.9.1~beta-1_amd64.deb
# You need to have .build and .deb.build for the build_tag.
#
# Packages will be placed under builder/build/
builder/build-package ubuntu bionic
@@ -70,3 +79,14 @@ packages installed with XFCE.
```
builder/test-deb-barebones ubuntu focal
```
# CI development
S3 upload code is extracted to various files in `.ci`. It's possible to iterate
locally by doing stuff like this:
```
bash -c '
. .ci/upload.sh;
prepare_upload_filename "bionic/kasmvncserver_0.9.1~beta-1+libjpeg-turbo-latest_amd64.deb";
echo $upload_filename;'
```

View File

@@ -5,12 +5,17 @@ set -e
cd "$(dirname "$0")/.."
. builder/os_ver_cli.sh
docker build -t debbuilder_${os}:${os_codename} -f \
builder/dockerfile.${os}_${os_codename}.deb.build .
deb_output_dir=$(cd .. && echo $PWD)
L_UID=$(id -u) #Ubuntu already has UID env var, but this should work on all Linix systems
L_GID=$(id -g)
docker run --rm -v "$deb_output_dir":/src --user $L_UID:$L_GID \
debbuilder_${os}:${os_codename} /bin/bash -c \
builder_image=debbuilder_${os}:${os_codename}${build_tag_for_images}
docker build --build-arg KASMVNC_PACKAGE_DIR="builder/build/${os_codename}" \
--build-arg L_UID="$L_UID" \
-t "$builder_image" -f \
builder/dockerfile.${os}_${os_codename}${build_tag}.deb.build .
deb_output_dir=$(cd .. && echo $PWD)
docker run --rm -v "$deb_output_dir":/src -e BUILD_TAG="$build_tag" \
--user "$L_UID:$L_GID" \
"$builder_image" /bin/bash -c \
'/src/*/builder/build-deb-inside-docker'

View File

@@ -2,12 +2,31 @@
set -e
cd "$(dirname "$0")/.."
prepare_docker_copy_of_debian_dir_and_cd_to_id() {
cd "$(dirname "$0")/.."
local mounted_src_dir="$PWD"
local docker_src_dir="$HOME/src"
mkdir "$docker_src_dir"
cd "$docker_src_dir"
cp -a "$mounted_src_dir/debian/" .
ln -s "$mounted_src_dir/builder" .
}
prepare_docker_copy_of_debian_dir_and_cd_to_id
os=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
os_codename=$(lsb_release -cs)
os_dir="builder/build/${os_codename}"
if [ "$BUILD_TAG" = "+libjpeg-turbo_latest" ]; then
echo 'libjpeg 62 libjpeg-turbo (>= 2.1.1)' > debian/shlibs.local
debian_revision="$(echo $BUILD_TAG | tr _ -)"
sed -i -e "1 s/)/$debian_revision)/" debian/changelog
fi
dpkg-buildpackage -us -uc -b
mkdir -p "$os_dir"
cp ../*.deb "$os_dir"

View File

@@ -4,6 +4,7 @@ set -e
os="$1"
codename="$2"
build_tag="$3"
detect_package_format() {
package_format=rpm
@@ -12,8 +13,17 @@ detect_package_format() {
fi
}
warn_build_tag_not_supported_for_rpm_and_exit() {
if [[ "$build_tag" && "$package_format" = "rpm" ]]; then
echo >&2 "<build_tag> isn't supported for rpm"
exit 1
fi
}
cd "$(dirname "$0")/.."
detect_package_format
builder/build-tarball "$os" "$codename"
builder/build-${package_format} "$os" "$codename"
warn_build_tag_not_supported_for_rpm_and_exit
builder/build-tarball "$os" "$codename" "$build_tag"
builder/build-${package_format} "$os" "$codename" "$build_tag"

View File

@@ -2,8 +2,18 @@
set -e
warn_build_tag_not_supported_for_rpm_and_exit() {
local build_tag="$1"
if [[ -n "$build_tag" ]]; then
echo >&2 "<build_tag> isn't supported for rpm"
exit 1
fi
}
cd "$(dirname "$0")/.."
. builder/os_ver_cli.sh
warn_build_tag_not_supported_for_rpm_and_exit "$build_tag"
docker build -t kasmvnc_rpmbuilder_${os}:${os_codename} -f \
builder/dockerfile.${os}_${os_codename}.rpm.build .

View File

@@ -1,7 +1,6 @@
#!/bin/bash
set -e
set -x
build_www_dir() {
local webpacked_www=$PWD/builder/www
@@ -13,6 +12,13 @@ build_www_dir() {
fi
}
move_libjpeg_turbo_to_os_specific_dir() {
chown $L_UID:$L_GID $shared_with_docker_dir/${os_codename}/*
mkdir -p $PWD/builder/build/${os_codename}/
mv $shared_with_docker_dir/${os_codename}/libjpeg-turbo*.deb \
$PWD/builder/build/${os_codename}/
}
shared_with_docker_dir=${GITLAB_SHARED_DIND_DIR:-/tmp}
cd "$(dirname "$0")/.."
@@ -20,13 +26,21 @@ cd "$(dirname "$0")/.."
build_www_dir
docker build -t kasmvncbuilder:$os_codename \
-f builder/dockerfile.${os}_${os_codename}.build .
builder_image=kasmvncbuilder:$os_codename${build_tag_for_images}
docker build -t "$builder_image" \
-f builder/dockerfile.${os}_${os_codename}${build_tag}.build .
mkdir -p builder/build
docker run -v $shared_with_docker_dir:/build --rm kasmvncbuilder:$os_codename
docker run -v $shared_with_docker_dir:/build -e BUILD_TAG="$build_tag" \
--rm "$builder_image"
L_GID=$(id -g)
L_UID=$(id -u)
tarball_name="kasmvnc.${os}_${os_codename}.tar.gz"
tarball_name_with_build_tag="kasmvnc.${os}_${os_codename}${build_tag}.tar.gz"
chown $L_UID:$L_GID $shared_with_docker_dir/$tarball_name
mv $shared_with_docker_dir/$tarball_name $PWD/builder/build/
mv $shared_with_docker_dir/$tarball_name \
$PWD/builder/build/"$tarball_name_with_build_tag"
if [ "$build_tag" = "+libjpeg-turbo_latest" ]; then
move_libjpeg_turbo_to_os_specific_dir
fi

View File

@@ -1,7 +1,5 @@
#!/bin/sh -e
set -x
detect_quilt() {
if which quilt 1>/dev/null; then
QUILT_PRESENT=1
@@ -19,7 +17,7 @@ cd /tmp
# default to the version of x in Ubuntu 18.04, otherwise caller will need to specify
XORG_VER=${XORG_VER:-"1.19.6"}
XORG_PATCH=$(echo "$XORG_VER" | grep -Po '^\d.\d+' | sed 's#\.##')
wget https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.bz2
wget --no-check-certificate https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.bz2
#git clone https://kasmweb@bitbucket.org/kasmtech/kasmvnc.git
#cd kasmvnc
@@ -82,9 +80,11 @@ cd /src
detect_quilt
if [ -n "$QUILT_PRESENT" ]; then
quilt push -a
echo 'Patches applied!'
fi
make servertarball
cp kasmvnc*.tar.gz /build/kasmvnc.${KASMVNC_BUILD_OS}_${KASMVNC_BUILD_OS_CODENAME}.tar.gz
if [ "$BUILD_TAG" = "+libjpeg-turbo_latest" ]; then
mkdir -p /build/${KASMVNC_BUILD_OS_CODENAME}/
cp /libjpeg-turbo/libjpeg*.deb /build/${KASMVNC_BUILD_OS_CODENAME}/
fi

View File

@@ -10,8 +10,7 @@ RUN yum install -y make
RUN yum group install -y "Development Tools"
RUN yum install -y xorg-x11-server-devel zlib-devel libjpeg-turbo-devel
RUN yum install -y libxkbfile-devel libXfont2-devel xorg-x11-font-utils \
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel libXrandr-devel pam-devel \
gnutls-devel libX11-devel libXtst-devel libXcursor-devel
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel
RUN yum install -y mesa-dri-drivers
# Additions for webp

View File

@@ -13,7 +13,7 @@ RUN apt-get update && \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
RUN apt-get update && apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz

View File

@@ -9,4 +9,11 @@ RUN apt-get update && \
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
USER 1000
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -42,8 +42,8 @@ COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
RUN dpkg -i /tmp/*.deb; apt-get -yf install
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ###

View File

@@ -1,8 +1,8 @@
FROM debian:buster-slim
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
RUN apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
RUN apt-get update && apt-get -y install xterm
COPY startup/deb/kasmvncserver-easy-start /usr/local/bin

View File

@@ -13,7 +13,7 @@ RUN apt-get update && \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
RUN apt-get update && apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz

View File

@@ -9,4 +9,11 @@ RUN apt-get update && \
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
USER 1000
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -34,6 +34,14 @@ RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release
RUN apt-get update && apt-get install -y task-cinnamon-desktop
RUN apt-get update && apt-get install -y task-gnome-desktop
RUN mkdir -p /usr/share/man/man1
RUN apt-get update && apt-get install -y apt-utils openjdk-11-jre
RUN apt-get update && apt-get install -y task-lxde-desktop
RUN apt-get update && apt-get install -y task-mate-desktop
RUN apt-get update && apt-get install -y task-kde-desktop
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
@@ -42,8 +50,8 @@ COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
RUN dpkg -i /tmp/*.deb; apt-get -yf install
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ###

View File

@@ -18,7 +18,7 @@ RUN dnf install -y make
RUN dnf group install -y "Development Tools"
RUN dnf install -y xorg-x11-server-devel zlib-devel libjpeg-turbo-devel
RUN dnf install -y libxkbfile-devel libXfont2-devel xorg-x11-font-utils \
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel libXrandr-devel libXcursor-devel
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel
RUN dnf install -y mesa-dri-drivers
RUN dnf install -y bzip2 redhat-lsb-core

View File

@@ -13,7 +13,7 @@ RUN apt-get update && \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
RUN apt-get update && apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz

View File

@@ -9,4 +9,11 @@ RUN apt-get update && \
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
USER 1000
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -42,8 +42,8 @@ COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
RUN dpkg -i /tmp/*.deb; apt-get -yf install
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ###

View File

@@ -0,0 +1,39 @@
FROM ubuntu:18.04
ENV KASMVNC_BUILD_OS ubuntu
ENV KASMVNC_BUILD_OS_CODENAME bionic
ENV XORG_VER 1.20.10
RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list
RUN apt-get update && \
apt-get -y install sudo
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
RUN apt-get update && apt-get install -y cmake nasm gcc
RUN git clone https://github.com/libjpeg-turbo/libjpeg-turbo.git
RUN export MAKEFLAGS=-j`nproc`; cd libjpeg-turbo && cmake -G"Unix Makefiles" && make deb
RUN export MAKEFLAGS=-j`nproc`; cd libjpeg-turbo && cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G"Unix Makefiles" && make && make install
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
RUN cd /tmp && tar -xzvf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
# Fix for older required libs
#RUN cd /tmp && wget http://launchpadlibrarian.net/347526424/libxfont1-dev_1.5.2-4ubuntu2_amd64.deb && \
# wget http://launchpadlibrarian.net/347526425/libxfont1_1.5.2-4ubuntu2_amd64.deb && \
# dpkg -i libxfont1_1.5.2-4ubuntu2_amd64.deb && \
# dpkg -i libxfont1-dev_1.5.2-4ubuntu2_amd64.deb
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
COPY --chown=docker:docker . /src
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@@ -0,0 +1,23 @@
FROM ubuntu:bionic
RUN apt-get update && \
apt-get -y install vim build-essential devscripts equivs
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/libjpeg-turbo*deb /tmp
RUN apt-get install /tmp/libjpeg-turbo*deb
# Install build-deps for the package.
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
ENV LD_LIBRARY_PATH="/opt/libjpeg-turbo/lib64/:$LD_LIBRARY_PATH"
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -0,0 +1,58 @@
FROM ubuntu:bionic
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib64/:/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=ubuntu \
KASMVNC_BUILD_OS_CODENAME=bionic
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/libjpeg-turbo_*.deb /tmp
RUN apt-get install /tmp/libjpeg-turbo*deb
ARG BUILD_DEBIAN_REVISION
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*$BUILD_DEBIAN_REVISION*.deb /tmp
RUN dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert
WORKDIR $HOME
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -11,7 +11,7 @@ RUN apt-get update && \
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
RUN apt-get update && apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz

View File

@@ -7,4 +7,11 @@ RUN apt-get update && \
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
USER 1000
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -42,8 +42,8 @@ COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
RUN dpkg -i /tmp/*.deb; apt-get -yf install
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ###

View File

@@ -1,8 +1,8 @@
FROM ubuntu:focal
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
RUN apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
RUN apt-get update && apt-get -y install xterm lsb-release
RUN useradd -m foo && addgroup foo ssl-cert

View File

@@ -13,7 +13,7 @@ RUN apt-get update && \
RUN apt-get update && apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
RUN apt-get update && apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz

View File

@@ -9,4 +9,11 @@ RUN apt-get update && \
COPY ./debian/control /tmp
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
USER 1000
ARG L_UID
RUN if [ "$L_UID" -eq 0 ]; then \
useradd -m docker; \
else \
useradd -m docker -u $L_UID;\
fi
USER docker

View File

@@ -42,8 +42,8 @@ COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
RUN dpkg -i /tmp/*.deb; apt-get -yf install
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
RUN mkdir ~/.vnc && echo '/usr/bin/xfce4-session &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup

View File

@@ -0,0 +1,50 @@
FROM ubuntu:focal
ENV DEBIAN_FRONTEND=noninteractive
ENV VNC_PORT 8443
ENV VNC_PORT2 8444
ENV VNC_PORT3 8445
EXPOSE $VNC_PORT
EXPOSE $VNC_PORT2
EXPOSE $VNC_PORT3
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext wget
RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release
RUN apt-get update && apt-get -y install net-tools
# RUN mkdir -p /usr/share/man/man1
# RUN apt-get update && apt-get install -y apt-utils openjdk-11-jre
RUN apt-get update && apt-get install -y ubuntu-mate-desktop
RUN apt-get update && apt-get install -y lxde
RUN apt-get update && apt-get install -y lxqt
RUN apt-get update && apt-get install -y kde-full
RUN apt-get update && apt-get install -y cinnamon
RUN apt-get update && apt-get install -y ubuntu-gnome-desktop
RUN apt-get update && apt-get install -y python3-pip
RUN apt-get update && apt-get install -y strace
RUN useradd -m docker
ENV USER docker
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
RUN dpkg -i /tmp/*.deb; apt-get -yf install
ENV HOME /home/docker
RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert
WORKDIR $HOME
RUN pip3 install --user pipenv
RUN echo 'PATH="/src/unix:~/.local/bin/:$PATH"' >> ~/.bashrc
RUN echo 'alias go="sh /src/s; vncserver -kill :1"' >> ~/.bashrc
RUN echo 'alias ns="netstat -nltp"' >> ~/.bashrc
RUN echo 'alias mamba="pipenv run mamba spec/"' >> ~/.bashrc
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENTRYPOINT ["bash", "-ic", "cd /src && pipenv install; exec bash"]

View File

@@ -3,6 +3,11 @@ default_os_codename=bionic
os=${1:-$default_os}
os_codename=${2:-$default_os_codename}
build_tag="${3:-}"
if [[ -n "$build_tag" ]]; then
build_tag_for_images="_${build_tag#+}"
build_debian_revision="$(echo $build_tag | tr _ -)"
fi
os_image="$os:$os_codename"
echo "Building for $os_image"

View File

@@ -0,0 +1,50 @@
#!/bin/bash
debug() {
if [ -z "$debug" ]; then return; fi
echo "$@"
}
enable_debug() {
debug=1
log_option="-log *:stderr:100"
}
kill_vnc_server() {
vncserver -kill $display
}
process_cli_options() {
for option in "$@"; do
case "$option" in
--help)
show_help
exit
;;
-d|--debug)
enable_debug
;;
-k|--kill)
kill_vnc_server
exit
;;
-s|--select-de)
action=select-de-and-start
;;
*)
echo >&2 "Unsupported argument: $option"
exit 1
esac
done
}
show_help() {
cat >&2 <<-USAGE
Usage: $(basename "$0") [options]
-d, --debug Debug output
-k, --kill Kill vncserver
-s, --select-de Select desktop environent to run
--help Show this help
USAGE
}

View File

@@ -4,43 +4,8 @@ set -e
display=:10
interface=0.0.0.0
cert_group=ssl-cert
if [[ "$1" = "--help" ]]; then
cat >&2 <<-USAGE
Usage: `basename $0` [options]
-d Debug output
-kill Kill vncserver
--help show this help
USAGE
exit
fi
if [[ "$1" = "-d" ]]; then
log_option="-log *:stderr:100"
fi
action=start
if [[ "$1" = "-kill" ]]; then
action=kill
fi
if groups | grep -qvw ssl-cert; then
cat <<-EOF
Can't access TLS certificate.
Please add your user to $cert_group via 'addgroup <user> ssl-cert'
EOF
exit 1
fi
if [[ "$action" = "kill" ]]; then
vncserver -kill $display
exit
fi
vncserver $display -interface $interface
vncserver -kill $display
vncserver $display -depth 24 -geometry 1280x1050 -websocketPort 8443 \
-cert /etc/ssl/certs/ssl-cert-snakeoil.pem \
-key /etc/ssl/private/ssl-cert-snakeoil.key -sslOnly -FrameRate=24 \
-interface $interface -httpd /usr/share/kasmvnc/www $log_option
-interface $interface -httpd /usr/share/kasmvnc/www

258
builder/startup/deb/select-de.sh Executable file
View File

@@ -0,0 +1,258 @@
#!/bin/bash
set -e
xstartup_script=~/.vnc/xstartup
de_was_selected_file="$HOME/.vnc/.de-was-selected"
debug() {
if [ -z "$debug" ]; then return; fi
echo "$@"
}
enable_debug() {
debug=1
}
process_cli_options() {
while [ $# -gt 0 ]; do
local option="$1"
shift
case "$option" in
--help|-h)
show_help
exit
;;
-d|--debug)
enable_debug
;;
-y|--assume-yes)
assume_yes=1
;;
-s|--select-de)
action=select-de
if [[ -n "$1" && "${1:0:1}" != "-" ]]; then
selected_de="$1"
assume_yes_for_xstartup_overwrite=1
if [ "$selected_de" = "manual" ]; then
selected_de="$manual_xstartup_choice"
fi
shift
fi
;;
*)
echo >&2 "Unsupported argument: $option"
exit 1
esac
done
}
show_help() {
cat >&2 <<-USAGE
Usage: $(basename "$0") [options]
-d, --debug Debug output
-y, --assume-yes Automatic "yes" to prompts
-s, --select-de Select desktop environent to run
--help Show this help
USAGE
}
add_uppercase_desktop_environment_keys() {
local de_cmd
for de in "${!all_desktop_environments[@]}"; do
de_cmd=${all_desktop_environments[$de]};
all_desktop_environments[${de^^}]="$de_cmd"
done
}
process_cli_options "$@"
manual_xstartup_choice="Manually edit xstartup"
declare -A all_desktop_environments=(
[Cinnamon]="exec cinnamon-session"
[Mate]="XDG_CURRENT_DESKTOP=MATE exec dbus-launch --exit-with-session mate-session"
[LXDE]="exec lxsession"
[Lxqt]="exec startlxqt"
[KDE]="exec startkde"
[Gnome]="XDG_CURRENT_DESKTOP=GNOME exec dbus-launch --exit-with-session /usr/bin/gnome-session"
[XFCE]="exec xfce4-session")
readarray -t sorted_desktop_environments < <(for de in "${!all_desktop_environments[@]}"; do echo "$de"; done | sort)
all_desktop_environments[$manual_xstartup_choice]=""
sorted_desktop_environments+=("$manual_xstartup_choice")
add_uppercase_desktop_environment_keys
detected_desktop_environments=()
declare -A numbered_desktop_environments
print_detected_desktop_environments() {
declare -i i=1
echo "Please choose Desktop Environment to run:"
for detected_de in "${detected_desktop_environments[@]}"; do
echo "[$i] $detected_de"
numbered_desktop_environments[$i]=$detected_de
i+=1
done
}
detect_desktop_environments() {
for de_name in "${sorted_desktop_environments[@]}"; do
if [[ "$de_name" = "$manual_xstartup_choice" ]]; then
detected_desktop_environments+=("$de_name")
continue;
fi
local executable=${all_desktop_environments[$de_name]}
executable=($executable)
executable=${executable[-1]}
if detect_desktop_environment "$de_name" "$executable"; then
detected_desktop_environments+=("$de_name")
fi
done
}
ask_user_to_choose_de() {
while : ; do
print_detected_desktop_environments
read -r de_number_to_run
de_name_from_number "$de_number_to_run"
if [[ -n "$de_name" ]]; then
break;
fi
echo "Incorrect number: $de_number_to_run"
echo
done
}
remember_de_choice() {
touch "$de_was_selected_file"
}
de_was_selected_on_previous_run() {
[[ -f "$de_was_selected_file" ]]
}
detect_desktop_environment() {
local de_name="$1"
local executable="$2"
if command -v "$executable" &>/dev/null; then
return 0
fi
return 1
}
did_user_forbid_replacing_xstartup() {
grep -q -v KasmVNC-safe-to-replace-this-file "$xstartup_script"
}
de_cmd_from_name() {
de_cmd=${all_desktop_environments[${de_name^^}]}
}
de_name_from_number() {
local de_number_to_run="$1"
de_name=${numbered_desktop_environments[$de_number_to_run]}
}
warn_xstartup_will_be_overwriten() {
if [[ -n "$assume_yes" || -n "$assume_yes_for_xstartup_overwrite" ]]; then
return 0
fi
if [ ! -f "$xstartup_script" ]; then
return 0
fi
echo -n "WARNING: $xstartup_script will be overwritten y/N?"
read -r do_overwrite_xstartup
if [[ "$do_overwrite_xstartup" = "y" || "$do_overwrite_xstartup" = "Y" ]]; then
return 0
fi
return 1
}
setup_de_to_run_via_xstartup() {
warn_xstartup_will_be_overwriten
generate_xstartup "$de_name"
}
generate_xstartup() {
local de_name="$1"
de_cmd_from_name
cat <<-SCRIPT > "$xstartup_script"
#!/bin/sh
$de_cmd
SCRIPT
chmod +x "$xstartup_script"
}
user_asked_to_select_de() {
[[ "$action" = "select-de" ]]
}
user_specified_de() {
[ -n "$selected_de" ]
}
check_de_name_is_valid() {
local selected_de="$1"
local de_cmd=${all_desktop_environments["${selected_de^^}"]:-}
if [ -z "$de_cmd" ]; then
echo >&2 "'$selected_de': not supported Desktop Environment"
return 1
fi
}
de_installed() {
local de_name="${1^^}"
for de in "${detected_desktop_environments[@]}"; do
if [ "${de^^}" = "$de_name" ]; then
return 0
fi
done
return 1
}
check_de_installed() {
local de_name="$1"
if ! de_installed "$de_name"; then
echo >&2 "'$de_name': Desktop Environment not installed"
return 1
fi
}
if user_asked_to_select_de || ! de_was_selected_on_previous_run; then
if user_specified_de; then
check_de_name_is_valid "$selected_de"
fi
detect_desktop_environments
if user_specified_de; then
check_de_installed "$selected_de"
de_name="$selected_de"
else
ask_user_to_choose_de
fi
debug "You selected $de_name desktop environment"
if [[ "$de_name" != "$manual_xstartup_choice" ]]; then
setup_de_to_run_via_xstartup
fi
remember_de_choice
fi

View File

@@ -61,9 +61,6 @@ kasmvncpasswd -d -u "$VNC_USER-to-delete" $HOME/.kasmpasswd
chmod 0600 $HOME/.kasmpasswd
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout $HOME/.vnc/self.pem -out $HOME/.vnc/self.pem -subj "/C=US/ST=VA/L=None/O=None/OU=DoFu/CN=kasm/emailAddress=none@none.none"
vncserver :1 -interface 0.0.0.0
vncserver -kill :1
if [[ -f $PASSWD_PATH ]]; then
rm -f $PASSWD_PATH
fi
@@ -86,10 +83,10 @@ vncserver -kill $DISPLAY &> $HOME/.vnc/vnc_startup.log \
detect_www_dir
detect_cert_location
[ -n "$KASMVNC_VERBOSE_LOGGING" ] && verbose_logging_option="-log *:stderr:100"
[ -n "$KASMVNC_VERBOSE_LOGGING" ] && verbose_logging_option="-debug"
echo -e "start vncserver with param: VNC_COL_DEPTH=$VNC_COL_DEPTH, VNC_RESOLUTION=$VNC_RESOLUTION\n..."
vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -FrameRate=$MAX_FRAME_RATE -websocketPort $VNC_PORT $cert_option -sslOnly -interface 0.0.0.0 $VNCOPTIONS $package_www_dir_option $verbose_logging_option #&> $STARTUPDIR/no_vnc_startup.log
vncserver $DISPLAY -select-de xfce -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -FrameRate=$MAX_FRAME_RATE -websocketPort $VNC_PORT $cert_option -sslOnly -interface 0.0.0.0 $VNCOPTIONS $package_www_dir_option $verbose_logging_option #&> $STARTUPDIR/no_vnc_startup.log
PID_SUN=$!

View File

@@ -5,10 +5,12 @@ set -e
cd "$(dirname "$0")"
. ./os_ver_cli.sh
tester_image=kasmvnctester_${os}:$os_codename${build_tag_for_images}
docker build --build-arg KASMVNC_PACKAGE_DIR="build/${os_codename}" \
-t kasmvnctester_${os}:$os_codename \
-f dockerfile.${os}_${os_codename}.deb.test .
--build-arg BUILD_DEBIAN_REVISION="$build_debian_revision" \
-t "$tester_image" \
-f dockerfile.${os}_${os_codename}${build_tag}.deb.test .
docker run -it -p 443:8443 --rm \
-e KASMVNC_VERBOSE_LOGGING=$KASMVNC_VERBOSE_LOGGING \
-e "VNC_USER=foo" -e "VNC_PW=foobar" \
kasmvnctester_${os}:$os_codename
"$tester_image"

15
builder/test-vncserver Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"
. ./os_ver_cli.sh
docker build --build-arg KASMVNC_PACKAGE_DIR="build/${os_codename}" \
-t kasmvnctester_${os}:$os_codename \
-f dockerfile.${os}_${os_codename}.vncserver.test .
docker run -it -v $(realpath ${PWD}/..):/src -p 8443:8443 -p 8444:8444 \
-p 8445:8445 --rm \
-e KASMVNC_VERBOSE_LOGGING=$KASMVNC_VERBOSE_LOGGING \
-e "VNC_USER=foo" -e "VNC_PW=foobar" \
kasmvnctester_${os}:$os_codename

View File

@@ -1,5 +1,5 @@
Name: kasmvncserver
Version: 0.9.1~beta
Version: 0.9.3~beta
Release: 1%{?dist}
Summary: VNC server accessible from a web browser
@@ -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
Requires: xorg-x11-xauth, xorg-x11-xkb-utils, xkeyboard-config, xorg-x11-server-utils, openssl, perl, perl-Switch
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 \
@@ -62,12 +63,11 @@ cp $SRC/man/man1/Xvnc.1 $DESTDIR/usr/share/man/man1/;
cp $SRC/share/man/man1/vncserver.1 $DST_MAN;
cp $SRC/share/man/man1/vncconfig.1 $DST_MAN;
cp $SRC/share/man/man1/vncpasswd.1 $DST_MAN;
cp $SRC/share/man/man1/kasmxpoxy.1 $DST_MAN;
cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1;
%files
/usr/bin/*
/usr/lib/kasmvncserver
/usr/share/man/man1/*
/usr/share/kasmvnc/www

View File

@@ -1,7 +1,7 @@
TARGET_OS := $(shell lsb_release -is | tr '[:upper:]' '[:lower:]')
TARGET_OS_CODENAME := $(shell lsb_release -cs | tr '[:upper:]' '[:lower:]')
TARBALL_DIR := builder/build
TARBALL := $(TARBALL_DIR)/kasmvnc.$(TARGET_OS)_$(TARGET_OS_CODENAME).tar.gz
TARBALL := $(TARBALL_DIR)/kasmvnc.$(TARGET_OS)_$(TARGET_OS_CODENAME)$(BUILD_TAG).tar.gz
TAR_DATA := $(shell mktemp -d)
SRC := $(TAR_DATA)/usr/local
SRC_BIN := $(SRC)/bin
@@ -11,12 +11,12 @@ install: unpack_tarball
echo "TAR_DATA: $(TAR_DATA)"
echo "installing files"
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/Xkasmvnc
cp $(SRC_BIN)/vncserver $(DESTDIR)/usr/bin/kasmvncserver
cp $(SRC_BIN)/vncconfig $(DESTDIR)/usr/bin/kasmvncconfig
cp $(SRC_BIN)/kasmvncpasswd $(DESTDIR)/usr/bin/
cp $(SRC_BIN)/kasmxproxy $(DESTDIR)/usr/bin/
cp -r $(SRC)/lib/kasmvnc/ $(DESTDIR)/usr/lib/kasmvncserver
cp -r $(SRC)/share/doc/kasmvnc*/* $(DESTDIR)/usr/share/doc/kasmvncserver/
rsync -r --exclude '.git*' --exclude po2js --exclude xgettext-html \
--exclude www/utils/ --exclude .eslintrc \

6
debian/changelog vendored
View File

@@ -1,3 +1,9 @@
kasmvnc (0.9.3~beta-1) unstable; urgency=medium
* New upstream release.
-- Dmitry Maksyoma <ledestin@gmail.com> Fri, 29 Oct 2021 19:16:33 +1300
kasmvnc (0.9.1~beta-1) unstable; urgency=medium
* Initial release of the Debian package.

4
debian/control vendored
View File

@@ -3,7 +3,7 @@ Section: x11
Priority: optional
Maintainer: Kasm Technologies LLC <info@kasmweb.com>
Build-Depends: debhelper (>= 11), rsync, libjpeg-dev, libjpeg-dev, libpng-dev,
libtiff-dev, libgif-dev, libavcodec-dev, libssl-dev, libgl1, libxfont2, libsm6, libxext-dev, libxrandr-dev, libxtst-dev, libxcursor-dev
libtiff-dev, libgif-dev, libavcodec-dev, libssl-dev, libgl1, libxfont2, libsm6
Standards-Version: 4.1.3
Homepage: https://github.com/kasmtech/KasmVNC
#Vcs-Browser: https://salsa.debian.org/debian/kasmvnc
@@ -12,7 +12,7 @@ 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
x11-xkb-utils, xkb-data, procps, libswitch-perl
Provides: vnc-server
Description: VNC server accessible from a web browser
VNC stands for Virtual Network Computing. It is, in essence, a remote

2
debian/postinst vendored
View File

@@ -21,7 +21,7 @@ case "$1" in
configure)
bindir=/usr/bin
mandir=/usr/share/man
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc kasmxproxy"
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc"
for kasm_command in $commands; do
generic_command=`echo "$kasm_command" | sed -e 's/kasm//'`;

2
debian/prerm vendored
View File

@@ -21,7 +21,7 @@ case "$1" in
remove)
bindir=/usr/bin
mandir=/usr/share/man
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc kasmxproxy"
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc"
for kasm_command in $commands; do
generic_command=`echo "$kasm_command" | sed -e 's/kasm//'`;

Submodule kasmweb updated: ba40cacce0...f9f5b01cc2

View File

@@ -45,12 +45,13 @@ mkdir -p $OUTDIR/man/man1
make DESTDIR=$TMPDIR/inst install
if [ $SERVER = 1 ]; then
install -m 755 ./unix/kasmxproxy/kasmxproxy $OUTDIR/bin/
install -m 755 ./xorg.build/bin/Xvnc $OUTDIR/bin/
install -m 644 ./xorg.build/man/man1/Xvnc.1 $OUTDIR/man/man1/Xvnc.1
install -m 644 ./xorg.build/man/man1/Xserver.1 $OUTDIR/man/man1/Xserver.1
mkdir -p $OUTDIR/lib/dri/
install -m 755 ./xorg.build/lib/dri/swrast_dri.so $OUTDIR/lib/dri/
mkdir -p $OUTDIR/lib/kasmvnc
install -m 755 $SRCDIR/builder/startup/deb/select-de.sh $OUTDIR/lib/kasmvnc
mkdir -p $OUTDIR/share/kasmvnc
cp -r $SRCDIR/builder/www $OUTDIR/share/kasmvnc/www
fi

3
run-specs Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
pipenv run mamba spec/*

189
spec/vncserver_spec.py Normal file
View File

@@ -0,0 +1,189 @@
import os
import sys
import pexpect
import shutil
import subprocess
from path import Path
from mamba import description, context, it, fit, before, after
from expects import expect, equal
# WIP. Plan to move to start_xvnc_pexpect(), because pexpect provides a way to
# wait for vncserver output. start_xvnc() just blindly prints input to vncserver
# without knowing what it prints back.
vncserver_cmd = 'vncserver :1 -cert /etc/ssl/certs/ssl-cert-snakeoil.pem -key /etc/ssl/private/ssl-cert-snakeoil.key -sslOnly -FrameRate=24 -interface 0.0.0.0 -httpd /usr/share/kasmvnc/www -depth 24 -geometry 1280x1050 -log *:stderr:100'
running_xvnc = False
def clean_env():
clean_kasm_users()
home_dir = os.environ['HOME']
vnc_dir = os.path.join(home_dir, ".vnc")
Path(vnc_dir).rmtree(ignore_errors=True)
def clean_kasm_users():
home_dir = os.environ['HOME']
password_file = os.path.join(home_dir, ".kasmpasswd")
Path(password_file).remove_p()
def start_xvnc_pexpect(extra_args="", **kwargs):
global running_xvnc
# ":;" is a hack. Without it, Xvnc doesn't run. No idea what happens, but
# when I run top, Xvnc just isn't there. I suspect a race.
child = pexpect.spawn('/bin/bash',
['-ic', f':;{vncserver_cmd} {extra_args}'],
timeout=5, encoding='utf-8', **kwargs)
running_xvnc = True
return child
def start_xvnc(extra_args="", **kwargs):
global running_xvnc
completed_process = run_cmd(f'{vncserver_cmd} {extra_args}', **kwargs)
if completed_process.returncode == 0:
running_xvnc = True
return completed_process
def run_cmd(cmd, **kwargs):
completed_process = subprocess.run(cmd, shell=True, text=True,
capture_output=True,
executable='/bin/bash', **kwargs)
if completed_process.returncode != 0:
print(completed_process.stdout)
print(completed_process.stderr)
return completed_process
def add_kasmvnc_user_docker():
completed_process = run_cmd('echo -e "password\\npassword\\n" | vncpasswd -u docker')
expect(completed_process.returncode).to(equal(0))
def kill_xvnc():
global running_xvnc
if not running_xvnc:
return
run_cmd('vncserver -kill :1')
running_xvnc = False
def select_de(de_name):
try:
extra_args = f'-select-de {de_name}'
completed_process = start_xvnc(extra_args)
expect(completed_process.returncode).to(equal(0))
finally:
kill_xvnc()
def check_de_was_setup_to_run(de_name):
completed_process = run_cmd(f'grep -q {de_name} ~/.vnc/xstartup')
expect(completed_process.returncode).to(equal(0))
with description('vncserver') as self:
with before.each:
clean_env()
with after.each:
kill_xvnc()
with context('on the first run'):
with before.each:
add_kasmvnc_user_docker()
with it('asks user to select a DE'):
choose_cinnamon = "1\n"
completed_process = start_xvnc(input=choose_cinnamon)
expect(completed_process.returncode).to(equal(0))
check_de_was_setup_to_run('cinnamon')
with it('asks to select a DE, when ran with -select-de'):
choose_cinnamon = "1\n"
completed_process = start_xvnc('-select-de', input=choose_cinnamon)
expect(completed_process.returncode).to(equal(0))
check_de_was_setup_to_run('cinnamon')
with it('selects passed DE with -s'):
select_de('mate')
check_de_was_setup_to_run('mate')
with context('after DE was selected'):
with before.each:
add_kasmvnc_user_docker()
with it("don't ask to choose DE by default"):
select_de('mate')
completed_process = start_xvnc()
expect(completed_process.returncode).to(equal(0))
check_de_was_setup_to_run('mate')
with it('asks to select a DE, when ran with -select-de'):
select_de('mate')
choose_cinnamon_and_answer_yes = "1\ny\n"
completed_process = start_xvnc('-select-de',
input=choose_cinnamon_and_answer_yes)
expect(completed_process.returncode).to(equal(0))
check_de_was_setup_to_run('cinnamon')
with it('selects passed DE with -s'):
select_de('mate')
completed_process = start_xvnc('-select-de cinnamon')
expect(completed_process.returncode).to(equal(0))
check_de_was_setup_to_run('cinnamon')
with context('guided user creation'):
with fit('asks to create a user if none exist'):
clean_kasm_users()
child = start_xvnc_pexpect('-select-de cinnamon')
child.expect('Enter username')
child.sendline()
child.expect('Password:')
child.sendline('password')
child.expect('Verify:')
child.sendline('password')
child.expect(pexpect.EOF)
child.close()
expect(child.exitstatus).to(equal(0))
home_dir = os.environ['HOME']
user = os.environ['USER']
completed_process = run_cmd(f'grep -qw {user} {home_dir}/.kasmpasswd')
expect(completed_process.returncode).to(equal(0))
with fit('specify custom username'):
custom_username = 'custom_username'
child = start_xvnc_pexpect('-select-de cinnamon')
child.logfile_read = sys.stderr
child.expect('Enter username')
child.sendline(custom_username)
child.expect('Password:')
child.sendline('password')
child.expect('Verify:')
child.sendline('password')
child.expect(pexpect.EOF)
child.wait()
# expect(child.exitstatus).to(equal(0))
home_dir = os.environ['HOME']
completed_process = run_cmd(f'grep -qw {custom_username} {home_dir}/.kasmpasswd')
expect(completed_process.returncode).to(equal(0))
# os.system(f'pgrep Xvnc >/dev/null || cat {home_dir}/.vnc/*.log')

View File

@@ -3,7 +3,6 @@ add_subdirectory(common)
add_subdirectory(vncconfig)
add_subdirectory(vncpasswd)
add_subdirectory(kasmvncpasswd)
add_subdirectory(kasmxproxy)
install(PROGRAMS vncserver DESTINATION ${BIN_DIR})
install(FILES vncserver.man DESTINATION ${MAN_DIR}/man1 RENAME vncserver.1)

View File

@@ -1 +0,0 @@
kasmxproxy

View File

@@ -1,11 +0,0 @@
include_directories(${X11_INCLUDE_DIR})
add_executable(kasmxproxy
xxhash.c
kasmxproxy.c)
target_link_libraries(kasmxproxy ${X11_LIBRARIES} ${X11_XTest_LIB} ${X11_Xrandr_LIB}
${X11_Xcursor_LIB} ${X11_Xfixes_LIB})
install(TARGETS kasmxproxy DESTINATION ${BIN_DIR})
install(FILES kasmxproxy.man DESTINATION ${MAN_DIR}/man1 RENAME kasmxproxy.1)

View File

@@ -1,530 +0,0 @@
/* Copyright (C) 2021 Kasm. All Rights Reserved.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include <getopt.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <unistd.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xcursor/Xcursor.h>
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/XTest.h>
#include "xxhash.h"
#define min(a, b) ((a) < (b) ? (a) : (b))
static void help(const char name[]) {
printf("Usage: %s [opts]\n\n"
"-a --app-display disp App display, default :0\n"
"-v --vnc-display disp VNC display, default :1\n"
"\n"
"-f --fps fps FPS, default 30\n"
"-r --resize Enable resize, default disabled.\n"
" Do not enable this if there's a physical screen\n"
" connected to the app display.\n",
name);
exit(1);
}
#define CUT_MAX (16 * 1024)
static uint8_t cutbuf[CUT_MAX];
static void supplyselection(Display *disp, const XEvent * const ev, const Atom xa_targets) {
XSelectionEvent sev;
sev.type = SelectionNotify;
sev.display = disp;
sev.requestor = ev->xselectionrequest.requestor;
sev.selection = ev->xselectionrequest.selection;
sev.target = ev->xselectionrequest.target;
sev.time = ev->xselectionrequest.time;
/*printf("someone wants our clipboard, sel %lu, tgt %lu, prop %lu\n",
sev.selection, sev.target,
ev.xselectionrequest.property);*/
if (ev->xselectionrequest.property == None)
sev.property = sev.target;
else
sev.property = ev->xselectionrequest.property;
const uint32_t len = strlen((char *) cutbuf);
if (xa_targets != None &&
sev.target == xa_targets) {
// Which formats can we do
Atom tgt[2] = {
xa_targets,
XA_STRING
};
XChangeProperty(disp, sev.requestor,
ev->xselectionrequest.property,
XA_ATOM, 32,
PropModeReplace,
(unsigned char *) tgt,
2);
//puts("sent targets");
} else {
// Data
XChangeProperty(disp, sev.requestor,
ev->xselectionrequest.property,
sev.target, 8,
PropModeReplace,
cutbuf, len);
//printf("sent data, of len %u\n", len);
}
// Send the notify event
XSendEvent(disp, sev.requestor, False, 0,
(XEvent *) &sev);
}
int main(int argc, char **argv) {
const char *appstr = ":0";
const char *vncstr = ":1";
uint8_t resize = 0;
uint8_t fps = 30;
const struct option longargs[] = {
{"app-display", 1, NULL, 'a'},
{"vnc-display", 1, NULL, 'v'},
{"resize", 0, NULL, 'r'},
{"fps", 1, NULL, 'f'},
{NULL, 0, NULL, 0},
};
while (1) {
int c = getopt_long(argc, argv, "a:v:rf:", longargs, NULL);
if (c == -1)
break;
switch (c) {
case 'a':
appstr = strdup(optarg);
break;
case 'v':
vncstr = strdup(optarg);
break;
case 'r':
resize = 1;
break;
case 'f':
fps = atoi(optarg);
if (fps < 1 || fps > 120) {
printf("Invalid fps\n");
return 1;
}
break;
default:
help(argv[0]);
break;
}
}
Display *appdisp = XOpenDisplay(appstr);
if (!appdisp) {
printf("Cannot open display %s\n", appstr);
return 1;
}
if (!XShmQueryExtension(appdisp)) {
printf("Display %s lacks SHM extension\n", appstr);
return 1;
}
Display *vncdisp = XOpenDisplay(vncstr);
if (!vncdisp) {
printf("Cannot open display %s\n", vncstr);
return 1;
}
if (!XShmQueryExtension(vncdisp)) {
printf("Display %s lacks SHM extension\n", vncstr);
return 1;
}
const int appscreen = DefaultScreen(appdisp);
const int vncscreen = DefaultScreen(vncdisp);
Visual *appvis = DefaultVisual(appdisp, appscreen);
//Visual *vncvis = DefaultVisual(vncdisp, vncscreen);
const int appdepth = DefaultDepth(appdisp, appscreen);
const int vncdepth = DefaultDepth(vncdisp, vncscreen);
if (appdepth != vncdepth) {
printf("Depths don't match, app %u vnc %u\n", appdepth, vncdepth);
return 1;
}
Window approot = DefaultRootWindow(appdisp);
Window vncroot = DefaultRootWindow(vncdisp);
XWindowAttributes appattr, vncattr;
XGCValues gcval;
gcval.plane_mask = AllPlanes;
gcval.function = GXcopy;
GC gc = XCreateGC(vncdisp, vncroot, GCFunction | GCPlaneMask, &gcval);
XImage *img = NULL;
XShmSegmentInfo shminfo;
unsigned imgw = 0, imgh = 0;
if (XGrabPointer(vncdisp, vncroot, False,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
GrabModeAsync, GrabModeAsync, None, None,
CurrentTime) != Success)
return 1;
if (XGrabKeyboard(vncdisp, vncroot, False, GrabModeAsync, GrabModeAsync,
CurrentTime) != Success)
return 1;
int xfixesbase, xfixeserrbase;
XFixesQueryExtension(appdisp, &xfixesbase, &xfixeserrbase);
XFixesSelectSelectionInput(appdisp, approot, XA_PRIMARY,
XFixesSetSelectionOwnerNotifyMask);
int xfixesbasevnc, xfixeserrbasevnc;
XFixesQueryExtension(vncdisp, &xfixesbasevnc, &xfixeserrbasevnc);
XFixesSelectSelectionInput(vncdisp, vncroot, XA_PRIMARY,
XFixesSetSelectionOwnerNotifyMask);
Atom xa_targets_vnc = XInternAtom(vncdisp, "TARGETS", False);
Atom xa_targets_app = XInternAtom(appdisp, "TARGETS", False);
Window selwin = XCreateSimpleWindow(appdisp, approot, 3, 2, 1, 1, 0, 0, 0);
Window vncselwin = XCreateSimpleWindow(vncdisp, vncroot, 3, 2, 1, 1, 0, 0, 0);
XFixesCursorImage *cursor = NULL;
uint64_t cursorhash = 0;
Cursor xcursor = None;
const unsigned sleeptime = 1000 * 1000 / fps;
while (1) {
if (!XGetWindowAttributes(appdisp, approot, &appattr))
break;
if (!XGetWindowAttributes(vncdisp, vncroot, &vncattr))
break;
if (resize && (appattr.width != vncattr.width ||
appattr.height != vncattr.height)) {
// resize app display to VNC display size
XRRScreenConfiguration *config = XRRGetScreenInfo(appdisp, approot);
int nsizes, i, match = -1;
XRRScreenSize *sizes = XRRConfigSizes(config, &nsizes);
//printf("%u sizes\n", nsizes);
for (i = 0; i < nsizes; i++) {
if (sizes[i].width == vncattr.width &&
sizes[i].height == vncattr.height) {
//printf("match %u\n", i);
match = i;
break;
}
}
if (match >= 0) {
XRRSetScreenConfig(appdisp, config, approot, match,
RR_Rotate_0, CurrentTime);
} else {
/*XRRSetScreenSize(appdisp, approot,
vncattr.width, vncattr.height,
sizes[0].mwidth, sizes[0].mheight);*/
XRRScreenResources *res = XRRGetScreenResources(appdisp, approot);
//printf("%u outputs, %u crtcs\n", res->noutput, res->ncrtc);
// Nvidia crap uses a *different* list for 1.0 and 1.2!
unsigned oldmode = 0xffff;
//printf("1.2 modes %u\n", res->nmode);
for (i = 0; i < res->nmode; i++) {
if (res->modes[i].width == vncattr.width &&
res->modes[i].height == vncattr.height) {
oldmode = i;
//printf("old mode %u matched\n", i);
break;
}
}
unsigned tgt = 0;
if (res->noutput > 1) {
for (i = 0; i < res->noutput; i++) {
XRROutputInfo *info = XRRGetOutputInfo(appdisp, res, res->outputs[i]);
if (info->connection == RR_Connected)
tgt = i;
//printf("%u %s %u\n", i, info->name, info->connection);
XRRFreeOutputInfo(info);
}
}
if (oldmode < 0xffff) {
Status s;
// nvidia needs this weird dance
s = XRRSetCrtcConfig(appdisp, res, res->crtcs[tgt],
CurrentTime,
0, 0,
None, RR_Rotate_0,
NULL, 0);
//printf("disable %u\n", s);
XRRSetScreenSize(appdisp, approot,
vncattr.width, vncattr.height,
sizes[0].mwidth, sizes[0].mheight);
s = XRRSetCrtcConfig(appdisp, res, res->crtcs[tgt],
CurrentTime,
0, 0,
res->modes[oldmode].id, RR_Rotate_0,
&res->outputs[tgt], 1);
//printf("set %u\n", s);
} else {
char name[32];
sprintf(name, "%ux%u_60", vncattr.width, vncattr.height);
printf("Creating new Mode %s\n", name);
XRRModeInfo *mode = XRRAllocModeInfo(name, strlen(name));
mode->width = vncattr.width;
mode->height = vncattr.height;
RRMode rmode = XRRCreateMode(appdisp, approot, mode);
XRRAddOutputMode(appdisp,
res->outputs[tgt],
rmode);
XRRFreeModeInfo(mode);
}
XRRFreeScreenResources(res);
}
XRRFreeScreenConfigInfo(config);
}
const unsigned w = min(appattr.width, vncattr.width);
const unsigned h = min(appattr.height, vncattr.height);
if (w != imgw || h != imgh) {
if (img) {
XShmDetach(appdisp, &shminfo);
XDestroyImage(img);
shmdt(shminfo.shmaddr);
shmctl(shminfo.shmid, IPC_RMID, NULL);
}
img = XShmCreateImage(appdisp, appvis, appdepth, ZPixmap,
NULL, &shminfo, w, h);
if (!img)
break;
shminfo.shmid = shmget(IPC_PRIVATE,
img->bytes_per_line * img->height,
IPC_CREAT | 0666);
if (shminfo.shmid == -1)
break;
shminfo.shmaddr = img->data = shmat(shminfo.shmid, 0, 0);
shminfo.readOnly = False;
if (!XShmAttach(appdisp, &shminfo))
break;
imgw = w;
imgh = h;
}
XShmGetImage(appdisp, approot, img, 0, 0, 0xffffffff);
XPutImage(vncdisp, vncroot, gc, img, 0, 0, 0, 0, w, h);
// Handle events
while (XPending(vncdisp)) {
XEvent ev;
XNextEvent(vncdisp, &ev);
if (ev.type == xfixesbasevnc + XFixesSelectionNotify) {
XFixesSelectionNotifyEvent *xfe =
(XFixesSelectionNotifyEvent *) &ev;
// printf("vnc disp did a copy, owner %lu, root %lu\n",
// xfe->owner, vncroot);
if (xfe->owner == None || xfe->owner == vncroot)
continue;
XConvertSelection(vncdisp, XA_PRIMARY, XA_STRING, XA_STRING,
vncselwin, CurrentTime);
} else switch (ev.type) {
case KeyPress:
case KeyRelease:
XTestFakeKeyEvent(appdisp, ev.xkey.keycode,
ev.type == KeyPress,
CurrentTime);
break;
case ButtonPress:
case ButtonRelease:
XTestFakeButtonEvent(appdisp, ev.xbutton.button,
ev.type == ButtonPress,
CurrentTime);
break;
case MotionNotify:
XTestFakeMotionEvent(appdisp, appscreen,
ev.xmotion.x,
ev.xmotion.y,
CurrentTime);
break;
case SelectionRequest:
supplyselection(vncdisp, &ev, xa_targets_vnc);
break;
case SelectionNotify:
{
Atom realtype;
int fmt;
unsigned long nitems, bytes_rem;
unsigned char *data;
if (XGetWindowProperty(vncdisp, vncselwin,
XA_STRING,
0, CUT_MAX / 4,
False, AnyPropertyType,
&realtype, &fmt,
&nitems, &bytes_rem,
&data) == Success) {
if (bytes_rem) {
printf("Clipboard too large, ignoring\n");
} else {
const uint32_t len = nitems * (fmt / 8);
//printf("realtype %lu, fmt %u, nitems %lu\n",
// realtype, fmt, nitems);
memcpy(cutbuf, data, len);
if (len < CUT_MAX)
cutbuf[len] = 0;
else
cutbuf[CUT_MAX - 1] = 0;
// Send it to the app screen
XSetSelectionOwner(appdisp, XA_PRIMARY,
approot,
CurrentTime);
}
XFree(data);
} else {
printf("Failed to fetch vnc clipboard\n");
}
}
break;
case SelectionClear:
cutbuf[0] = '\0';
XSetSelectionOwner(appdisp, XA_PRIMARY, None,
CurrentTime);
break;
default:
printf("Unexpected event type %u\n", ev.type);
break;
}
}
// App-side events
while (XPending(appdisp)) {
XEvent ev;
XNextEvent(appdisp, &ev);
if (ev.type == xfixesbase + XFixesSelectionNotify) {
XFixesSelectionNotifyEvent *xfe =
(XFixesSelectionNotifyEvent *) &ev;
//printf("app disp did a copy, owner %lu\n", xfe->owner);
if (xfe->owner == None || xfe->owner == approot)
continue;
XConvertSelection(appdisp, XA_PRIMARY, XA_STRING, XA_STRING,
selwin, CurrentTime);
} else switch (ev.type) {
case SelectionNotify:
{
Atom realtype;
int fmt;
unsigned long nitems, bytes_rem;
unsigned char *data;
if (XGetWindowProperty(appdisp, selwin,
XA_STRING,
0, CUT_MAX / 4,
False, AnyPropertyType,
&realtype, &fmt,
&nitems, &bytes_rem,
&data) == Success) {
if (bytes_rem) {
printf("Clipboard too large, ignoring\n");
} else {
const uint32_t len = nitems * (fmt / 8);
//printf("realtype %lu, fmt %u, nitems %lu\n",
// realtype, fmt, nitems);
memcpy(cutbuf, data, len);
if (len < CUT_MAX)
cutbuf[len] = 0;
else
cutbuf[CUT_MAX - 1] = 0;
// Send it to the VNC screen
XSetSelectionOwner(vncdisp, XA_PRIMARY,
vncroot,
CurrentTime);
}
XFree(data);
} else {
printf("Failed to fetch app clipboard\n");
}
}
break;
case SelectionRequest:
supplyselection(appdisp, &ev, xa_targets_app);
break;
default:
printf("Unexpected app event type %u\n", ev.type);
break;
}
}
// Cursors
cursor = XFixesGetCursorImage(appdisp);
uint64_t newhash = XXH64(cursor->pixels,
cursor->width * cursor->height * sizeof(unsigned long),
0);
if (cursorhash != newhash) {
if (cursorhash)
XFreeCursor(vncdisp, xcursor);
XcursorImage *converted = XcursorImageCreate(cursor->width, cursor->height);
converted->xhot = cursor->xhot;
converted->yhot = cursor->yhot;
unsigned i;
for (i = 0; i < cursor->width * cursor->height; i++) {
converted->pixels[i] = cursor->pixels[i];
}
xcursor = XcursorImageLoadCursor(vncdisp, converted);
XDefineCursor(vncdisp, vncroot, xcursor);
XcursorImageDestroy(converted);
cursorhash = newhash;
}
usleep(sleeptime);
}
XCloseDisplay(appdisp);
XCloseDisplay(vncdisp);
return 0;
}

View File

@@ -1,18 +0,0 @@
.TH kasmxproxy 1 "" "KasmVNC" "Virtual Network Computing"
.SH NAME
kasmxproxy \- proxy an existing X11 display to a KasmVNC display
.SH SYNOPSIS
.B kasmxproxy
.RB [ \-a \-\-app\-display
.IR source display, default :0 ]
.RB [ \-v \-\-vnc\-display
.IR destination display, default :1 ]
.RB [ \-f \-\-fps
.IR FPS, default 30 ]
.RB [ \-r \-\-resize
.IR Enable resizing, default disabled. WARNING: DO NOT ENABLE IF PHYSICAL DISPLAY IS ATTACHED ]
.br
.BI "kasmxproxy -a :1 -v :10 -r"
.SH DESCRIPTION
.B kasmxproxy
is used to proxy an x display, usually attached to a physical GPU, to KasmVNC display. This is usually used in the context of providing GPU acceleration to a KasmVNC session.

View File

@@ -1 +0,0 @@
../../common/rfb/xxhash.c

View File

@@ -1 +0,0 @@
../../common/rfb/xxhash.h

1715
unix/vncserver Normal file → Executable file

File diff suppressed because it is too large Load Diff