From 7fd8673a63286d66bae80ba8e86c65e4157a487f Mon Sep 17 00:00:00 2001 From: chgl Date: Fri, 22 Aug 2025 15:02:28 +0200 Subject: [PATCH 1/5] refactor: refactored get_http_dir --- registry/coder/modules/kasmvnc/run.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/registry/coder/modules/kasmvnc/run.sh b/registry/coder/modules/kasmvnc/run.sh index 5223fb9f0..1ffefcc0e 100644 --- a/registry/coder/modules/kasmvnc/run.sh +++ b/registry/coder/modules/kasmvnc/run.sh @@ -230,19 +230,19 @@ get_http_dir() { # Check the system configuration path if [[ -e /etc/kasmvnc/kasmvnc.yaml ]]; then - d=($(grep -E "^\s*httpd_directory:.*$" /etc/kasmvnc/kasmvnc.yaml)) - # If this grep is successful, it will return: - # httpd_directory: /usr/share/kasmvnc/www - if [[ $${#d[@]} -eq 2 && -d "$${d[1]}" ]]; then - httpd_directory="$${d[1]}" + d=$(grep -E '^\s*httpd_directory:.*$' "/etc/kasmvnc/kasmvnc.yaml" | awk '{print $2}') + + if [[ -n "$httpd_directory" ]]; then + httpd_directory=$d fi fi # Check the home directory for overriding values if [[ -e "$HOME/.vnc/kasmvnc.yaml" ]]; then - d=($(grep -E "^\s*httpd_directory:.*$" "$HOME/.vnc/kasmvnc.yaml")) - if [[ $${#d[@]} -eq 2 && -d "$${d[1]}" ]]; then - httpd_directory="$${d[1]}" + d=$(grep -E '^\s*httpd_directory:.*$' "$HOME/.vnc/kasmvnc.yaml" | awk '{print $2}') + + if [[ -n "$httpd_directory" ]]; then + httpd_directory=$d fi fi echo $httpd_directory From ec8c6d1f61d6edf529bc39c18f19ff38be5c2bf0 Mon Sep 17 00:00:00 2001 From: chgl Date: Fri, 22 Aug 2025 15:19:47 +0200 Subject: [PATCH 2/5] version bump and variable fix --- registry/coder/modules/kasmvnc/README.md | 2 +- registry/coder/modules/kasmvnc/run.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/registry/coder/modules/kasmvnc/README.md b/registry/coder/modules/kasmvnc/README.md index b9b16b269..9a9092038 100644 --- a/registry/coder/modules/kasmvnc/README.md +++ b/registry/coder/modules/kasmvnc/README.md @@ -14,7 +14,7 @@ Automatically install [KasmVNC](https://kasmweb.com/kasmvnc) in a workspace, and module "kasmvnc" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/kasmvnc/coder" - version = "1.2.2" + version = "1.2.3" agent_id = coder_agent.example.id desktop_environment = "xfce" subdomain = true diff --git a/registry/coder/modules/kasmvnc/run.sh b/registry/coder/modules/kasmvnc/run.sh index 1ffefcc0e..83f0fb8fe 100644 --- a/registry/coder/modules/kasmvnc/run.sh +++ b/registry/coder/modules/kasmvnc/run.sh @@ -232,7 +232,7 @@ get_http_dir() { if [[ -e /etc/kasmvnc/kasmvnc.yaml ]]; then d=$(grep -E '^\s*httpd_directory:.*$' "/etc/kasmvnc/kasmvnc.yaml" | awk '{print $2}') - if [[ -n "$httpd_directory" ]]; then + if [[ -n "$d" ]]; then httpd_directory=$d fi fi @@ -241,7 +241,7 @@ get_http_dir() { if [[ -e "$HOME/.vnc/kasmvnc.yaml" ]]; then d=$(grep -E '^\s*httpd_directory:.*$' "$HOME/.vnc/kasmvnc.yaml" | awk '{print $2}') - if [[ -n "$httpd_directory" ]]; then + if [[ -n "$d" ]]; then httpd_directory=$d fi fi From 383ed223571f16c11dc3399dcea15b19c7f1ee92 Mon Sep 17 00:00:00 2001 From: chgl Date: Tue, 26 Aug 2025 19:31:01 +0200 Subject: [PATCH 3/5] check for directory existence Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- registry/coder/modules/kasmvnc/run.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/registry/coder/modules/kasmvnc/run.sh b/registry/coder/modules/kasmvnc/run.sh index 83f0fb8fe..52374b9a2 100644 --- a/registry/coder/modules/kasmvnc/run.sh +++ b/registry/coder/modules/kasmvnc/run.sh @@ -230,9 +230,7 @@ get_http_dir() { # Check the system configuration path if [[ -e /etc/kasmvnc/kasmvnc.yaml ]]; then - d=$(grep -E '^\s*httpd_directory:.*$' "/etc/kasmvnc/kasmvnc.yaml" | awk '{print $2}') - - if [[ -n "$d" ]]; then + if [[ -n "$d" && -d "$d" ]]; then httpd_directory=$d fi fi From 1e3a60e1f12d1f8f7753948978fa5e85310a07e7 Mon Sep 17 00:00:00 2001 From: chgl Date: Tue, 26 Aug 2025 19:31:11 +0200 Subject: [PATCH 4/5] check for directory existence Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- registry/coder/modules/kasmvnc/run.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/registry/coder/modules/kasmvnc/run.sh b/registry/coder/modules/kasmvnc/run.sh index 52374b9a2..81f150f9d 100644 --- a/registry/coder/modules/kasmvnc/run.sh +++ b/registry/coder/modules/kasmvnc/run.sh @@ -237,9 +237,7 @@ get_http_dir() { # Check the home directory for overriding values if [[ -e "$HOME/.vnc/kasmvnc.yaml" ]]; then - d=$(grep -E '^\s*httpd_directory:.*$' "$HOME/.vnc/kasmvnc.yaml" | awk '{print $2}') - - if [[ -n "$d" ]]; then + if [[ -n "$d" && -d "$d" ]]; then httpd_directory=$d fi fi From 569e21f20a58969e52eda3121159f01d14d9129f Mon Sep 17 00:00:00 2001 From: chgl Date: Tue, 26 Aug 2025 19:32:51 +0200 Subject: [PATCH 5/5] fix missing d --- registry/coder/modules/kasmvnc/run.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/registry/coder/modules/kasmvnc/run.sh b/registry/coder/modules/kasmvnc/run.sh index 81f150f9d..b7fc6fc1a 100644 --- a/registry/coder/modules/kasmvnc/run.sh +++ b/registry/coder/modules/kasmvnc/run.sh @@ -230,6 +230,7 @@ get_http_dir() { # Check the system configuration path if [[ -e /etc/kasmvnc/kasmvnc.yaml ]]; then + d=$(grep -E '^\s*httpd_directory:.*$' "/etc/kasmvnc/kasmvnc.yaml" | awk '{print $2}') if [[ -n "$d" && -d "$d" ]]; then httpd_directory=$d fi @@ -237,6 +238,7 @@ get_http_dir() { # Check the home directory for overriding values if [[ -e "$HOME/.vnc/kasmvnc.yaml" ]]; then + d=$(grep -E '^\s*httpd_directory:.*$' "$HOME/.vnc/kasmvnc.yaml" | awk '{print $2}') if [[ -n "$d" && -d "$d" ]]; then httpd_directory=$d fi