mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-11-21 04:55:15 +00:00
Refactor update_script for Kasm updates
This commit is contained in:
25
ct/kasm.sh
25
ct/kasm.sh
@@ -25,23 +25,28 @@ function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /var ]]; then
|
||||
if [[ ! -d /opt/kasm/current ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
msg_info "Updating Kasm"
|
||||
cd /tmp
|
||||
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
|
||||
)
|
||||
msg_info "Checking for new version"
|
||||
CURRENT_VERSION=$(readlink -f /opt/kasm/current | awk -F'/' '{print $4}')
|
||||
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)
|
||||
if [[ -z "$KASM_URL" ]]; then
|
||||
msg_error "Unable to detect latest Kasm release URL."
|
||||
exit 1
|
||||
fi
|
||||
KASM_VERSION=$(echo "$KASM_URL" | sed -E 's/.*kasm_release_([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
|
||||
msg_info "Checked for new version"
|
||||
|
||||
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"
|
||||
|
||||
if [[ -z "$CURRENT_VERSION" ]] || [[ "$KASM_VERSION" != "$CURRENT_VERSION" ]]; then
|
||||
msg_info "Updating Kasm"
|
||||
cd /tmp
|
||||
|
||||
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."
|
||||
@@ -61,6 +66,10 @@ function update_script() {
|
||||
bash /tmp/kasm_release/upgrade.sh --proxy-port 443
|
||||
rm -rf /tmp/kasm_release
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. Kasm is already at v${KASM_VERSION}"
|
||||
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user