From cec1c590140ddd45e064e590a5de24fc14c007e9 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 27 May 2025 09:30:25 +0200 Subject: [PATCH] dev --- ct/kasm.sh | 64 +++++++++++++++++++++++++++++++++++++++++ install/kasm-install.sh | 36 +++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 ct/kasm.sh create mode 100644 install/kasm-install.sh diff --git a/ct/kasm.sh b/ct/kasm.sh new file mode 100644 index 0000000..781c79a --- /dev/null +++ b/ct/kasm.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Omar Minaya +# 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:-4192}" +var_disk="${var_disk:-30}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-0}" +var_fuse="${var_fuse:-yes}" +var_tun="${var_tun:-yes}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/kasm ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -fsSL 'https://www.kasmweb.com/downloads' | grep -o 'https://kasm-static-content.s3.amazonaws.com/kasm_release_[^"]*\.tar\.gz' | head -n 1 | sed -E 's/.*release_(.*)\.tar\.gz/\1/') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Updating ${APP} to v${RELEASE}" + temp_file=$(mktemp) + curl -fsSL "https://kasm-static-content.s3.amazonaws.com/kasm_release_${RELEASE}.tar.gz" -o "$temp_file" + tar zxf "$temp_file" + chmod 777 /opt/kasm/backups/ + printf 'y\n' | $STD sudo bash /tmp/kasm_release/upgrade.sh + $STD sudo bash /tmp/kasm_release/upgrade.sh + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP} to v${RELEASE}" + + msg_info "Cleaning up" + rm -f "$temp_file" + rm -rf /tmp/kasm_release + $STD apt-get -y autoremove + $STD apt-get -y autoclean + msg_ok "Cleaned" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}https://${IP}${CL}" diff --git a/install/kasm-install.sh b/install/kasm-install.sh new file mode 100644 index 0000000..082691d --- /dev/null +++ b/install/kasm-install.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Omar Minaya +# 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 + +check_or_create_swap + +msg_info "Installing Kasm Workspaces" +RELEASE=$(curl -fsSL 'https://www.kasmweb.com/downloads' | grep -o 'https://kasm-static-content.s3.amazonaws.com/kasm_release_[^"]*\.tar\.gz' | head -n 1 | sed -E 's/.*release_(.*)\.tar\.gz/\1/') +curl -fsSL -o "/opt/kasm_release_${RELEASE}.tar.gz" "https://kasm-static-content.s3.amazonaws.com/kasm_release_${RELEASE}.tar.gz" +cd /opt +tar -xf "kasm_release_${RELEASE}.tar.gz" +chmod +x /opt/kasm_release/install.sh +printf 'y\ny\ny\n4\n' | bash /opt/kasm_release/install.sh | tee ~/kasm-install.output +sed -n '/Kasm UI Login Credentials/,$p' ~/kasm-install.output >~/kasm.creds +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed Kasm Workspaces" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD rm -f /opt/kasm_release_${KASM_VERSION}.tar.gz +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"