Files
ProxmoxVE/ct/kasm.sh
T

98 lines
3.6 KiB
Bash
Raw Normal View History

2025-05-26 10:42:50 +02:00
#!/usr/bin/env bash
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
# Copyright (c) 2021-2026 community-scripts ORG
2026-06-17 10:12:39 +02:00
# Author: CrazyWolf13
2025-05-26 10:42:50 +02:00
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.kasmweb.com/docs/latest/index.html
APP="Kasm"
var_tags="${var_tags:-os}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-8192}"
2025-05-26 10:42:50 +02:00
var_disk="${var_disk:-30}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
2026-06-12 00:16:15 +10:00
var_arm64="${var_arm64:-yes}"
2025-06-03 04:08:37 -04:00
var_unprivileged="${var_unprivileged:-0}"
2025-05-26 10:42:50 +02:00
var_fuse="${var_fuse:-yes}"
var_tun="${var_tun:-yes}"
2026-06-17 10:12:39 +02:00
var_kasm_version="${var_kasm_version:-1.19.0}"
2025-05-26 10:42:50 +02:00
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
2025-11-20 13:02:30 +01:00
if [[ ! -d /opt/kasm/current ]]; then
2025-05-26 10:42:50 +02:00
msg_error "No ${APP} Installation Found!"
exit
fi
2025-11-20 13:02:30 +01:00
msg_info "Checking for new version"
CURRENT_VERSION=$(readlink -f /opt/kasm/current | awk -F'/' '{print $4}')
2026-06-17 10:12:39 +02:00
KASM_URL=$(curl -s https://kasm.com/downloads \
| grep -oP 'https://kasm-static-content\.s3\.amazonaws\.com/kasm_release_\d+\.\d+\.\d+-latest\.tar\.gz' \
| head -1)
KASM_VERSION=$(echo "$KASM_URL" | grep -oP '\d+\.\d+\.\d+(?=-latest)')
2026-06-17 10:12:39 +02:00
# 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}"
2026-04-06 20:26:59 +02:00
if [[ -z "$KASM_VERSION" ]] || [[ -z "$KASM_URL" ]]; then
2025-11-20 13:02:30 +01:00
msg_error "Unable to detect latest Kasm release URL."
exit 250
2025-11-20 13:02:30 +01:00
fi
2026-10-03 08:19:10 +02:00
msg_ok "Checked for new version"
2025-11-20 13:02:30 +01:00
msg_info "Removing outdated docker-compose plugin"
[ -f ~/.docker/cli-plugins/docker-compose ] && rm -rf ~/.docker/cli-plugins/docker-compose
msg_ok "Removed outdated docker-compose plugin"
2025-11-20 13:02:30 +01:00
if [[ -z "$CURRENT_VERSION" ]] || [[ "$KASM_VERSION" != "$CURRENT_VERSION" ]]; then
msg_info "Updating Kasm"
cd /tmp
2025-11-20 13:02:30 +01:00
msg_warn "WARNING: This script will run an external installer from a third-party source (https://www.kasmweb.com/)."
msg_warn "The following code is NOT maintained or audited by our repository."
msg_warn "If you have any doubts or concerns, please review the installer code before proceeding:"
msg_custom "${TAB3}${GATEWAY}${BGN}${CL}" "\e[1;34m" "→ upgrade.sh inside tar.gz $KASM_URL"
echo
read -r -p "${TAB3}Do you want to continue? [y/N]: " CONFIRM
if [[ ! "$CONFIRM" =~ ^([yY][eE][sS]|[yY])$ ]]; then
msg_error "Aborted by user. No changes have been made."
exit 10
fi
curl_download "/tmp/kasm_release_${KASM_VERSION}.tar.gz" "$KASM_URL"
2025-11-20 13:02:30 +01:00
tar -xf "kasm_release_${KASM_VERSION}.tar.gz"
chmod +x /tmp/kasm_release/install.sh
2026-01-06 22:57:40 +01:00
rm -f /tmp/kasm_release_"${KASM_VERSION}".tar.gz
2025-11-20 13:02:30 +01:00
bash /tmp/kasm_release/upgrade.sh --proxy-port 443
rm -rf /tmp/kasm_release
2026-01-06 22:57:40 +01:00
msg_ok "Updated successfully!"
2025-11-20 13:02:30 +01:00
else
msg_ok "No update required. Kasm is already at v${KASM_VERSION}"
2025-11-20 13:02:30 +01:00
fi
2025-05-26 10:42:50 +02:00
exit
}
start
build_container
description
2026-01-06 22:57:40 +01:00
msg_ok "Completed successfully!\n"
2025-05-26 10:42:50 +02:00
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
echo -e "${GATEWAY}${BGN}https://${IP}${CL}"