fix(kasmvnc): change installed check and bump default version (#505)

## Description

This PR makes the following changes to the `coder/modules/kasmvnc`:
- Change the installation check from checking `vncserver` to
`kasmvncserver`.
- Bump the default KasmVNC installation version to
[1.4.0](https://docs.kasmvnc.com/docs/release_notes/1.4.0).

In images where there is already TightVNC installed, the current
installation check will erroneously report that KasmVNC is already
installed. By checking `kasmvncserver` instead, it ensures KasmVNC is
installed.

Tested on Debian, Kali and Alpine-based images.

## Type of Change

- [ ] New module
- [ ] New template
- [X] Bug fix
- [ ] Feature/enhancement
- [ ] Documentation
- [ ] Other

## Module Information

**Path:** `registry/coder/modules/kasmvnc`  
**New version:** `v1.2.5`  
**Breaking change:** [ ] Yes [X] No

## Testing & Validation

- [X] Tests pass (`bun test`)
- [X] Code formatted (`bun fmt`)
- [X] Changes tested locally

## Related Issues

None
This commit is contained in:
netsgnut 2025-10-24 10:47:51 -07:00 committed by GitHub
parent bc39c2ee29
commit a327e79bc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View File

@ -14,7 +14,7 @@ Automatically install [KasmVNC](https://kasmweb.com/kasmvnc) in a workspace, and
module "kasmvnc" { module "kasmvnc" {
count = data.coder_workspace.me.start_count count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/kasmvnc/coder" source = "registry.coder.com/coder/kasmvnc/coder"
version = "1.2.4" version = "1.2.5"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
desktop_environment = "xfce" desktop_environment = "xfce"
subdomain = true subdomain = true

View File

@ -23,7 +23,7 @@ variable "port" {
variable "kasm_version" { variable "kasm_version" {
type = string type = string
description = "Version of KasmVNC to install." description = "Version of KasmVNC to install."
default = "1.3.2" default = "1.4.0"
} }
variable "desktop_environment" { variable "desktop_environment" {

View File

@ -8,10 +8,10 @@ error() {
exit 1 exit 1
} }
# Function to check if vncserver is already installed # Function to check if KasmVNC is already installed
check_installed() { check_installed() {
if command -v vncserver &> /dev/null; then if command -v kasmvncserver &> /dev/null; then
echo "vncserver is already installed." echo "KasmVNC is already installed."
return 0 # Don't exit, just indicate it's installed return 0 # Don't exit, just indicate it's installed
else else
return 1 # Indicates not installed return 1 # Indicates not installed
@ -158,7 +158,7 @@ case "$arch" in
;; ;;
esac esac
# Check if vncserver is installed, and install if not # Check if KasmVNC is installed, and install if not
if ! check_installed; then if ! check_installed; then
# Check for NOPASSWD sudo (required) # Check for NOPASSWD sudo (required)
if ! command -v sudo &> /dev/null || ! sudo -n true 2> /dev/null; then if ! command -v sudo &> /dev/null || ! sudo -n true 2> /dev/null; then
@ -188,7 +188,7 @@ if ! check_installed; then
;; ;;
esac esac
else else
echo "vncserver already installed. Skipping installation." echo "KasmVNC already installed. Skipping installation."
fi fi
if command -v sudo &> /dev/null && sudo -n true 2> /dev/null; then if command -v sudo &> /dev/null && sudo -n true 2> /dev/null; then
@ -227,7 +227,7 @@ EOF
# This password is not used since we start the server without auth. # This password is not used since we start the server without auth.
# The server is protected via the Coder session token / tunnel # The server is protected via the Coder session token / tunnel
# and does not listen publicly # and does not listen publicly
echo -e "password\npassword\n" | vncpasswd -wo -u "$USER" echo -e "password\npassword\n" | kasmvncpasswd -wo -u "$USER"
get_http_dir() { get_http_dir() {
# determine the served file path # determine the served file path
@ -290,7 +290,7 @@ VNC_LOG="/tmp/kasmvncserver.log"
printf "🚀 Starting KasmVNC server...\n" printf "🚀 Starting KasmVNC server...\n"
set +e set +e
vncserver -select-de "${DESKTOP_ENVIRONMENT}" -disableBasicAuth > "$VNC_LOG" 2>&1 kasmvncserver -select-de "${DESKTOP_ENVIRONMENT}" -disableBasicAuth > "$VNC_LOG" 2>&1
RETVAL=$? RETVAL=$?
set -e set -e