Skip to content

Commit 3850960

Browse files
authored
kasm: add: update (#9253)
1 parent 323ca24 commit 3850960

File tree

3 files changed

+48
-14
lines changed

3 files changed

+48
-14
lines changed

ct/kasm.sh

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,51 @@ function update_script() {
2525
header_info
2626
check_container_storage
2727
check_container_resources
28-
if [[ ! -d /var ]]; then
28+
if [[ ! -d /opt/kasm/current ]]; then
2929
msg_error "No ${APP} Installation Found!"
3030
exit
3131
fi
32-
msg_info "Updating LXC"
33-
$STD apt update
34-
$STD apt -y upgrade
35-
msg_ok "Updated LXC"
32+
33+
msg_info "Checking for new version"
34+
CURRENT_VERSION=$(readlink -f /opt/kasm/current | awk -F'/' '{print $4}')
35+
KASM_URL=$(curl -fsSL "https://www.kasm.com/downloads" | tr '\n' ' ' | grep -oE 'https://kasm-static-content[^"]*kasm_release_[0-9]+\.[0-9]+\.[0-9]+\.[a-z0-9]+\.tar\.gz' | head -n 1)
36+
if [[ -z "$KASM_URL" ]]; then
37+
msg_error "Unable to detect latest Kasm release URL."
38+
exit 1
39+
fi
40+
KASM_VERSION=$(echo "$KASM_URL" | sed -E 's/.*kasm_release_([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
41+
msg_info "Checked for new version"
42+
43+
msg_info "Removing outdated docker-compose plugin"
44+
[ -f ~/.docker/cli-plugins/docker-compose ] && rm -rf ~/.docker/cli-plugins/docker-compose
45+
msg_ok "Removed outdated docker-compose plugin"
46+
47+
if [[ -z "$CURRENT_VERSION" ]] || [[ "$KASM_VERSION" != "$CURRENT_VERSION" ]]; then
48+
msg_info "Updating Kasm"
49+
cd /tmp
50+
51+
msg_warn "WARNING: This script will run an external installer from a third-party source (https://www.kasmweb.com/)."
52+
msg_warn "The following code is NOT maintained or audited by our repository."
53+
msg_warn "If you have any doubts or concerns, please review the installer code before proceeding:"
54+
msg_custom "${TAB3}${GATEWAY}${BGN}${CL}" "\e[1;34m" "→ upgrade.sh inside tar.gz $KASM_URL"
55+
echo
56+
read -r -p "${TAB3}Do you want to continue? [y/N]: " CONFIRM
57+
if [[ ! "$CONFIRM" =~ ^([yY][eE][sS]|[yY])$ ]]; then
58+
msg_error "Aborted by user. No changes have been made."
59+
exit 10
60+
fi
61+
curl -fsSL -o "/tmp/kasm_release_${KASM_VERSION}.tar.gz" "$KASM_URL"
62+
tar -xf "kasm_release_${KASM_VERSION}.tar.gz"
63+
chmod +x /tmp/kasm_release/install.sh
64+
rm -f /tmp/kasm_release_${KASM_VERSION}.tar.gz
65+
66+
bash /tmp/kasm_release/upgrade.sh --proxy-port 443
67+
rm -rf /tmp/kasm_release
68+
msg_ok "Updated Successfully"
69+
else
70+
msg_ok "No update required. Kasm is already at v${KASM_VERSION}"
71+
72+
fi
3673
exit
3774
}
3875

frontend/public/json/kasm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
],
77
"date_created": "2025-05-26",
88
"type": "ct",
9-
"updateable": false,
9+
"updateable": true,
1010
"privileged": true,
1111
"config_path": "",
1212
"interface_port": 443,

install/kasm-install.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,16 @@ setting_up_container
1313
network_check
1414
update_os
1515

16-
msg_info "Detecting latest Kasm Workspaces release"
17-
KASM_URL=$(
18-
curl -fsSL "https://www.kasm.com/downloads" \
19-
| tr '\n' ' ' \
20-
| grep -oE 'https://kasm-static-content[^"]*kasm_release_[0-9]+\.[0-9]+\.[0-9]+\.[a-z0-9]+\.tar\.gz' \
21-
| head -n 1
22-
)
16+
msg_info "Installing Docker"
17+
$STD sh <(curl -fsSL https://get.docker.com/)
18+
msg_ok "Installed Docker"
2319

20+
msg_info "Detecting latest Kasm Workspaces release"
21+
KASM_URL=$(curl -fsSL "https://www.kasm.com/downloads" | tr '\n' ' ' | grep -oE 'https://kasm-static-content[^"]*kasm_release_[0-9]+\.[0-9]+\.[0-9]+\.[a-z0-9]+\.tar\.gz' | head -n 1)
2422
if [[ -z "$KASM_URL" ]]; then
2523
msg_error "Unable to detect latest Kasm release URL."
2624
exit 1
2725
fi
28-
2926
KASM_VERSION=$(echo "$KASM_URL" | sed -E 's/.*kasm_release_([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
3027
msg_ok "Detected Kasm Workspaces version $KASM_VERSION"
3128

0 commit comments

Comments
 (0)