|
| 1 | +#!/usr/bin/env bash |
| 2 | +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) |
| 3 | +# Copyright (c) 2021-2025 community-scripts ORG |
| 4 | +# Author: Nícolas Pastorello (opastorello) |
| 5 | +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE |
| 6 | +# Source: https://github.com/jumpserver/jumpserver |
| 7 | + |
| 8 | +APP="JumpServer" |
| 9 | +var_tags="bastion-host;pam" |
| 10 | +var_cpu="2" |
| 11 | +var_ram="8192" |
| 12 | +var_disk="60" |
| 13 | +var_os="debian" |
| 14 | +var_version="12" |
| 15 | +var_unprivileged="1" |
| 16 | + |
| 17 | +header_info "$APP" |
| 18 | +variables |
| 19 | +color |
| 20 | +catch_errors |
| 21 | + |
| 22 | +function update_script() { |
| 23 | + header_info |
| 24 | + check_container_storage |
| 25 | + check_container_resources |
| 26 | + |
| 27 | + if [[ ! -d /opt/jumpserver ]]; then |
| 28 | + msg_error "No ${APP} Installation Found!" |
| 29 | + exit |
| 30 | + fi |
| 31 | + RELEASE=$(curl -fsSL https://api.github.com/repos/jumpserver/installer/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') |
| 32 | + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then |
| 33 | + msg_info "Updating ${APP} to ${RELEASE}" |
| 34 | + if [[ -d /opt/jumpserver/config ]]; then |
| 35 | + cp -r /opt/jumpserver/config /opt/jumpserver_config_backup |
| 36 | + fi |
| 37 | + echo "${RELEASE}" >/opt/${APP}_version.txt |
| 38 | + rm -rf /opt/jumpserver |
| 39 | + cd /opt |
| 40 | + curl -fsSL "https://github.com/jumpserver/installer/releases/download/${RELEASE}/jumpserver-installer-${RELEASE}.tar.gz" -o jumpserver-installer-${RELEASE}.tar.gz |
| 41 | + mkdir -p /opt/jumpserver |
| 42 | + $STD tar -xzvf jumpserver-installer-${RELEASE}.tar.gz -C /opt/jumpserver --strip-components=1 |
| 43 | + if [[ -d /opt/jumpserver_config_backup ]]; then |
| 44 | + cp -r /opt/jumpserver_config_backup /opt/jumpserver/config |
| 45 | + rm -rf /opt/jumpserver_config_backup |
| 46 | + fi |
| 47 | + cd /opt/jumpserver |
| 48 | + yes y | head -n 3 | $STD ./jmsctl.sh upgrade |
| 49 | + $STD ./jmsctl.sh start |
| 50 | + rm -rf /opt/jumpserver-installer-${RELEASE}.tar.gz |
| 51 | + msg_ok "Updated Successfully" |
| 52 | + else |
| 53 | + msg_ok "No update required. ${APP} is already at ${RELEASE}." |
| 54 | + fi |
| 55 | + exit |
| 56 | +} |
| 57 | + |
| 58 | +start |
| 59 | +build_container |
| 60 | +description |
| 61 | + |
| 62 | +msg_ok "Completed Successfully!\n" |
| 63 | +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" |
| 64 | +echo -e "${INFO}${YW} Access it using the following URL:${CL}" |
| 65 | +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}" |
0 commit comments