2021-03-03 11:27:02 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2021-03-14 09:19:08 +01:00
|
|
|
display=:10
|
|
|
|
interface=0.0.0.0
|
|
|
|
cert_group=ssl-cert
|
2021-07-17 15:04:33 +02:00
|
|
|
|
2021-07-21 08:53:24 +02:00
|
|
|
action=start
|
|
|
|
|
2021-07-24 04:53:34 +02:00
|
|
|
get_lib_path() {
|
|
|
|
local lib="$1"
|
|
|
|
local script_dir=$(dirname "$0")
|
|
|
|
local system_dir=/usr/share/kasmvnc
|
2021-07-18 14:07:20 +02:00
|
|
|
|
2021-07-24 04:53:34 +02:00
|
|
|
if [[ -f "$script_dir/$lib" ]]; then
|
|
|
|
echo "$script_dir/$lib"
|
|
|
|
return
|
2021-07-03 08:13:59 +02:00
|
|
|
fi
|
2021-07-17 15:04:33 +02:00
|
|
|
|
2021-07-24 04:53:34 +02:00
|
|
|
if [[ -f "$system_dir/$lib" ]]; then
|
|
|
|
echo "$system_dir/$lib"
|
|
|
|
return
|
2021-07-21 09:18:07 +02:00
|
|
|
fi
|
2021-07-18 13:16:03 +02:00
|
|
|
}
|
|
|
|
|
2021-07-24 04:53:34 +02:00
|
|
|
. $(get_lib_path cli-processing.sh)
|
|
|
|
. $(get_lib_path select-de.sh)
|
2021-03-14 09:01:04 +01:00
|
|
|
|
2021-07-21 08:53:24 +02:00
|
|
|
process_cli_options "$@"
|
2021-03-14 09:01:04 +01:00
|
|
|
|
2021-03-03 11:27:02 +01:00
|
|
|
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
|
|
|
|
|
2021-07-21 09:10:49 +02:00
|
|
|
if user_asked_to_select_de || ! de_was_selected_on_previous_run; then
|
2021-07-18 13:30:37 +02:00
|
|
|
detect_desktop_environments
|
|
|
|
ask_user_to_choose_de
|
|
|
|
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
|
2021-07-03 08:13:59 +02:00
|
|
|
|
2021-03-03 11:27:02 +01:00
|
|
|
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 \
|
2021-03-14 09:01:04 +01:00
|
|
|
-interface $interface -httpd /usr/share/kasmvnc/www $log_option
|