Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cn-quick_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function get_installer() {
echo "download install script to /opt/jumpserver-installer-${VERSION}"
cd /opt || exit 1
if [ ! -d "/opt/jumpserver-installer-${VERSION}" ]; then
timeout 60 wget -qO jumpserver-installer-${VERSION}.tar.gz ${DOWNLOAD_URL}/jumpserver/installer/releases/download/${VERSION}/jumpserver-installer-${VERSION}.tar.gz || {
timeout 60 wget --show-progress -qO jumpserver-installer-${VERSION}.tar.gz ${DOWNLOAD_URL}/jumpserver/installer/releases/download/${VERSION}/jumpserver-installer-${VERSION}.tar.gz || {
rm -f /opt/jumpserver-installer-${VERSION}.tar.gz
echo -e "[\033[31m ERROR \033[0m] Failed to download jumpserver-installer-${VERSION}"
exit 1
Expand Down
2 changes: 2 additions & 0 deletions compose/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ services:
command: start web
env_file:
- ${CONFIG_FILE}
environment:
TIME_ZONE: ${TZ:-Asia/Shanghai}
volumes:
- ${CONFIG_DIR}/certs:/opt/jumpserver/data/certs
- ${VOLUME_DIR}/core/data:/opt/jumpserver/data
Expand Down
1 change: 0 additions & 1 deletion config-example.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,4 @@ USE_LB=1
# The current running version number of JumpServer, automatically generated after installation and upgrade
#
TZ=Asia/Shanghai
TIME_ZONE=Asia/Shanghai
CURRENT_VERSION=
10 changes: 9 additions & 1 deletion jmsctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ function video-worker() {
fi
}

function main() {
function check_os() {
if [[ -n "$UNCHECK_DEPENDENCIES" ]]; then
return 0
fi
if [[ "${OS}" == 'Darwin' ]]; then
echo
echo "$(gettext 'Unsupported Operating System Error')"
Expand All @@ -162,6 +165,11 @@ function main() {
echo "$(gettext 'Windows installer please see'): https://github.com/jumpserver/Dockerfile"
exit 0
fi
return 0
}

function main() {
check_os || return 3

if [[ "${action}" == "help" || "${action}" == "h" || "${action}" == "-h" || "${action}" == "--help" ]]; then
echo ""
Expand Down
2 changes: 1 addition & 1 deletion quick_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function get_installer() {
echo "download install script to /opt/jumpserver-installer-${VERSION}"
cd /opt || exit 1
if [ ! -d "/opt/jumpserver-installer-${VERSION}" ]; then
timeout 60 wget -qO jumpserver-installer-${VERSION}.tar.gz ${DOWNLOAD_URL}/jumpserver/installer/releases/download/${VERSION}/jumpserver-installer-${VERSION}.tar.gz || {
timeout 60 wget --show-progress -qO jumpserver-installer-${VERSION}.tar.gz ${DOWNLOAD_URL}/jumpserver/installer/releases/download/${VERSION}/jumpserver-installer-${VERSION}.tar.gz || {
rm -f /opt/jumpserver-installer-${VERSION}.tar.gz
echo -e "[\033[31m ERROR \033[0m] Failed to download jumpserver-installer-${VERSION}"
exit 1
Expand Down
4 changes: 2 additions & 2 deletions scripts/0_prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function download_and_verify() {
md5_url="${url}.md5"
fi

wget -q "${md5_url}" -O "${md5_target_path}" || {
wget --show-progress -q "${md5_url}" -O "${md5_target_path}" || {
log_error "$(gettext 'Download fails, check the network is normal')"
rm -f "${md5_target_path}"
exit 1
Expand All @@ -38,7 +38,7 @@ function download_and_verify() {
md5_matched=$(check_md5 "${target_path}" "${expected_md5}")
if [[ ! -f "${target_path}" || "${md5_matched}" != "1" ]]; then
echo "$(gettext 'Starting to download'): ${url}"
wget -q "${url}" -O "${target_path}" || {
wget --show-progress -q "${url}" -O "${target_path}" || {
log_error "$(gettext 'Download fails, check the network is normal')"
rm -f "${target_path}" "${md5_target_path}"
exit 1
Expand Down
16 changes: 15 additions & 1 deletion scripts/1_config_jumpserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function set_internal_redis() {
function set_redis() {
echo_yellow "\n4. $(gettext 'Configure Redis')"
redis_engine="redis"
read_from_input redis_engine "$(gettext 'Please enter Redis Engine')?" "redis/sentinel" "${redis_engine}"
read_from_input redis_engine "$(gettext 'Please enter Redis Engine')" "redis/sentinel" "${redis_engine}"

case "${redis_engine}" in
redis)
Expand Down Expand Up @@ -239,6 +239,17 @@ function init_db() {
fi
}

function set_others() {
echo_yellow "\n7. $(gettext 'Configure Others')"
lang=$(get_config LANGUAGE_CODE "zh")
read_from_input lang "$(gettext 'Please enter language')" "zh/en/ja/es/ko/ru/vi" "${lang}"
set_config LANGUAGE_CODE "${lang}"

timezone=$(get_config TZ "Asia/Shanghai")
read_from_input timezone "$(gettext 'Please enter timezone')" "" "${timezone}"
set_config TZ "${timezone}"
}

function main() {
if set_secret_key; then
echo_done
Expand All @@ -255,6 +266,9 @@ function main() {
if set_service; then
echo_done
fi
if set_others; then
echo_done
fi
if init_db; then
echo_done
fi
Expand Down
2 changes: 1 addition & 1 deletion scripts/2_install_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function check_docker_start() {

function check_docker_compose() {
if ! docker compose version &>/dev/null; then
echo_failed
echo_failed "$(gettext 'Docker compose is not installed')"
exit 1
fi
echo_done
Expand Down
3 changes: 3 additions & 0 deletions scripts/4_install_jumpserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
. "${BASE_DIR}/utils.sh"

function pre_install() {
if [[ -n "$UNCHECK_DEPENDENCIES" ]]; then
return 0
fi
if ! command -v systemctl &>/dev/null; then
docker version &>/dev/null || {
log_error "$(gettext 'The current Linux system does not support systemd management. Please deploy docker by yourself before running this script again')"
Expand Down
1 change: 1 addition & 0 deletions scripts/7_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function upgrade_config() {
check_and_set_config "SERVER_HOSTNAME" "${HOSTNAME}"
check_and_set_config "JUMPSERVER_ENABLE_FONT_SMOOTHING" "true"
check_and_set_config "USE_LB" "1"
check_and_set_config "VERIFY_EXTERNAL_SSL" "false"
# XPACK
use_xpack=$(get_config_or_env USE_XPACK)
if [[ "${use_xpack}" == "1" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions scripts/const.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ export DOCKER_VERSION=28.5.1
DOCKER_URL="https://download.docker.com/linux/static/stable"
DOCKER_MIRROR="https://download.jumpserver.org/docker/docker-ce/linux/static/stable"

if [[ "${USE_MIRROR}" == "1" ]];then
if [[ "${DOCKER_IMAGE_MIRROR}" == "1" ]];then
DOCKER_URL=${DOCKER_MIRROR}
fi

export DOCKER_COMPOSE_VERSION=v2.40.3
COMPOSE_URL="https://github.com/docker/compose/releases/download"
COMPOSE_MIRROR="https://download.jumpserver.org/docker/compose/releases/download"
if [[ "${USE_MIRROR}" == "1" ]];then
if [[ "${DOCKER_IMAGE_MIRROR}" == "1" ]];then
COMPOSE_URL=${COMPOSE_MIRROR}
fi

Expand Down
44 changes: 34 additions & 10 deletions scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ function get_config_or_env() {
echo "${value}"
}

function sed_in_place() {
# macOS requires a backup extension for sed -i, even if empty
if [[ "${OS}" == "Darwin" ]]; then
sed -i '' "$@"
else
sed -i "$@"
fi
}

function set_config() {
key=$1
value=$2
Expand All @@ -95,15 +104,15 @@ function set_config() {
return
fi

sed -i "s,^[ \t]*${key}=.*$,${key}=${value},g" "${CONFIG_FILE}"
sed_in_place "s,^[ \t]*${key}=.*$,${key}=${value},g" "${CONFIG_FILE}"
}

function disable_config() {
key=$1

has=$(has_config "${key}")
if [[ ${has} == "1" ]]; then
sed -i "s,^[ \t]*${key}=.*$,# ${key}=,g" "${CONFIG_FILE}"
sed_in_place "s,^[ \t]*${key}=.*$,# ${key}=,g" "${CONFIG_FILE}"
fi
}

Expand Down Expand Up @@ -223,14 +232,21 @@ function read_from_input() {
msg=$2
choices=$3
default=$4
if [[ -n "${choices}" ]]; then
msg="${msg} (${choices}) "
fi
if [[ -z "${default}" ]]; then
msg="${msg} ($(gettext 'no default'))"

if [[ -z "${choices}" && -n "${default}" ]]; then
msg="${msg} [default: ${default}] "
elif [[ "${choices}" == "y/n" ]]; then
if [[ "${default}" == "y" ]]; then
msg="${msg} [Y/n]"
else
msg="${msg} [y/N]"
fi
elif [[ -n "${choices}" && -n "${default}" ]]; then
msg="${msg} [${choices}] (default: ${default})"
else
msg="${msg} ($(gettext 'default') ${default})"
msg="${msg} [${choices}]"
fi

echo -n "${msg}: "
read -r input
if [[ -z "${input}" && -n "${default}" ]]; then
Expand Down Expand Up @@ -289,7 +305,12 @@ function echo_warn() {
}

function echo_failed() {
echo_red "$(gettext 'fail')"
msg="$(gettext 'fail')"
reason=$1
if [[ -n "${reason}" ]]; then
msg="${msg}: ${reason}"
fi
echo_red "${msg}"
}

function log_success() {
Expand Down Expand Up @@ -424,6 +445,9 @@ function get_video_worker_cmd_line() {
}

function prepare_check_required_pkg() {
if [[ -n "$UNCHECK_DEPENDENCIES" ]]; then
return 0
fi
for i in curl wget tar iptables gettext; do
command -v $i &>/dev/null || {
echo_red "$i: $(gettext 'command not found, Please install it first') $i"
Expand Down Expand Up @@ -514,7 +538,7 @@ function prepare_config() {
chmod 644 "${CONFIG_DIR}/mariadb/mariadb.cnf"

if [[ "$(uname -m)" == "aarch64" ]]; then
sed -i "s/# ignore-warnings ARM64-COW-BUG/ignore-warnings ARM64-COW-BUG/g" "${CONFIG_DIR}/redis/redis.conf"
sed_in_place "s/# ignore-warnings ARM64-COW-BUG/ignore-warnings ARM64-COW-BUG/g" "${CONFIG_DIR}/redis/redis.conf"
fi
}

Expand Down