From 7b0864596b9f091e3bf246a4172f5a8f6df32146 Mon Sep 17 00:00:00 2001 From: Omar Minaya Date: Tue, 20 May 2025 14:37:19 -0400 Subject: [PATCH] using new build.func for tun and fuse --- ct/kasm.sh | 88 +++++++++++------------------------------ install/kasm-install.sh | 14 ++++++- 2 files changed, 37 insertions(+), 65 deletions(-) diff --git a/ct/kasm.sh b/ct/kasm.sh index 8dd7957..783936b 100644 --- a/ct/kasm.sh +++ b/ct/kasm.sh @@ -1,19 +1,20 @@ #!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) -# Copyright (c) 2021-2025 community-scripts ORG +source <(curl -s https://raw.githubusercontent.com/omiinaya/ProxmoxVED/refs/heads/testing2/misc/build.func) +# Copyright (c) 2021-2025 tteck # Author: Omar Minaya -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: https://www.kasmweb.com/docs/1.10.0/install/single_server_install.html +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://www.debian.org/ APP="Kasm" -var_tags="kasm;workspaces;docker" -var_cpu="2" -var_ram="4096" -var_disk="50" -var_os="debian" -var_version="12" -var_unprivileged="0" -var_fuse="yes" +var_tags="${var_tags:-os}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-4192}" +var_disk="${var_disk:-50}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" +var_fuse="${var_fuse:-1}" +var_tun="${var_tun:-1}" header_info "$APP" variables @@ -21,63 +22,22 @@ 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 - msg_info "Updating ${APP} LXC" - $STD apt-get update - $STD apt-get -y upgrade - msg_ok "Updated ${APP} LXC" + header_info + check_container_storage + check_container_resources + if [[ ! -d /var ]]; then + msg_error "No ${APP} Installation Found!" exit + fi + msg_info "Updating $APP LXC" + $STD apt-get update + $STD apt-get -y upgrade + msg_ok "Updated $APP LXC" + exit } start build_container - -CT_CONF="/etc/pve/lxc/${CTID}.conf" - -msg_info "Configuring TUN/TAP support" -cat <>"$CT_CONF" -lxc.cgroup2.devices.allow: c 10:200 rwm -lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file -EOF -msg_ok "Configured TUN/TAP support" - -msg_info "Rebooting container to apply configuration" -pct reboot "$CTID" - -msg_info "Waiting for container to be back online" -MAX_ATTEMPTS=60 -ATTEMPT=1 -while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do - STATUS=$(pct status "$CTID" | grep -o "running") - if [ "$STATUS" = "running" ] && pct exec "$CTID" -- true >/dev/null 2>&1; then - msg_ok "Container is back online" - break - fi - echo -n "." - sleep 2 - ATTEMPT=$((ATTEMPT + 1)) -done - -if [ $ATTEMPT -gt $MAX_ATTEMPTS ]; then - msg_error "Container failed to come back online within $MAX_ATTEMPTS attempts" - exit 1 -fi - -msg_ok "Running Kasm installer" -pct exec "$CTID" -- bash -c " -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 -" - -msg_ok "Installed Kasm Workspaces" - description msg_ok "Completed Successfully!\n" diff --git a/install/kasm-install.sh b/install/kasm-install.sh index 30b6504..45f4fe2 100644 --- a/install/kasm-install.sh +++ b/install/kasm-install.sh @@ -24,9 +24,21 @@ msg_info "Installing Kasm Workspaces" KASM_VERSION=$(curl -s '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/') msg_ok "Latest Kasm Version: $KASM_VERSION" -wget -q -P /opt "https://kasm-static-content.s3.amazonaws.com/kasm_release_${KASM_VERSION}.tar.gz" +msg_ok "Downloading installer..." +curl -fsSL -o "/opt/kasm_release_${KASM_VERSION}.tar.gz" "https://kasm-static-content.s3.amazonaws.com/kasm_release_${KASM_VERSION}.tar.gz" + +msg_ok "Extracting installer..." cd /opt tar -xf "kasm_release_${KASM_VERSION}.tar.gz" +chmod +x /opt/kasm_release/install.sh + +msg_ok "Installing Kasm..." +printf 'y\ny\ny\n4\n' | bash /opt/kasm_release/install.sh | tee ~/kasm-install.output + +msg_ok "Storing credentials..." +sed -n '/Kasm UI Login Credentials/,$p' ~/kasm-install.output > ~/kasm.creds + +msg_ok "Installed Kasm Workspaces" motd_ssh customize