Create jumpserver.sh
This commit is contained in:
parent
3634a863b9
commit
6b02f6cf96
67
ct/jumpserver.sh
Normal file
67
ct/jumpserver.sh
Normal file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: Nícolas Pastorello (opastorello)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://jumpserver.com/
|
||||
|
||||
APP="JumpServer"
|
||||
var_tags="bastion-host;pam"
|
||||
var_cpu="2"
|
||||
var_ram="8192"
|
||||
var_disk="60"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
var_unprivileged="1"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -d /opt/jumpserver ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/jumpserver/installer/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/')
|
||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
msg_info "Updating ${APP} to ${RELEASE}"
|
||||
if [[ -d /opt/jumpserver/config ]]; then
|
||||
msg_info "Backing up /opt/jumpserver/config"
|
||||
cp -r /opt/jumpserver/config /opt/jumpserver_config_backup
|
||||
fi
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
rm -rf /opt/jumpserver
|
||||
cd /opt
|
||||
curl -fsSL "https://github.com/jumpserver/installer/releases/download/${RELEASE}/jumpserver-installer-${RELEASE}.tar.gz" -o jumpserver-installer-${RELEASE}.tar.gz
|
||||
$STD mkdir -p /opt/jumpserver
|
||||
$STD tar -xzvf jumpserver-installer-${RELEASE}.tar.gz -C /opt/jumpserver --strip-components=1
|
||||
if [[ -d /opt/jumpserver_config_backup ]]; then
|
||||
msg_info "Restoring config backup"
|
||||
cp -r /opt/jumpserver_config_backup /opt/jumpserver/config
|
||||
rm -rf /opt/jumpserver_config_backup
|
||||
fi
|
||||
cd /opt/jumpserver
|
||||
yes y | head -n 3 | $STD ./jmsctl.sh upgrade
|
||||
$STD ./jmsctl.sh start
|
||||
rm -rf /opt/jumpserver-installer-${RELEASE}.tar.gz
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}."
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"
|
Loading…
x
Reference in New Issue
Block a user