init v1 script (#8)
* init v1 script * . * complete dashboard script * init agent script (posix) * complete agent script (posix)
This commit is contained in:
180
nezha/i18n.sh
Normal file
180
nezha/i18n.sh
Normal file
@ -0,0 +1,180 @@
|
||||
#!/bin/bash
|
||||
|
||||
mapfile -t LANG < <(ls nezha/translations)
|
||||
TEMPLATE="nezha/template.pot"
|
||||
PODIR="nezha/translations/%s/LC_MESSAGES"
|
||||
GIT_ROOT=$(git rev-parse --show-toplevel)
|
||||
|
||||
red='\033[0;31m'
|
||||
green='\033[0;32m'
|
||||
yellow='\033[0;33m'
|
||||
plain='\033[0m'
|
||||
|
||||
err() {
|
||||
printf "${red}%s${plain}\n" "$*" >&2
|
||||
}
|
||||
|
||||
success() {
|
||||
printf "${green}%s${plain}\n" "$*"
|
||||
}
|
||||
|
||||
info() {
|
||||
printf "${yellow}%s${plain}\n" "$*"
|
||||
}
|
||||
|
||||
generate() {
|
||||
case $1 in
|
||||
"template")
|
||||
generate_template
|
||||
;;
|
||||
"en")
|
||||
generate_en
|
||||
;;
|
||||
*)
|
||||
err "invalid argument"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
generate_template() {
|
||||
xgettext -C --add-comments=TRANSLATORS: -k_ --from-code=UTF-8 -o $TEMPLATE ./nezha/template.sh
|
||||
}
|
||||
|
||||
generate_en() {
|
||||
local po_file
|
||||
po_file=$(printf "$PODIR/nezha.po" "en_US")
|
||||
local mo_file
|
||||
mo_file=$(printf "$PODIR/nezha.mo" "en_US")
|
||||
msginit --input=$TEMPLATE --locale=en_US.UTF-8 --output-file="$po_file" --no-translator
|
||||
msgfmt "$po_file" -o "$mo_file"
|
||||
}
|
||||
|
||||
compile() {
|
||||
if [[ $# != 0 && "$1" != "" ]]; then
|
||||
compile_single "$1"
|
||||
else
|
||||
compile_all
|
||||
fi
|
||||
}
|
||||
|
||||
compile_single() {
|
||||
local param="$1"
|
||||
local found=0
|
||||
|
||||
for lang in "${LANG[@]}"; do
|
||||
if [[ "$lang" == "$param" ]]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $found == 0 ]]; then
|
||||
err "the language does not exist."
|
||||
return
|
||||
fi
|
||||
|
||||
local po_file
|
||||
po_file=$(printf "$PODIR/nezha.po" "$param")
|
||||
local mo_file
|
||||
mo_file=$(printf "$PODIR/nezha.mo" "$param")
|
||||
|
||||
msgfmt "$po_file" -o "$mo_file"
|
||||
}
|
||||
|
||||
compile_all() {
|
||||
local po_file
|
||||
local mo_file
|
||||
for lang in "${LANG[@]}"; do
|
||||
po_file=$(printf "$PODIR/nezha.po" "$lang")
|
||||
mo_file=$(printf "$PODIR/nezha.mo" "$lang")
|
||||
|
||||
msgfmt "$po_file" -o "$mo_file"
|
||||
done
|
||||
}
|
||||
|
||||
update() {
|
||||
if [[ $# != 0 && "$1" != "" ]]; then
|
||||
update_single "$1"
|
||||
else
|
||||
update_all
|
||||
fi
|
||||
}
|
||||
|
||||
update_single() {
|
||||
local param="$1"
|
||||
local found=0
|
||||
|
||||
for lang in "${LANG[@]}"; do
|
||||
if [[ "$lang" == "$param" ]]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $found == 0 ]]; then
|
||||
err "the language does not exist."
|
||||
return
|
||||
fi
|
||||
|
||||
local po_file
|
||||
po_file=$(printf "$PODIR/nezha.po" "$param")
|
||||
msgmerge -U "$po_file" $TEMPLATE
|
||||
}
|
||||
|
||||
update_all() {
|
||||
for lang in "${LANG[@]}"; do
|
||||
local po_file
|
||||
po_file=$(printf "$PODIR/nezha.po" "$lang")
|
||||
msgmerge -U "$po_file" $TEMPLATE
|
||||
done
|
||||
}
|
||||
|
||||
show_help() {
|
||||
echo "Usage: $0 [command] args"
|
||||
echo ""
|
||||
echo "Available commands:"
|
||||
echo " update Update .po from .pot"
|
||||
echo " compile Compile .mo from .po"
|
||||
echo " generate Generate template or en_US locale"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 update # Update all locales"
|
||||
echo " $0 update zh_CN # Update zh_CN locale"
|
||||
echo " $0 compile # Compile all locales"
|
||||
echo " $0 compile zh_CN # Compile zh_CN locale"
|
||||
echo " $0 generate template # Generate template"
|
||||
echo " $0 generate en # Generate en_US locale"
|
||||
}
|
||||
|
||||
version() { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
|
||||
|
||||
main() {
|
||||
if [[ $(version "$BASH_VERSION") < $(version "4.0") ]]; then
|
||||
err "This version of bash does not support mapfile"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $PWD != "$GIT_ROOT" ]]; then
|
||||
err "Must execute in the project root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
"update")
|
||||
update "$2"
|
||||
;;
|
||||
"compile")
|
||||
compile "$2"
|
||||
;;
|
||||
"generate")
|
||||
generate "$2"
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown command '$1'"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
289
nezha/template.pot
Normal file
289
nezha/template.pot
Normal file
@ -0,0 +1,289 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-11-29 21:03+0800\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: nezha/template.sh:35
|
||||
msgid ""
|
||||
"ERROR: sudo is not installed on the system, the action cannot be proceeded."
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:47
|
||||
msgid "Run '$*' failed."
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:57
|
||||
msgid "$dep not found, please install it first."
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:117
|
||||
msgid "Unknown architecture: $uname"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:130 nezha/template.sh:144
|
||||
msgid "Docker image with nezha-dashboard repository exists:"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:136 nezha/template.sh:150
|
||||
msgid "No Docker images with the nezha-dashboard repository were found."
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:163
|
||||
msgid "Select your installation method:"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:165
|
||||
msgid "2. Standalone"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:167
|
||||
msgid "Please enter [1-2]: "
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:179
|
||||
msgid "Please enter the correct number [1-2]"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:196
|
||||
msgid ""
|
||||
"According to the information provided by various geoip api, the current IP "
|
||||
"may be in China"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:197
|
||||
msgid ""
|
||||
"Will the installation be done with a Chinese Mirror? [Y/n] (Custom Mirror "
|
||||
"Input 3): "
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:201
|
||||
msgid "Use Chinese Mirror"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:206 nezha/template.sh:220
|
||||
msgid "Do Not Use Chinese Mirror"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:210
|
||||
msgid "Use Custom Mirror"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:211
|
||||
msgid ""
|
||||
"Please enter a custom image (e.g. :dn-dao-github-mirror.daocloud.io). If "
|
||||
"left blank, it won't be used: "
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:244
|
||||
msgid "> Update Script"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:246
|
||||
msgid "https://${GITHUB_RAW_URL}/install_en.sh"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:249
|
||||
msgid "Execute new script after 3s"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:257
|
||||
msgid "* Press Enter to return to the main menu *"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:262
|
||||
msgid "> Install"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:268
|
||||
msgid ""
|
||||
"You may have already installed the dashboard, repeated installation will "
|
||||
"overwrite the data, please pay attention to backup."
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:269
|
||||
msgid "Exit the installation? [Y/n]"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:273 nezha/template.sh:281
|
||||
msgid "Exit the installation"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:277
|
||||
msgid "Continue"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:295
|
||||
msgid "Modify Configuration"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:299
|
||||
msgid "Download Docker Script"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:302 nezha/template.sh:313
|
||||
msgid ""
|
||||
"Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:306
|
||||
msgid ""
|
||||
"Please install docker-compose manually. https://docs.docker.com/compose/"
|
||||
"install/linux/"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:318
|
||||
msgid "Please enter the site title: "
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:320
|
||||
msgid "Please enter the exposed port: (default 8008)"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:322
|
||||
msgid "Please specify the backend locale"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:327
|
||||
msgid "Please enter [1-3]: "
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:343
|
||||
msgid "Please enter the correct number [1-3]"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:349
|
||||
msgid "All options cannot be empty"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:373
|
||||
msgid "Downloading service file"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:377 nezha/template.sh:383
|
||||
msgid ""
|
||||
"File failed to get, please check if the network can link ${GITHUB_RAW_URL}"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:391
|
||||
msgid ""
|
||||
"Dashboard configuration modified successfully, please wait for Dashboard "
|
||||
"self-restart to take effect"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:401
|
||||
msgid "> Restart and Update"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:410
|
||||
msgid "Nezha Monitoring Restart Successful"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:411
|
||||
msgid "Default address: domain:site_access_port"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:413
|
||||
msgid ""
|
||||
"The restart failed, probably because the boot time exceeded two seconds, "
|
||||
"please check the log information later"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:440
|
||||
msgid ""
|
||||
"Fail to obtain Dashboard version, please check if the network can link "
|
||||
"https://api.github.com/repos/nezhahq/nezha/releases/latest"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:443
|
||||
msgid "The current latest version is: ${_version}"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:472
|
||||
msgid "> View Log"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:498
|
||||
msgid "> Uninstall"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:537
|
||||
msgid "Nezha Monitor Management Script Usage: "
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:539
|
||||
msgid "./nezha.sh - Show Menu"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:540
|
||||
msgid "./nezha.sh install - Install Dashboard"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:541
|
||||
msgid "./nezha.sh modify_config - Modify Dashboard Configuration"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:542
|
||||
msgid "./nezha.sh restart_and_update - Restart and Update the Dashboard"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:543
|
||||
msgid "./nezha.sh show_log - View Dashboard Log"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:544
|
||||
msgid "./nezha.sh uninstall - Uninstall Dashboard"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:549
|
||||
msgid "${green}Nezha Monitor Management Script${plain}"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:551
|
||||
msgid "${green}1.${plain} Install Dashboard"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:552
|
||||
msgid "${green}2.${plain} Modify Dashboard Configuration"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:553
|
||||
msgid "${green}3.${plain} Restart and Update Dashboard"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:554
|
||||
msgid "${green}4.${plain} View Dashboard Log"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:555
|
||||
msgid "${green}5.${plain} Uninstall Dashboard"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:557
|
||||
msgid "${green}6.${plain} Update Script"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:559
|
||||
msgid "${green}0.${plain} Exit Script"
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:561
|
||||
msgid "Please enter [0-6]: "
|
||||
msgstr ""
|
||||
|
||||
#: nezha/template.sh:585
|
||||
msgid "Please enter the correct number [0-6]"
|
||||
msgstr ""
|
||||
617
nezha/template.sh
Normal file
617
nezha/template.sh
Normal file
@ -0,0 +1,617 @@
|
||||
#!/bin/sh
|
||||
|
||||
NZ_BASE_PATH="/opt/nezha"
|
||||
NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
|
||||
NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service"
|
||||
NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard"
|
||||
|
||||
red='\033[0;31m'
|
||||
green='\033[0;32m'
|
||||
yellow='\033[0;33m'
|
||||
plain='\033[0m'
|
||||
|
||||
err() {
|
||||
printf "${red}%s${plain}\n" "$*" >&2
|
||||
}
|
||||
|
||||
success() {
|
||||
printf "${green}%s${plain}\n" "$*"
|
||||
}
|
||||
|
||||
info() {
|
||||
printf "${yellow}%s${plain}\n" "$*"
|
||||
}
|
||||
|
||||
println() {
|
||||
printf "$*\n"
|
||||
}
|
||||
|
||||
sudo() {
|
||||
myEUID=$(id -ru)
|
||||
if [ "$myEUID" -ne 0 ]; then
|
||||
if command -v sudo > /dev/null 2>&1; then
|
||||
command sudo "$@"
|
||||
else
|
||||
err _("ERROR: sudo is not installed on the system, the action cannot be proceeded.")
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
mustn() {
|
||||
set -- "$@"
|
||||
|
||||
if ! "$@" >/dev/null 2>&1; then
|
||||
err _("Run '$*' failed.")
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
deps_check() {
|
||||
deps="curl wget unzip grep"
|
||||
set -- "$api_list"
|
||||
for dep in $deps; do
|
||||
if ! command -v "$dep" >/dev/null 2>&1; then
|
||||
err _("$dep not found, please install it first.")
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check_init() {
|
||||
init=$(readlink /sbin/init)
|
||||
case "$init" in
|
||||
*systemd*)
|
||||
INIT=systemd
|
||||
;;
|
||||
*openrc-init*|*busybox*)
|
||||
INIT=openrc
|
||||
;;
|
||||
*)
|
||||
err "Unknown init"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
geo_check() {
|
||||
api_list="https://blog.cloudflare.com/cdn-cgi/trace https://developers.cloudflare.com/cdn-cgi/trace"
|
||||
ua="Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0"
|
||||
set -- "$api_list"
|
||||
for url in $api_list; do
|
||||
text="$(curl -A "$ua" -m 10 -s "$url")"
|
||||
endpoint="$(echo "$text" | sed -n 's/.*h=\([^ ]*\).*/\1/p')"
|
||||
if echo "$text" | grep -qw 'CN'; then
|
||||
isCN=true
|
||||
break
|
||||
elif echo "$url" | grep -q "$endpoint"; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
env_check() {
|
||||
uname=$(uname -m)
|
||||
case "$uname" in
|
||||
amd64)
|
||||
os_arch="amd64"
|
||||
;;
|
||||
i386|i686)
|
||||
os_arch="386"
|
||||
;;
|
||||
aarch64|arm64)
|
||||
os_arch="arm64"
|
||||
;;
|
||||
*arm*)
|
||||
os_arch="arm"
|
||||
;;
|
||||
s390x)
|
||||
os_arch="s390x"
|
||||
;;
|
||||
riscv64)
|
||||
os_arch="riscv64"
|
||||
;;
|
||||
*)
|
||||
err _("Unknown architecture: $uname")
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
installation_check() {
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
DOCKER_COMPOSE_COMMAND="docker compose"
|
||||
if sudo $DOCKER_COMPOSE_COMMAND ls | grep -qw "$NZ_DASHBOARD_PATH/docker-compose.yaml" >/dev/null 2>&1; then
|
||||
NEZHA_IMAGES=$(sudo docker images --format "{{.Repository}}":"{{.Tag}}" | grep -w "nezha-dashboard")
|
||||
if [ -n "$NEZHA_IMAGES" ]; then
|
||||
echo _("Docker image with nezha-dashboard repository exists:")
|
||||
echo "$NEZHA_IMAGES"
|
||||
IS_DOCKER_NEZHA=1
|
||||
FRESH_INSTALL=0
|
||||
return
|
||||
else
|
||||
echo _("No Docker images with the nezha-dashboard repository were found.")
|
||||
fi
|
||||
fi
|
||||
elif command -v docker-compose >/dev/null 2>&1; then
|
||||
DOCKER_COMPOSE_COMMAND="docker-compose"
|
||||
if sudo $DOCKER_COMPOSE_COMMAND -f "$NZ_DASHBOARD_PATH/docker-compose.yaml" config >/dev/null 2>&1; then
|
||||
NEZHA_IMAGES=$(sudo docker images --format "{{.Repository}}":"{{.Tag}}" | grep -w "nezha-dashboard")
|
||||
if [ -n "$NEZHA_IMAGES" ]; then
|
||||
echo _("Docker image with nezha-dashboard repository exists:")
|
||||
echo "$NEZHA_IMAGES"
|
||||
IS_DOCKER_NEZHA=1
|
||||
FRESH_INSTALL=0
|
||||
return
|
||||
else
|
||||
echo _("No Docker images with the nezha-dashboard repository were found.")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "$NZ_DASHBOARD_PATH/app" ]; then
|
||||
IS_DOCKER_NEZHA=0
|
||||
FRESH_INSTALL=0
|
||||
fi
|
||||
}
|
||||
|
||||
select_version() {
|
||||
if [ -z "$IS_DOCKER_NEZHA" ]; then
|
||||
info _("Select your installation method:")
|
||||
info "1. Docker"
|
||||
info _("2. Standalone")
|
||||
while true; do
|
||||
printf _("Please enter [1-2]: ")
|
||||
read -r option
|
||||
case "${option}" in
|
||||
1)
|
||||
IS_DOCKER_NEZHA=1
|
||||
break
|
||||
;;
|
||||
2)
|
||||
IS_DOCKER_NEZHA=0
|
||||
break
|
||||
;;
|
||||
*)
|
||||
err _("Please enter the correct number [1-2]")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
init() {
|
||||
deps_check
|
||||
check_init
|
||||
env_check
|
||||
installation_check
|
||||
|
||||
## China_IP
|
||||
if [ -z "$CN" ]; then
|
||||
geo_check
|
||||
if [ -n "$isCN" ]; then
|
||||
echo _("According to the information provided by various geoip api, the current IP may be in China")
|
||||
printf _("Will the installation be done with a Chinese Mirror? [Y/n] (Custom Mirror Input 3): ")
|
||||
read -r input
|
||||
case $input in
|
||||
[yY][eE][sS] | [yY])
|
||||
echo _("Use Chinese Mirror")
|
||||
CN=true
|
||||
;;
|
||||
|
||||
[nN][oO] | [nN])
|
||||
echo _("Do Not Use Chinese Mirror")
|
||||
;;
|
||||
|
||||
[3])
|
||||
echo _("Use Custom Mirror")
|
||||
printf _("Please enter a custom image (e.g. :dn-dao-github-mirror.daocloud.io). If left blank, it won't be used: ")
|
||||
read -r input
|
||||
case $input in
|
||||
*)
|
||||
CUSTOM_MIRROR=$input
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo _("Do Not Use Chinese Mirror")
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$CUSTOM_MIRROR" ]; then
|
||||
GITHUB_RAW_URL="gitee.com/naibahq/scripts/raw/main"
|
||||
GITHUB_URL=$CUSTOM_MIRROR
|
||||
Docker_IMG="registry.cn-shanghai.aliyuncs.com\/naibahq\/nezha-dashboard"
|
||||
else
|
||||
if [ -z "$CN" ]; then
|
||||
GITHUB_RAW_URL="raw.githubusercontent.com/nezhahq/scripts/main"
|
||||
GITHUB_URL="github.com"
|
||||
Docker_IMG="ghcr.io\/nezhahq\/nezha"
|
||||
else
|
||||
GITHUB_RAW_URL="gitee.com/naibahq/scripts/raw/main"
|
||||
GITHUB_URL="gitee.com"
|
||||
Docker_IMG="registry.cn-shanghai.aliyuncs.com\/naibahq\/nezha-dashboard"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
update_script() {
|
||||
echo _("> Update Script")
|
||||
|
||||
curl -sL _("https://${GITHUB_RAW_URL}/install_en.sh") -o /tmp/nezha.sh
|
||||
mv -f /tmp/nezha.sh ./nezha.sh && chmod a+x ./nezha.sh
|
||||
|
||||
echo _("Execute new script after 3s")
|
||||
sleep 3s
|
||||
clear
|
||||
exec ./nezha.sh
|
||||
exit 0
|
||||
}
|
||||
|
||||
before_show_menu() {
|
||||
echo && info _("* Press Enter to return to the main menu *") && read temp
|
||||
show_menu
|
||||
}
|
||||
|
||||
install() {
|
||||
echo _("> Install")
|
||||
|
||||
# Nezha Monitoring Folder
|
||||
if [ ! "$FRESH_INSTALL" = 0 ]; then
|
||||
sudo mkdir -p $NZ_DASHBOARD_PATH
|
||||
else
|
||||
echo _("You may have already installed the dashboard, repeated installation will overwrite the data, please pay attention to backup.")
|
||||
printf _("Exit the installation? [Y/n]")
|
||||
read -r input
|
||||
case $input in
|
||||
[yY][eE][sS] | [yY])
|
||||
echo _("Exit the installation")
|
||||
exit 0
|
||||
;;
|
||||
[nN][oO] | [nN])
|
||||
echo _("Continue")
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo _("Exit the installation")
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
modify_config 0
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
before_show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
modify_config() {
|
||||
echo _("Modify Configuration")
|
||||
|
||||
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
|
||||
if [ -n "$DOCKER_COMPOSE_COMMAND" ]; then
|
||||
echo _("Download Docker Script")
|
||||
_cmd="wget -t 2 -T 60 -O /tmp/nezha-docker-compose.yaml https://${GITHUB_RAW_URL}/extras/docker-compose.yaml >/dev/null 2>&1"
|
||||
if ! eval "$_cmd"; then
|
||||
err _("Script failed to get, please check if the network can link ${GITHUB_RAW_URL}")
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
err _("Please install docker-compose manually. https://docs.docker.com/compose/install/linux/")
|
||||
before_show_menu
|
||||
fi
|
||||
fi
|
||||
|
||||
_cmd="wget -t 2 -T 60 -O /tmp/nezha-config.yaml https://${GITHUB_RAW_URL}/extras/config.yaml >/dev/null 2>&1"
|
||||
if ! eval "$_cmd"; then
|
||||
err _("Script failed to get, please check if the network can link ${GITHUB_RAW_URL}")
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
||||
printf _("Please enter the site title: ")
|
||||
read -r nz_site_title
|
||||
printf _("Please enter the exposed port: (default 8008)")
|
||||
read -r nz_port
|
||||
info _("Please specify the backend locale")
|
||||
info "1. 中文(简体)"
|
||||
info "2. 中文(台灣)"
|
||||
info "3. English"
|
||||
while true; do
|
||||
printf _("Please enter [1-3]: ")
|
||||
read -r option
|
||||
case "${option}" in
|
||||
1)
|
||||
nz_lang=zh_CN
|
||||
break
|
||||
;;
|
||||
2)
|
||||
nz_lang=zh_TW
|
||||
break
|
||||
;;
|
||||
3)
|
||||
nz_lang=en_US
|
||||
break
|
||||
;;
|
||||
*)
|
||||
err _("Please enter the correct number [1-3]")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$nz_lang" ] || [ -z "$nz_site_title" ]; then
|
||||
err _("All options cannot be empty")
|
||||
before_show_menu
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "$nz_port" ]; then
|
||||
nz_port=8008
|
||||
fi
|
||||
|
||||
sed -i "s/nz_port/${nz_port}/" /tmp/nezha-config.yaml
|
||||
sed -i "s/nz_language/${nz_lang}/" /tmp/nezha-config.yaml
|
||||
sed -i "s/nz_site_title/${nz_site_title}/" /tmp/nezha-config.yaml
|
||||
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
|
||||
sed -i "s/nz_port/${nz_port}/g" /tmp/nezha-docker-compose.yaml
|
||||
sed -i "s/nz_image_url/${Docker_IMG}/" /tmp/nezha-docker-compose.yaml
|
||||
fi
|
||||
|
||||
sudo mkdir -p $NZ_DASHBOARD_PATH/data
|
||||
sudo mv -f /tmp/nezha-config.yaml ${NZ_DASHBOARD_PATH}/data/config.yaml
|
||||
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
|
||||
sudo mv -f /tmp/nezha-docker-compose.yaml ${NZ_DASHBOARD_PATH}/docker-compose.yaml
|
||||
fi
|
||||
|
||||
if [ "$IS_DOCKER_NEZHA" = 0 ]; then
|
||||
echo _("Downloading service file")
|
||||
if [ "$INIT" = "systemd" ]; then
|
||||
_download="sudo wget -t 2 -T 60 -O $NZ_DASHBOARD_SERVICE https://${GITHUB_RAW_URL}/services/nezha-dashboard.service >/dev/null 2>&1"
|
||||
if ! eval "$_download"; then
|
||||
err _("File failed to get, please check if the network can link ${GITHUB_RAW_URL}")
|
||||
return 0
|
||||
fi
|
||||
elif [ "$INIT" = "openrc" ]; then
|
||||
_download="sudo wget -t 2 -T 60 -O $NZ_DASHBOARD_SERVICERC https://${GITHUB_RAW_URL}/services/nezha-dashboard >/dev/null 2>&1"
|
||||
if ! eval "$_download"; then
|
||||
err _("File failed to get, please check if the network can link ${GITHUB_RAW_URL}")
|
||||
return 0
|
||||
fi
|
||||
sudo chmod +x $NZ_DASHBOARD_SERVICERC
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
success _("Dashboard configuration modified successfully, please wait for Dashboard self-restart to take effect")
|
||||
|
||||
restart_and_update
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
before_show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
restart_and_update() {
|
||||
echo _("> Restart and Update")
|
||||
|
||||
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
|
||||
_cmd="restart_and_update_docker"
|
||||
elif [ "$IS_DOCKER_NEZHA" = 0 ]; then
|
||||
_cmd="restart_and_update_standalone"
|
||||
fi
|
||||
|
||||
if eval "$_cmd"; then
|
||||
success _("Nezha Monitoring Restart Successful")
|
||||
info _("Default address: domain:site_access_port")
|
||||
else
|
||||
err _("The restart failed, probably because the boot time exceeded two seconds, please check the log information later")
|
||||
fi
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
before_show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
restart_and_update_docker() {
|
||||
sudo $DOCKER_COMPOSE_COMMAND -f ${NZ_DASHBOARD_PATH}/docker-compose.yaml pull
|
||||
sudo $DOCKER_COMPOSE_COMMAND -f ${NZ_DASHBOARD_PATH}/docker-compose.yaml down
|
||||
sudo $DOCKER_COMPOSE_COMMAND -f ${NZ_DASHBOARD_PATH}/docker-compose.yaml up -d
|
||||
}
|
||||
|
||||
restart_and_update_standalone() {
|
||||
_version=$(curl -m 10 -sL "https://api.github.com/repos/nezhahq/nezha/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
|
||||
if [ -z "$_version" ]; then
|
||||
_version=$(curl -m 10 -sL "https://fastly.jsdelivr.net/gh/nezhahq/nezha/" | grep "option\.value" | awk -F "'" '{print $2}' | sed 's/nezhahq\/nezha@/v/g')
|
||||
fi
|
||||
if [ -z "$_version" ]; then
|
||||
_version=$(curl -m 10 -sL "https://gcore.jsdelivr.net/gh/nezhahq/nezha/" | grep "option\.value" | awk -F "'" '{print $2}' | sed 's/nezhahq\/nezha@/v/g')
|
||||
fi
|
||||
if [ -z "$_version" ]; then
|
||||
_version=$(curl -m 10 -sL "https://gitee.com/api/v5/repos/naibahq/nezha/releases/latest" | awk -F '"' '{for(i=1;i<=NF;i++){if($i=="tag_name"){print $(i+2)}}}')
|
||||
fi
|
||||
|
||||
if [ -z "$_version" ]; then
|
||||
err _("Fail to obtain Dashboard version, please check if the network can link https://api.github.com/repos/nezhahq/nezha/releases/latest")
|
||||
return 1
|
||||
else
|
||||
echo _("The current latest version is: ${_version}")
|
||||
fi
|
||||
|
||||
if [ "$INIT" = "systemd" ]; then
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl stop nezha-dashboard
|
||||
elif [ "$INIT" = "openrc" ]; then
|
||||
sudo rc-service nezha-dashboard stop
|
||||
fi
|
||||
|
||||
if [ -z "$CN" ]; then
|
||||
NZ_DASHBOARD_URL="https://${GITHUB_URL}/nezhahq/nezha/releases/download/${_version}/dashboard-linux-${os_arch}.zip"
|
||||
else
|
||||
NZ_DASHBOARD_URL="https://${GITHUB_URL}/naibahq/nezha/releases/download/${_version}/dashboard-linux-${os_arch}.zip"
|
||||
fi
|
||||
|
||||
sudo wget -qO $NZ_DASHBOARD_PATH/app.zip "$NZ_DASHBOARD_URL" >/dev/null 2>&1 && sudo unzip -qq -o $NZ_DASHBOARD_PATH/app.zip -d $NZ_DASHBOARD_PATH && sudo mv $NZ_DASHBOARD_PATH/dashboard-linux-$os_arch $NZ_DASHBOARD_PATH/app && sudo rm $NZ_DASHBOARD_PATH/app.zip
|
||||
sudo chmod +x $NZ_DASHBOARD_PATH/app
|
||||
|
||||
if [ "$INIT" = "systemd" ]; then
|
||||
sudo systemctl enable nezha-dashboard
|
||||
sudo systemctl restart nezha-dashboard
|
||||
elif [ "$INIT" = "openrc" ]; then
|
||||
sudo rc-update add nezha-dashboard
|
||||
sudo rc-service nezha-dashboard restart
|
||||
fi
|
||||
}
|
||||
|
||||
show_log() {
|
||||
echo _("> View Log")
|
||||
|
||||
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
|
||||
show_dashboard_log_docker
|
||||
elif [ "$IS_DOCKER_NEZHA" = 0 ]; then
|
||||
show_dashboard_log_standalone
|
||||
fi
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
before_show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
show_dashboard_log_docker() {
|
||||
sudo $DOCKER_COMPOSE_COMMAND -f ${NZ_DASHBOARD_PATH}/docker-compose.yaml logs -f
|
||||
}
|
||||
|
||||
show_dashboard_log_standalone() {
|
||||
if [ "$INIT" = "systemd" ]; then
|
||||
sudo journalctl -xf -u nezha-dashboard.service
|
||||
elif [ "$INIT" = "openrc" ]; then
|
||||
sudo tail -n 10 /var/log/nezha-dashboard.err
|
||||
fi
|
||||
}
|
||||
|
||||
uninstall() {
|
||||
echo _("> Uninstall")
|
||||
|
||||
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
|
||||
uninstall_dashboard_docker
|
||||
elif [ "$IS_DOCKER_NEZHA" = 0 ]; then
|
||||
uninstall_dashboard_standalone
|
||||
fi
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
before_show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
uninstall_dashboard_docker() {
|
||||
sudo $DOCKER_COMPOSE_COMMAND -f ${NZ_DASHBOARD_PATH}/docker-compose.yaml down
|
||||
sudo rm -rf $NZ_DASHBOARD_PATH
|
||||
sudo docker rmi -f ghcr.io/nezhahq/nezha >/dev/null 2>&1
|
||||
sudo docker rmi -f registry.cn-shanghai.aliyuncs.com/naibahq/nezha-dashboard >/dev/null 2>&1
|
||||
}
|
||||
|
||||
uninstall_dashboard_standalone() {
|
||||
sudo rm -rf $NZ_DASHBOARD_PATH
|
||||
|
||||
if [ "$INIT" = "systemd" ]; then
|
||||
sudo systemctl disable nezha-dashboard
|
||||
sudo systemctl stop nezha-dashboard
|
||||
elif [ "$INIT" = "openrc" ]; then
|
||||
sudo rc-update del nezha-dashboard
|
||||
sudo rc-service nezha-dashboard stop
|
||||
fi
|
||||
|
||||
if [ "$INIT" = "systemd" ]; then
|
||||
sudo rm $NZ_DASHBOARD_SERVICE
|
||||
elif [ "$INIT" = "openrc" ]; then
|
||||
sudo rm $NZ_DASHBOARD_SERVICERC
|
||||
fi
|
||||
}
|
||||
|
||||
show_usage() {
|
||||
echo _("Nezha Monitor Management Script Usage: ")
|
||||
echo "--------------------------------------------------------"
|
||||
echo _("./nezha.sh - Show Menu")
|
||||
echo _("./nezha.sh install - Install Dashboard")
|
||||
echo _("./nezha.sh modify_config - Modify Dashboard Configuration")
|
||||
echo _("./nezha.sh restart_and_update - Restart and Update the Dashboard")
|
||||
echo _("./nezha.sh show_log - View Dashboard Log")
|
||||
echo _("./nezha.sh uninstall - Uninstall Dashboard")
|
||||
echo "--------------------------------------------------------"
|
||||
}
|
||||
|
||||
show_menu() {
|
||||
println _("${green}Nezha Monitor Management Script${plain}")
|
||||
echo "--- https://github.com/nezhahq/nezha ---"
|
||||
println _("${green}1.${plain} Install Dashboard")
|
||||
println _("${green}2.${plain} Modify Dashboard Configuration")
|
||||
println _("${green}3.${plain} Restart and Update Dashboard")
|
||||
println _("${green}4.${plain} View Dashboard Log")
|
||||
println _("${green}5.${plain} Uninstall Dashboard")
|
||||
echo "————————————————-"
|
||||
println _("${green}6.${plain} Update Script")
|
||||
echo "————————————————-"
|
||||
println _("${green}0.${plain} Exit Script")
|
||||
|
||||
echo && printf _("Please enter [0-6]: ") && read -r num
|
||||
case "${num}" in
|
||||
0)
|
||||
exit 0
|
||||
;;
|
||||
1)
|
||||
install
|
||||
;;
|
||||
2)
|
||||
modify_config
|
||||
;;
|
||||
3)
|
||||
restart_and_update
|
||||
;;
|
||||
4)
|
||||
show_log
|
||||
;;
|
||||
5)
|
||||
uninstall
|
||||
;;
|
||||
6)
|
||||
update_script
|
||||
;;
|
||||
*)
|
||||
err _("Please enter the correct number [0-6]")
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
init
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
case $1 in
|
||||
"install")
|
||||
install 0
|
||||
;;
|
||||
"modify_config")
|
||||
modify_config 0
|
||||
;;
|
||||
"restart_and_update")
|
||||
restart_and_update 0
|
||||
;;
|
||||
"show_log")
|
||||
show_log 0
|
||||
;;
|
||||
"uninstall")
|
||||
uninstall 0
|
||||
;;
|
||||
"update_script")
|
||||
update_script 0
|
||||
;;
|
||||
*) show_usage ;;
|
||||
esac
|
||||
else
|
||||
select_version
|
||||
show_menu
|
||||
fi
|
||||
BIN
nezha/translations/en_US/LC_MESSAGES/nezha.mo
Normal file
BIN
nezha/translations/en_US/LC_MESSAGES/nezha.mo
Normal file
Binary file not shown.
308
nezha/translations/en_US/LC_MESSAGES/nezha.po
Normal file
308
nezha/translations/en_US/LC_MESSAGES/nezha.po
Normal file
@ -0,0 +1,308 @@
|
||||
# English translations for PACKAGE package.
|
||||
# Copyright (C) 2024 THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# Automatically generated, 2024.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-11-29 21:03+0800\n"
|
||||
"PO-Revision-Date: 2024-11-29 21:03+0800\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: en_US\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: nezha/template.sh:35
|
||||
msgid ""
|
||||
"ERROR: sudo is not installed on the system, the action cannot be proceeded."
|
||||
msgstr ""
|
||||
"ERROR: sudo is not installed on the system, the action cannot be proceeded."
|
||||
|
||||
#: nezha/template.sh:47
|
||||
msgid "Run '$*' failed."
|
||||
msgstr "Run '$*' failed."
|
||||
|
||||
#: nezha/template.sh:57
|
||||
msgid "$dep not found, please install it first."
|
||||
msgstr "$dep not found, please install it first."
|
||||
|
||||
#: nezha/template.sh:117
|
||||
msgid "Unknown architecture: $uname"
|
||||
msgstr "Unknown architecture: $uname"
|
||||
|
||||
#: nezha/template.sh:130 nezha/template.sh:144
|
||||
msgid "Docker image with nezha-dashboard repository exists:"
|
||||
msgstr "Docker image with nezha-dashboard repository exists:"
|
||||
|
||||
#: nezha/template.sh:136 nezha/template.sh:150
|
||||
msgid "No Docker images with the nezha-dashboard repository were found."
|
||||
msgstr "No Docker images with the nezha-dashboard repository were found."
|
||||
|
||||
#: nezha/template.sh:163
|
||||
msgid "Select your installation method:"
|
||||
msgstr "Select your installation method:"
|
||||
|
||||
#: nezha/template.sh:165
|
||||
msgid "2. Standalone"
|
||||
msgstr "2. Standalone"
|
||||
|
||||
#: nezha/template.sh:167
|
||||
msgid "Please enter [1-2]: "
|
||||
msgstr "Please enter [1-2]: "
|
||||
|
||||
#: nezha/template.sh:179
|
||||
msgid "Please enter the correct number [1-2]"
|
||||
msgstr "Please enter the correct number [1-2]"
|
||||
|
||||
#: nezha/template.sh:196
|
||||
msgid ""
|
||||
"According to the information provided by various geoip api, the current IP "
|
||||
"may be in China"
|
||||
msgstr ""
|
||||
"According to the information provided by various geoip api, the current IP "
|
||||
"may be in China"
|
||||
|
||||
#: nezha/template.sh:197
|
||||
msgid ""
|
||||
"Will the installation be done with a Chinese Mirror? [Y/n] (Custom Mirror "
|
||||
"Input 3): "
|
||||
msgstr ""
|
||||
"Will the installation be done with a Chinese Mirror? [Y/n] (Custom Mirror "
|
||||
"Input 3): "
|
||||
|
||||
#: nezha/template.sh:201
|
||||
msgid "Use Chinese Mirror"
|
||||
msgstr "Use Chinese Mirror"
|
||||
|
||||
#: nezha/template.sh:206 nezha/template.sh:220
|
||||
msgid "Do Not Use Chinese Mirror"
|
||||
msgstr "Do Not Use Chinese Mirror"
|
||||
|
||||
#: nezha/template.sh:210
|
||||
msgid "Use Custom Mirror"
|
||||
msgstr "Use Custom Mirror"
|
||||
|
||||
#: nezha/template.sh:211
|
||||
msgid ""
|
||||
"Please enter a custom image (e.g. :dn-dao-github-mirror.daocloud.io). If "
|
||||
"left blank, it won't be used: "
|
||||
msgstr ""
|
||||
"Please enter a custom image (e.g. :dn-dao-github-mirror.daocloud.io). If "
|
||||
"left blank, it won't be used: "
|
||||
|
||||
#: nezha/template.sh:244
|
||||
msgid "> Update Script"
|
||||
msgstr "> Update Script"
|
||||
|
||||
#: nezha/template.sh:246
|
||||
msgid "https://${GITHUB_RAW_URL}/install_en.sh"
|
||||
msgstr "https://${GITHUB_RAW_URL}/install_en.sh"
|
||||
|
||||
#: nezha/template.sh:249
|
||||
msgid "Execute new script after 3s"
|
||||
msgstr "Execute new script after 3s"
|
||||
|
||||
#: nezha/template.sh:257
|
||||
msgid "* Press Enter to return to the main menu *"
|
||||
msgstr "* Press Enter to return to the main menu *"
|
||||
|
||||
#: nezha/template.sh:262
|
||||
msgid "> Install"
|
||||
msgstr "> Install"
|
||||
|
||||
#: nezha/template.sh:268
|
||||
msgid ""
|
||||
"You may have already installed the dashboard, repeated installation will "
|
||||
"overwrite the data, please pay attention to backup."
|
||||
msgstr ""
|
||||
"You may have already installed the dashboard, repeated installation will "
|
||||
"overwrite the data, please pay attention to backup."
|
||||
|
||||
#: nezha/template.sh:269
|
||||
msgid "Exit the installation? [Y/n]"
|
||||
msgstr "Exit the installation? [Y/n]"
|
||||
|
||||
#: nezha/template.sh:273 nezha/template.sh:281
|
||||
msgid "Exit the installation"
|
||||
msgstr "Exit the installation"
|
||||
|
||||
#: nezha/template.sh:277
|
||||
msgid "Continue"
|
||||
msgstr "Continue"
|
||||
|
||||
#: nezha/template.sh:295
|
||||
msgid "Modify Configuration"
|
||||
msgstr "Modify Configuration"
|
||||
|
||||
#: nezha/template.sh:299
|
||||
msgid "Download Docker Script"
|
||||
msgstr "Download Docker Script"
|
||||
|
||||
#: nezha/template.sh:302 nezha/template.sh:313
|
||||
msgid ""
|
||||
"Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
|
||||
msgstr ""
|
||||
"Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
|
||||
|
||||
#: nezha/template.sh:306
|
||||
msgid ""
|
||||
"Please install docker-compose manually. https://docs.docker.com/compose/"
|
||||
"install/linux/"
|
||||
msgstr ""
|
||||
"Please install docker-compose manually. https://docs.docker.com/compose/"
|
||||
"install/linux/"
|
||||
|
||||
#: nezha/template.sh:318
|
||||
msgid "Please enter the site title: "
|
||||
msgstr "Please enter the site title: "
|
||||
|
||||
#: nezha/template.sh:320
|
||||
msgid "Please enter the exposed port: (default 8008)"
|
||||
msgstr "Please enter the exposed port: (default 8008)"
|
||||
|
||||
#: nezha/template.sh:322
|
||||
msgid "Please specify the backend locale"
|
||||
msgstr "Please specify the backend locale"
|
||||
|
||||
#: nezha/template.sh:327
|
||||
msgid "Please enter [1-3]: "
|
||||
msgstr "Please enter [1-3]: "
|
||||
|
||||
#: nezha/template.sh:343
|
||||
msgid "Please enter the correct number [1-3]"
|
||||
msgstr "Please enter the correct number [1-3]"
|
||||
|
||||
#: nezha/template.sh:349
|
||||
msgid "All options cannot be empty"
|
||||
msgstr "All options cannot be empty"
|
||||
|
||||
#: nezha/template.sh:373
|
||||
msgid "Downloading service file"
|
||||
msgstr "Downloading service file"
|
||||
|
||||
#: nezha/template.sh:377 nezha/template.sh:383
|
||||
msgid ""
|
||||
"File failed to get, please check if the network can link ${GITHUB_RAW_URL}"
|
||||
msgstr ""
|
||||
"File failed to get, please check if the network can link ${GITHUB_RAW_URL}"
|
||||
|
||||
#: nezha/template.sh:391
|
||||
msgid ""
|
||||
"Dashboard configuration modified successfully, please wait for Dashboard "
|
||||
"self-restart to take effect"
|
||||
msgstr ""
|
||||
"Dashboard configuration modified successfully, please wait for Dashboard "
|
||||
"self-restart to take effect"
|
||||
|
||||
#: nezha/template.sh:401
|
||||
msgid "> Restart and Update"
|
||||
msgstr "> Restart and Update"
|
||||
|
||||
#: nezha/template.sh:410
|
||||
msgid "Nezha Monitoring Restart Successful"
|
||||
msgstr "Nezha Monitoring Restart Successful"
|
||||
|
||||
#: nezha/template.sh:411
|
||||
msgid "Default address: domain:site_access_port"
|
||||
msgstr "Default address: domain:site_access_port"
|
||||
|
||||
#: nezha/template.sh:413
|
||||
msgid ""
|
||||
"The restart failed, probably because the boot time exceeded two seconds, "
|
||||
"please check the log information later"
|
||||
msgstr ""
|
||||
"The restart failed, probably because the boot time exceeded two seconds, "
|
||||
"please check the log information later"
|
||||
|
||||
#: nezha/template.sh:440
|
||||
msgid ""
|
||||
"Fail to obtain Dashboard version, please check if the network can link "
|
||||
"https://api.github.com/repos/nezhahq/nezha/releases/latest"
|
||||
msgstr ""
|
||||
"Fail to obtain Dashboard version, please check if the network can link "
|
||||
"https://api.github.com/repos/nezhahq/nezha/releases/latest"
|
||||
|
||||
#: nezha/template.sh:443
|
||||
msgid "The current latest version is: ${_version}"
|
||||
msgstr "The current latest version is: ${_version}"
|
||||
|
||||
#: nezha/template.sh:472
|
||||
msgid "> View Log"
|
||||
msgstr "> View Log"
|
||||
|
||||
#: nezha/template.sh:498
|
||||
msgid "> Uninstall"
|
||||
msgstr "> Uninstall"
|
||||
|
||||
#: nezha/template.sh:537
|
||||
msgid "Nezha Monitor Management Script Usage: "
|
||||
msgstr "Nezha Monitor Management Script Usage: "
|
||||
|
||||
#: nezha/template.sh:539
|
||||
msgid "./nezha.sh - Show Menu"
|
||||
msgstr "./nezha.sh - Show Menu"
|
||||
|
||||
#: nezha/template.sh:540
|
||||
msgid "./nezha.sh install - Install Dashboard"
|
||||
msgstr "./nezha.sh install - Install Dashboard"
|
||||
|
||||
#: nezha/template.sh:541
|
||||
msgid "./nezha.sh modify_config - Modify Dashboard Configuration"
|
||||
msgstr "./nezha.sh modify_config - Modify Dashboard Configuration"
|
||||
|
||||
#: nezha/template.sh:542
|
||||
msgid "./nezha.sh restart_and_update - Restart and Update the Dashboard"
|
||||
msgstr "./nezha.sh restart_and_update - Restart and Update the Dashboard"
|
||||
|
||||
#: nezha/template.sh:543
|
||||
msgid "./nezha.sh show_log - View Dashboard Log"
|
||||
msgstr "./nezha.sh show_log - View Dashboard Log"
|
||||
|
||||
#: nezha/template.sh:544
|
||||
msgid "./nezha.sh uninstall - Uninstall Dashboard"
|
||||
msgstr "./nezha.sh uninstall - Uninstall Dashboard"
|
||||
|
||||
#: nezha/template.sh:549
|
||||
msgid "${green}Nezha Monitor Management Script${plain}"
|
||||
msgstr "${green}Nezha Monitor Management Script${plain}"
|
||||
|
||||
#: nezha/template.sh:551
|
||||
msgid "${green}1.${plain} Install Dashboard"
|
||||
msgstr "${green}1.${plain} Install Dashboard"
|
||||
|
||||
#: nezha/template.sh:552
|
||||
msgid "${green}2.${plain} Modify Dashboard Configuration"
|
||||
msgstr "${green}2.${plain} Modify Dashboard Configuration"
|
||||
|
||||
#: nezha/template.sh:553
|
||||
msgid "${green}3.${plain} Restart and Update Dashboard"
|
||||
msgstr "${green}3.${plain} Restart and Update Dashboard"
|
||||
|
||||
#: nezha/template.sh:554
|
||||
msgid "${green}4.${plain} View Dashboard Log"
|
||||
msgstr "${green}4.${plain} View Dashboard Log"
|
||||
|
||||
#: nezha/template.sh:555
|
||||
msgid "${green}5.${plain} Uninstall Dashboard"
|
||||
msgstr "${green}5.${plain} Uninstall Dashboard"
|
||||
|
||||
#: nezha/template.sh:557
|
||||
msgid "${green}6.${plain} Update Script"
|
||||
msgstr "${green}6.${plain} Update Script"
|
||||
|
||||
#: nezha/template.sh:559
|
||||
msgid "${green}0.${plain} Exit Script"
|
||||
msgstr "${green}0.${plain} Exit Script"
|
||||
|
||||
#: nezha/template.sh:561
|
||||
msgid "Please enter [0-6]: "
|
||||
msgstr "Please enter [0-6]: "
|
||||
|
||||
#: nezha/template.sh:585
|
||||
msgid "Please enter the correct number [0-6]"
|
||||
msgstr "Please enter the correct number [0-6]"
|
||||
BIN
nezha/translations/zh_CN/LC_MESSAGES/nezha.mo
Normal file
BIN
nezha/translations/zh_CN/LC_MESSAGES/nezha.mo
Normal file
Binary file not shown.
300
nezha/translations/zh_CN/LC_MESSAGES/nezha.po
Normal file
300
nezha/translations/zh_CN/LC_MESSAGES/nezha.po
Normal file
@ -0,0 +1,300 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-11-29 21:03+0800\n"
|
||||
"PO-Revision-Date: 2024-11-29 21:05+0800\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: zh_CN\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 3.5\n"
|
||||
|
||||
#: nezha/template.sh:35
|
||||
msgid ""
|
||||
"ERROR: sudo is not installed on the system, the action cannot be proceeded."
|
||||
msgstr "错误: 您的系统未安装 sudo,因此无法进行该项操作。"
|
||||
|
||||
#: nezha/template.sh:47
|
||||
msgid "Run '$*' failed."
|
||||
msgstr "运行 '$*' 失败。"
|
||||
|
||||
#: nezha/template.sh:57
|
||||
msgid "$dep not found, please install it first."
|
||||
msgstr "未找到依赖 $dep,请先安装。"
|
||||
|
||||
#: nezha/template.sh:117
|
||||
msgid "Unknown architecture: $uname"
|
||||
msgstr "未知架构:$uname"
|
||||
|
||||
#: nezha/template.sh:130 nezha/template.sh:144
|
||||
msgid "Docker image with nezha-dashboard repository exists:"
|
||||
msgstr "存在带有 nezha-dashboard 仓库的 Docker 镜像:"
|
||||
|
||||
#: nezha/template.sh:136 nezha/template.sh:150
|
||||
msgid "No Docker images with the nezha-dashboard repository were found."
|
||||
msgstr "未找到带有 nezha-dashboard 仓库的 Docker 镜像。"
|
||||
|
||||
#: nezha/template.sh:163
|
||||
msgid "Select your installation method:"
|
||||
msgstr "请自行选择您的安装方式:"
|
||||
|
||||
#: nezha/template.sh:165
|
||||
msgid "2. Standalone"
|
||||
msgstr "2. 独立安装"
|
||||
|
||||
#: nezha/template.sh:167
|
||||
msgid "Please enter [1-2]: "
|
||||
msgstr "请输入选择 [1-2]:"
|
||||
|
||||
#: nezha/template.sh:179
|
||||
msgid "Please enter the correct number [1-2]"
|
||||
msgstr "请输入正确的选择 [1-2]"
|
||||
|
||||
#: nezha/template.sh:196
|
||||
msgid ""
|
||||
"According to the information provided by various geoip api, the current IP "
|
||||
"may be in China"
|
||||
msgstr "根据geoip api提供的信息,当前IP可能在中国"
|
||||
|
||||
#: nezha/template.sh:197
|
||||
msgid ""
|
||||
"Will the installation be done with a Chinese Mirror? [Y/n] (Custom Mirror "
|
||||
"Input 3): "
|
||||
msgstr "否选用中国镜像完成安装? [Y/n] (自定义镜像输入 3):"
|
||||
|
||||
#: nezha/template.sh:201
|
||||
msgid "Use Chinese Mirror"
|
||||
msgstr "使用中国镜像"
|
||||
|
||||
#: nezha/template.sh:206 nezha/template.sh:220
|
||||
msgid "Do Not Use Chinese Mirror"
|
||||
msgstr "不使用中国镜像"
|
||||
|
||||
#: nezha/template.sh:210
|
||||
msgid "Use Custom Mirror"
|
||||
msgstr "使用自定义镜像"
|
||||
|
||||
#: nezha/template.sh:211
|
||||
msgid ""
|
||||
"Please enter a custom image (e.g. :dn-dao-github-mirror.daocloud.io). If "
|
||||
"left blank, it won't be used: "
|
||||
msgstr ""
|
||||
"请输入自定义镜像 (例如:dn-dao-github-mirror.daocloud.io),留空为不使用:"
|
||||
|
||||
#: nezha/template.sh:244
|
||||
msgid "> Update Script"
|
||||
msgstr "> 更新脚本"
|
||||
|
||||
#: nezha/template.sh:246
|
||||
msgid "https://${GITHUB_RAW_URL}/install_en.sh"
|
||||
msgstr "https://${GITHUB_RAW_URL}/install.sh"
|
||||
|
||||
#: nezha/template.sh:249
|
||||
msgid "Execute new script after 3s"
|
||||
msgstr "3s后执行新脚本"
|
||||
|
||||
#: nezha/template.sh:257
|
||||
msgid "* Press Enter to return to the main menu *"
|
||||
msgstr "* 按回车返回主菜单 *"
|
||||
|
||||
#: nezha/template.sh:262
|
||||
msgid "> Install"
|
||||
msgstr "> 安装"
|
||||
|
||||
#: nezha/template.sh:268
|
||||
msgid ""
|
||||
"You may have already installed the dashboard, repeated installation will "
|
||||
"overwrite the data, please pay attention to backup."
|
||||
msgstr "您可能已经安装过面板端,重复安装会覆盖数据,请注意备份。"
|
||||
|
||||
#: nezha/template.sh:269
|
||||
msgid "Exit the installation? [Y/n]"
|
||||
msgstr "是否退出安装? [Y/n]"
|
||||
|
||||
#: nezha/template.sh:273 nezha/template.sh:281
|
||||
msgid "Exit the installation"
|
||||
msgstr "退出安装"
|
||||
|
||||
#: nezha/template.sh:277
|
||||
msgid "Continue"
|
||||
msgstr "继续安装"
|
||||
|
||||
#: nezha/template.sh:295
|
||||
msgid "Modify Configuration"
|
||||
msgstr "> 修改配置"
|
||||
|
||||
#: nezha/template.sh:299
|
||||
msgid "Download Docker Script"
|
||||
msgstr "正在下载 Docker 脚本"
|
||||
|
||||
#: nezha/template.sh:302 nezha/template.sh:313
|
||||
msgid ""
|
||||
"Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
|
||||
msgstr "脚本获取失败,请检查本机能否链接 ${GITHUB_RAW_URL}"
|
||||
|
||||
#: nezha/template.sh:306
|
||||
msgid ""
|
||||
"Please install docker-compose manually. https://docs.docker.com/compose/"
|
||||
"install/linux/"
|
||||
msgstr ""
|
||||
"请手动安装 docker-compose。 https://docs.docker.com/compose/install/linux/"
|
||||
|
||||
#: nezha/template.sh:318
|
||||
msgid "Please enter the site title: "
|
||||
msgstr "请输入站点标题: "
|
||||
|
||||
#: nezha/template.sh:320
|
||||
msgid "Please enter the exposed port: (default 8008)"
|
||||
msgstr "请输入暴露端口: (默认 8008)"
|
||||
|
||||
#: nezha/template.sh:322
|
||||
msgid "Please specify the backend locale"
|
||||
msgstr "请指定后台语言"
|
||||
|
||||
#: nezha/template.sh:327
|
||||
msgid "Please enter [1-3]: "
|
||||
msgstr "请输入选项 [1-3]"
|
||||
|
||||
#: nezha/template.sh:343
|
||||
msgid "Please enter the correct number [1-3]"
|
||||
msgstr "请输入正确的选项 [1-3]"
|
||||
|
||||
#: nezha/template.sh:349
|
||||
msgid "All options cannot be empty"
|
||||
msgstr "\"所有选项都不能为空\""
|
||||
|
||||
#: nezha/template.sh:373
|
||||
msgid "Downloading service file"
|
||||
msgstr "正在下载服务文件"
|
||||
|
||||
#: nezha/template.sh:377 nezha/template.sh:383
|
||||
msgid ""
|
||||
"File failed to get, please check if the network can link ${GITHUB_RAW_URL}"
|
||||
msgstr "文件下载失败,请检查本机能否连接 ${GITHUB_RAW_URL}"
|
||||
|
||||
#: nezha/template.sh:391
|
||||
msgid ""
|
||||
"Dashboard configuration modified successfully, please wait for Dashboard "
|
||||
"self-restart to take effect"
|
||||
msgstr "Dashboard 配置 修改成功,请稍等 Dashboard 重启生效"
|
||||
|
||||
#: nezha/template.sh:401
|
||||
msgid "> Restart and Update"
|
||||
msgstr "> 重启并更新"
|
||||
|
||||
#: nezha/template.sh:410
|
||||
msgid "Nezha Monitoring Restart Successful"
|
||||
msgstr "哪吒监控 重启成功"
|
||||
|
||||
#: nezha/template.sh:411
|
||||
msgid "Default address: domain:site_access_port"
|
||||
msgstr "默认地址:域名:站点访问端口"
|
||||
|
||||
#: nezha/template.sh:413
|
||||
msgid ""
|
||||
"The restart failed, probably because the boot time exceeded two seconds, "
|
||||
"please check the log information later"
|
||||
msgstr "重启失败,可能是因为启动时间超过了两秒,请稍后查看日志信息"
|
||||
|
||||
#: nezha/template.sh:440
|
||||
msgid ""
|
||||
"Fail to obtain Dashboard version, please check if the network can link "
|
||||
"https://api.github.com/repos/nezhahq/nezha/releases/latest"
|
||||
msgstr ""
|
||||
"获取 Dashboard 版本号失败,请检查本机能否链接 https://api.github.com/repos/"
|
||||
"nezhahq/nezha/releases/latest"
|
||||
|
||||
#: nezha/template.sh:443
|
||||
msgid "The current latest version is: ${_version}"
|
||||
msgstr "当前最新版本为: ${_version}"
|
||||
|
||||
#: nezha/template.sh:472
|
||||
msgid "> View Log"
|
||||
msgstr "> 获取日志"
|
||||
|
||||
#: nezha/template.sh:498
|
||||
msgid "> Uninstall"
|
||||
msgstr "> 卸载"
|
||||
|
||||
#: nezha/template.sh:537
|
||||
msgid "Nezha Monitor Management Script Usage: "
|
||||
msgstr "哪吒监控 管理脚本使用方法: "
|
||||
|
||||
#: nezha/template.sh:539
|
||||
msgid "./nezha.sh - Show Menu"
|
||||
msgstr "./nezha.sh - 显示管理菜单"
|
||||
|
||||
#: nezha/template.sh:540
|
||||
msgid "./nezha.sh install - Install Dashboard"
|
||||
msgstr "./nezha.sh install - 安装面板端"
|
||||
|
||||
#: nezha/template.sh:541
|
||||
msgid "./nezha.sh modify_config - Modify Dashboard Configuration"
|
||||
msgstr "./nezha.sh modify_config - 修改面板配置"
|
||||
|
||||
#: nezha/template.sh:542
|
||||
msgid "./nezha.sh restart_and_update - Restart and Update the Dashboard"
|
||||
msgstr "./nezha.sh restart_and_update - 重启并更新面板"
|
||||
|
||||
#: nezha/template.sh:543
|
||||
msgid "./nezha.sh show_log - View Dashboard Log"
|
||||
msgstr "./nezha.sh show_log - 查看面板日志"
|
||||
|
||||
#: nezha/template.sh:544
|
||||
msgid "./nezha.sh uninstall - Uninstall Dashboard"
|
||||
msgstr "./nezha.sh uninstall - 卸载管理面板"
|
||||
|
||||
#: nezha/template.sh:549
|
||||
msgid "${green}Nezha Monitor Management Script${plain}"
|
||||
msgstr "${green}哪吒监控管理脚本${plain}"
|
||||
|
||||
#: nezha/template.sh:551
|
||||
msgid "${green}1.${plain} Install Dashboard"
|
||||
msgstr "${green}1.${plain} 安装面板端"
|
||||
|
||||
#: nezha/template.sh:552
|
||||
msgid "${green}2.${plain} Modify Dashboard Configuration"
|
||||
msgstr "${green}2.${plain} 修改面板配置"
|
||||
|
||||
#: nezha/template.sh:553
|
||||
msgid "${green}3.${plain} Restart and Update Dashboard"
|
||||
msgstr "${green}3.${plain} 重启并更新面板"
|
||||
|
||||
#: nezha/template.sh:554
|
||||
msgid "${green}4.${plain} View Dashboard Log"
|
||||
msgstr "${green}4.${plain} 查看面板日志"
|
||||
|
||||
#: nezha/template.sh:555
|
||||
msgid "${green}5.${plain} Uninstall Dashboard"
|
||||
msgstr "${green}5.${plain} 卸载管理面板"
|
||||
|
||||
#: nezha/template.sh:557
|
||||
msgid "${green}6.${plain} Update Script"
|
||||
msgstr "${green}6.${plain} 更新脚本"
|
||||
|
||||
#: nezha/template.sh:559
|
||||
msgid "${green}0.${plain} Exit Script"
|
||||
msgstr "${green}0.${plain} 退出脚本"
|
||||
|
||||
#: nezha/template.sh:561
|
||||
msgid "Please enter [0-6]: "
|
||||
msgstr "请输入选择 [0-6]: "
|
||||
|
||||
#: nezha/template.sh:585
|
||||
msgid "Please enter the correct number [0-6]"
|
||||
msgstr "请输入正确的数字 [0-6]"
|
||||
|
||||
#~ msgid "Installing Docker"
|
||||
#~ msgstr "正在安装 Docker"
|
||||
|
||||
#~ msgid "Docker installed successfully"
|
||||
#~ msgstr "Docker 安装成功"
|
||||
Reference in New Issue
Block a user