Files
ProxmoxVE/install/kasm-install.sh
T
MickLesk 4a4cbc99a7 kasm: survive a failed release lookup and answer the installer with flags
The lookup ran under pipefail with no timeout: a page without the link
ended the install at `head -1`, a stalled connection hung it for half an
hour, and the fallback version never ran. The installer takes
--accept-eula, --no-swap-check and --no-check-disk; piped answers
shifted with the prompts, and a "y" to the swap question tried swapon
inside the container.
2026-10-23 11:39:05 +02:00

81 lines
2.8 KiB
Bash

#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: CrazyWolf13
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.kasmweb.com/docs/latest/index.html
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Docker"
if [[ "$(arch_resolve)" == "arm64" ]]; then
setup_deb822_repo "docker" \
"https://download.docker.com/linux/$(get_os_info id)/gpg" \
"https://download.docker.com/linux/$(get_os_info id)" \
"$(get_os_info codename)" \
"stable"
$STD apt install -y \
docker-ce=5:28.5.2-1~debian.13~trixie \
docker-ce-cli=5:28.5.2-1~debian.13~trixie \
containerd.io=1.7.29-1~debian.13~trixie \
docker-buildx-plugin docker-compose-plugin
runc_tmp=$(mktemp -d)
(cd "$runc_tmp" && apt-get download runc && dpkg-deb -x runc_*.deb x)
dpkg-divert --local --rename --add /usr/bin/runc
install -m755 "$runc_tmp"/x/usr/sbin/runc /usr/bin/runc
rm -rf "$runc_tmp"
systemctl restart containerd docker
else
$STD sh <(curl -fsSL https://get.docker.com/)
fi
msg_ok "Installed Docker"
msg_info "Detecting latest Kasm Workspaces release"
KASM_URL=$(curl -s --max-time 30 https://kasm.com/downloads \
| grep -oP 'https://kasm-static-content\.s3\.amazonaws\.com/kasm_release_\d+\.\d+\.\d+-latest\.tar\.gz' \
| head -1 || true)
KASM_VERSION=$(echo "$KASM_URL" | grep -oP '\d+\.\d+\.\d+(?=-latest)' || true)
# Fallback to predefined version if online lookup failed.
if [[ -z "$KASM_VERSION" ]] || [[ -z "$KASM_URL" ]]; then
msg_warn "Unable to fetch latest Kasm release online, falling back to v${var_kasm_version}"
fi
KASM_VERSION="${KASM_VERSION:-$var_kasm_version}"
KASM_URL="${KASM_URL:-https://kasm-static-content.s3.amazonaws.com/kasm_release_${KASM_VERSION}-latest.tar.gz}"
if [[ -z "$KASM_VERSION" ]] || [[ -z "$KASM_URL" ]]; then
msg_error "Unable to detect latest Kasm release URL."
exit 250
fi
msg_ok "Detected Kasm Workspaces version $KASM_VERSION"
confirm_external_installer "https://www.kasmweb.com/" "install.sh inside tar.gz $KASM_URL"
msg_info "Installing Kasm Workspaces"
curl_download "/opt/kasm_release_${KASM_VERSION}.tar.gz" "$KASM_URL"
cd /opt
tar -xf "kasm_release_${KASM_VERSION}.tar.gz"
chmod +x /opt/kasm_release/install.sh
bash /opt/kasm_release/install.sh --accept-eula --no-swap-check --no-check-disk --ignore-dep-failures >~/kasm-install.output 2>&1
awk '
/^Kasm UI Login Credentials$/ {capture=1}
capture {print}
/^Service Registration Token$/ {in_token=1}
in_token && /^-+$/ {dash_count++}
in_token && dash_count==2 {exit}
' ~/kasm-install.output >~/kasm.creds
rm -f /opt/kasm_release_${KASM_VERSION}.tar.gz
rm -f ~/kasm-install.output
msg_ok "Installed Kasm Workspaces"
motd_ssh
customize
cleanup_lxc