Skip to content

Commit a900ebd

Browse files
authored
kasm: fix release fetching (#9244)
* kasm: fix release fetching * Update kasm-install.sh
1 parent 06316c2 commit a900ebd

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

install/kasm-install.sh

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

16-
KASM_VERSION=$(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/')
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+
)
23+
24+
if [[ -z "$KASM_URL" ]]; then
25+
msg_error "Unable to detect latest Kasm release URL."
26+
exit 1
27+
fi
28+
29+
KASM_VERSION=$(echo "$KASM_URL" | sed -E 's/.*kasm_release_([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
30+
msg_ok "Detected Kasm Workspaces version $KASM_VERSION"
1731

1832
msg_warn "WARNING: This script will run an external installer from a third-party source (https://www.kasmweb.com/)."
1933
msg_warn "The following code is NOT maintained or audited by our repository."
2034
msg_warn "If you have any doubts or concerns, please review the installer code before proceeding:"
21-
msg_custom "${TAB3}${GATEWAY}${BGN}${CL}" "\e[1;34m" "→ install.sh inside tar.gz https://kasm-static-content.s3.amazonaws.com/kasm_release_${KASM_VERSION}.tar.gz"
35+
msg_custom "${TAB3}${GATEWAY}${BGN}${CL}" "\e[1;34m" "→ install.sh inside tar.gz $KASM_URL"
2236
echo
2337
read -r -p "${TAB3}Do you want to continue? [y/N]: " CONFIRM
2438
if [[ ! "$CONFIRM" =~ ^([yY][eE][sS]|[yY])$ ]]; then
@@ -27,7 +41,7 @@ if [[ ! "$CONFIRM" =~ ^([yY][eE][sS]|[yY])$ ]]; then
2741
fi
2842

2943
msg_info "Installing Kasm Workspaces"
30-
curl -fsSL -o "/opt/kasm_release_${KASM_VERSION}.tar.gz" "https://kasm-static-content.s3.amazonaws.com/kasm_release_${KASM_VERSION}.tar.gz"
44+
curl -fsSL -o "/opt/kasm_release_${KASM_VERSION}.tar.gz" "$KASM_URL"
3145
cd /opt
3246
tar -xf "kasm_release_${KASM_VERSION}.tar.gz"
3347
chmod +x /opt/kasm_release/install.sh
@@ -39,10 +53,10 @@ awk '
3953
in_token && /^-+$/ {dash_count++}
4054
in_token && dash_count==2 {exit}
4155
' ~/kasm-install.output >~/kasm.creds
56+
rm -f /opt/kasm_release_${KASM_VERSION}.tar.gz
57+
rm -f ~/kasm-install.output
4258
msg_ok "Installed Kasm Workspaces"
4359

4460
motd_ssh
4561
customize
46-
rm -f /opt/kasm_release_${KASM_VERSION}.tar.gz
47-
rm -f ~/kasm-install.output
4862
cleanup_lxc

0 commit comments

Comments
 (0)