From 2ec045618c9c0aed5ba82876bbace7750034881b Mon Sep 17 00:00:00 2001
From: BlueFunny_ <53890138+FunnyShadow@users.noreply.github.com>
Date: Sat, 21 Jan 2023 11:48:26 +0800
Subject: [PATCH 001/460] Some updates
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
#### Scripts
- Removed the content about deb (mainly because no one has been using it, I'm too lazy to rewrite it)
- Fix encoding and line break issues
- Complete refactoring of the main installation script (The old one is kept as `setup_old.sh`)
#### Readme
- Adding Chinese documentation
- Add one-click installation command
---
#### 脚本相关
- 删除了所有关于 APT 安装包 (deb) 的内容 (主要是没啥人用它, 我也懒得重写了)
- 修复了编码以及换行符的问题
- 完全重构主安装脚本 (旧的保留为 `setup_old.sh`)
#### Readme 相关
- 添加了新的中文文档
- 添加了一键安装命令
---
.gitignore | 36 +-
LICENSE | 42 +-
README.md | 11 +-
README_cn.md | 23 +
deb/README.md | 15 -
deb/pack/amd64/DEBIAN/control | 9 -
deb/pack/amd64/DEBIAN/postinst | 129 ------
deb/pack/amd64/DEBIAN/preinst | 280 ------------
deb/pack/amd64/DEBIAN/prerm | 86 ----
deb/pack/arm/DEBIAN/control | 9 -
deb/pack/arm/DEBIAN/postinst | 129 ------
deb/pack/arm/DEBIAN/preinst | 280 ------------
deb/pack/arm/DEBIAN/prerm | 86 ----
deb/pack/arm64/DEBIAN/control | 9 -
deb/pack/arm64/DEBIAN/postinst | 129 ------
deb/pack/arm64/DEBIAN/preinst | 280 ------------
deb/pack/arm64/DEBIAN/prerm | 86 ----
deb/pack/build.sh | 67 ---
deb/pack/i386/DEBIAN/control | 9 -
deb/pack/i386/DEBIAN/postinst | 129 ------
deb/pack/i386/DEBIAN/preinst | 280 ------------
deb/pack/i386/DEBIAN/prerm | 86 ----
deb/pack/ppc64le/DEBIAN/control | 9 -
deb/pack/ppc64le/DEBIAN/postinst | 129 ------
deb/pack/ppc64le/DEBIAN/preinst | 280 ------------
deb/pack/ppc64le/DEBIAN/prerm | 86 ----
deb/pack/s390x/DEBIAN/control | 9 -
deb/pack/s390x/DEBIAN/postinst | 129 ------
deb/pack/s390x/DEBIAN/preinst | 280 ------------
deb/pack/s390x/DEBIAN/prerm | 86 ----
deb/src/DEBIAN/postinst.sh | 165 -------
deb/src/DEBIAN/preinst.sh | 291 ------------
deb/src/DEBIAN/prerm.sh | 86 ----
deb_remove.sh | 86 ----
deb_setup.sh | 442 ------------------
setup.sh | 757 ++++++++++++++++++++-----------
setup_old.sh | 371 +++++++++++++++
update_gbk.bat | 92 ++--
38 files changed, 981 insertions(+), 4527 deletions(-)
create mode 100644 README_cn.md
delete mode 100644 deb/README.md
delete mode 100644 deb/pack/amd64/DEBIAN/control
delete mode 100644 deb/pack/amd64/DEBIAN/postinst
delete mode 100644 deb/pack/amd64/DEBIAN/preinst
delete mode 100644 deb/pack/amd64/DEBIAN/prerm
delete mode 100644 deb/pack/arm/DEBIAN/control
delete mode 100644 deb/pack/arm/DEBIAN/postinst
delete mode 100644 deb/pack/arm/DEBIAN/preinst
delete mode 100644 deb/pack/arm/DEBIAN/prerm
delete mode 100644 deb/pack/arm64/DEBIAN/control
delete mode 100644 deb/pack/arm64/DEBIAN/postinst
delete mode 100644 deb/pack/arm64/DEBIAN/preinst
delete mode 100644 deb/pack/arm64/DEBIAN/prerm
delete mode 100644 deb/pack/build.sh
delete mode 100644 deb/pack/i386/DEBIAN/control
delete mode 100644 deb/pack/i386/DEBIAN/postinst
delete mode 100644 deb/pack/i386/DEBIAN/preinst
delete mode 100644 deb/pack/i386/DEBIAN/prerm
delete mode 100644 deb/pack/ppc64le/DEBIAN/control
delete mode 100644 deb/pack/ppc64le/DEBIAN/postinst
delete mode 100644 deb/pack/ppc64le/DEBIAN/preinst
delete mode 100644 deb/pack/ppc64le/DEBIAN/prerm
delete mode 100644 deb/pack/s390x/DEBIAN/control
delete mode 100644 deb/pack/s390x/DEBIAN/postinst
delete mode 100644 deb/pack/s390x/DEBIAN/preinst
delete mode 100644 deb/pack/s390x/DEBIAN/prerm
delete mode 100644 deb/src/DEBIAN/postinst.sh
delete mode 100644 deb/src/DEBIAN/preinst.sh
delete mode 100644 deb/src/DEBIAN/prerm.sh
delete mode 100644 deb_remove.sh
delete mode 100644 deb_setup.sh
create mode 100644 setup_old.sh
diff --git a/.gitignore b/.gitignore
index 5d947ca..9067b5d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,18 +1,18 @@
-# Build and Release Folders
-bin-debug/
-bin-release/
-[Oo]bj/
-[Bb]in/
-
-# Other files and folders
-.settings/
-
-# Executables
-*.swf
-*.air
-*.ipa
-*.apk
-
-# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
-# should NOT be excluded as they contain compiler settings and other important
-# information for Eclipse / Flash Builder.
+# Build and Release Folders
+bin-debug/
+bin-release/
+[Oo]bj/
+[Bb]in/
+
+# Other files and folders
+.settings/
+
+# Executables
+*.swf
+*.air
+*.ipa
+*.apk
+
+# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
+# should NOT be excluded as they contain compiler settings and other important
+# information for Eclipse / Flash Builder.
diff --git a/LICENSE b/LICENSE
index 431912a..bfd24f9 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,21 +1,21 @@
-MIT License
-
-Copyright (c) 2021 Suwings
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+MIT License
+
+Copyright (c) 2021 Suwings
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index 4878d4b..732728c 100644
--- a/README.md
+++ b/README.md
@@ -7,11 +7,18 @@
## What is this?
+[中文文档]()
The files here are all platform-wide install, delete, update scripts, etc. for MCSManager 9.
-The default installation script on the official website is the `setup_en.sh` file of this repository.
+The default installation script on the official website is the `setup.sh` file of this repository, it contains multiple languages.
-Contains multiple languages.
+You can also use the following one-click command to perform a quick installation
+
+## Installation commands
+
+```bash
+
+```
diff --git a/README_cn.md b/README_cn.md
new file mode 100644
index 0000000..4ff917d
--- /dev/null
+++ b/README_cn.md
@@ -0,0 +1,23 @@
+
+
+
+
+[MCSManager 9 官方网站](http://mcsmanager.com/)
+
+
+
+## 这是什么?
+
+这里是 Ubuntu / Debian / CentOS 等 Linux 系系统的 MCSManager 9 安装, 卸载, 升级脚本等的集中存储库
+
+官网上默认的安装脚本为本仓库中的 `setup.sh` , 它包含多种语言支持
+
+你也可以使用下列一键命令安装 MCSManager 9
+
+## 安装命令
+
+```bash
+
+```
+
+
diff --git a/deb/README.md b/deb/README.md
deleted file mode 100644
index 1312914..0000000
--- a/deb/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-此部分主要为 MCSManager 在 Debian/Ubuntu 系统上的发布版的源码
-
-本部分分为两个模块, `deb` 和 `src`
-`pack`: 编译模块, 此模块内的一级文件夹为架构名称, 编译时除 `一级文件夹\DEBIAN\control` 文件不会改变以外, 其他文件均由 `src` 模块内的所有文件覆盖, 如需编辑源码请见下面的 `src` 模块介绍
-`src`: 源码模块, 此模块内的所有文件在编译阶段会覆盖掉 `pack` 模块内所有文件
-
-如果你需要将此部分源码打包成可以直接使用 `apt` 或 `dpkg` 等工具可直接安装的 `deb` 程序包的话, 你需要先安装 `dpkg`, 然后运行以下命令
-
-```bash
-git clone https://github.com/MCSManager/Script.git
-cd Script/deb/pack
-bash build.sh
-```
-
-当显示 `Build complete` 时证明构建已成功, `build.sh` 同文件夹内应该会出现不同架构的 `deb` 程序包
\ No newline at end of file
diff --git a/deb/pack/amd64/DEBIAN/control b/deb/pack/amd64/DEBIAN/control
deleted file mode 100644
index 14cde5f..0000000
--- a/deb/pack/amd64/DEBIAN/control
+++ /dev/null
@@ -1,9 +0,0 @@
-Package:MCSManager
-Version:9
-Section:stable
-Priority:optional
-Depends:wget,curl,git,tar,sudo
-Suggests:language-pack-zh-hans,fonts-droid-fallback,ttf-wqy-zenhei,ttf-wqy-microhei,fonts-arphic-ukai,fonts-arphic-uming
-Architecture:amd64
-Maintainer:unitwk
-Description:A multilingual, lightweight, out-of-the-box, and multi-instance Minecraft server control panel with Docker support.
diff --git a/deb/pack/amd64/DEBIAN/postinst b/deb/pack/amd64/DEBIAN/postinst
deleted file mode 100644
index 56d465a..0000000
--- a/deb/pack/amd64/DEBIAN/postinst
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## Install Mode
-if [ -d /tmp/mcsmanager/data ]; then
- installMode="upgrade"
-else
- installMode="install"
-fi
-
-## Other
-firewall=""
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho echo "[-] 正在启动 MCSManager..." "[-] Starting MCSManager..."
-
- # Start MCSM service
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
- systemctl start mcsm-daemon.service
- systemctl start mcsm-web.service
-
- # Check MCSM service
- if ! systemctl is-active --quiet mcsm-daemon.service || ! systemctl --quiet is-active mcsm-web.service; then
- systemctl status mcsm-{web,daemon}.service
- LEcho error "[x] MCSManager 启动失败" "[x] MCSManager failed to start"
- fi
-
- # Allow ports
- if command -v ufw; then
- ufw allow 23333/tcp
- ufw allow 24444/tcp
- elif command -v iptables-save; then
- iptables -A INPUT -p tcp --dport 23333 -j ACCEPT
- iptables -A INPUT -p tcp --dport 24444 -j ACCEPT
- iptables-save
- else
- firewall="problem"
- fi
-
- # Output auth information
- AuthInfo
- return
-}
-
-## Access Information
-AuthInfo() {
- if [ ${installMode} == "upgrade" ]; then
- ip="$(curl -s https://ipconfig.io)"
- port=$(cat ${mcsmPath}/web/data/SystemConfig/config.json | grep "httpPort" | tr -cd '0-9')
- daemonPort=$(cat ${mcsmPath}/daemon/data/Config/global.json | grep "port" | tr -cd '0-9')
- fi
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan "欢迎使用 MCSManager, 您可以通过以下方式访问 MCSManager " "Welcome to MCSManager, you can access it by the following ways"
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板地址: " "Web Service Address: "
-
- [ ${installMode} == "upgrade" ] && LEcho cyan "http://${ip}:${port}" "http://${ip}:${port}"
- [ ${installMode} == "upgrade" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
- [ ${installMode} == "upgrade" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
-
- [ ${installMode} == "install" ] && LEcho cyan "http://localhost:23333" "http://localhost:23333"
- [ ${installMode} == "install" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- [ ${installMode} == "install" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports 23333 and 24444 to use the service properly on the Internet."
-
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More info: https://docs.mcsmanager.com/"
- LEcho cyan "==================================================================" "=================================================================="
- return
-}
-
-### Start ###
-Start
-exit 0
diff --git a/deb/pack/amd64/DEBIAN/preinst b/deb/pack/amd64/DEBIAN/preinst
deleted file mode 100644
index 7a8cac7..0000000
--- a/deb/pack/amd64/DEBIAN/preinst
+++ /dev/null
@@ -1,280 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-
-## Files
-mcsmOldPath="/opt/mcsmanager"
-mcsmPath="/opt/mcsmanager"
-nodePath="${mcsmPath}/node"
-
-## Node
-nodeVersion="18.12.1"
-node="${nodePath}/bin/node"
-npm="${node} ${nodePath}/bin/npm"
-
-## Install Mode
-installMode="install"
-
-## URL
-daemonCloneURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
-webCloneURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
-nodeMirror="https://npmmirror.com/mirrors/node"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## CDN
-CN=0
-
-## Other
-try=1
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Init ###
-## Check environment
-Init() {
- LEcho echo "[-] 正在初始化环境..." "[-] Initializing environment..."
-
- # Check functions
- CheckMCSM
- CheckCN
- CheckNodejs
-
- LEcho echo "[-] 环境初始化完成" "[-] Environment initialization completed"
- return
-}
-
-## Check if MCSM is installed
-CheckMCSM() {
- if [ -d ${mcsmOldPath} ]; then
- LEcho yellow "[-] 检测到已安装的 MCSManager, 切换为更新模式..." "[-] MCSManager has been installed, switching to update mode..."
-
- # Switch to update mode
- installMode="upgrade"
-
- # Prepare for backup old data
- mkdir -p /tmp/mcsmanager/data
-
- # A little easteregg
- # Maybe you wanna play Inscryption?
- LEcho echo "[-] 正在将 旧数据 打包并移动至临时文件夹..." "[-] Packing and moving old data to temporary folder..."
-
- # Backup old data
- if [ -d ${mcsmOldPath}/daemon/data ]; then
- mv -f ${mcsmOldPath}/daemon/data /tmp/mcsmanager/data/daemon
- else
- LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- fi
- if [ -d ${mcsmOldPath}/web/data ]; then
- mv -f ${mcsmOldPath}/web/data /tmp/mcsmanager/data/web
- else
- LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- fi
-
- # Remove old service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove old data
- if [ -d ${mcsmOldPath} ]; then
- rm -rf ${mcsmOldPath}
- fi
-
- # Remove old link
- if [ -L /usr/bin/mcsmanager ]; then
- rm -f /usr/bin/mcsmanager
- fi
- fi
-
- # Prepare for a new install
- mkdir -p ${nodePath}
- return
-}
-
-## Check if the system is Chinese
-CheckCN() {
- if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
- LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China"
- [ "${zh}" == 1 ] && read -e -r -p "[?] 是否选用中国镜像完成安装? [y/n] " input
- [ "${zh}" == 0 ] && read -e -r -p "[?] Whether to use the Chinese mirror to complete the installation? [y/n] " input
- case ${input} in
- [yY][eE][sS] | [yY])
- LEcho echo "[-] 选用中国镜像" "[-] Use Chinese mirror"
- CN=1
- ;;
- *)
- LEcho echo "[-] 不选用中国镜像" "[-] Do not use Chinese mirror"
- ;;
- esac
- fi
- if [ "${CN}" == 1 ]; then
- daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- export N_NODE_MIRROR=${nodeMirror}
- fi
- return
-}
-
-## Check nodejs
-CheckNodejs() {
- if ! /usr/local/bin/n -V; then
- if [ "${CN}" == 1 ]; then
- npm i -g n --registry=https://registry.npmmirror.com
- else
- npm i -g n
- fi
- fi
- while true; do
- if /usr/local/bin/n ${nodeVersion} -d || [ ${try} == 3 ]; then
- break
- else
- LEcho yellow "[!] 安装 Node.js ${nodeVersion} 失败, 重试中... (${try}/3)" "[!] Failed to install Node.js ${nodeVersion}, retrying... (${try}/3)"
- fi
- sleep 3
- try=${try}+1
- done
- cp -r /usr/local/n/versions/node/${nodeVersion}/* ${nodePath}/
- /usr/local/bin/n rm ${nodeVersion}
- if ! ${node} --version; then
- LEcho error "[x] 未能成功安装最新版本 Node.js" "[x] Failed to install the latest version of Node.js"
- fi
- LEcho echo "=============== Node Version ===============" "=============== Node Version ==============="
- LEcho echo "Node 版本: $(${node} --version)" "Node Version: $(${node} --version)"
- LEcho echo "NPM 版本: $(${npm} --version)" "NPM Version: $(${npm} --version)"
- LEcho echo "============================================" "============================================"
- return
-}
-
-### Main ###
-## Main Install Function
-Install() {
- LEcho echo "[-] 正在安装 MCSManager ..." "[-] Installing MCSManager ..."
-
- # Move to MCSM
- cd ${mcsmPath} || LEcho error "[x] 未能成功进入 MCSM 安装目录" "[x] Failed to enter the MCSM installation directory"
-
- # Download MCSM Daemon
- LEcho echo "[↓] 正在下载 MCSManager Daemon..." "[↓] Downloading MCSManager Daemon..."
- git clone --single-branch -b master --depth 1 ${daemonCloneURL}
- mv -f MCSManager-Daemon-Production daemon
-
- # Download MCSM Web
- LEcho echo "[↓] 正在下载 MCSManager Web..." "[↓] Downloading MCSManager Web..."
- git clone --single-branch -b master --depth 1 ${webCloneURL}
- mv -f MCSManager-Web-Production web
-
- # Install MCSM Daemon
- LEcho echo "[+] 正在安装 MCSManager Daemon..." "[+] Installing MCSManager Daemon..."
- cd daemon || LEcho error "[x] 未能成功进入 MCSM Daemon 安装目录" "[x] Failed to enter the MCSM Daemon installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- # Install MCSM Web
- LEcho echo "[+] 正在安装 MCSManager Web..." "[+] Installing MCSManager Web..."
- cd ../web || LEcho error "[x] 未能成功进入 MCSM Web 安装目录" "[x] Failed to enter the MCSManager Web installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- LEcho green "[√] MCSManager 安装完成" "[√] MCSManager installation completed"
-
- # Check install mode
- if [ "${installMode}" == "upgrade" ]; then
- LEcho echo "[-] 正在移动旧数据..." "[-] Moving old data..."
- mv -f /tmp/mcsmanager/data/daemon ${mcsmPath}/daemon/data || LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- mv -f /tmp/mcsmanager/data/web ${mcsmPath}/web/data || LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- rm -rf /tmp/mcsmanager
- LEcho green "[√] 数据迁移完成" "[√] Data migration completed"
- fi
- return
-}
-
-### Other ###
-## Clean up
-Clean() {
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
- return
-}
-
-### Start ###
-Init
-Install
-exit 0
\ No newline at end of file
diff --git a/deb/pack/amd64/DEBIAN/prerm b/deb/pack/amd64/DEBIAN/prerm
deleted file mode 100644
index 05c41dd..0000000
--- a/deb/pack/amd64/DEBIAN/prerm
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Uninstall Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-### Tools ###
-# Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho cyan "[-] 正在卸载 MCSManager..." "[-] Uninstalling MCSManager..."
-
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
-
- LEcho green "[+] MCSManager 卸载成功!" "[+] MCSManager Uninstalled!"
- return
-}
-
-### Start ###
-Start
-exit 0
\ No newline at end of file
diff --git a/deb/pack/arm/DEBIAN/control b/deb/pack/arm/DEBIAN/control
deleted file mode 100644
index 2eb1a9e..0000000
--- a/deb/pack/arm/DEBIAN/control
+++ /dev/null
@@ -1,9 +0,0 @@
-Package:MCSManager
-Version:9
-Section:stable
-Priority:optional
-Depends:wget,curl,git,tar,sudo
-Suggests:language-pack-zh-hans,fonts-droid-fallback,ttf-wqy-zenhei,ttf-wqy-microhei,fonts-arphic-ukai,fonts-arphic-uming
-Architecture:arm
-Maintainer:unitwk
-Description:A multilingual, lightweight, out-of-the-box, and multi-instance Minecraft server control panel with Docker support.
diff --git a/deb/pack/arm/DEBIAN/postinst b/deb/pack/arm/DEBIAN/postinst
deleted file mode 100644
index 56d465a..0000000
--- a/deb/pack/arm/DEBIAN/postinst
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## Install Mode
-if [ -d /tmp/mcsmanager/data ]; then
- installMode="upgrade"
-else
- installMode="install"
-fi
-
-## Other
-firewall=""
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho echo "[-] 正在启动 MCSManager..." "[-] Starting MCSManager..."
-
- # Start MCSM service
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
- systemctl start mcsm-daemon.service
- systemctl start mcsm-web.service
-
- # Check MCSM service
- if ! systemctl is-active --quiet mcsm-daemon.service || ! systemctl --quiet is-active mcsm-web.service; then
- systemctl status mcsm-{web,daemon}.service
- LEcho error "[x] MCSManager 启动失败" "[x] MCSManager failed to start"
- fi
-
- # Allow ports
- if command -v ufw; then
- ufw allow 23333/tcp
- ufw allow 24444/tcp
- elif command -v iptables-save; then
- iptables -A INPUT -p tcp --dport 23333 -j ACCEPT
- iptables -A INPUT -p tcp --dport 24444 -j ACCEPT
- iptables-save
- else
- firewall="problem"
- fi
-
- # Output auth information
- AuthInfo
- return
-}
-
-## Access Information
-AuthInfo() {
- if [ ${installMode} == "upgrade" ]; then
- ip="$(curl -s https://ipconfig.io)"
- port=$(cat ${mcsmPath}/web/data/SystemConfig/config.json | grep "httpPort" | tr -cd '0-9')
- daemonPort=$(cat ${mcsmPath}/daemon/data/Config/global.json | grep "port" | tr -cd '0-9')
- fi
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan "欢迎使用 MCSManager, 您可以通过以下方式访问 MCSManager " "Welcome to MCSManager, you can access it by the following ways"
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板地址: " "Web Service Address: "
-
- [ ${installMode} == "upgrade" ] && LEcho cyan "http://${ip}:${port}" "http://${ip}:${port}"
- [ ${installMode} == "upgrade" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
- [ ${installMode} == "upgrade" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
-
- [ ${installMode} == "install" ] && LEcho cyan "http://localhost:23333" "http://localhost:23333"
- [ ${installMode} == "install" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- [ ${installMode} == "install" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports 23333 and 24444 to use the service properly on the Internet."
-
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More info: https://docs.mcsmanager.com/"
- LEcho cyan "==================================================================" "=================================================================="
- return
-}
-
-### Start ###
-Start
-exit 0
diff --git a/deb/pack/arm/DEBIAN/preinst b/deb/pack/arm/DEBIAN/preinst
deleted file mode 100644
index 7a8cac7..0000000
--- a/deb/pack/arm/DEBIAN/preinst
+++ /dev/null
@@ -1,280 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-
-## Files
-mcsmOldPath="/opt/mcsmanager"
-mcsmPath="/opt/mcsmanager"
-nodePath="${mcsmPath}/node"
-
-## Node
-nodeVersion="18.12.1"
-node="${nodePath}/bin/node"
-npm="${node} ${nodePath}/bin/npm"
-
-## Install Mode
-installMode="install"
-
-## URL
-daemonCloneURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
-webCloneURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
-nodeMirror="https://npmmirror.com/mirrors/node"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## CDN
-CN=0
-
-## Other
-try=1
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Init ###
-## Check environment
-Init() {
- LEcho echo "[-] 正在初始化环境..." "[-] Initializing environment..."
-
- # Check functions
- CheckMCSM
- CheckCN
- CheckNodejs
-
- LEcho echo "[-] 环境初始化完成" "[-] Environment initialization completed"
- return
-}
-
-## Check if MCSM is installed
-CheckMCSM() {
- if [ -d ${mcsmOldPath} ]; then
- LEcho yellow "[-] 检测到已安装的 MCSManager, 切换为更新模式..." "[-] MCSManager has been installed, switching to update mode..."
-
- # Switch to update mode
- installMode="upgrade"
-
- # Prepare for backup old data
- mkdir -p /tmp/mcsmanager/data
-
- # A little easteregg
- # Maybe you wanna play Inscryption?
- LEcho echo "[-] 正在将 旧数据 打包并移动至临时文件夹..." "[-] Packing and moving old data to temporary folder..."
-
- # Backup old data
- if [ -d ${mcsmOldPath}/daemon/data ]; then
- mv -f ${mcsmOldPath}/daemon/data /tmp/mcsmanager/data/daemon
- else
- LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- fi
- if [ -d ${mcsmOldPath}/web/data ]; then
- mv -f ${mcsmOldPath}/web/data /tmp/mcsmanager/data/web
- else
- LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- fi
-
- # Remove old service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove old data
- if [ -d ${mcsmOldPath} ]; then
- rm -rf ${mcsmOldPath}
- fi
-
- # Remove old link
- if [ -L /usr/bin/mcsmanager ]; then
- rm -f /usr/bin/mcsmanager
- fi
- fi
-
- # Prepare for a new install
- mkdir -p ${nodePath}
- return
-}
-
-## Check if the system is Chinese
-CheckCN() {
- if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
- LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China"
- [ "${zh}" == 1 ] && read -e -r -p "[?] 是否选用中国镜像完成安装? [y/n] " input
- [ "${zh}" == 0 ] && read -e -r -p "[?] Whether to use the Chinese mirror to complete the installation? [y/n] " input
- case ${input} in
- [yY][eE][sS] | [yY])
- LEcho echo "[-] 选用中国镜像" "[-] Use Chinese mirror"
- CN=1
- ;;
- *)
- LEcho echo "[-] 不选用中国镜像" "[-] Do not use Chinese mirror"
- ;;
- esac
- fi
- if [ "${CN}" == 1 ]; then
- daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- export N_NODE_MIRROR=${nodeMirror}
- fi
- return
-}
-
-## Check nodejs
-CheckNodejs() {
- if ! /usr/local/bin/n -V; then
- if [ "${CN}" == 1 ]; then
- npm i -g n --registry=https://registry.npmmirror.com
- else
- npm i -g n
- fi
- fi
- while true; do
- if /usr/local/bin/n ${nodeVersion} -d || [ ${try} == 3 ]; then
- break
- else
- LEcho yellow "[!] 安装 Node.js ${nodeVersion} 失败, 重试中... (${try}/3)" "[!] Failed to install Node.js ${nodeVersion}, retrying... (${try}/3)"
- fi
- sleep 3
- try=${try}+1
- done
- cp -r /usr/local/n/versions/node/${nodeVersion}/* ${nodePath}/
- /usr/local/bin/n rm ${nodeVersion}
- if ! ${node} --version; then
- LEcho error "[x] 未能成功安装最新版本 Node.js" "[x] Failed to install the latest version of Node.js"
- fi
- LEcho echo "=============== Node Version ===============" "=============== Node Version ==============="
- LEcho echo "Node 版本: $(${node} --version)" "Node Version: $(${node} --version)"
- LEcho echo "NPM 版本: $(${npm} --version)" "NPM Version: $(${npm} --version)"
- LEcho echo "============================================" "============================================"
- return
-}
-
-### Main ###
-## Main Install Function
-Install() {
- LEcho echo "[-] 正在安装 MCSManager ..." "[-] Installing MCSManager ..."
-
- # Move to MCSM
- cd ${mcsmPath} || LEcho error "[x] 未能成功进入 MCSM 安装目录" "[x] Failed to enter the MCSM installation directory"
-
- # Download MCSM Daemon
- LEcho echo "[↓] 正在下载 MCSManager Daemon..." "[↓] Downloading MCSManager Daemon..."
- git clone --single-branch -b master --depth 1 ${daemonCloneURL}
- mv -f MCSManager-Daemon-Production daemon
-
- # Download MCSM Web
- LEcho echo "[↓] 正在下载 MCSManager Web..." "[↓] Downloading MCSManager Web..."
- git clone --single-branch -b master --depth 1 ${webCloneURL}
- mv -f MCSManager-Web-Production web
-
- # Install MCSM Daemon
- LEcho echo "[+] 正在安装 MCSManager Daemon..." "[+] Installing MCSManager Daemon..."
- cd daemon || LEcho error "[x] 未能成功进入 MCSM Daemon 安装目录" "[x] Failed to enter the MCSM Daemon installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- # Install MCSM Web
- LEcho echo "[+] 正在安装 MCSManager Web..." "[+] Installing MCSManager Web..."
- cd ../web || LEcho error "[x] 未能成功进入 MCSM Web 安装目录" "[x] Failed to enter the MCSManager Web installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- LEcho green "[√] MCSManager 安装完成" "[√] MCSManager installation completed"
-
- # Check install mode
- if [ "${installMode}" == "upgrade" ]; then
- LEcho echo "[-] 正在移动旧数据..." "[-] Moving old data..."
- mv -f /tmp/mcsmanager/data/daemon ${mcsmPath}/daemon/data || LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- mv -f /tmp/mcsmanager/data/web ${mcsmPath}/web/data || LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- rm -rf /tmp/mcsmanager
- LEcho green "[√] 数据迁移完成" "[√] Data migration completed"
- fi
- return
-}
-
-### Other ###
-## Clean up
-Clean() {
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
- return
-}
-
-### Start ###
-Init
-Install
-exit 0
\ No newline at end of file
diff --git a/deb/pack/arm/DEBIAN/prerm b/deb/pack/arm/DEBIAN/prerm
deleted file mode 100644
index 05c41dd..0000000
--- a/deb/pack/arm/DEBIAN/prerm
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Uninstall Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-### Tools ###
-# Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho cyan "[-] 正在卸载 MCSManager..." "[-] Uninstalling MCSManager..."
-
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
-
- LEcho green "[+] MCSManager 卸载成功!" "[+] MCSManager Uninstalled!"
- return
-}
-
-### Start ###
-Start
-exit 0
\ No newline at end of file
diff --git a/deb/pack/arm64/DEBIAN/control b/deb/pack/arm64/DEBIAN/control
deleted file mode 100644
index 8d30a3c..0000000
--- a/deb/pack/arm64/DEBIAN/control
+++ /dev/null
@@ -1,9 +0,0 @@
-Package:MCSManager
-Version:9
-Section:stable
-Priority:optional
-Depends:wget,curl,git,tar,sudo
-Suggests:language-pack-zh-hans,fonts-droid-fallback,ttf-wqy-zenhei,ttf-wqy-microhei,fonts-arphic-ukai,fonts-arphic-uming
-Architecture:arm64
-Maintainer:unitwk
-Description:A multilingual, lightweight, out-of-the-box, and multi-instance Minecraft server control panel with Docker support.
diff --git a/deb/pack/arm64/DEBIAN/postinst b/deb/pack/arm64/DEBIAN/postinst
deleted file mode 100644
index 56d465a..0000000
--- a/deb/pack/arm64/DEBIAN/postinst
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## Install Mode
-if [ -d /tmp/mcsmanager/data ]; then
- installMode="upgrade"
-else
- installMode="install"
-fi
-
-## Other
-firewall=""
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho echo "[-] 正在启动 MCSManager..." "[-] Starting MCSManager..."
-
- # Start MCSM service
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
- systemctl start mcsm-daemon.service
- systemctl start mcsm-web.service
-
- # Check MCSM service
- if ! systemctl is-active --quiet mcsm-daemon.service || ! systemctl --quiet is-active mcsm-web.service; then
- systemctl status mcsm-{web,daemon}.service
- LEcho error "[x] MCSManager 启动失败" "[x] MCSManager failed to start"
- fi
-
- # Allow ports
- if command -v ufw; then
- ufw allow 23333/tcp
- ufw allow 24444/tcp
- elif command -v iptables-save; then
- iptables -A INPUT -p tcp --dport 23333 -j ACCEPT
- iptables -A INPUT -p tcp --dport 24444 -j ACCEPT
- iptables-save
- else
- firewall="problem"
- fi
-
- # Output auth information
- AuthInfo
- return
-}
-
-## Access Information
-AuthInfo() {
- if [ ${installMode} == "upgrade" ]; then
- ip="$(curl -s https://ipconfig.io)"
- port=$(cat ${mcsmPath}/web/data/SystemConfig/config.json | grep "httpPort" | tr -cd '0-9')
- daemonPort=$(cat ${mcsmPath}/daemon/data/Config/global.json | grep "port" | tr -cd '0-9')
- fi
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan "欢迎使用 MCSManager, 您可以通过以下方式访问 MCSManager " "Welcome to MCSManager, you can access it by the following ways"
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板地址: " "Web Service Address: "
-
- [ ${installMode} == "upgrade" ] && LEcho cyan "http://${ip}:${port}" "http://${ip}:${port}"
- [ ${installMode} == "upgrade" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
- [ ${installMode} == "upgrade" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
-
- [ ${installMode} == "install" ] && LEcho cyan "http://localhost:23333" "http://localhost:23333"
- [ ${installMode} == "install" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- [ ${installMode} == "install" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports 23333 and 24444 to use the service properly on the Internet."
-
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More info: https://docs.mcsmanager.com/"
- LEcho cyan "==================================================================" "=================================================================="
- return
-}
-
-### Start ###
-Start
-exit 0
diff --git a/deb/pack/arm64/DEBIAN/preinst b/deb/pack/arm64/DEBIAN/preinst
deleted file mode 100644
index 7a8cac7..0000000
--- a/deb/pack/arm64/DEBIAN/preinst
+++ /dev/null
@@ -1,280 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-
-## Files
-mcsmOldPath="/opt/mcsmanager"
-mcsmPath="/opt/mcsmanager"
-nodePath="${mcsmPath}/node"
-
-## Node
-nodeVersion="18.12.1"
-node="${nodePath}/bin/node"
-npm="${node} ${nodePath}/bin/npm"
-
-## Install Mode
-installMode="install"
-
-## URL
-daemonCloneURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
-webCloneURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
-nodeMirror="https://npmmirror.com/mirrors/node"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## CDN
-CN=0
-
-## Other
-try=1
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Init ###
-## Check environment
-Init() {
- LEcho echo "[-] 正在初始化环境..." "[-] Initializing environment..."
-
- # Check functions
- CheckMCSM
- CheckCN
- CheckNodejs
-
- LEcho echo "[-] 环境初始化完成" "[-] Environment initialization completed"
- return
-}
-
-## Check if MCSM is installed
-CheckMCSM() {
- if [ -d ${mcsmOldPath} ]; then
- LEcho yellow "[-] 检测到已安装的 MCSManager, 切换为更新模式..." "[-] MCSManager has been installed, switching to update mode..."
-
- # Switch to update mode
- installMode="upgrade"
-
- # Prepare for backup old data
- mkdir -p /tmp/mcsmanager/data
-
- # A little easteregg
- # Maybe you wanna play Inscryption?
- LEcho echo "[-] 正在将 旧数据 打包并移动至临时文件夹..." "[-] Packing and moving old data to temporary folder..."
-
- # Backup old data
- if [ -d ${mcsmOldPath}/daemon/data ]; then
- mv -f ${mcsmOldPath}/daemon/data /tmp/mcsmanager/data/daemon
- else
- LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- fi
- if [ -d ${mcsmOldPath}/web/data ]; then
- mv -f ${mcsmOldPath}/web/data /tmp/mcsmanager/data/web
- else
- LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- fi
-
- # Remove old service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove old data
- if [ -d ${mcsmOldPath} ]; then
- rm -rf ${mcsmOldPath}
- fi
-
- # Remove old link
- if [ -L /usr/bin/mcsmanager ]; then
- rm -f /usr/bin/mcsmanager
- fi
- fi
-
- # Prepare for a new install
- mkdir -p ${nodePath}
- return
-}
-
-## Check if the system is Chinese
-CheckCN() {
- if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
- LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China"
- [ "${zh}" == 1 ] && read -e -r -p "[?] 是否选用中国镜像完成安装? [y/n] " input
- [ "${zh}" == 0 ] && read -e -r -p "[?] Whether to use the Chinese mirror to complete the installation? [y/n] " input
- case ${input} in
- [yY][eE][sS] | [yY])
- LEcho echo "[-] 选用中国镜像" "[-] Use Chinese mirror"
- CN=1
- ;;
- *)
- LEcho echo "[-] 不选用中国镜像" "[-] Do not use Chinese mirror"
- ;;
- esac
- fi
- if [ "${CN}" == 1 ]; then
- daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- export N_NODE_MIRROR=${nodeMirror}
- fi
- return
-}
-
-## Check nodejs
-CheckNodejs() {
- if ! /usr/local/bin/n -V; then
- if [ "${CN}" == 1 ]; then
- npm i -g n --registry=https://registry.npmmirror.com
- else
- npm i -g n
- fi
- fi
- while true; do
- if /usr/local/bin/n ${nodeVersion} -d || [ ${try} == 3 ]; then
- break
- else
- LEcho yellow "[!] 安装 Node.js ${nodeVersion} 失败, 重试中... (${try}/3)" "[!] Failed to install Node.js ${nodeVersion}, retrying... (${try}/3)"
- fi
- sleep 3
- try=${try}+1
- done
- cp -r /usr/local/n/versions/node/${nodeVersion}/* ${nodePath}/
- /usr/local/bin/n rm ${nodeVersion}
- if ! ${node} --version; then
- LEcho error "[x] 未能成功安装最新版本 Node.js" "[x] Failed to install the latest version of Node.js"
- fi
- LEcho echo "=============== Node Version ===============" "=============== Node Version ==============="
- LEcho echo "Node 版本: $(${node} --version)" "Node Version: $(${node} --version)"
- LEcho echo "NPM 版本: $(${npm} --version)" "NPM Version: $(${npm} --version)"
- LEcho echo "============================================" "============================================"
- return
-}
-
-### Main ###
-## Main Install Function
-Install() {
- LEcho echo "[-] 正在安装 MCSManager ..." "[-] Installing MCSManager ..."
-
- # Move to MCSM
- cd ${mcsmPath} || LEcho error "[x] 未能成功进入 MCSM 安装目录" "[x] Failed to enter the MCSM installation directory"
-
- # Download MCSM Daemon
- LEcho echo "[↓] 正在下载 MCSManager Daemon..." "[↓] Downloading MCSManager Daemon..."
- git clone --single-branch -b master --depth 1 ${daemonCloneURL}
- mv -f MCSManager-Daemon-Production daemon
-
- # Download MCSM Web
- LEcho echo "[↓] 正在下载 MCSManager Web..." "[↓] Downloading MCSManager Web..."
- git clone --single-branch -b master --depth 1 ${webCloneURL}
- mv -f MCSManager-Web-Production web
-
- # Install MCSM Daemon
- LEcho echo "[+] 正在安装 MCSManager Daemon..." "[+] Installing MCSManager Daemon..."
- cd daemon || LEcho error "[x] 未能成功进入 MCSM Daemon 安装目录" "[x] Failed to enter the MCSM Daemon installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- # Install MCSM Web
- LEcho echo "[+] 正在安装 MCSManager Web..." "[+] Installing MCSManager Web..."
- cd ../web || LEcho error "[x] 未能成功进入 MCSM Web 安装目录" "[x] Failed to enter the MCSManager Web installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- LEcho green "[√] MCSManager 安装完成" "[√] MCSManager installation completed"
-
- # Check install mode
- if [ "${installMode}" == "upgrade" ]; then
- LEcho echo "[-] 正在移动旧数据..." "[-] Moving old data..."
- mv -f /tmp/mcsmanager/data/daemon ${mcsmPath}/daemon/data || LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- mv -f /tmp/mcsmanager/data/web ${mcsmPath}/web/data || LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- rm -rf /tmp/mcsmanager
- LEcho green "[√] 数据迁移完成" "[√] Data migration completed"
- fi
- return
-}
-
-### Other ###
-## Clean up
-Clean() {
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
- return
-}
-
-### Start ###
-Init
-Install
-exit 0
\ No newline at end of file
diff --git a/deb/pack/arm64/DEBIAN/prerm b/deb/pack/arm64/DEBIAN/prerm
deleted file mode 100644
index 05c41dd..0000000
--- a/deb/pack/arm64/DEBIAN/prerm
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Uninstall Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-### Tools ###
-# Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho cyan "[-] 正在卸载 MCSManager..." "[-] Uninstalling MCSManager..."
-
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
-
- LEcho green "[+] MCSManager 卸载成功!" "[+] MCSManager Uninstalled!"
- return
-}
-
-### Start ###
-Start
-exit 0
\ No newline at end of file
diff --git a/deb/pack/build.sh b/deb/pack/build.sh
deleted file mode 100644
index 8b12c1f..0000000
--- a/deb/pack/build.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/bash
-
-
-echo "Building..."
-
-# Find dpkg
-if ! command -v dpkg;then
- echo "Error: dpkg not found"
- exit 1
-fi
-
-# Some prepare work
-[ -f ../src/DEBIAN/postinst.sh ] && mv -f ../src/DEBIAN/postinst.sh ../src/DEBIAN/postinst
-[ -f ../src/DEBIAN/preinst.sh ] && mv -f ../src/DEBIAN/preinst.sh ../src/DEBIAN/preinst
-[ -f ../src/DEBIAN/prerm.sh ] && mv -f ../src/DEBIAN/prerm.sh ../src/DEBIAN/prerm
-
-# Remove old files
-echo "Remove old files..."
-rm -rf ./*/DEBIAN/preinst
-rm -rf ./*/DEBIAN/postinst
-rm -rf ./*/DEBIAN/prerm
-
-echo "Copy new script files..."
-cp -r -v ../src/DEBIAN/* ./amd64/DEBIAN/
-cp -r -v ../src/DEBIAN/* ./arm64/DEBIAN/
-cp -r -v ../src/DEBIAN/* ./arm/DEBIAN/
-cp -r -v ../src/DEBIAN/* ./i386/DEBIAN/
-cp -r -v ../src/DEBIAN/* ./ppc64le/DEBIAN/
-cp -r -v ../src/DEBIAN/* ./s390x/DEBIAN/
-
-# Set Premission
-echo "Set Permission..."
-chmod 775 ./*/DEBIAN/pre*
-chmod 775 ./*/DEBIAN/post*
-chown -R debian ./*
-
-[ -f ../src/DEBIAN/postinst ] && mv -f ../src/DEBIAN/postinst ../src/DEBIAN/postinst.sh
-[ -f ../src/DEBIAN/preinst ] && mv -f ../src/DEBIAN/preinst ../src/DEBIAN/preinst.sh
-[ -f ../src/DEBIAN/prerm ] && mv -f ../src/DEBIAN/prerm ../src/DEBIAN/prerm.sh
-
-# Build
-if ! dpkg -b ./amd64/ MCSManager-amd64.deb; then
- echo "Error: Build amd64 arch deb failed"
- exit 1
-fi
-if ! dpkg -b ./arm/ MCSManager-arm.deb; then
- echo "Error: Build arm arch deb failed"
- exit 1
-fi
-if ! dpkg -b ./arm64/ MCSManager-arm64.deb; then
- echo "Error: Build arm64 arch deb failed"
- exit 1
-fi
-if ! dpkg -b ./i386/ MCSManager-i386.deb; then
- echo "Error: Build i386 arch deb failed"
- exit 1
-fi
-if ! dpkg -b ./ppc64le/ MCSManager-ppc64le.deb; then
- echo "Error: Build ppc64le arch deb failed"
- exit 1
-fi
-if ! dpkg -b ./s390x/ MCSManager-s390x.deb; then
- echo "Error: Build s390x arch deb failed"
- exit 1
-fi
-
-echo "Build complete"
diff --git a/deb/pack/i386/DEBIAN/control b/deb/pack/i386/DEBIAN/control
deleted file mode 100644
index 145a2df..0000000
--- a/deb/pack/i386/DEBIAN/control
+++ /dev/null
@@ -1,9 +0,0 @@
-Package:MCSManager
-Version:9
-Section:stable
-Priority:optional
-Depends:wget,curl,git,tar,sudo
-Suggests:language-pack-zh-hans,fonts-droid-fallback,ttf-wqy-zenhei,ttf-wqy-microhei,fonts-arphic-ukai,fonts-arphic-uming
-Architecture:i386
-Maintainer:unitwk
-Description:A multilingual, lightweight, out-of-the-box, and multi-instance Minecraft server control panel with Docker support.
diff --git a/deb/pack/i386/DEBIAN/postinst b/deb/pack/i386/DEBIAN/postinst
deleted file mode 100644
index 56d465a..0000000
--- a/deb/pack/i386/DEBIAN/postinst
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## Install Mode
-if [ -d /tmp/mcsmanager/data ]; then
- installMode="upgrade"
-else
- installMode="install"
-fi
-
-## Other
-firewall=""
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho echo "[-] 正在启动 MCSManager..." "[-] Starting MCSManager..."
-
- # Start MCSM service
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
- systemctl start mcsm-daemon.service
- systemctl start mcsm-web.service
-
- # Check MCSM service
- if ! systemctl is-active --quiet mcsm-daemon.service || ! systemctl --quiet is-active mcsm-web.service; then
- systemctl status mcsm-{web,daemon}.service
- LEcho error "[x] MCSManager 启动失败" "[x] MCSManager failed to start"
- fi
-
- # Allow ports
- if command -v ufw; then
- ufw allow 23333/tcp
- ufw allow 24444/tcp
- elif command -v iptables-save; then
- iptables -A INPUT -p tcp --dport 23333 -j ACCEPT
- iptables -A INPUT -p tcp --dport 24444 -j ACCEPT
- iptables-save
- else
- firewall="problem"
- fi
-
- # Output auth information
- AuthInfo
- return
-}
-
-## Access Information
-AuthInfo() {
- if [ ${installMode} == "upgrade" ]; then
- ip="$(curl -s https://ipconfig.io)"
- port=$(cat ${mcsmPath}/web/data/SystemConfig/config.json | grep "httpPort" | tr -cd '0-9')
- daemonPort=$(cat ${mcsmPath}/daemon/data/Config/global.json | grep "port" | tr -cd '0-9')
- fi
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan "欢迎使用 MCSManager, 您可以通过以下方式访问 MCSManager " "Welcome to MCSManager, you can access it by the following ways"
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板地址: " "Web Service Address: "
-
- [ ${installMode} == "upgrade" ] && LEcho cyan "http://${ip}:${port}" "http://${ip}:${port}"
- [ ${installMode} == "upgrade" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
- [ ${installMode} == "upgrade" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
-
- [ ${installMode} == "install" ] && LEcho cyan "http://localhost:23333" "http://localhost:23333"
- [ ${installMode} == "install" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- [ ${installMode} == "install" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports 23333 and 24444 to use the service properly on the Internet."
-
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More info: https://docs.mcsmanager.com/"
- LEcho cyan "==================================================================" "=================================================================="
- return
-}
-
-### Start ###
-Start
-exit 0
diff --git a/deb/pack/i386/DEBIAN/preinst b/deb/pack/i386/DEBIAN/preinst
deleted file mode 100644
index 7a8cac7..0000000
--- a/deb/pack/i386/DEBIAN/preinst
+++ /dev/null
@@ -1,280 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-
-## Files
-mcsmOldPath="/opt/mcsmanager"
-mcsmPath="/opt/mcsmanager"
-nodePath="${mcsmPath}/node"
-
-## Node
-nodeVersion="18.12.1"
-node="${nodePath}/bin/node"
-npm="${node} ${nodePath}/bin/npm"
-
-## Install Mode
-installMode="install"
-
-## URL
-daemonCloneURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
-webCloneURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
-nodeMirror="https://npmmirror.com/mirrors/node"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## CDN
-CN=0
-
-## Other
-try=1
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Init ###
-## Check environment
-Init() {
- LEcho echo "[-] 正在初始化环境..." "[-] Initializing environment..."
-
- # Check functions
- CheckMCSM
- CheckCN
- CheckNodejs
-
- LEcho echo "[-] 环境初始化完成" "[-] Environment initialization completed"
- return
-}
-
-## Check if MCSM is installed
-CheckMCSM() {
- if [ -d ${mcsmOldPath} ]; then
- LEcho yellow "[-] 检测到已安装的 MCSManager, 切换为更新模式..." "[-] MCSManager has been installed, switching to update mode..."
-
- # Switch to update mode
- installMode="upgrade"
-
- # Prepare for backup old data
- mkdir -p /tmp/mcsmanager/data
-
- # A little easteregg
- # Maybe you wanna play Inscryption?
- LEcho echo "[-] 正在将 旧数据 打包并移动至临时文件夹..." "[-] Packing and moving old data to temporary folder..."
-
- # Backup old data
- if [ -d ${mcsmOldPath}/daemon/data ]; then
- mv -f ${mcsmOldPath}/daemon/data /tmp/mcsmanager/data/daemon
- else
- LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- fi
- if [ -d ${mcsmOldPath}/web/data ]; then
- mv -f ${mcsmOldPath}/web/data /tmp/mcsmanager/data/web
- else
- LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- fi
-
- # Remove old service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove old data
- if [ -d ${mcsmOldPath} ]; then
- rm -rf ${mcsmOldPath}
- fi
-
- # Remove old link
- if [ -L /usr/bin/mcsmanager ]; then
- rm -f /usr/bin/mcsmanager
- fi
- fi
-
- # Prepare for a new install
- mkdir -p ${nodePath}
- return
-}
-
-## Check if the system is Chinese
-CheckCN() {
- if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
- LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China"
- [ "${zh}" == 1 ] && read -e -r -p "[?] 是否选用中国镜像完成安装? [y/n] " input
- [ "${zh}" == 0 ] && read -e -r -p "[?] Whether to use the Chinese mirror to complete the installation? [y/n] " input
- case ${input} in
- [yY][eE][sS] | [yY])
- LEcho echo "[-] 选用中国镜像" "[-] Use Chinese mirror"
- CN=1
- ;;
- *)
- LEcho echo "[-] 不选用中国镜像" "[-] Do not use Chinese mirror"
- ;;
- esac
- fi
- if [ "${CN}" == 1 ]; then
- daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- export N_NODE_MIRROR=${nodeMirror}
- fi
- return
-}
-
-## Check nodejs
-CheckNodejs() {
- if ! /usr/local/bin/n -V; then
- if [ "${CN}" == 1 ]; then
- npm i -g n --registry=https://registry.npmmirror.com
- else
- npm i -g n
- fi
- fi
- while true; do
- if /usr/local/bin/n ${nodeVersion} -d || [ ${try} == 3 ]; then
- break
- else
- LEcho yellow "[!] 安装 Node.js ${nodeVersion} 失败, 重试中... (${try}/3)" "[!] Failed to install Node.js ${nodeVersion}, retrying... (${try}/3)"
- fi
- sleep 3
- try=${try}+1
- done
- cp -r /usr/local/n/versions/node/${nodeVersion}/* ${nodePath}/
- /usr/local/bin/n rm ${nodeVersion}
- if ! ${node} --version; then
- LEcho error "[x] 未能成功安装最新版本 Node.js" "[x] Failed to install the latest version of Node.js"
- fi
- LEcho echo "=============== Node Version ===============" "=============== Node Version ==============="
- LEcho echo "Node 版本: $(${node} --version)" "Node Version: $(${node} --version)"
- LEcho echo "NPM 版本: $(${npm} --version)" "NPM Version: $(${npm} --version)"
- LEcho echo "============================================" "============================================"
- return
-}
-
-### Main ###
-## Main Install Function
-Install() {
- LEcho echo "[-] 正在安装 MCSManager ..." "[-] Installing MCSManager ..."
-
- # Move to MCSM
- cd ${mcsmPath} || LEcho error "[x] 未能成功进入 MCSM 安装目录" "[x] Failed to enter the MCSM installation directory"
-
- # Download MCSM Daemon
- LEcho echo "[↓] 正在下载 MCSManager Daemon..." "[↓] Downloading MCSManager Daemon..."
- git clone --single-branch -b master --depth 1 ${daemonCloneURL}
- mv -f MCSManager-Daemon-Production daemon
-
- # Download MCSM Web
- LEcho echo "[↓] 正在下载 MCSManager Web..." "[↓] Downloading MCSManager Web..."
- git clone --single-branch -b master --depth 1 ${webCloneURL}
- mv -f MCSManager-Web-Production web
-
- # Install MCSM Daemon
- LEcho echo "[+] 正在安装 MCSManager Daemon..." "[+] Installing MCSManager Daemon..."
- cd daemon || LEcho error "[x] 未能成功进入 MCSM Daemon 安装目录" "[x] Failed to enter the MCSM Daemon installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- # Install MCSM Web
- LEcho echo "[+] 正在安装 MCSManager Web..." "[+] Installing MCSManager Web..."
- cd ../web || LEcho error "[x] 未能成功进入 MCSM Web 安装目录" "[x] Failed to enter the MCSManager Web installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- LEcho green "[√] MCSManager 安装完成" "[√] MCSManager installation completed"
-
- # Check install mode
- if [ "${installMode}" == "upgrade" ]; then
- LEcho echo "[-] 正在移动旧数据..." "[-] Moving old data..."
- mv -f /tmp/mcsmanager/data/daemon ${mcsmPath}/daemon/data || LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- mv -f /tmp/mcsmanager/data/web ${mcsmPath}/web/data || LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- rm -rf /tmp/mcsmanager
- LEcho green "[√] 数据迁移完成" "[√] Data migration completed"
- fi
- return
-}
-
-### Other ###
-## Clean up
-Clean() {
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
- return
-}
-
-### Start ###
-Init
-Install
-exit 0
\ No newline at end of file
diff --git a/deb/pack/i386/DEBIAN/prerm b/deb/pack/i386/DEBIAN/prerm
deleted file mode 100644
index 05c41dd..0000000
--- a/deb/pack/i386/DEBIAN/prerm
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Uninstall Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-### Tools ###
-# Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho cyan "[-] 正在卸载 MCSManager..." "[-] Uninstalling MCSManager..."
-
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
-
- LEcho green "[+] MCSManager 卸载成功!" "[+] MCSManager Uninstalled!"
- return
-}
-
-### Start ###
-Start
-exit 0
\ No newline at end of file
diff --git a/deb/pack/ppc64le/DEBIAN/control b/deb/pack/ppc64le/DEBIAN/control
deleted file mode 100644
index ba2131e..0000000
--- a/deb/pack/ppc64le/DEBIAN/control
+++ /dev/null
@@ -1,9 +0,0 @@
-Package:MCSManager
-Version:9
-Section:stable
-Priority:optional
-Depends:wget,curl,git,tar,sudo
-Suggests:language-pack-zh-hans,fonts-droid-fallback,ttf-wqy-zenhei,ttf-wqy-microhei,fonts-arphic-ukai,fonts-arphic-uming
-Architecture:ppc64le
-Maintainer:unitwk
-Description:A multilingual, lightweight, out-of-the-box, and multi-instance Minecraft server control panel with Docker support.
diff --git a/deb/pack/ppc64le/DEBIAN/postinst b/deb/pack/ppc64le/DEBIAN/postinst
deleted file mode 100644
index 56d465a..0000000
--- a/deb/pack/ppc64le/DEBIAN/postinst
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## Install Mode
-if [ -d /tmp/mcsmanager/data ]; then
- installMode="upgrade"
-else
- installMode="install"
-fi
-
-## Other
-firewall=""
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho echo "[-] 正在启动 MCSManager..." "[-] Starting MCSManager..."
-
- # Start MCSM service
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
- systemctl start mcsm-daemon.service
- systemctl start mcsm-web.service
-
- # Check MCSM service
- if ! systemctl is-active --quiet mcsm-daemon.service || ! systemctl --quiet is-active mcsm-web.service; then
- systemctl status mcsm-{web,daemon}.service
- LEcho error "[x] MCSManager 启动失败" "[x] MCSManager failed to start"
- fi
-
- # Allow ports
- if command -v ufw; then
- ufw allow 23333/tcp
- ufw allow 24444/tcp
- elif command -v iptables-save; then
- iptables -A INPUT -p tcp --dport 23333 -j ACCEPT
- iptables -A INPUT -p tcp --dport 24444 -j ACCEPT
- iptables-save
- else
- firewall="problem"
- fi
-
- # Output auth information
- AuthInfo
- return
-}
-
-## Access Information
-AuthInfo() {
- if [ ${installMode} == "upgrade" ]; then
- ip="$(curl -s https://ipconfig.io)"
- port=$(cat ${mcsmPath}/web/data/SystemConfig/config.json | grep "httpPort" | tr -cd '0-9')
- daemonPort=$(cat ${mcsmPath}/daemon/data/Config/global.json | grep "port" | tr -cd '0-9')
- fi
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan "欢迎使用 MCSManager, 您可以通过以下方式访问 MCSManager " "Welcome to MCSManager, you can access it by the following ways"
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板地址: " "Web Service Address: "
-
- [ ${installMode} == "upgrade" ] && LEcho cyan "http://${ip}:${port}" "http://${ip}:${port}"
- [ ${installMode} == "upgrade" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
- [ ${installMode} == "upgrade" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
-
- [ ${installMode} == "install" ] && LEcho cyan "http://localhost:23333" "http://localhost:23333"
- [ ${installMode} == "install" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- [ ${installMode} == "install" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports 23333 and 24444 to use the service properly on the Internet."
-
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More info: https://docs.mcsmanager.com/"
- LEcho cyan "==================================================================" "=================================================================="
- return
-}
-
-### Start ###
-Start
-exit 0
diff --git a/deb/pack/ppc64le/DEBIAN/preinst b/deb/pack/ppc64le/DEBIAN/preinst
deleted file mode 100644
index 7a8cac7..0000000
--- a/deb/pack/ppc64le/DEBIAN/preinst
+++ /dev/null
@@ -1,280 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-
-## Files
-mcsmOldPath="/opt/mcsmanager"
-mcsmPath="/opt/mcsmanager"
-nodePath="${mcsmPath}/node"
-
-## Node
-nodeVersion="18.12.1"
-node="${nodePath}/bin/node"
-npm="${node} ${nodePath}/bin/npm"
-
-## Install Mode
-installMode="install"
-
-## URL
-daemonCloneURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
-webCloneURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
-nodeMirror="https://npmmirror.com/mirrors/node"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## CDN
-CN=0
-
-## Other
-try=1
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Init ###
-## Check environment
-Init() {
- LEcho echo "[-] 正在初始化环境..." "[-] Initializing environment..."
-
- # Check functions
- CheckMCSM
- CheckCN
- CheckNodejs
-
- LEcho echo "[-] 环境初始化完成" "[-] Environment initialization completed"
- return
-}
-
-## Check if MCSM is installed
-CheckMCSM() {
- if [ -d ${mcsmOldPath} ]; then
- LEcho yellow "[-] 检测到已安装的 MCSManager, 切换为更新模式..." "[-] MCSManager has been installed, switching to update mode..."
-
- # Switch to update mode
- installMode="upgrade"
-
- # Prepare for backup old data
- mkdir -p /tmp/mcsmanager/data
-
- # A little easteregg
- # Maybe you wanna play Inscryption?
- LEcho echo "[-] 正在将 旧数据 打包并移动至临时文件夹..." "[-] Packing and moving old data to temporary folder..."
-
- # Backup old data
- if [ -d ${mcsmOldPath}/daemon/data ]; then
- mv -f ${mcsmOldPath}/daemon/data /tmp/mcsmanager/data/daemon
- else
- LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- fi
- if [ -d ${mcsmOldPath}/web/data ]; then
- mv -f ${mcsmOldPath}/web/data /tmp/mcsmanager/data/web
- else
- LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- fi
-
- # Remove old service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove old data
- if [ -d ${mcsmOldPath} ]; then
- rm -rf ${mcsmOldPath}
- fi
-
- # Remove old link
- if [ -L /usr/bin/mcsmanager ]; then
- rm -f /usr/bin/mcsmanager
- fi
- fi
-
- # Prepare for a new install
- mkdir -p ${nodePath}
- return
-}
-
-## Check if the system is Chinese
-CheckCN() {
- if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
- LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China"
- [ "${zh}" == 1 ] && read -e -r -p "[?] 是否选用中国镜像完成安装? [y/n] " input
- [ "${zh}" == 0 ] && read -e -r -p "[?] Whether to use the Chinese mirror to complete the installation? [y/n] " input
- case ${input} in
- [yY][eE][sS] | [yY])
- LEcho echo "[-] 选用中国镜像" "[-] Use Chinese mirror"
- CN=1
- ;;
- *)
- LEcho echo "[-] 不选用中国镜像" "[-] Do not use Chinese mirror"
- ;;
- esac
- fi
- if [ "${CN}" == 1 ]; then
- daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- export N_NODE_MIRROR=${nodeMirror}
- fi
- return
-}
-
-## Check nodejs
-CheckNodejs() {
- if ! /usr/local/bin/n -V; then
- if [ "${CN}" == 1 ]; then
- npm i -g n --registry=https://registry.npmmirror.com
- else
- npm i -g n
- fi
- fi
- while true; do
- if /usr/local/bin/n ${nodeVersion} -d || [ ${try} == 3 ]; then
- break
- else
- LEcho yellow "[!] 安装 Node.js ${nodeVersion} 失败, 重试中... (${try}/3)" "[!] Failed to install Node.js ${nodeVersion}, retrying... (${try}/3)"
- fi
- sleep 3
- try=${try}+1
- done
- cp -r /usr/local/n/versions/node/${nodeVersion}/* ${nodePath}/
- /usr/local/bin/n rm ${nodeVersion}
- if ! ${node} --version; then
- LEcho error "[x] 未能成功安装最新版本 Node.js" "[x] Failed to install the latest version of Node.js"
- fi
- LEcho echo "=============== Node Version ===============" "=============== Node Version ==============="
- LEcho echo "Node 版本: $(${node} --version)" "Node Version: $(${node} --version)"
- LEcho echo "NPM 版本: $(${npm} --version)" "NPM Version: $(${npm} --version)"
- LEcho echo "============================================" "============================================"
- return
-}
-
-### Main ###
-## Main Install Function
-Install() {
- LEcho echo "[-] 正在安装 MCSManager ..." "[-] Installing MCSManager ..."
-
- # Move to MCSM
- cd ${mcsmPath} || LEcho error "[x] 未能成功进入 MCSM 安装目录" "[x] Failed to enter the MCSM installation directory"
-
- # Download MCSM Daemon
- LEcho echo "[↓] 正在下载 MCSManager Daemon..." "[↓] Downloading MCSManager Daemon..."
- git clone --single-branch -b master --depth 1 ${daemonCloneURL}
- mv -f MCSManager-Daemon-Production daemon
-
- # Download MCSM Web
- LEcho echo "[↓] 正在下载 MCSManager Web..." "[↓] Downloading MCSManager Web..."
- git clone --single-branch -b master --depth 1 ${webCloneURL}
- mv -f MCSManager-Web-Production web
-
- # Install MCSM Daemon
- LEcho echo "[+] 正在安装 MCSManager Daemon..." "[+] Installing MCSManager Daemon..."
- cd daemon || LEcho error "[x] 未能成功进入 MCSM Daemon 安装目录" "[x] Failed to enter the MCSM Daemon installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- # Install MCSM Web
- LEcho echo "[+] 正在安装 MCSManager Web..." "[+] Installing MCSManager Web..."
- cd ../web || LEcho error "[x] 未能成功进入 MCSM Web 安装目录" "[x] Failed to enter the MCSManager Web installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- LEcho green "[√] MCSManager 安装完成" "[√] MCSManager installation completed"
-
- # Check install mode
- if [ "${installMode}" == "upgrade" ]; then
- LEcho echo "[-] 正在移动旧数据..." "[-] Moving old data..."
- mv -f /tmp/mcsmanager/data/daemon ${mcsmPath}/daemon/data || LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- mv -f /tmp/mcsmanager/data/web ${mcsmPath}/web/data || LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- rm -rf /tmp/mcsmanager
- LEcho green "[√] 数据迁移完成" "[√] Data migration completed"
- fi
- return
-}
-
-### Other ###
-## Clean up
-Clean() {
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
- return
-}
-
-### Start ###
-Init
-Install
-exit 0
\ No newline at end of file
diff --git a/deb/pack/ppc64le/DEBIAN/prerm b/deb/pack/ppc64le/DEBIAN/prerm
deleted file mode 100644
index 05c41dd..0000000
--- a/deb/pack/ppc64le/DEBIAN/prerm
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Uninstall Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-### Tools ###
-# Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho cyan "[-] 正在卸载 MCSManager..." "[-] Uninstalling MCSManager..."
-
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
-
- LEcho green "[+] MCSManager 卸载成功!" "[+] MCSManager Uninstalled!"
- return
-}
-
-### Start ###
-Start
-exit 0
\ No newline at end of file
diff --git a/deb/pack/s390x/DEBIAN/control b/deb/pack/s390x/DEBIAN/control
deleted file mode 100644
index 2b44ac1..0000000
--- a/deb/pack/s390x/DEBIAN/control
+++ /dev/null
@@ -1,9 +0,0 @@
-Package:MCSManager
-Version:9
-Section:stable
-Priority:optional
-Depends:wget,curl,git,tar,sudo
-Suggests:language-pack-zh-hans,fonts-droid-fallback,ttf-wqy-zenhei,ttf-wqy-microhei,fonts-arphic-ukai,fonts-arphic-uming
-Architecture:s390x
-Maintainer:unitwk
-Description:A multilingual, lightweight, out-of-the-box, and multi-instance Minecraft server control panel with Docker support.
diff --git a/deb/pack/s390x/DEBIAN/postinst b/deb/pack/s390x/DEBIAN/postinst
deleted file mode 100644
index 56d465a..0000000
--- a/deb/pack/s390x/DEBIAN/postinst
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## Install Mode
-if [ -d /tmp/mcsmanager/data ]; then
- installMode="upgrade"
-else
- installMode="install"
-fi
-
-## Other
-firewall=""
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho echo "[-] 正在启动 MCSManager..." "[-] Starting MCSManager..."
-
- # Start MCSM service
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
- systemctl start mcsm-daemon.service
- systemctl start mcsm-web.service
-
- # Check MCSM service
- if ! systemctl is-active --quiet mcsm-daemon.service || ! systemctl --quiet is-active mcsm-web.service; then
- systemctl status mcsm-{web,daemon}.service
- LEcho error "[x] MCSManager 启动失败" "[x] MCSManager failed to start"
- fi
-
- # Allow ports
- if command -v ufw; then
- ufw allow 23333/tcp
- ufw allow 24444/tcp
- elif command -v iptables-save; then
- iptables -A INPUT -p tcp --dport 23333 -j ACCEPT
- iptables -A INPUT -p tcp --dport 24444 -j ACCEPT
- iptables-save
- else
- firewall="problem"
- fi
-
- # Output auth information
- AuthInfo
- return
-}
-
-## Access Information
-AuthInfo() {
- if [ ${installMode} == "upgrade" ]; then
- ip="$(curl -s https://ipconfig.io)"
- port=$(cat ${mcsmPath}/web/data/SystemConfig/config.json | grep "httpPort" | tr -cd '0-9')
- daemonPort=$(cat ${mcsmPath}/daemon/data/Config/global.json | grep "port" | tr -cd '0-9')
- fi
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan "欢迎使用 MCSManager, 您可以通过以下方式访问 MCSManager " "Welcome to MCSManager, you can access it by the following ways"
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板地址: " "Web Service Address: "
-
- [ ${installMode} == "upgrade" ] && LEcho cyan "http://${ip}:${port}" "http://${ip}:${port}"
- [ ${installMode} == "upgrade" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
- [ ${installMode} == "upgrade" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
-
- [ ${installMode} == "install" ] && LEcho cyan "http://localhost:23333" "http://localhost:23333"
- [ ${installMode} == "install" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- [ ${installMode} == "install" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports 23333 and 24444 to use the service properly on the Internet."
-
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More info: https://docs.mcsmanager.com/"
- LEcho cyan "==================================================================" "=================================================================="
- return
-}
-
-### Start ###
-Start
-exit 0
diff --git a/deb/pack/s390x/DEBIAN/preinst b/deb/pack/s390x/DEBIAN/preinst
deleted file mode 100644
index 7a8cac7..0000000
--- a/deb/pack/s390x/DEBIAN/preinst
+++ /dev/null
@@ -1,280 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-
-## Files
-mcsmOldPath="/opt/mcsmanager"
-mcsmPath="/opt/mcsmanager"
-nodePath="${mcsmPath}/node"
-
-## Node
-nodeVersion="18.12.1"
-node="${nodePath}/bin/node"
-npm="${node} ${nodePath}/bin/npm"
-
-## Install Mode
-installMode="install"
-
-## URL
-daemonCloneURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
-webCloneURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
-nodeMirror="https://npmmirror.com/mirrors/node"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## CDN
-CN=0
-
-## Other
-try=1
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Init ###
-## Check environment
-Init() {
- LEcho echo "[-] 正在初始化环境..." "[-] Initializing environment..."
-
- # Check functions
- CheckMCSM
- CheckCN
- CheckNodejs
-
- LEcho echo "[-] 环境初始化完成" "[-] Environment initialization completed"
- return
-}
-
-## Check if MCSM is installed
-CheckMCSM() {
- if [ -d ${mcsmOldPath} ]; then
- LEcho yellow "[-] 检测到已安装的 MCSManager, 切换为更新模式..." "[-] MCSManager has been installed, switching to update mode..."
-
- # Switch to update mode
- installMode="upgrade"
-
- # Prepare for backup old data
- mkdir -p /tmp/mcsmanager/data
-
- # A little easteregg
- # Maybe you wanna play Inscryption?
- LEcho echo "[-] 正在将 旧数据 打包并移动至临时文件夹..." "[-] Packing and moving old data to temporary folder..."
-
- # Backup old data
- if [ -d ${mcsmOldPath}/daemon/data ]; then
- mv -f ${mcsmOldPath}/daemon/data /tmp/mcsmanager/data/daemon
- else
- LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- fi
- if [ -d ${mcsmOldPath}/web/data ]; then
- mv -f ${mcsmOldPath}/web/data /tmp/mcsmanager/data/web
- else
- LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- fi
-
- # Remove old service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove old data
- if [ -d ${mcsmOldPath} ]; then
- rm -rf ${mcsmOldPath}
- fi
-
- # Remove old link
- if [ -L /usr/bin/mcsmanager ]; then
- rm -f /usr/bin/mcsmanager
- fi
- fi
-
- # Prepare for a new install
- mkdir -p ${nodePath}
- return
-}
-
-## Check if the system is Chinese
-CheckCN() {
- if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
- LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China"
- [ "${zh}" == 1 ] && read -e -r -p "[?] 是否选用中国镜像完成安装? [y/n] " input
- [ "${zh}" == 0 ] && read -e -r -p "[?] Whether to use the Chinese mirror to complete the installation? [y/n] " input
- case ${input} in
- [yY][eE][sS] | [yY])
- LEcho echo "[-] 选用中国镜像" "[-] Use Chinese mirror"
- CN=1
- ;;
- *)
- LEcho echo "[-] 不选用中国镜像" "[-] Do not use Chinese mirror"
- ;;
- esac
- fi
- if [ "${CN}" == 1 ]; then
- daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- export N_NODE_MIRROR=${nodeMirror}
- fi
- return
-}
-
-## Check nodejs
-CheckNodejs() {
- if ! /usr/local/bin/n -V; then
- if [ "${CN}" == 1 ]; then
- npm i -g n --registry=https://registry.npmmirror.com
- else
- npm i -g n
- fi
- fi
- while true; do
- if /usr/local/bin/n ${nodeVersion} -d || [ ${try} == 3 ]; then
- break
- else
- LEcho yellow "[!] 安装 Node.js ${nodeVersion} 失败, 重试中... (${try}/3)" "[!] Failed to install Node.js ${nodeVersion}, retrying... (${try}/3)"
- fi
- sleep 3
- try=${try}+1
- done
- cp -r /usr/local/n/versions/node/${nodeVersion}/* ${nodePath}/
- /usr/local/bin/n rm ${nodeVersion}
- if ! ${node} --version; then
- LEcho error "[x] 未能成功安装最新版本 Node.js" "[x] Failed to install the latest version of Node.js"
- fi
- LEcho echo "=============== Node Version ===============" "=============== Node Version ==============="
- LEcho echo "Node 版本: $(${node} --version)" "Node Version: $(${node} --version)"
- LEcho echo "NPM 版本: $(${npm} --version)" "NPM Version: $(${npm} --version)"
- LEcho echo "============================================" "============================================"
- return
-}
-
-### Main ###
-## Main Install Function
-Install() {
- LEcho echo "[-] 正在安装 MCSManager ..." "[-] Installing MCSManager ..."
-
- # Move to MCSM
- cd ${mcsmPath} || LEcho error "[x] 未能成功进入 MCSM 安装目录" "[x] Failed to enter the MCSM installation directory"
-
- # Download MCSM Daemon
- LEcho echo "[↓] 正在下载 MCSManager Daemon..." "[↓] Downloading MCSManager Daemon..."
- git clone --single-branch -b master --depth 1 ${daemonCloneURL}
- mv -f MCSManager-Daemon-Production daemon
-
- # Download MCSM Web
- LEcho echo "[↓] 正在下载 MCSManager Web..." "[↓] Downloading MCSManager Web..."
- git clone --single-branch -b master --depth 1 ${webCloneURL}
- mv -f MCSManager-Web-Production web
-
- # Install MCSM Daemon
- LEcho echo "[+] 正在安装 MCSManager Daemon..." "[+] Installing MCSManager Daemon..."
- cd daemon || LEcho error "[x] 未能成功进入 MCSM Daemon 安装目录" "[x] Failed to enter the MCSM Daemon installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- # Install MCSM Web
- LEcho echo "[+] 正在安装 MCSManager Web..." "[+] Installing MCSManager Web..."
- cd ../web || LEcho error "[x] 未能成功进入 MCSM Web 安装目录" "[x] Failed to enter the MCSManager Web installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- LEcho green "[√] MCSManager 安装完成" "[√] MCSManager installation completed"
-
- # Check install mode
- if [ "${installMode}" == "upgrade" ]; then
- LEcho echo "[-] 正在移动旧数据..." "[-] Moving old data..."
- mv -f /tmp/mcsmanager/data/daemon ${mcsmPath}/daemon/data || LEcho yellow "[-] 未检测到旧版 Daemon 数据, 跳过迁移..." "[-] Old Daemon data was not detected, skipping migration..."
- mv -f /tmp/mcsmanager/data/web ${mcsmPath}/web/data || LEcho yellow "[-] 未检测到旧版 Web 数据, 跳过迁移..." "[-] Old Web data was not detected, skipping migration..."
- rm -rf /tmp/mcsmanager
- LEcho green "[√] 数据迁移完成" "[√] Data migration completed"
- fi
- return
-}
-
-### Other ###
-## Clean up
-Clean() {
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
- return
-}
-
-### Start ###
-Init
-Install
-exit 0
\ No newline at end of file
diff --git a/deb/pack/s390x/DEBIAN/prerm b/deb/pack/s390x/DEBIAN/prerm
deleted file mode 100644
index 05c41dd..0000000
--- a/deb/pack/s390x/DEBIAN/prerm
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Uninstall Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-### Tools ###
-# Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho cyan "[-] 正在卸载 MCSManager..." "[-] Uninstalling MCSManager..."
-
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
-
- LEcho green "[+] MCSManager 卸载成功!" "[+] MCSManager Uninstalled!"
- return
-}
-
-### Start ###
-Start
-exit 0
\ No newline at end of file
diff --git a/deb/src/DEBIAN/postinst.sh b/deb/src/DEBIAN/postinst.sh
deleted file mode 100644
index 62e21ac..0000000
--- a/deb/src/DEBIAN/postinst.sh
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-nodePath="${mcsmPath}/node"
-
-## Node
-node="${nodePath}/bin/node"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## Install Mode
-if [ -d /tmp/mcsmanager/data ]; then
- installMode="upgrade"
-else
- installMode="install"
-fi
-
-## Other
-#firewall=""
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho cyan "[-] 正在注册系统服务..." "[-] Registering system service..."
-
- echo "
-[Unit]
-Description=MCSManager Daemon
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
-ExecStart=${node} app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-daemon.service
-
- echo "
-[Unit]
-Description=MCSManager Web
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/web
-ExecStart=${node} app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-web.service
-
- LEcho cyan "[-] 正在启动 MCSManager..." "[-] Starting MCSManager..."
-
- # Start MCSM service
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
- systemctl start mcsm-daemon.service
- systemctl start mcsm-web.service
-
- # Check MCSM service
- if ! systemctl is-active --quiet mcsm-daemon.service || ! systemctl --quiet is-active mcsm-web.service; then
- systemctl status mcsm-{web,daemon}.service
- LEcho error "[x] MCSManager 启动失败" "[x] MCSManager failed to start"
- fi
-
- # Allow ports
- if command -v ufw; then
- ufw allow 23333/tcp
- ufw allow 24444/tcp
- elif command -v iptables-save; then
- iptables -A INPUT -p tcp --dport 23333 -j ACCEPT
- iptables -A INPUT -p tcp --dport 24444 -j ACCEPT
- iptables-save
- #else
- # firewall="problem"
- fi
-
- # Output auth information
- AuthInfo
- return
-}
-
-## Access Information
-AuthInfo() {
- if [ ${installMode} == "upgrade" ]; then
- ip="$(curl -s https://ipconfig.io)"
- port=$(cat ${mcsmPath}/web/data/SystemConfig/config.json | grep "httpPort" | tr -cd '0-9')
- daemonPort=$(cat ${mcsmPath}/daemon/data/Config/global.json | grep "port" | tr -cd '0-9')
- fi
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan "欢迎使用 MCSManager, 您可以通过以下方式访问 MCSManager " "Welcome to MCSManager, you can access it by the following ways"
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板地址: " "Web Service Address: "
-
- [ ${installMode} == "upgrade" ] && LEcho cyan "http://${ip}:${port}" "http://${ip}:${port}"
- [ ${installMode} == "upgrade" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
- #[ ${installMode} == "upgrade" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
-
- [ ${installMode} == "install" ] && LEcho cyan "http://localhost:23333" "http://localhost:23333"
- [ ${installMode} == "install" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- #[ ${installMode} == "install" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports 23333 and 24444 to use the service properly on the Internet."
-
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More info: https://docs.mcsmanager.com/"
- LEcho cyan "==================================================================" "=================================================================="
- return
-}
-
-### Start ###
-Start
-exit 0
diff --git a/deb/src/DEBIAN/preinst.sh b/deb/src/DEBIAN/preinst.sh
deleted file mode 100644
index af99458..0000000
--- a/deb/src/DEBIAN/preinst.sh
+++ /dev/null
@@ -1,291 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-
-## Files
-mcsmOldPath="/opt/mcsmanager"
-mcsmPath="/opt/mcsmanager"
-nodePath="${mcsmPath}/node"
-
-## Node
-nodeVersion="14.19.1"
-node="${nodePath}/bin/node"
-npm="${node} ${nodePath}/bin/npm"
-
-## Install Mode
-installMode="install"
-
-## URL
-daemonCloneURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
-webCloneURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
-nodeMirror="https://npmmirror.com/mirrors/node"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## CDN
-CN=0
-
-## Other
-try=1
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Init ###
-## Check environment
-Init() {
- LEcho cyan "[-] 正在初始化环境..." "[-] Initializing environment..."
-
- # Check functions
- CheckMCSM
- CheckCN
- CheckNodejs
-
- LEcho cyan "[-] 环境初始化完成" "[-] Environment initialization completed"
- return
-}
-
-## Check if MCSM is installed
-CheckMCSM() {
- if [ -d ${mcsmOldPath} ]; then
- LEcho yellow "[-] 检测到已安装的 MCSManager, 切换为更新模式..." "[-] MCSManager has been installed, switching to update mode..."
-
- # Switch to update mode
- installMode="upgrade"
-
- # Move old MCSM to backup path
- mv -f ${mcsmOldPath} ${mcsmOldPath}.bak
-
- # Remove old service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove old data
- if [ -d ${mcsmOldPath} ]; then
- rm -rf ${mcsmOldPath}
- fi
-
- # Remove old link
- if [ -L /usr/bin/mcsmanager ]; then
- rm -f /usr/bin/mcsmanager
- fi
- fi
-
- # Prepare for a new install
- mkdir -p ${nodePath}
- return
-}
-
-## Check if the system is Chinese
-CheckCN() {
- if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
- LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China"
- [ "${zh}" == 1 ] && read -e -r -p "[?] 是否选用中国镜像完成安装? [y/n] " input
- [ "${zh}" == 0 ] && read -e -r -p "[?] Whether to use the Chinese mirror to complete the installation? [y/n] " input
- case ${input} in
- [yY][eE][sS] | [yY])
- LEcho cyan "[-] 选用中国镜像" "[-] Use Chinese mirror"
- CN=1
- ;;
- *)
- LEcho cyan "[-] 不选用中国镜像" "[-] Do not use Chinese mirror"
- ;;
- esac
- fi
- if [ "${CN}" == 1 ]; then
- daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- export N_NODE_MIRROR=${nodeMirror}
- fi
- return
-}
-
-## Check nodejs
-CheckNodejs() {
- if ! /usr/local/bin/n -V; then
- if [ "${CN}" == 1 ]; then
- npm i -g n --registry=https://registry.npmmirror.com
- else
- npm i -g n
- fi
- fi
- while true; do
- if /usr/local/bin/n ${nodeVersion} -q -d || [ ${try} == 3 ]; then
- break
- else
- LEcho yellow "[!] 安装 Node.js ${nodeVersion} 失败, 重试中... (${try}/3)" "[!] Failed to install Node.js ${nodeVersion}, retrying... (${try}/3)"
- fi
- sleep 3
- try=${try}+1
- done
- cp -r /usr/local/n/versions/node/${nodeVersion}/* ${nodePath}/
- /usr/local/bin/n rm ${nodeVersion}
- if ! ${node} --version; then
- LEcho error "[x] 未能成功安装最新版本 Node.js" "[x] Failed to install the latest version of Node.js"
- fi
- LEcho cyan "=============== Node Version ===============" "=============== Node Version ==============="
- LEcho cyan "Node 版本: $(${node} --version)" "Node Version: $(${node} --version)"
- LEcho cyan "NPM 版本: $(${npm} --version)" "NPM Version: $(${npm} --version)"
- LEcho cyan "============================================" "============================================"
- return
-}
-
-### Main ###
-## Main Install Function
-Install() {
- LEcho cyan "[-] 正在安装 MCSManager ..." "[-] Installing MCSManager ..."
-
- # Move to MCSM
- cd ${mcsmPath} || LEcho error "[x] 未能成功进入 MCSM 安装目录" "[x] Failed to enter the MCSM installation directory"
-
- # Download MCSM Daemon
- LEcho cyan "[↓] 正在下载 MCSManager Daemon..." "[↓] Downloading MCSManager Daemon..."
- git clone --single-branch -b master --depth 1 ${daemonCloneURL}
- mv -f MCSManager-Daemon-Production daemon
-
- # Download MCSM Web
- LEcho cyan "[↓] 正在下载 MCSManager Web..." "[↓] Downloading MCSManager Web..."
- git clone --single-branch -b master --depth 1 ${webCloneURL}
- mv -f MCSManager-Web-Production web
-
- # Install MCSM Daemon
- LEcho cyan "[+] 正在安装 MCSManager Daemon..." "[+] Installing MCSManager Daemon..."
- cd daemon || LEcho error "[x] 未能成功进入 MCSM Daemon 安装目录" "[x] Failed to enter the MCSM Daemon installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- # Install MCSM Web
- LEcho cyan "[+] 正在安装 MCSManager Web..." "[+] Installing MCSManager Web..."
- cd ../web || LEcho error "[x] 未能成功进入 MCSM Web 安装目录" "[x] Failed to enter the MCSManager Web installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- LEcho green "[√] MCSManager 安装完成" "[√] MCSManager installation completed"
-
- # Check install mode
- if [ "${installMode}" == "upgrade" ]; then
- mv -f ${mcsmOldPath}.bak/daemon/data/ ${mcsmPath}/daemon/data/
- mv -f ${mcsmOldPath}.bak/web/data/ ${mcsmPath}/web/data/
- if [ ! -d ${mcsmPath}/daemon/data/ ] || [ ! -d ${mcsmPath}/web/data/ ]; then
- LEcho yellow "[!] 部分数据迁移失败, 您可能需要到 ${mcsmOldPath}.bak 手动进行迁移" "[!] Some data migration failed, you may need to manually migrate to ${mcsmOldPath}.bak"
- fi
- LEcho green "[√] 数据迁移完成" "[√] Data migration completed"
- fi
- return
-}
-
-### Other ###
-## Clean up
-Clean() {
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
-
- # Check install mode
- if [ ${mcsmOldPath} == "upgrade" ]; then
- LEcho cyan "[-] 检测到旧版 MCSManager 备份, 自动恢复中" "[-] Old version of MCSManager backup detected, automatic recovery"
- if ! mv -f ${mcsmOldPath}.bak ${mcsmOldPath}; then
- LEcho yellow "[!] 旧版 MCSManager 备份文件移动失败, 请手动移动 ${mcsmOldPath}.bak 至 ${mcsmOldPath}" "[!] Old version of MCSManager backup file move failed, please manually move ${mcsmOldPath}.bak to ${mcsmOldPath}"
- else
- rm -rf ${mcsmOldPath}.bak
- fi
- fi
- return
-}
-
-### Start ###
-LEcho cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-+----------------------------------------------------------------------
-" "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-+----------------------------------------------------------------------
-"
-## Try to cheat APT
-Init
-Install
-exit 0
diff --git a/deb/src/DEBIAN/prerm.sh b/deb/src/DEBIAN/prerm.sh
deleted file mode 100644
index 05c41dd..0000000
--- a/deb/src/DEBIAN/prerm.sh
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Uninstall Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-### Tools ###
-# Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho cyan "[-] 正在卸载 MCSManager..." "[-] Uninstalling MCSManager..."
-
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
-
- LEcho green "[+] MCSManager 卸载成功!" "[+] MCSManager Uninstalled!"
- return
-}
-
-### Start ###
-Start
-exit 0
\ No newline at end of file
diff --git a/deb_remove.sh b/deb_remove.sh
deleted file mode 100644
index 05c41dd..0000000
--- a/deb_remove.sh
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Uninstall Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-### Tools ###
-# Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Main ###
-Start() {
- LEcho cyan "[-] 正在卸载 MCSManager..." "[-] Uninstalling MCSManager..."
-
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
-
- LEcho green "[+] MCSManager 卸载成功!" "[+] MCSManager Uninstalled!"
- return
-}
-
-### Start ###
-Start
-exit 0
\ No newline at end of file
diff --git a/deb_setup.sh b/deb_setup.sh
deleted file mode 100644
index 1570c0f..0000000
--- a/deb_setup.sh
+++ /dev/null
@@ -1,442 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Remake By BlueFunny_
-
-### Variables ###
-
-## Files
-mcsmOldPath="/opt/mcsmanager"
-mcsmPath="/opt/mcsmanager"
-nodePath="${mcsmPath}/node"
-
-## Node
-nodeVersion="14.19.1"
-node="${nodePath}/bin/node"
-npm="${node} ${nodePath}/bin/npm"
-
-## Install Mode
-installMode="install"
-
-## URL
-daemonCloneURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
-webCloneURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
-nodeMirror="https://npmmirror.com/mirrors/node"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## CDN
-CN=0
-
-## Other
-try=1
-
-### Tools ###
-## Localize echo
-LEcho() {
- case $1 in
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
- error)
- Clean
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Init ###
-## Check environment
-Init() {
- LEcho cyan "[-] 正在初始化环境..." "[-] Initializing environment..."
-
- # Check functions
- CheckMCSM
- CheckCommand
- CheckCN
- CheckNodejs
-
- LEcho cyan "[-] 环境初始化完成" "[-] Environment initialization completed"
- return
-}
-
-## Check if all necessary software is installed
-CheckCommand() {
- LEcho cyan "[-] 正在检查依赖..." "[-] Checking dependencies..."
-
- # Check git
- if [[ $(command -v git) == "" ]]; then
- LEcho yellow "[-] 未安装 git" "[-] git is not installed"
- LEcho cyan "[-] 正在自动安装 git..." "[-] Automatically installing git..."
- [[ $(command -v apt) != "" ]] && apt install -y git
- [[ $(command -v yum) != "" ]] && yum install -y git
- [[ $(command -v pacman) != "" ]] && pacman -S git
- [[ $(command -v dnf) != "" ]] && dnf install -y git
- if [[ $(command -v git) == "" ]]; then LEcho error "[x] 未能自动安装 git, 请手动安装或重试" "[x] Unable to automatically install git, please manually install or try again"; fi
- fi
-
- # Check curl
- if [ "$(command -v curl)" == "" ]; then
- LEcho yellow "[-] 未安装 curl" "[-] curl is not installed"
- LEcho cyan "[-] 正在自动安装 curl..." "[-] Automatically installing curl..."
- [[ $(command -v apt) != "" ]] && apt install -y curl
- [[ $(command -v yum) != "" ]] && yum install -y curl
- [[ $(command -v pacman) != "" ]] && pacman -S curl
- [[ $(command -v dnf) != "" ]] && dnf install -y curl
- if [[ $(command -v curl) == "" ]]; then LEcho error "[x] 未能自动安装 curl, 请手动安装或重试" "[x] Unable to automatically install curl, please manually install or try again"; fi
- fi
-
- # Check wget
- if [ "$(command -v wget)" == "" ]; then
- LEcho yellow "[-] 未安装 wget" "[-] wget is not installed"
- LEcho cyan "[-] 正在自动安装 wget..." "[-] Automatically installing wget..."
- [[ $(command -v apt) != "" ]] && apt install -y wget
- [[ $(command -v yum) != "" ]] && yum install -y wget
- [[ $(command -v pacman) != "" ]] && pacman -S wget
- [[ $(command -v dnf) != "" ]] && dnf install -y wget
- if [[ $(command -v wget) == "" ]]; then LEcho error "[x] 未能自动安装 wget, 请手动安装或重试" "[x] Unable to automatically install wget, please manually install or try again"; fi
- fi
-
- # Check tar
- if [ "$(command -v tar)" == "" ]; then
- LEcho yellow "[-] 未安装 tar" "[-] tar is not installed"
- LEcho cyan "[-] 正在自动安装 tar..." "[-] Automatically installing tar..."
- [[ $(command -v apt) != "" ]] && apt install -y tar
- [[ $(command -v yum) != "" ]] && yum install -y tar
- [[ $(command -v pacman) != "" ]] && pacman -S tar
- [[ $(command -v dnf) != "" ]] && dnf install -y tar
- if [[ $(command -v tar) == "" ]]; then LEcho error "[x] 未能自动安装 tar, 请手动安装或重试" "[x] Unable to automatically install tar, please manually install or try again"; fi
- fi
-
- # Check npm
- if [ "$(command -v npm)" == "" ]; then
- LEcho yellow "[-] 未安装 npm" "[-] npm is not installed"
- LEcho cyan "[-] 正在自动安装 npm..." "[-] Automatically installing npm..."
- [[ $(command -v apt) != "" ]] && apt install -y npm
- [[ $(command -v yum) != "" ]] && yum install -y npm
- [[ $(command -v pacman) != "" ]] && pacman -S npm
- [[ $(command -v dnf) != "" ]] && dnf install -y npm
- if [[ $(command -v npm) == "" ]]; then LEcho error "[x] 未能自动安装 npm, 请手动安装或重试" "[x] Unable to automatically install npm, please manually install or try again"; fi
- fi
-
- LEcho cyan "[-] 依赖检查完成" "[-] Dependency check completed"
- return
-}
-
-## Check if MCSM is installed
-CheckMCSM() {
- if [ -d ${mcsmOldPath} ]; then
- LEcho yellow "[-] 检测到已安装的 MCSManager, 切换为更新模式..." "[-] MCSManager has been installed, switching to update mode..."
-
- # Switch to update mode
- installMode="upgrade"
-
- # Move old MCSM to backup path
- mv -f ${mcsmOldPath} ${mcsmOldPath}.bak
-
- # Remove old service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove old data
- if [ -d ${mcsmOldPath} ]; then
- rm -rf ${mcsmOldPath}
- fi
-
- # Remove old link
- if [ -L /usr/bin/mcsmanager ]; then
- rm -f /usr/bin/mcsmanager
- fi
- fi
-
- # Prepare for a new install
- mkdir -p ${nodePath}
- return
-}
-
-## Check if the system is Chinese
-CheckCN() {
- if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
- LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China"
- [ "${zh}" == 1 ] && read -e -r -p "[?] 是否选用中国镜像完成安装? [y/n] " input
- [ "${zh}" == 0 ] && read -e -r -p "[?] Whether to use the Chinese mirror to complete the installation? [y/n] " input
- case ${input} in
- [yY][eE][sS] | [yY])
- LEcho cyan "[-] 选用中国镜像" "[-] Use Chinese mirror"
- CN=1
- ;;
- *)
- LEcho cyan "[-] 不选用中国镜像" "[-] Do not use Chinese mirror"
- ;;
- esac
- fi
- if [ "${CN}" == 1 ]; then
- daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- export N_NODE_MIRROR=${nodeMirror}
- fi
- return
-}
-
-## Check nodejs
-CheckNodejs() {
- if ! /usr/local/bin/n -V; then
- if [ "${CN}" == 1 ]; then
- npm i -g n --registry=https://registry.npmmirror.com
- else
- npm i -g n
- fi
- fi
- while true; do
- if /usr/local/bin/n ${nodeVersion} -q -d || [ ${try} == 3 ]; then
- break
- else
- LEcho yellow "[!] 安装 Node.js ${nodeVersion} 失败, 重试中... (${try}/3)" "[!] Failed to install Node.js ${nodeVersion}, retrying... (${try}/3)"
- fi
- sleep 3
- try=${try}+1
- done
- cp -r /usr/local/n/versions/node/${nodeVersion}/* ${nodePath}/
- /usr/local/bin/n rm ${nodeVersion}
- if ! ${node} --version; then
- LEcho error "[x] 未能成功安装最新版本 Node.js" "[x] Failed to install the latest version of Node.js"
- fi
- LEcho yellow "=============== Node Version ===============" "=============== Node Version ==============="
- LEcho yellow "Node 版本: $(${node} --version)" "Node Version: $(${node} --version)"
- LEcho yellow "NPM 版本: $(${npm} --version)" "NPM Version: $(${npm} --version)"
- LEcho yellow "============================================" "============================================"
- return
-}
-
-### Main ###
-## Main Install Function
-Install() {
- LEcho cyan "[-] 正在安装 MCSManager ..." "[-] Installing MCSManager ..."
-
- # Move to MCSM
- cd ${mcsmPath} || LEcho error "[x] 未能成功进入 MCSM 安装目录" "[x] Failed to enter the MCSM installation directory"
-
- # Download MCSM Daemon
- LEcho cyan "[↓] 正在下载 MCSManager Daemon..." "[↓] Downloading MCSManager Daemon..."
- git clone --single-branch -b master --depth 1 ${daemonCloneURL}
- mv -f MCSManager-Daemon-Production daemon
-
- # Download MCSM Web
- LEcho cyan "[↓] 正在下载 MCSManager Web..." "[↓] Downloading MCSManager Web..."
- git clone --single-branch -b master --depth 1 ${webCloneURL}
- mv -f MCSManager-Web-Production web
-
- # Install MCSM Daemon
- LEcho cyan "[+] 正在安装 MCSManager Daemon..." "[+] Installing MCSManager Daemon..."
- cd daemon || LEcho error "[x] 未能成功进入 MCSM Daemon 安装目录" "[x] Failed to enter the MCSM Daemon installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- # Install MCSM Web
- LEcho cyan "[+] 正在安装 MCSManager Web..." "[+] Installing MCSManager Web..."
- cd ../web || LEcho error "[x] 未能成功进入 MCSM Web 安装目录" "[x] Failed to enter the MCSManager Web installation directory"
- if [ "${CN}" == 1 ]; then
- ${npm} i --registry=https://registry.npmmirror.com
- else
- ${npm} i
- fi
-
- LEcho green "[√] MCSManager 安装完成" "[√] MCSManager installation completed"
-
- # Check install mode
- if [ "${installMode}" == "upgrade" ]; then
- mv -f ${mcsmOldPath}.bak/daemon/data/ ${mcsmPath}/daemon/data/
- mv -f ${mcsmOldPath}.bak/web/data/ ${mcsmPath}/web/data/
- if [ ! -d ${mcsmPath}/daemon/data/ ] || [ ! -d ${mcsmPath}/web/data/ ]; then
- LEcho yellow "[!] 部分数据迁移失败, 您可能需要到 ${mcsmOldPath}.bak 手动进行迁移" "[!] Some data migration failed, you may need to manually migrate to ${mcsmOldPath}.bak"
- fi
- LEcho green "[√] 数据迁移完成" "[√] Data migration completed"
- fi
- LEcho cyan "[-] 正在注册系统服务..." "[-] Registering system service..."
-
- echo "
-[Unit]
-Description=MCSManager Daemon
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
-ExecStart=${node} app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-daemon.service
-
- echo "
-[Unit]
-Description=MCSManager Web
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/web
-ExecStart=${node} app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-web.service
-
- LEcho cyan "[-] 正在启动 MCSManager..." "[-] Starting MCSManager..."
-
- # Start MCSM service
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
- systemctl start mcsm-daemon.service
- systemctl start mcsm-web.service
-
- # Check MCSM service
- if ! systemctl is-active --quiet mcsm-daemon.service || ! systemctl --quiet is-active mcsm-web.service; then
- systemctl status mcsm-{web,daemon}.service
- LEcho error "[x] MCSManager 启动失败" "[x] MCSManager failed to start"
- fi
-
- # Allow ports
- if command -v ufw; then
- ufw allow 23333/tcp
- ufw allow 24444/tcp
- elif command -v iptables-save; then
- iptables -A INPUT -p tcp --dport 23333 -j ACCEPT
- iptables -A INPUT -p tcp --dport 24444 -j ACCEPT
- iptables-save
- #else
- # firewall="problem"
- fi
-
- # Output auth information
- AuthInfo
- return
-}
-
-## Access Information
-AuthInfo() {
- if [ ${installMode} == "upgrade" ]; then
- ip="$(curl -s https://ipconfig.io)"
- port=$(cat ${mcsmPath}/web/data/SystemConfig/config.json | grep "httpPort" | tr -cd '0-9')
- daemonPort=$(cat ${mcsmPath}/daemon/data/Config/global.json | grep "port" | tr -cd '0-9')
- fi
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan "欢迎使用 MCSManager, 您可以通过以下方式访问 MCSManager " "Welcome to MCSManager, you can access it by the following ways"
- LEcho cyan "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板地址: " "Web Service Address: "
-
- [ ${installMode} == "upgrade" ] && LEcho cyan "http://${ip}:${port}" "http://${ip}:${port}"
- [ ${installMode} == "upgrade" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
- #[ ${installMode} == "upgrade" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 ${port} 和 ${daemonPort} 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports ${port} and ${daemonPort} to use the service properly on the Internet."
-
- [ ${installMode} == "install" ] && LEcho cyan "http://localhost:23333" "http://localhost:23333"
- [ ${installMode} == "install" ] && LEcho yellow "若无法访问面板, 请检查 [云防火墙 / 安全组] 是否有放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- #[ ${installMode} == "install" ] && [ ${firewall} == "problem" ] && LEcho red "您的服务器没有安装防火墙, 请自行放行面板 23333 和 24444 端口, 控制面板需要这两个端口才能正常工作" "Your server does not have a firewall installed, please expose ports 23333 and 24444 to use the service properly on the Internet."
-
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More info: https://docs.mcsmanager.com/"
- LEcho cyan "==================================================================" "=================================================================="
- return
-}
-
-### Other ###
-## Clean up
-Clean() {
- # Remove service
- if [ -f /etc/systemd/system/mcsm-daemon.service ]; then
- systemctl is-active --quiet mcsm-daemon && systemctl stop mcsm-daemon
- systemctl disable mcsm-daemon
- rm -f /etc/systemd/system/mcsm-daemon.service
- fi
- if [ -f /etc/systemd/system/mcsm-web.service ]; then
- systemctl is-active --quiet mcsm-web && systemctl stop mcsm-web
- systemctl disable mcsm-web
- rm -f /etc/systemd/system/mcsm-web.service
- fi
- systemctl daemon-reload
-
- # Remove MCSManager
- if [ -d "${mcsmPath}" ]; then
- rm -rf "${mcsmPath}"
- fi
-
- # Check install mode
- if [ ${mcsmOldPath} == "upgrade" ]; then
- LEcho cyan "[-] 检测到旧版 MCSManager 备份, 自动恢复中" "[-] Old version of MCSManager backup detected, automatic recovery"
- if ! mv -f ${mcsmOldPath}.bak ${mcsmOldPath}; then
- LEcho yellow "[!] 旧版 MCSManager 备份文件移动失败, 请手动移动 ${mcsmOldPath}.bak 至 ${mcsmOldPath}" "[!] Old version of MCSManager backup file move failed, please manually move ${mcsmOldPath}.bak to ${mcsmOldPath}"
- else
- rm -rf ${mcsmOldPath}.bak
- fi
- fi
- return
-}
-
-### Start ###
-LEcho cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-| Remake By BlueFunny_
-+----------------------------------------------------------------------
-" "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-| Remake By BlueFunny_
-+----------------------------------------------------------------------
-"
-## Try to cheat APT
-Init
-Install
-exit 0
diff --git a/setup.sh b/setup.sh
index 5402ff3..5fcc2ec 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,187 +1,446 @@
-#!/bin/bash
-printf "\033c"
+#!/usr/bin/env bash
+
+#### MCSM Install Script
+#### Made By nuomiaa, CreeperKong, unitwk
+#### Recode By BlueFunny_
+
+### Variables ###
+## Files
+mcsmPath="/opt/mcsmanager"
+mcsmDaemonDPath="${mcsmPath}/daemon/data"
+mcsmWebDPath="${mcsmPath}/web/data"
+nodePath="${mcsmPath}/node"
+tmpPath="/tmp/mcsmanager-setup"
+
+## Node
+nodeVersion="v14.19.1"
+node="${nodePath}/bin/node"
+npm="${nodePath}/bin/npm"
+
+## Setup tools mode
+mode="install"
+
+## URL
+nodeMirror="https://nodejs.org/dist"
+daemonCloneURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
+webCloneURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
+nodeFileURL="${nodeMirror}/${nodeVersion}/node-${nodeVersion}-linux-${arch}.tar.gz"
+nodeHashURL="${nodeMirror}/${nodeVersion}/SHASUMS256.txt"
+
+## Language
+if [ "$(locale -a | grep "zh_CN")" != "" ]; then
+ zh=1
+ export LANG="zh_CN.UTF-8"
+else
+ zh=0
+fi
-error=""
-node="v14.19.1"
+## Other
+try=1
+os=$(uname -a)
arch=$(uname -m)
-mcsmanager_install_path="/opt/mcsmanager"
-zh=$([[ $(locale -a) =~ "zh" ]] && echo 1; export LANG=zh_CN.UTF-8 || echo 0)
-
-Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
+skipNodeInstall=0
+skipMCSMInstall=0
+
+### Tools ###
+## Localize echo
+# $1: color
+# $2: zh
+# $3: en
+LEcho() {
+ case $1 in
+ # Red color echo
+ red)
+ [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
+ ;;
+
+ # Green color echo
+ green)
+ [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
+ ;;
+
+ # Cyan color echo
+ cyan)
+ [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
+ ;;
+
+ # Cyan color echo (No line break)
+ cyan_n)
+ [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
+ ;;
+
+ # Yellow color echo
+ yellow)
+ [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
+ ;;
+
+ # Red error echo
+ error)
+ echo '================================================='
+ [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
+ echo '================================================='
+ exit 1
+ ;;
+
+ # No color echo
+ *)
+ [ "${zh}" == 1 ] && echo "$2"
+ [ "${zh}" == 0 ] && echo "$3"
+ ;;
+ esac
+ return
}
-echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
-}
+### Entry Point ###
+## Program entry point
+Main() {
+ LEcho cyan "[-] 正在检查环境..." "[-] Initializing environment..."
-echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
+ # Check mode
+ if [ "$1" == "uninstall" ]; then
+ mode="uninstall"
+ fi
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
+ # Create temp dir
+ if ! [ ! -d "${tmpPath}" ] && mkdir -p "${tmpPath}" || rm -rf "${tmpPath}" && mkdir -p "${tmpPath}"; then
+ CheckRoot
+ LEcho error "[x] 未能成功创建临时目录, 请检查权限" "[x] Failed to create temporary directory, please check permissions"
+ fi
+
+ # Check functions collection
+ if [ "${mode}" == "install" ]; then
+ # Install
+ CheckSystem
+ CheckOldFiles "$1"
+ CheckNetwork
+ CheckCN
+ SetArgs "$1" "$2"
+
+ LEcho cyan "[-] 环境检查完毕, 开始安装 MCSManager" "[-] Environment check completed, start installing MCSManager"
+
+ Install
+
+ if [ -d "${tmpPath}"/mcsmanager ] || [ -d "${tmpPath}"/node ]; then
+ LEcho cyan "[-] 检测到备份文件, 正在恢复中..." "[-] Backup files detected, recovering..."
+ MirgrateFiles
+ fi
+ else
+ # Uninstall
+ CheckRoot
+ CheckInstall
+
+ LEcho cyan "[-] 环境校验完毕, 开始卸载 MCSManager" "[-] Environment check completed, start uninstalling MCSManager"
-echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
+ Remove "$1"
+ fi
+
+ return
}
-echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
+### Init ###
+## Check if mcsm installed
+CheckInstall() {
+ if [ ! -d ${mcsmPath} ]; then
+ LEcho error "[x] 检测到您没有安装 MCSManager, 谨慎的拒绝卸载请求" "[x] It is detected that you have not installed MCSManager, and the uninstall request is rejected"
+ fi
+ return
}
-Install_Node() {
- if [ "$zh" == 1 ];
- then echo_cyan_n "[+] 安装 Node 环境... "
- else echo_cyan_n "[+] Install Node environment... "
+## Check OS
+CheckOS() {
+ if [ "$(echo "${os}" | grep "Ubuntu")" == "" ] && [ "$(echo "${os}" | grep "Debian")" == "" ] && [ "$(echo "${os}" | grep "CentOS")" == "" ]; then
+ LEcho error "[x] 本脚本仅支持 Ubuntu/Debian/CentOS 系统!" "[x] This script only supports Ubuntu/Debian/CentOS systems!"
fi
+ return
+}
- rm -irf "$node_install_path"
+## Check user permission
+CheckRoot() {
+ if [ "$(whoami)" != "root" ]; then
+ LEcho error "[x] 请使用 root 用户或者使用 sudo 命令执行脚本!" "[x] Please use root user or use sudo command to execute the script!"
+ fi
+ return
+}
- cd /opt || exit
+## Check system environment
+CheckSystem() {
+ # Function reuse
+ CheckRoot
+ CheckOS
- wget -o /dev/null https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
+ # Check Tools
+ if [ -f /etc/redhat-release ]; then
+ yum install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
+ else
+ apt-get install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
+ fi
- tar -zxf node-"$node"-linux-"$arch".tar.gz
+ # Check Arch
+ case "${arch}" in
+ x86_64)
+ arch=x64
+ ;;
+ aarch64)
+ arch=arm64
+ ;;
+ arm)
+ arch=armv7l
+ ;;
+ ppc64le)
+ arch=ppc64le
+ ;;
+ s390x)
+ arch=s390x
+ ;;
+ *)
+ LEcho error "[x] 当前系统架构暂不受 Node.js 支持, 无法安装 MCSManager" "[x] The current system architecture is not supported by Node.js, MCSManager cannot be installed"
+ ;;
+ esac
+
+ LEcho green "[√] 系统环境检查完成" "[√] System environment check completed"
+ return
+}
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- if [ ! -L /usr/bin/node ] && [ ! -f /usr/bin/node ];then
- ln -s "$node_install_path"/bin/node /usr/bin/node
- fi
- if [ ! -L /usr/bin/npm ] && [ ! -f /usr/bin/npm ];then
- ln -s "$node_install_path"/bin/npm /usr/bin/npm
+## Check if MCSManager is already installed on system
+CheckOldFiles() {
+ # Check old MCSManager files
+ if [ -d ${mcsmPath} ]; then
+ LEcho echo "[-] 检测到旧版本 MCSManager, 正在迁移文件中" "[-] Old version MCSManager detected, migrating files"
+ # Create backup dir
+ [ ! -d ${tmpPath}/mcsmanager ] && mkdir -p ${tmpPath}/mcsmanager
+ [ ! -d ${tmpPath}/systemd ] && mkdir -p ${tmpPath}/systemd
+
+ # Stop service
+ systemctl stop mcsm-daemson.service
+ systemctl stop mcsm-web.service
+ systemctl disable mcsm-daemon.service
+ systemctl disable mcsm-web.service
+
+ # Move files
+ mv -f ${mcsmPath}/web ${tmpPath}/mcsmanager/web
+ mv -f ${mcsmPath}/daemon ${tmpPath}/mcsmanager/daemon
+ mv -f /etc/systemd/system/mcsm-daemon.service "${tmpPath}"/systemd/mcsm-daemon.service
+ mv -f /etc/systemd/system/mcsm-web.service "${tmpPath}"/systemd/mcsm-web.service
fi
- chmod +x "$node_install_path"/bin/node
- chmod +x "$node_install_path"/bin/npm
+ # Check old node files
+ if [ -d ${nodePath} ]; then
+ LEcho echo "[-] 检测到旧版本 Node.js, 正在比对版本中" "[-] Old version Node.js detected, comparing versions"
- if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
- then
- if [ "$zh" == 1 ];
- then echo_green "成功"
- else echo_green "Success"
- fi
- else
- if [ "$zh" == 1 ];
- then
- echo_red "失败"
- Red_Error "[x] Node 安装失败!"
- else
- echo_red "Failed"
- Red_Error "[x] Node installation failed!"
+ # Check node version
+ if [ "$(${node} -v)" == "${nodeVersion}" ]; then
+ LEcho echo "[-] Node.js 版本匹配, 跳过 Node.js 下载" "[-] Node.js version matches, skipping Node.js download"
+ mv -f ${nodePath} ${tmpPath}/node
+ skipNodeInstall=1
fi
fi
- echo
- echo_yellow "=============== Node Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node Version ==============="
- echo
+ # Remove old files
+ Remove "$1"
- sleep 3
+ # Create new dir
+ mkdir -p ${mcsmPath}
+
+ LEcho green "[√] 旧文件检查完毕" "[√] Old file check completed"
+ return
}
-Install_MCSManager() {
- if [ "$zh" == 1 ];
- then echo_cyan "[+] 安装 MCSManager..."
- else echo_cyan "[+] Install MCSManager..."
+# Check network
+CheckNetwork() {
+ if [ "$(curl -m 10 -s https://www.baidu.com)" == "" ]; then
+ LEcho error "[x] 未能成功连接到网络, 请检查网络连接后重试" "[x] Failed to connect to the network, please check the network connection and try again"
fi
+ LEcho green "[√] 网络连接正常" "[√] Network connection is normal"
+ return
+}
- # 删除服务
- rm -f /etc/systemd/system/mcsm-daemon.service
- rm -f /etc/systemd/system/mcsm-web.service
+# Check if the server is in China
+CheckCN() {
+ if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
+ # LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China"
+ # [ "${zh}" == 1 ] && read -e -r -p "[?] 是否选用中国镜像完成安装? [y/n] " input
+ # [ "${zh}" == 0 ] && read -e -r -p "[?] Whether to use the Chinese mirror to complete the installation? [y/n] " input
+ # case ${input} in
+ # [yY][eE][sS] | [yY])
+ # LEcho cyan "[-] 选用中国镜像" "[-] Use Chinese mirror"
+ # daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
+ # webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
+ # nodeMirror="https://npmmirror.com/mirrors/node"
+ # ;;
+ # *)
+ # LEcho cyan "[-] 不选用中国镜像" "[-] Do not use Chinese mirror"
+ # ;;
+ # esac
+ LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国, 已自动切换为中国镜像源" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China, and the Chinese mirror source has been automatically switched"
+ daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
+ webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
+ nodeMirror="https://npmmirror.com/mirrors/node"
+ else
+ LEcho cyan "[-] 检测服务器地理位置出错, 跳过检测" "[-] Error detecting server location, skipping detection"
+ fi
+ LEcho green "[√] 服务器地理位置检查完毕" "[√] Location check completed"
+ return
+}
- # 重载
- systemctl daemon-reload
-
- # echo "[x] Delete the original MCSManager"
- rm -irf ${mcsmanager_install_path}
+# Set Debug Args
+SetArgs() {
+ # Warning
+ LEcho yellow "[!] 检测到您已启用 debug 功能, 安装可能会导致不可预知的错误" "[!] Debug mode is enabled, installation may cause unpredictable errors"
+ LEcho yellow "[!] 此模式导致的任何问题都不会得到解决" "[!] Any problems caused by this mode will not be solved"
+
+ # Set args
+ if [ "$1" != "" ] && [ "$1" != "remove" ]; then
+ if [ "$1" == "force" ]; then
+ LEcho echo "[-] 强制下载 Node.js" "[-] Force download Node.js"
+ skipNodeInstall=0
+ fi
+ if [ "$1" == "skipnode" ]; then
+ LEcho echo "[-] 已跳过 Node.js 安装" "[-] Skipped Node.js installation"
+ skipNodeInstall=1
+ fi
+ if [ "$1" == "skipmcsm" ]; then
+ LEcho echo "[-] 已跳过 MCSManager 安装" "[-] Skipped MCSManager installation"
+ skipMCSMInstall=1
+ fi
+ if [ "$1" == "custom" ] && [ "$2" != "" ]; then
+ LEcho echo "[-] 自定义安装路径为: $2" "[-] Custom installation path: $2"
+ mcsmPath="$2"
+ fi
+ if [ "$1" == "node" ] && [ "$2" != "" ]; then
+ LEcho echo "[-] 自定义 Node.js 下载链接为: $2" "[-] Custom Node.js download link: $2"
+ nodeMirror="$2"
+ fi
+ fi
+}
- # echo "[+] mkdir -p ${mcsmanager_install_path}"
- mkdir -p ${mcsmanager_install_path} || exit
+### Main ###
+## Main install function
+Install() {
+ InstallNode
+ [ ${skipMCSMInstall} != 1 ] && InstallMCSM
+}
- # echo "[→] cd ${mcsmanager_install_path}"
- cd ${mcsmanager_install_path} || exit
+## Install Node.js
+InstallNode() {
+ if [ ${skipNodeInstall} == 1 ]; then
+ if [ ! -d ${tmpPath}/node ]; then
+ LEcho echo "[-] 跳过 Node.js 安装" "[-] Skipped Node.js installation"
+ else
+ mv -f ${tmpPath}/node ${nodePath}
+ fi
+ else
+ LEcho echo "[+] 正在安装 Node.js" "[+] Installing Node.js"
- if [ "$zh" == 1 ];
- then echo_cyan "[↓] Git 克隆 MCSManager-Daemon..."
- else echo_cyan "[↓] Git clone MCSManager-Daemon..."
- fi
- git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git
+ # Download Node.js
+ wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
+ wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
- # echo "[-] mv MCSManager-Daemon-Production daemon"
- mv MCSManager-Daemon-Production daemon
+ # Check hash
+ cat ${tmpPath}/node.sha256 | grep "${nodeVersion}/node-${nodeVersion}-linux-${arch}.tar.gz" | tee ${tmpPath}/node.sha256
+ cd ${tmpPath} || LEcho red "[x] 校验出错, 无法继续进行下一步, 退回操作中..." "[x] Verification error, unable to continue to the next step, returning to operation..." && Revert
+ sha256sum -c ${tmpPath}/node.sha256 || LEcho red "[x] 校验出错, 无法继续进行下一步, 退回操作中..." "[x] Verification error, unable to continue to the next step, returning to operation..." && Revert
- # echo "[→] cd daemon"
- cd daemon || exit
+ # Extract Node.js
+ tar -xzvf ${tmpPath}/node.tar.gz -C ${nodePath} --strip-components=1
- if [ "$zh" == 1 ];
- then echo_cyan "[+] 安装 MCSManager-Daemon 依赖库..."
- else echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- fi
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
+ # Set permission
+ chmod +x ${node}
+ chmod +x ${npm}
- # echo "[←] cd .."
- cd ..
+ # Check Node.js installation
+ if ! ${node} -v; then
+ LEcho red "[x] Node.js 安装失败, 无法继续进行下一步, 退回操作中..." "[x] Node.js installation failed, please check the network connection"
+ Revert
+ fi
+ if ! ${npm} -v; then
+ LEcho red "[x] Node.js 安装失败, 无法继续进行下一步, 退回操作中..." "[x] Node.js installation failed, please check the network connection"
+ Revert
+ fi
- if [ "$zh" == 1 ];
- then echo_cyan "[↓] Git 克隆 MCSManager-Web..."
- else echo_cyan "[↓] Git clone MCSManager-Web..."
+ # Output Node.js version
+ echo
+ LEcho cyan "=============== Node 版本 ===============" "=============== Node Version ==============="
+ LEcho cyan_n " Node: " " Node: "
+ LEcho echo "$("${node}" -v)" "$("${node}" -v)"
+ LEcho cyan_n " NPM: " " NPM: "
+ LEcho echo "v$("${npm}" -v)" "v$("${npm}" -v)"
+ LEcho cyan "=========================================" "=============== Node Version ==============="
+ echo
+
+ sleep 3
+ LEcho green "[√] Node.js 安装完毕" "[√] Node.js installation completed"
fi
- git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Web-Production.git
-
- # echo "[-] mv MCSManager-Web-Production web"
- mv MCSManager-Web-Production web
+ return
+}
- # echo "[→] cd web"
- cd web || exit
+## Install MCSManager
+InstallMCSM() {
+ # Clone MCSManager daemon and web
+ git clone --single-branch -b master --depth 1 ${daemonCloneURL} "${mcsmPath}/daemon"
+ git clone --single-branch -b master --depth 1 ${webCloneURL} "${mcsmPath}/web"
- if [ "$zh" == 1 ];
- then echo_cyan "[+] 安装 MCSManager-Web 依赖库..."
- else echo_cyan "[+] Install MCSManager-Web dependencies..."
- fi
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
+ # Install Node.js dependencies
+ cd "${mcsmPath}/daemon" || LEcho red "[x] 无法进入 MCSManager 守护进程目录, 无法继续进行下一步, 退回操作中..." "[x] Unable to enter the MCSManager daemon directory, unable to continue to the next step, returning to operation..." && Revert
+ ${npm} install --registry=https://registry.npmmirror.com >error
+ cd "${mcsmPath}/web" || LEcho red "[x] 无法进入 MCSManager 网页面板目录, 无法继续进行下一步, 退回操作中..." "[x] Unable to enter the MCSManager web directory, unable to continue to the next step, returning to operation..." && Revert
+ ${npm} install --registry=https://registry.npmmirror.com >error
+ # Output MCSManager install path
echo
- echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
+ LEcho cyan "=============== MCSManager 安装目录 ===============" "=============== MCSManager Install Path ==============="
+ LEcho cyan_n " Daemon: " " Daemon: "
+ LEcho echo "${mcsmPath}/daemon" "${mcsmPath}/daemon"
+ LEcho cyan_n " Web: " " Web: "
+ LEcho echo "${mcsmPath}/web" "${mcsmPath}/web"
+ LEcho cyan "==================================================" "=============== MCSManager Install Path ==============="
echo
- if [ "$zh" == 1 ];
- then echo_green "[+] MCSManager 安装成功!"
- else echo_green "[+] MCSManager installation success!"
+
+ # Function reuse
+ CreateService
+ MirgrateFiles
+
+ # Test the availability of MCSManager
+ if ! systemctl start mcsm-web; then
+ LEcho red "[x] MCSManager 网页面板启动失败, 无法继续进行下一步, 退回操作中..." "[x] MCSManager installation failed, unable to continue to the next step, returning to operation..." && Revert
+ else
+ systemctl stop mcsm-web
+ fi
+ if ! systemctl start mcsm-daemon; then
+ LEcho red "[x] MCSManager 守护进程启动失败, 无法继续进行下一步, 退回操作中..." "[x] MCSManager installation failed, unable to continue to the next step, returning to operation..." && Revert
+ else
+ systemctl stop mcsm-daemon
fi
+ LEcho green "[√] MCSManager 安装完毕" "[√] MCSManager installation completed"
+
sleep 3
+ Output
+ return
}
-Create_Service() {
- if [ "$zh" == 1 ];
- then echo_cyan "[+] 创建 MCSManager 服务..."
- else echo_cyan "[+] Create MCSManager service..."
- fi
-
+## Create systemd service
+CreateService() {
+ # Write systemd service
echo "
[Unit]
Description=MCSManager Daemon
[Service]
WorkingDirectory=/opt/mcsmanager/daemon
-ExecStart=${node_install_path}/bin/node app.js
+ExecStart=${nodePath}/bin/node app.js
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-daemon.service
+" >/etc/systemd/system/mcsm-daemon.service
echo "
[Unit]
@@ -189,173 +448,143 @@ Description=MCSManager Web
[Service]
WorkingDirectory=/opt/mcsmanager/web
-ExecStart=${node_install_path}/bin/node app.js
+ExecStart=${nodePath}/bin/node app.js
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-web.service
+" >/etc/systemd/system/mcsm-web.service
- # 重载
+ # Enable systemd service
systemctl daemon-reload
-
- # 创建 Daemon 服务
systemctl enable mcsm-daemon.service --now
-
- # 创建 Web 服务
systemctl enable mcsm-web.service --now
sleep 3
+ return
+}
+
+## Mirgrate data
+MirgrateFiles() {
+ # Mirgrate mcsmanager data
+ if [ -d "${tmpPath}"/mcsmanager ]; then
+ [ ! -d "${mcsmWebDPath}" ] && mv -f "${tmpPath}"/mcsmanager/web/data "${mcsmWebDPath}" || rm -rf ${mcsmWebDPath} && mv -f "${tmpPath}"/mcsmanager/web/data "${mcsmWebDPath}"
+ [ ! -d "${mcsmWebDPath}" ] && mv -f "${tmpPath}"/mcsmanager/daemon/data "${mcsmDaemonDPath}" || rm -rf ${mcsmDaemonDPath} && mv -f "${tmpPath}"/mcsmanager/daemon/data "${mcsmDaemonDPath}"
+ fi
+
+ # Mirgrate old node files
+ if [ -d "${tmpPath}"/node ]; then
+ mv -f "${tmpPath}"/node "${nodePath}"
+ fi
+}
+## Output MCSManager information
+Output() {
printf "\033c"
- echo_yellow "=================================================================="
- if [ "$zh" == 1 ];
- then
- echo_green "欢迎使用 MCSManager,您可以通过以下方式访问:"
- echo_yellow "=================================================================="
- echo_cyan_n "控制面板地址: "; echo_yellow "http://localhost:23333"
- echo_red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。"
- echo_yellow "=================================================================="
- echo_cyan "重启 systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "禁用 systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "启用 systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "启动 systemctl start mcsm-{daemon,web}.service"
- echo_cyan "停止 systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "更多使用说明,请参考:https://docs.mcsmanager.com/"
- else
- echo_green "Welcome to MCSManager, you can access it by the following ways:"
- echo_yellow "=================================================================="
- echo_cyan_n "Web Service Address: "; echo_yellow "http://localhost:23333"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow "=================================================================="
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "More info: https://docs.mcsmanager.com/"
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho green "欢迎使用 MCSManager, 您可以通过以下方式访问: " "Welcome to use MCSManager, you can access it through the following ways:"
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho cyan_n "控制面板地址: " "Control panel address: "
+ LEcho yellow "http://localhost:23333" "http://localhost:23333"
+ LEcho red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。" "If you can't access the panel, please check if the firewall/security group has opened the panel 23333 and 24444 ports. The control panel needs these two ports to work properly."
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho cyan "重启 systemctl restart mcsm-{daemon,web}.service" "Restart systemctl restart mcsm-{daemon,web}.service"
+ LEcho cyan "禁用 systemctl disable mcsm-{daemon,web}.service" "Disable systemctl disable mcsm-{daemon,web}.service"
+ LEcho cyan "启用 systemctl enable mcsm-{daemon,web}.service" "Enable systemctl enable mcsm-{daemon,web}.service"
+ LEcho cyan "启动 systemctl start mcsm-{daemon,web}.service" "Start systemctl start mcsm-{daemon,web}.service"
+ LEcho cyan "停止 systemctl stop mcsm-{daemon,web}.service" "Stop systemctl stop mcsm-{daemon,web}.service"
+ LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More usage instructions, please refer to: https://docs.mcsmanager.com/"
+ LEcho yellow "==================================================================" "=================================================================="
+}
+
+## Main remove function
+Remove() {
+ # Stop systemd service
+ if [ "$1" != "remove" ]; then
+ systemctl stop mcsm-daemson.service
+ systemctl stop mcsm-web.service
+ systemctl disable mcsm-daemon.service
+ systemctl disable mcsm-web.service
fi
- echo_yellow "=================================================================="
-
+ # Remove systemd service
+ [ -f /etc/systemd/system/mcsm-daemon.service ] && rm -rf /etc/systemd/system/mcsm-daemon.service
+ [ -f /etc/systemd/system/mcsm-daemon.service ] && rm -rf /etc/systemd/system/mcsm-web.service
+ systemctl daemon-reload
+ # Ask if data is retained
+ if [ -d "${mcsmDaemonDPath}" ] || [ -d "${mcsmWebDPath}" ]; then
+ LEcho yellow "[?] 是否保留数据?" "[?] Do you want to keep the data?"
+ read -r -p "[y/N]:" input
+ case ${input} in
+ [yY][eE][sS] | [yY])
+ LEcho echo "[-] 保留数据" "[-] Keep data"
+ mv -f "${mcsmDaemonDPath}" "${tmpPath}"/mcsmanager/daemon
+ mv -f "${mcsmWebDPath}" "${tmpPath}"/mcsmanager/web
+ rm -rf "${mcsmPath}"
+ mv -f "${tmpPath}"/mcsmanager "${mcsmPath}.old"
+ ;;
+ *)
+ LEcho echo "[-] 删除数据" "[-] Delete data"
+ rm -rf "${mcsmPath}"
+ ;;
+ esac
+ fi
+ return
}
+### Other Functions ###
+## Revert Script Operation
+Revert() {
+ # Remove new files
+ rm -rf "${mcsmPath}"
+ rm -rf "${nodePath}"
+ rm -rf /etc/systemd/system/mcsm-daemon.service
+ rm -rf /etc/systemd/system/mcsm-web.service
+
+ # Restore old files
+ mv -f "${tmpPath}"/mcsmanager "${mcsmPath}"
+ mv -f "${tmpPath}"/node "${nodePath}"
+ mv -f "${tmpPath}"/systemd/mcsm-daemon.service /etc/systemd/system/mcsm-daemon.service
+ mv -f "${tmpPath}"/systemd/mcsm-web.service /etc/systemd/system/mcsm-web.service
+
+ # Re-enable systemd service
+ systemctl daemon-reload
+ systemctl enable mcsm-daemon.service
+ systemctl enable mcsm-web.service
-# ----------------- 程序启动 -----------------
+ Clean
-# 删除 Shell 脚本自身
-rm -f "$0"
+ LEcho error "[x] 安装失败" "[x] Installation failed"
+}
-# 检查执行用户权限
-if [ "$(whoami)" != "root" ]; then
- if [ "$zh" == 1 ];
- then Red_Error "[x] 请使用 root 权限执行 MCSManager 安装命令!"
- else Red_Error "[x] Please execute the MCSManager installation command with root permission!"
- fi
-fi
+## Clean Function
+Clean() {
+ rm -rf "${tmpPath}"
+ rm -rf "$0"
+ return
+}
-echo_cyan "+----------------------------------------------------------------------
+### Start ###
+LEcho cyan "+----------------------------------------------------------------------
+| MCSManager Installer
++----------------------------------------------------------------------
+| Copyright © 2022 MCSManager All rights reserved.
++----------------------------------------------------------------------
+| Shell Install Script by Nuomiaa & CreeperKong
+| Remake By BlueFunny_
++----------------------------------------------------------------------
+" "+----------------------------------------------------------------------
| MCSManager Installer
+----------------------------------------------------------------------
| Copyright © 2022 MCSManager All rights reserved.
+----------------------------------------------------------------------
| Shell Install Script by Nuomiaa & CreeperKong
+| Remake By BlueFunny_
+----------------------------------------------------------------------
"
-
-# 环境检查
-if [ "$arch" == x86_64 ]; then
- arch=x64
- #echo "[-] x64 architecture detected"
-elif [ $arch == aarch64 ]; then
- arch=arm64
- #echo "[-] 64-bit ARM architecture detected"
-elif [ $arch == arm ]; then
- arch=armv7l
- #echo "[-] 32-bit ARM architecture detected"
-elif [ $arch == ppc64le ]; then
- arch=ppc64le
- #echo "[-] IBM POWER architecture detected"
-elif [ $arch == s390x ]; then
- arch=s390x
- #echo "[-] IBM LinuxONE architecture detected"
-else
- if [ "$zh" == 1 ];
- then Red_Error "[x] 抱歉,暂不支持您的 体系架构($arch)!"
- else Red_Error "[x] Sorry, this architecture is not supported yet!"
- fi
- exit
-fi
-
-# 定义变量 Node 安装目录
-node_install_path="/opt/node-$node-linux-$arch"
-
-# 检查网络连接
-if [ "$zh" == 1 ];
- then
- echo_cyan "[-] 体系架构:$arch"
- else
- echo_cyan "[-] Architecture: $arch"
-fi
-
-# MCSManager 已安装
-if [ -d "$mcsmanager_install_path" ]; then
- printf "\033c"
- if [ "$zh" == 1 ];
- then echo_red "----------------------------------------------------
-检查到已有 MCSManager 安装在 \"$mcsmanager_install_path\"
-继续安装会删除原有 MCSManager 面版的所有数据!
-----------------------------------------------------
-将在 10 秒后继续安装,取消请按 Ctrl + Z/C 键!"
- else echo_red "----------------------------------------------------
-MCSManager is installed at \"$mcsmanager_install_path\"
-Continuing the installation will delete the original MCSManager!
-----------------------------------------------------
-Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
- fi
- sleep 10
-fi
-
-# 安装相关软件
-if [ "$zh" == 1 ];
- then echo_cyan_n "[-] 安装相关软件(git,tar)... "
- else echo_cyan_n "[+] Installing dependent software(git,tar)... "
-fi
-if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
-elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
-elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
-elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
-fi
-
-# 判断相关软件是否安装成功
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
- then
- if [ "$zh" == 1 ];
- then echo_green "成功"
- else echo_green "Success"
- fi
- else
- if [ "$zh" == 1 ];
- then echo_red "失败"
- else echo_red "Failed"
- fi
- echo "$error"
- if [ "$zh" == 1 ];
- then Red_Error "[x] 相关软件安装失败,请手动安装 git 和 tar 软件包!"
- else Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- fi
- exit
-fi
-
-
-# 安装 Node 环境
-Install_Node
-
-# 安装 MCSManager
-Install_MCSManager
-
-# 创建 MCSManager 后台服务
-Create_Service
+Main "$1" "$2" "$3"
+Clean
+exit 0
diff --git a/setup_old.sh b/setup_old.sh
new file mode 100644
index 0000000..dfd530e
--- /dev/null
+++ b/setup_old.sh
@@ -0,0 +1,371 @@
+#!/bin/bash
+printf "\033c"
+
+error=""
+node="v14.19.1"
+arch=$(uname -m)
+mcsmanager_install_path="/opt/mcsmanager"
+zh=$(
+ [[ $(locale -a) =~ "zh" ]] && echo 1
+ export LANG=zh_CN.UTF-8 || echo 0
+)
+
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
+
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
+
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
+
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
+
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
+
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
+}
+
+Install_Node() {
+ if [ "$zh" == 1 ]; then
+ echo_cyan_n "[+] 安装 Node 环境... "
+ else
+ echo_cyan_n "[+] Install Node environment... "
+ fi
+
+ rm -irf "$node_install_path"
+
+ cd /opt || exit
+
+ wget -o /dev/null https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
+
+ tar -zxf node-"$node"-linux-"$arch".tar.gz
+
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
+ if [ ! -L /usr/bin/node ] && [ ! -f /usr/bin/node ]; then
+ ln -s "$node_install_path"/bin/node /usr/bin/node
+ fi
+ if [ ! -L /usr/bin/npm ] && [ ! -f /usr/bin/npm ]; then
+ ln -s "$node_install_path"/bin/npm /usr/bin/npm
+ fi
+
+ chmod +x "$node_install_path"/bin/node
+ chmod +x "$node_install_path"/bin/npm
+
+ if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]; then
+ if [ "$zh" == 1 ]; then
+ echo_green "成功"
+ else
+ echo_green "Success"
+ fi
+ else
+ if [ "$zh" == 1 ]; then
+ echo_red "失败"
+ Red_Error "[x] Node 安装失败!"
+ else
+ echo_red "Failed"
+ Red_Error "[x] Node installation failed!"
+ fi
+ fi
+
+ echo
+ echo_yellow "=============== Node Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node Version ==============="
+ echo
+
+ sleep 3
+}
+
+Install_MCSManager() {
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 安装 MCSManager..."
+ else
+ echo_cyan "[+] Install MCSManager..."
+ fi
+
+ # 删除服务
+ rm -f /etc/systemd/system/mcsm-daemon.service
+ rm -f /etc/systemd/system/mcsm-web.service
+
+ # 重载
+ systemctl daemon-reload
+
+ # echo "[x] Delete the original MCSManager"
+ rm -irf ${mcsmanager_install_path}
+
+ # echo "[+] mkdir -p ${mcsmanager_install_path}"
+ mkdir -p ${mcsmanager_install_path} || exit
+
+ # echo "[→] cd ${mcsmanager_install_path}"
+ cd ${mcsmanager_install_path} || exit
+
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[↓] Git 克隆 MCSManager-Daemon..."
+ else
+ echo_cyan "[↓] Git clone MCSManager-Daemon..."
+ fi
+ git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git daemon
+
+ # echo "[→] cd daemon"
+ cd daemon || exit
+
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 安装 MCSManager-Daemon 依赖库..."
+ else
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ fi
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
+
+ # echo "[←] cd .."
+ cd ..
+
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[↓] Git 克隆 MCSManager-Web..."
+ else
+ echo_cyan "[↓] Git clone MCSManager-Web..."
+ fi
+ git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Web-Production.git web
+
+ # echo "[→] cd web"
+ cd web || exit
+
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 安装 MCSManager-Web 依赖库..."
+ else
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ fi
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
+
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green " Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ if [ "$zh" == 1 ]; then
+ echo_green "[+] MCSManager 安装成功!"
+ else
+ echo_green "[+] MCSManager installation success!"
+ fi
+
+ sleep 3
+}
+
+Create_Service() {
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 创建 MCSManager 服务..."
+ else
+ echo_cyan "[+] Create MCSManager service..."
+ fi
+
+ echo "
+[Unit]
+Description=MCSManager Daemon
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/daemon
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s HUP $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" >/etc/systemd/system/mcsm-daemon.service
+
+ echo "
+[Unit]
+Description=MCSManager Web
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/web
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s HUP $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" >/etc/systemd/system/mcsm-web.service
+
+ # 重载
+ systemctl daemon-reload
+
+ # 创建 Daemon 服务
+ systemctl enable mcsm-daemon.service --now
+
+ # 创建 Web 服务
+ systemctl enable mcsm-web.service --now
+
+ sleep 3
+
+ printf "\033c"
+ echo_yellow "=================================================================="
+ if [ "$zh" == 1 ]; then
+ echo_green "欢迎使用 MCSManager,您可以通过以下方式访问:"
+ echo_yellow "=================================================================="
+ echo_cyan_n "控制面板地址: "
+ echo_yellow "http://localhost:23333"
+ echo_red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。"
+ echo_yellow "=================================================================="
+ echo_cyan "重启 systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "禁用 systemctl disable mcsm-{daemon,web}.service"
+ echo_cyan "启用 systemctl enable mcsm-{daemon,web}.service"
+ echo_cyan "启动 systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "停止 systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "更多使用说明,请参考:https://docs.mcsmanager.com/"
+ else
+ echo_green "Welcome to MCSManager, you can access it by the following ways:"
+ echo_yellow "=================================================================="
+ echo_cyan_n "Web Service Address: "
+ echo_yellow "http://localhost:23333"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow "=================================================================="
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "systemctl disable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl enable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "More info: https://docs.mcsmanager.com/"
+ fi
+ echo_yellow "=================================================================="
+
+}
+
+# ----------------- 程序启动 -----------------
+
+# 删除 Shell 脚本自身
+rm -f "$0"
+
+# 检查执行用户权限
+if [ "$(whoami)" != "root" ]; then
+ if [ "$zh" == 1 ]; then
+ Red_Error "[x] 请使用 root 权限执行 MCSManager 安装命令!"
+ else
+ Red_Error "[x] Please execute the MCSManager installation command with root permission!"
+ fi
+fi
+
+echo_cyan "+----------------------------------------------------------------------
+| MCSManager Installer
++----------------------------------------------------------------------
+| Copyright © 2022 MCSManager All rights reserved.
++----------------------------------------------------------------------
+| Shell Install Script by Nuomiaa & CreeperKong
++----------------------------------------------------------------------
+"
+
+# 环境检查
+if [ "$arch" == x86_64 ]; then
+ arch=x64
+ #echo "[-] x64 architecture detected"
+elif [ $arch == aarch64 ]; then
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
+elif [ $arch == arm ]; then
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
+elif [ $arch == ppc64le ]; then
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
+elif [ $arch == s390x ]; then
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
+else
+ if [ "$zh" == 1 ]; then
+ Red_Error "[x] 抱歉,暂不支持您的 体系架构($arch)!"
+ else
+ Red_Error "[x] Sorry, this architecture is not supported yet!"
+ fi
+ exit
+fi
+
+# 定义变量 Node 安装目录
+node_install_path="/opt/node-$node-linux-$arch"
+
+# 检查网络连接
+if [ "$zh" == 1 ]; then
+ echo_cyan "[-] 体系架构:$arch"
+else
+ echo_cyan "[-] Architecture: $arch"
+fi
+
+# MCSManager 已安装
+if [ -d "$mcsmanager_install_path" ]; then
+ printf "\033c"
+ if [ "$zh" == 1 ]; then
+ echo_red "----------------------------------------------------
+检查到已有 MCSManager 安装在 \"$mcsmanager_install_path\"
+继续安装会删除原有 MCSManager 面版的所有数据!
+----------------------------------------------------
+将在 10 秒后继续安装,取消请按 Ctrl + Z/C 键!"
+ else
+ echo_red "----------------------------------------------------
+MCSManager is installed at \"$mcsmanager_install_path\"
+Continuing the installation will delete the original MCSManager!
+----------------------------------------------------
+Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
+ fi
+ sleep 10
+fi
+
+# 安装相关软件
+if [ "$zh" == 1 ]; then
+ echo_cyan_n "[-] 安装相关软件(git,tar)... "
+else
+ echo_cyan_n "[+] Installing dependent software(git,tar)... "
+fi
+if [ -x "$(command -v yum)" ]; then
+ yum install -y git tar >error
+elif [ -x "$(command -v apt-get)" ]; then
+ apt-get install -y git tar >error
+elif [ -x "$(command -v pacman)" ]; then
+ pacman -Syu --noconfirm git tar >error
+elif [ -x "$(command -v zypper)" ]; then
+ zypper --non-interactive install git tar >error
+fi
+
+# 判断相关软件是否安装成功
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
+ if [ "$zh" == 1 ]; then
+ echo_green "成功"
+ else
+ echo_green "Success"
+ fi
+else
+ if [ "$zh" == 1 ]; then
+ echo_red "失败"
+ else
+ echo_red "Failed"
+ fi
+ echo "$error"
+ if [ "$zh" == 1 ]; then
+ Red_Error "[x] 相关软件安装失败,请手动安装 git 和 tar 软件包!"
+ else
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
+ fi
+ exit
+fi
+
+# 安装 Node 环境
+Install_Node
+
+# 安装 MCSManager
+Install_MCSManager
+
+# 创建 MCSManager 后台服务
+Create_Service
diff --git a/update_gbk.bat b/update_gbk.bat
index dfe249c..827d64e 100644
--- a/update_gbk.bat
+++ b/update_gbk.bat
@@ -1,47 +1,47 @@
-@echo off
-
-Title MCSManager-Web �Զ�����
-
-color 9
-echo ######################################################
-echo # #
-echo # MCSManager-Web �Զ����� #
-echo # by Ŵ��(nuomiaa) #
-echo # #
-echo ######################################################
-echo.
-echo [-] ��� Git �Ƿ�װ...
-
-for /F %%i in ('git --version') ^
-do (
- set vars1=%%i
-)
-
-echo.
-
-if "%vars1%"=="git" (
- echo [-] Git �Ѱ�װ
- echo.
-
- echo [-] ��ʼ�� Git
- git init
- git remote add origin https://github.com.cnpmjs.org/mcsmanager/mcsmanager-web-production.git
- git fetch --all
- git reset --hard origin/master
- echo.
-
- echo [-] ������ȡ���°汾...
- git pull origin master
-
- echo [-] ������ɣ�
-) else (
- echo [x] Git δ��װ������ʹ�� winget ��װ...
- winget install --id Git.Git -e --source winget
-
- color 4
- echo [-] ��װ�����ѽ��������������нű���鰲װ��
- echo [-] �� Git ��װʧ�ܣ����ֶ���װ Git: https://git-scm.com/download/win
-)
-
-
+@echo off
+
+Title MCSManager-Web �Զ�����
+
+color 9
+echo ######################################################
+echo # #
+echo # MCSManager-Web �Զ����� #
+echo # by Ŵ��(nuomiaa) #
+echo # #
+echo ######################################################
+echo.
+echo [-] ��� Git �Ƿ�װ...
+
+for /F %%i in ('git --version') ^
+do (
+ set vars1=%%i
+)
+
+echo.
+
+if "%vars1%"=="git" (
+ echo [-] Git �Ѱ�װ
+ echo.
+
+ echo [-] ��ʼ�� Git
+ git init
+ git remote add origin https://github.com.cnpmjs.org/mcsmanager/mcsmanager-web-production.git
+ git fetch --all
+ git reset --hard origin/master
+ echo.
+
+ echo [-] ������ȡ���°汾...
+ git pull origin master
+
+ echo [-] ������ɣ�
+) else (
+ echo [x] Git δ��װ������ʹ�� winget ��װ...
+ winget install --id Git.Git -e --source winget
+
+ color 4
+ echo [-] ��װ�����ѽ��������������нű���鰲װ��
+ echo [-] �� Git ��װʧ�ܣ����ֶ���װ Git: https://git-scm.com/download/win
+)
+
+
pause
\ No newline at end of file
From 6cb3b2b379526ee0416cb710f595ce7094953984 Mon Sep 17 00:00:00 2001
From: BlueFunny_ <53890138+FunnyShadow@users.noreply.github.com>
Date: Sat, 21 Jan 2023 12:02:56 +0800
Subject: [PATCH 002/460] Readme Fix
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Fixed a Readme problem (I forgot I didn't finish my Readme.md, fuck)
- 修正了一个 Readme 的问题(我忘记我 Readme.md 没敲完了, 淦)
---
README.md | 5 ++---
README_cn.md | 8 +++++++-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 732728c..28da690 100644
--- a/README.md
+++ b/README.md
@@ -2,12 +2,11 @@
-[Official Website](http://mcsmanager.com/)
+[Official Website](http://mcsmanager.com/) | [中文文档](https://github.com/MCSManager/Script/blob/master/README_cn.md) | [Gitee](https://gitee.com/mcsmanager/script)
## What is this?
-[中文文档]()
The files here are all platform-wide install, delete, update scripts, etc. for MCSManager 9.
@@ -18,7 +17,7 @@ You can also use the following one-click command to perform a quick installation
## Installation commands
```bash
-
+wget https://raw.githubusercontent.com/MCSManager/Script/master/setup.sh -O setup.sh && bash setup.sh
```
diff --git a/README_cn.md b/README_cn.md
index 4ff917d..87f191c 100644
--- a/README_cn.md
+++ b/README_cn.md
@@ -2,7 +2,7 @@
-[MCSManager 9 官方网站](http://mcsmanager.com/)
+[MCSManager 9 官方网站](http://mcsmanager.com/) | [English](https://github.com/MCSManager/Script/blob/master/README.md) | [Gitee 仓库](https://gitee.com/mcsmanager/script)
@@ -17,7 +17,13 @@
## 安装命令
```bash
+wget https://raw.githubusercontent.com/MCSManager/Script/master/setup.sh -O setup.sh && bash setup.sh
+```
+
+当然, 一般国内用户因为某些神奇的原因都连不上 Github, 下方为 Gitee 国内镜像源链接
+```bash
+wget https://gitee.com/mcsmanager/script/raw/master/setup.sh -O setup.sh && bash setup.sh
```
From 21576d6433a5cd50c1161297e48d92b25d6cb72b Mon Sep 17 00:00:00 2001
From: BlueFunny_ <53890138+FunnyShadow@users.noreply.github.com>
Date: Sat, 21 Jan 2023 12:37:23 +0800
Subject: [PATCH 003/460] Update setup.sh
---
setup.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 5fcc2ec..99b55c6 100644
--- a/setup.sh
+++ b/setup.sh
@@ -108,7 +108,8 @@ Main() {
fi
# Create temp dir
- if ! [ ! -d "${tmpPath}" ] && mkdir -p "${tmpPath}" || rm -rf "${tmpPath}" && mkdir -p "${tmpPath}"; then
+ [ ! -d "${tmpPath}" ] && mkdir -p "${tmpPath}" || rm -rf "${tmpPath}" && mkdir -p "${tmpPath}"
+ if [ -d "${tmpPath}" ]; then
CheckRoot
LEcho error "[x] 未能成功创建临时目录, 请检查权限" "[x] Failed to create temporary directory, please check permissions"
fi
From 40977376ab676123956c7b1886d8cbffd907a651 Mon Sep 17 00:00:00 2001
From: BlueFunny_ <53890138+FunnyShadow@users.noreply.github.com>
Date: Sat, 21 Jan 2023 12:38:36 +0800
Subject: [PATCH 004/460] Update setup.sh
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 99b55c6..29b68c8 100644
--- a/setup.sh
+++ b/setup.sh
@@ -109,7 +109,7 @@ Main() {
# Create temp dir
[ ! -d "${tmpPath}" ] && mkdir -p "${tmpPath}" || rm -rf "${tmpPath}" && mkdir -p "${tmpPath}"
- if [ -d "${tmpPath}" ]; then
+ if [ ! -d "${tmpPath}" ]; then
CheckRoot
LEcho error "[x] 未能成功创建临时目录, 请检查权限" "[x] Failed to create temporary directory, please check permissions"
fi
From 2c8afdcae24faae4eb4eb558b7ea9963223478c3 Mon Sep 17 00:00:00 2001
From: BlueFunny_ <53890138+FunnyShadow@users.noreply.github.com>
Date: Sat, 21 Jan 2023 12:51:12 +0800
Subject: [PATCH 005/460] Update setup.sh
---
setup.sh | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/setup.sh b/setup.sh
index 29b68c8..d1dfcd0 100644
--- a/setup.sh
+++ b/setup.sh
@@ -85,6 +85,7 @@ LEcho() {
[ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
[ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
echo '================================================='
+ Clean
exit 1
;;
@@ -108,7 +109,7 @@ Main() {
fi
# Create temp dir
- [ ! -d "${tmpPath}" ] && mkdir -p "${tmpPath}" || rm -rf "${tmpPath}" && mkdir -p "${tmpPath}"
+ [ ! -d "${tmpPath}" ] && mkdir -p "${tmpPath}" || rm -rf "${tmpPath}" && mkdir -p "${tmpPath}"
if [ ! -d "${tmpPath}" ]; then
CheckRoot
LEcho error "[x] 未能成功创建临时目录, 请检查权限" "[x] Failed to create temporary directory, please check permissions"
@@ -556,15 +557,12 @@ Revert() {
systemctl enable mcsm-daemon.service
systemctl enable mcsm-web.service
- Clean
-
LEcho error "[x] 安装失败" "[x] Installation failed"
}
## Clean Function
Clean() {
rm -rf "${tmpPath}"
- rm -rf "$0"
return
}
From 3e73eaab7f1cf68bf0e4098c4ae75d197afd0840 Mon Sep 17 00:00:00 2001
From: BlueFunny_ <53890138+FunnyShadow@users.noreply.github.com>
Date: Sat, 21 Jan 2023 14:21:34 +0800
Subject: [PATCH 006/460] Update setup.sh
---
setup.sh | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/setup.sh b/setup.sh
index d1dfcd0..d643566 100644
--- a/setup.sh
+++ b/setup.sh
@@ -41,6 +41,7 @@ os=$(uname -a)
arch=$(uname -m)
skipNodeInstall=0
skipMCSMInstall=0
+oldSystem=0
### Tools ###
## Localize echo
@@ -109,7 +110,7 @@ Main() {
fi
# Create temp dir
- [ ! -d "${tmpPath}" ] && mkdir -p "${tmpPath}" || rm -rf "${tmpPath}" && mkdir -p "${tmpPath}"
+ [ ! -d "${tmpPath}" ] && mkdir -p "${tmpPath}" || rm -rf "${tmpPath}" && mkdir -p "${tmpPath}"
if [ ! -d "${tmpPath}" ]; then
CheckRoot
LEcho error "[x] 未能成功创建临时目录, 请检查权限" "[x] Failed to create temporary directory, please check permissions"
@@ -159,6 +160,16 @@ CheckOS() {
if [ "$(echo "${os}" | grep "Ubuntu")" == "" ] && [ "$(echo "${os}" | grep "Debian")" == "" ] && [ "$(echo "${os}" | grep "CentOS")" == "" ]; then
LEcho error "[x] 本脚本仅支持 Ubuntu/Debian/CentOS 系统!" "[x] This script only supports Ubuntu/Debian/CentOS systems!"
fi
+ if [ "$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')" ]; then
+ LEcho yellow "[!] 检测到您的系统版本过低, 可能会存在一定的兼容性问题, 请了解" "[!] It is detected that your system version is too low, there may be certain compatibility issues, please understand"
+ LEcho cyan "[-] 切换为兼容性模式" "[-] Switch to compatibility mode"
+ oldSystem=1
+ fi
+ if [ "$(cat /etc/issue | grep Ubuntu | awk '{print $2}' | cut -f 1 -d '.')" ] && [ "$(cat /etc/issue | grep Ubuntu | awk '{print $2}' | cut -f 1 -d '.')" -lt "16" ]; then
+ LEcho yellow "[!] 检测到您的系统版本过低, 可能会存在一定的兼容性问题, 请了解" "[!] It is detected that your system version is too low, there may be certain compatibility issues, please understand"
+ LEcho cyan "[-] 切换为兼容性模式" "[-] Switch to compatibility mode"
+ oldSystem=1
+ fi
return
}
@@ -180,7 +191,11 @@ CheckSystem() {
if [ -f /etc/redhat-release ]; then
yum install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
else
- apt-get install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
+ if [ ${oldSystem} == 1 ]; then
+ apt-get install --force-yes git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
+ else
+ apt-get install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
+ fi
fi
# Check Arch
From 5bf21d0d420bb34518766be7a1bc31931a89f0ea Mon Sep 17 00:00:00 2001
From: BlueFunny_ <53890138+FunnyShadow@users.noreply.github.com>
Date: Sat, 21 Jan 2023 14:25:30 +0800
Subject: [PATCH 007/460] Update setup.sh
---
setup.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/setup.sh b/setup.sh
index d643566..32d38c8 100644
--- a/setup.sh
+++ b/setup.sh
@@ -192,7 +192,7 @@ CheckSystem() {
yum install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
else
if [ ${oldSystem} == 1 ]; then
- apt-get install --force-yes git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
+ apt-get install --force-yes -y git tar wget curl systemctl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
else
apt-get install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
fi
@@ -355,8 +355,13 @@ InstallNode() {
LEcho echo "[+] 正在安装 Node.js" "[+] Installing Node.js"
# Download Node.js
- wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
- wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
+ if [ ${oldSystem} != 1 ]; then
+ wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
+ wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
+ else
+ wget -t ${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
+ wget -t ${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
+ fi
# Check hash
cat ${tmpPath}/node.sha256 | grep "${nodeVersion}/node-${nodeVersion}-linux-${arch}.tar.gz" | tee ${tmpPath}/node.sha256
From 47abc16b9ea8b4e16fa377e6062ea1da0b541941 Mon Sep 17 00:00:00 2001
From: BlueFunny_ <53890138+FunnyShadow@users.noreply.github.com>
Date: Sat, 21 Jan 2023 14:29:26 +0800
Subject: [PATCH 008/460] Update setup.sh
---
setup.sh | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/setup.sh b/setup.sh
index 32d38c8..c6a1c48 100644
--- a/setup.sh
+++ b/setup.sh
@@ -161,14 +161,16 @@ CheckOS() {
LEcho error "[x] 本脚本仅支持 Ubuntu/Debian/CentOS 系统!" "[x] This script only supports Ubuntu/Debian/CentOS systems!"
fi
if [ "$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')" ]; then
- LEcho yellow "[!] 检测到您的系统版本过低, 可能会存在一定的兼容性问题, 请了解" "[!] It is detected that your system version is too low, there may be certain compatibility issues, please understand"
- LEcho cyan "[-] 切换为兼容性模式" "[-] Switch to compatibility mode"
- oldSystem=1
+ # LEcho yellow "[!] 检测到您的系统版本过低, 可能会存在一定的兼容性问题, 请了解" "[!] It is detected that your system version is too low, there may be certain compatibility issues, please understand"
+ # LEcho cyan "[-] 切换为兼容性模式" "[-] Switch to compatibility mode"
+ # oldSystem=1
+ LEcho error "[x] 本脚本不支持 CentOS 6, 请升级到 CentOS 7 或更高版本" "[x] This script does not support CentOS 6, please upgrade to CentOS 7 or higher"
fi
if [ "$(cat /etc/issue | grep Ubuntu | awk '{print $2}' | cut -f 1 -d '.')" ] && [ "$(cat /etc/issue | grep Ubuntu | awk '{print $2}' | cut -f 1 -d '.')" -lt "16" ]; then
- LEcho yellow "[!] 检测到您的系统版本过低, 可能会存在一定的兼容性问题, 请了解" "[!] It is detected that your system version is too low, there may be certain compatibility issues, please understand"
- LEcho cyan "[-] 切换为兼容性模式" "[-] Switch to compatibility mode"
- oldSystem=1
+ # LEcho yellow "[!] 检测到您的系统版本过低, 可能会存在一定的兼容性问题, 请了解" "[!] It is detected that your system version is too low, there may be certain compatibility issues, please understand"
+ # LEcho cyan "[-] 切换为兼容性模式" "[-] Switch to compatibility mode"
+ # oldSystem=1
+ LEcho error "[x] 本脚本不支持 Ubuntu 14, 请升级到 Ubuntu 16 或更高版本" "[x] This script does not support Ubuntu 14, please upgrade to Ubuntu 16 or higher"
fi
return
}
From a589e538c3bb0c868b04bd287a8afa9684ed5e63 Mon Sep 17 00:00:00 2001
From: BlueFunny_ <53890138+FunnyShadow@users.noreply.github.com>
Date: Sat, 21 Jan 2023 14:32:53 +0800
Subject: [PATCH 009/460] Update setup.sh
---
setup.sh | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/setup.sh b/setup.sh
index c6a1c48..bea835f 100644
--- a/setup.sh
+++ b/setup.sh
@@ -41,7 +41,7 @@ os=$(uname -a)
arch=$(uname -m)
skipNodeInstall=0
skipMCSMInstall=0
-oldSystem=0
+#oldSystem=0
### Tools ###
## Localize echo
@@ -193,11 +193,12 @@ CheckSystem() {
if [ -f /etc/redhat-release ]; then
yum install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
else
- if [ ${oldSystem} == 1 ]; then
- apt-get install --force-yes -y git tar wget curl systemctl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
- else
- apt-get install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
- fi
+ #if [ ${oldSystem} == 1 ]; then
+ # apt-get install --force-yes -y git tar wget curl systemctl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
+ #else
+ # apt-get install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
+ #fi
+ apt-get install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
fi
# Check Arch
@@ -357,13 +358,15 @@ InstallNode() {
LEcho echo "[+] 正在安装 Node.js" "[+] Installing Node.js"
# Download Node.js
- if [ ${oldSystem} != 1 ]; then
- wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
- wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
- else
- wget -t ${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
- wget -t ${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
- fi
+ #if [ ${oldSystem} != 1 ]; then
+ # wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
+ # wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
+ #else
+ # wget -t ${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
+ # wget -t ${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
+ #fi
+ wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
+ wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
# Check hash
cat ${tmpPath}/node.sha256 | grep "${nodeVersion}/node-${nodeVersion}-linux-${arch}.tar.gz" | tee ${tmpPath}/node.sha256
From 83bb8d1d701c2617725ab2581a2d42527ca03b4f Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 12:09:49 +0800
Subject: [PATCH 010/460] Update readme
---
README.md | 2 +-
README_cn.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 28da690..3d08d19 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
The files here are all platform-wide install, delete, update scripts, etc. for MCSManager 9.
-The default installation script on the official website is the `setup.sh` file of this repository, it contains multiple languages.
+The default installation script on the official website is the `setup.sh` file of gitee repository, it contains multiple languages.
You can also use the following one-click command to perform a quick installation
diff --git a/README_cn.md b/README_cn.md
index 87f191c..5f55c3a 100644
--- a/README_cn.md
+++ b/README_cn.md
@@ -10,7 +10,7 @@
这里是 Ubuntu / Debian / CentOS 等 Linux 系系统的 MCSManager 9 安装, 卸载, 升级脚本等的集中存储库
-官网上默认的安装脚本为本仓库中的 `setup.sh` , 它包含多种语言支持
+官网上默认的安装脚本为 Gitee 仓库中的 `setup.sh` , 它包含多种语言支持
你也可以使用下列一键命令安装 MCSManager 9
From 27fe32897dfa4438258f0d04f719f96afaedf6f2 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 12:11:20 +0800
Subject: [PATCH 011/460] Installer refactoring
---
setup.sh => setup.sh.bak | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename setup.sh => setup.sh.bak (100%)
diff --git a/setup.sh b/setup.sh.bak
similarity index 100%
rename from setup.sh
rename to setup.sh.bak
From 7631a277a8259c1d16ceb7c3b539a9610ba608c7 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 15:52:26 +0800
Subject: [PATCH 012/460] Deprecated
---
update_gbk.bat | 47 -----------------------------------------------
1 file changed, 47 deletions(-)
delete mode 100644 update_gbk.bat
diff --git a/update_gbk.bat b/update_gbk.bat
deleted file mode 100644
index 827d64e..0000000
--- a/update_gbk.bat
+++ /dev/null
@@ -1,47 +0,0 @@
-@echo off
-
-Title MCSManager-Web �Զ�����
-
-color 9
-echo ######################################################
-echo # #
-echo # MCSManager-Web �Զ����� #
-echo # by Ŵ��(nuomiaa) #
-echo # #
-echo ######################################################
-echo.
-echo [-] ��� Git �Ƿ�װ...
-
-for /F %%i in ('git --version') ^
-do (
- set vars1=%%i
-)
-
-echo.
-
-if "%vars1%"=="git" (
- echo [-] Git �Ѱ�װ
- echo.
-
- echo [-] ��ʼ�� Git
- git init
- git remote add origin https://github.com.cnpmjs.org/mcsmanager/mcsmanager-web-production.git
- git fetch --all
- git reset --hard origin/master
- echo.
-
- echo [-] ������ȡ���°汾...
- git pull origin master
-
- echo [-] ������ɣ�
-) else (
- echo [x] Git δ��װ������ʹ�� winget ��װ...
- winget install --id Git.Git -e --source winget
-
- color 4
- echo [-] ��װ�����ѽ��������������нű���鰲װ��
- echo [-] �� Git ��װʧ�ܣ����ֶ���װ Git: https://git-scm.com/download/win
-)
-
-
-pause
\ No newline at end of file
From 8d2890c5e15f047f76725145c4101fff8d1ee6a9 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 15:52:33 +0800
Subject: [PATCH 013/460] Deprecated
---
setup_en.sh | 263 ----------------------------------------------------
1 file changed, 263 deletions(-)
delete mode 100644 setup_en.sh
diff --git a/setup_en.sh b/setup_en.sh
deleted file mode 100644
index 90f389e..0000000
--- a/setup_en.sh
+++ /dev/null
@@ -1,263 +0,0 @@
-#!/bin/bash
-printf "\033c"
-
-error=""
-node="v14.19.1"
-arch=$(uname -m)
-mcsmanager_install_path="/opt/mcsmanager"
-
-Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
-}
-
-echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
-}
-
-echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
-
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
-
-echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
-}
-
-echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
-}
-
-Install_Node() {
- echo_cyan_n "[+] Install Node environment... "
-
- rm -irf "$node_install_path"
-
- cd /opt || exit
-
- wget -o /dev/null https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
-
- tar -zxf node-"$node"-linux-"$arch".tar.gz
-
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- Red_Error "[x] Node installation failed!"
- fi
-
- echo
- echo_yellow "=============== Node Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node Version ==============="
- echo
-
- sleep 3
-}
-
-Install_MCSManager() {
- echo_cyan "[+] Install MCSManager..."
-
- # delete service
- rm -f /etc/systemd/system/mcsm-daemon.service
- rm -f /etc/systemd/system/mcsm-web.service
-
- # reload
- systemctl daemon-reload
-
- # echo "[x] Delete the original MCSManager"
- rm -irf ${mcsmanager_install_path}
-
- # echo "[+] mkdir -p ${mcsmanager_install_path}"
- mkdir -p ${mcsmanager_install_path} || exit
-
- # echo "[→] cd ${mcsmanager_install_path}"
- cd ${mcsmanager_install_path} || exit
-
- echo_cyan "[↓] Git clone MCSManager-Daemon..."
- git clone --single-branch -b master --depth 1 https://github.com/MCSManager/MCSManager-Daemon-Production.git daemon
-
- # echo "[→] cd daemon"
- cd daemon || exit
-
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
-
- # echo "[←] cd .."
- cd ..
-
- echo_cyan "[↓] Git clone MCSManager-Web..."
- git clone --single-branch -b master --depth 1 https://github.com/MCSManager/MCSManager-Web-Production.git web
-
- # echo "[→] cd web"
- cd web || exit
-
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
-
- echo
- echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
- echo
- echo_green "[+] MCSManager installation success!"
-
- sleep 3
-}
-
-Create_Service() {
- echo_cyan "[+] Create MCSManager service..."
-
- echo "
-[Unit]
-Description=MCSManager Daemon
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-
-[Install]
-WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-daemon.service
-
- echo "
-[Unit]
-Description=MCSManager Web
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/web
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-
-[Install]
-WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-web.service
-
- systemctl daemon-reload
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
-
- sleep 3
-
- printf "\033c"
- echo_yellow "=================================================================="
- echo_green "Welcome to MCSManager, you can access it by the following ways:"
- echo_yellow "=================================================================="
- echo_cyan_n "Daemon Service Address: "; echo_yellow "http://localhost:24444"
- echo_cyan_n "Web Service Address: "; echo_yellow "http://localhost:23333"
- echo_cyan_n "Username: "; echo_yellow "root"
- echo_cyan_n "Password: "; echo_yellow "123456"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow "=================================================================="
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "More info: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
-
-
-}
-
-
-# ----------------- Program Start -----------------
-
-# delete the shell script itself
-rm -f "$0"
-
-# Check execute user permissions
-if [ "$(whoami)" != "root" ]; then
- Red_Error "[x] Please execute the MCSManager installation command with root permission!"
-fi
-
-echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-+----------------------------------------------------------------------
-"
-
-# Environmental inspection
-if [ "$arch" == x86_64 ]; then
- arch=x64
- #echo "[-] x64 architecture detected"
-elif [ $arch == aarch64 ]; then
- arch=arm64
- #echo "[-] 64-bit ARM architecture detected"
-elif [ $arch == arm ]; then
- arch=armv7l
- #echo "[-] 32-bit ARM architecture detected"
-elif [ $arch == ppc64le ]; then
- arch=ppc64le
- #echo "[-] IBM POWER architecture detected"
-elif [ $arch == s390x ]; then
- arch=s390x
- #echo "[-] IBM LinuxONE architecture detected"
-else
- Red_Error "[x] Sorry, this architecture is not supported yet!"
- exit
-fi
-
-# Define the variable Node installation directory
-node_install_path="/opt/node-$node-linux-$arch"
-
-# Check network connection
-echo_cyan "[-] Architecture: $arch"
-
-# MCSManager Installed
-if [ -d "$mcsmanager_install_path" ]; then
- printf "\033c"
- echo_red "----------------------------------------------------
-MCSManager is installed at \"$mcsmanager_install_path\"
-Continuing the installation will delete the original MCSManager!
-----------------------------------------------------
-Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
- sleep 10
-fi
-
-# Install related software
-echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
-elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
-elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
-elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
-fi
-
-# Determine whether the relevant software is installed successfully
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- echo "$error"
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- exit
-fi
-
-
-# Install the Node environment
-Install_Node
-
-# Install MCSManager
-Install_MCSManager
-
-# Create MCSManager background service
-Create_Service
From 1161147f088a482dc51b6a4f308c4d44e9228e90 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 18:12:53 +0800
Subject: [PATCH 014/460] Smaller, Better, Stroger !
---
setup.sh | 422 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 422 insertions(+)
create mode 100644 setup.sh
diff --git a/setup.sh b/setup.sh
new file mode 100644
index 0000000..d304de4
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,422 @@
+#!/usr/bin/env bash
+
+#### MCSManager Installer
+#### Made by BlueFunny
+#### Originally written by nuomiaa, CreeperKong, unitwk
+
+#### Copyright © 2023 MCSManager All rights reserved.
+
+### Variables
+## Files
+# MCSManager
+mcsmPath="/opt/mcsmanager"
+daemonPath="$mcsmPath/daemon"
+webPath="$mcsmPath/web"
+
+# Node.js
+nodePath="$mcsmPath/node"
+nodeBin="$nodePath/bin/node"
+npmBin="$nodePath/bin/npm"
+
+# Junk
+tmpDir="/tmp/mcsmanager"
+
+## Node info
+nodeVer="v16.13.0"
+
+## Install mode
+mode="install"
+
+## URLs
+# Node.js
+nodeBaseURL="https://nodejs.org/dist"
+nodeFileURL="$nodeBaseURL/$nodeVer/node-$nodeVer-linux-$arch.tar.gz"
+nodeHashURL="$nodeBaseURL/$nodeVer/SHASUMS256.txt"
+
+# MCSManager
+daemonURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
+webURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
+
+## Language
+if [ "$(echo "$LANG" | grep "zh_CN")" != "" ]; then
+ zh=1
+else
+ zh=0
+fi
+
+## Debug
+debug=0
+
+## Other
+cn=0
+
+### Functions
+## Localize echo
+# $1: color
+# $2: zh
+# $3: en
+LEcho() {
+ case $1 in
+ # Red color echo
+ red)
+ [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
+ ;;
+
+ # Green color echo
+ green)
+ [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
+ ;;
+
+ # Cyan color echo
+ cyan)
+ [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
+ ;;
+
+ # Cyan color echo (No line break)
+ cyan_n)
+ [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
+ ;;
+
+ # Yellow color echo
+ yellow)
+ [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
+ ;;
+
+ # Red error echo
+ error)
+ Clean
+ echo '================================================='
+ [ "$zh" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
+ [ "$zh" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
+ echo '================================================='
+ exit 1
+ ;;
+
+ # Debug echo
+ debug)
+ [ "$debug" == 1 ] && printf '\033[1;35m%b\033[0m\n' "[DEBUG] $2"
+ ;;
+
+ # No color echo
+ *)
+ [ "$zh" == 1 ] && echo "$2"
+ [ "$zh" == 0 ] && echo "$3"
+ ;;
+ esac
+ return
+}
+
+## Check root
+CheckRoot() {
+ if [[ $EUID -ne 0 ]]; then
+ LEcho debug "User: $(whoami)"
+ LEcho debug "EUID: $EUID"
+ LEcho error "[!] 请使用 root 用户运行此脚本" "[!] Please run this script as root"
+ fi
+ return
+}
+
+## Detect server geographic location
+CheckCN() {
+ LEcho echo "[*] 正在检查服务器地理位置" "[*] Checking server location"
+ if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
+ LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国, 已自动切换为中国镜像源" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China, and the Chinese mirror source has been automatically switched"
+ LEcho debug "=============================================="
+ LEcho debug "Raw data: $(curl -m 10 -s https://ipapi.co/json)"
+ LEcho debug "=============================================="
+ daemonURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
+ webURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
+ nodeBaseURL="https://npmmirror.com/mirrors/node"
+ cn=1
+ else
+ LEcho cyan "[-] 检测服务器地理位置出错, 跳过检测" "[-] Error detecting server location, skipping detection"
+ fi
+ return
+}
+
+## Detect system architecture
+CheckArch() {
+ LEcho echo "[*] 正在检查系统架构" "[*] Checking system architecture"
+ LEcho debug "Raw architecture: $arch"
+ arch=$(uname -m)
+ case $arch in
+ x86_64)
+ arch="x64"
+ ;;
+ aarch64)
+ arch="arm64"
+ ;;
+ arm)
+ arch="armv7l"
+ ;;
+ ppc64le)
+ arch="ppc64le"
+ ;;
+ s390x)
+ arch="s390x"
+ ;;
+ *)
+ LEcho error "[x] MCSManager 暂不支持当前系统架构" "[x] MCSManager does not currently support the current system architecture"
+ ;;
+ esac
+ return
+}
+
+## Detect system version
+CheckOS() {
+ if [ -f /etc/os-release ]; then
+ # shellcheck source=/dev/null
+ . /etc/os-release
+ LEcho debug "========================================"
+ LEcho debug "Raw data: $(cat /etc/os-release)"
+ LEcho debug "========================================"
+ case "$ID" in
+ debian|ubuntu)
+ os="debian"
+ ;;
+ centos|rhel|fedora)
+ os="redhat"
+ ;;
+ *)
+ LEcho error "[x] 本脚本仅支持 Ubuntu/Debian/CentOS 系统!" "[x] This script only supports Ubuntu/Debian/CentOS systems!"
+ ;;
+ esac
+ else
+ LEcho error "[x] 未能正常检测到系统类型, 无法继续安装" "[x] Unable to detect system type, installation cannot continue"
+ fi
+ return
+}
+
+## Detect nodejs version
+CheckNode() {
+ if command -v node > /dev/null; then
+ if [ "$(node -v | cut -c2- | awk -F. '{print $1}')" -ge 14 ]; then
+ return 0
+ fi
+ fi
+ return 1
+}
+
+## Main GUI
+GUI(){
+ clear
+ LEcho cyan "===============================================" "==============================================="
+ LEcho cyan "MCSManager Installer" "MCSManager Installer"
+ LEcho cyan "===============================================" "==============================================="
+ LEcho cyan "1. 安装 MCSManager" "1. Install MCSManager"
+ LEcho cyan "2. 卸载 MCSManager" "2. Uninstall MCSManager"
+ LEcho cyan "3. 退出" "3. Exit"
+ LEcho cyan "===============================================" "==============================================="
+ LEcho cyan_n "请输入选项: " "Please enter an option: "
+ read -r option
+ case $option in
+ 1)
+ Install
+ ;;
+ 2)
+ Remove
+ ;;
+ 3)
+ return
+ ;;
+ *)
+ LEcho error "[x] 无效的选项" "[x] Invalid option"
+ GUI
+ ;;
+ esac
+ return
+}
+
+## Install MCSManager
+Install() {
+ clear
+ LEcho cyan "[-] 开始安装 MCSManager" "[-] Start installing MCSManager"
+ # Init work environment
+ LEcho cyan "[*] 正在初始化工作环境" "[*] Initializing work environment"
+ mkdir -p $tmpDir
+
+ # Detect old MCSManager
+ [ -d $mcsmPath ] && LEcho yellow "[!] 检测到旧版 MCSManager, 切换为更新模式" "[!] Old version of MCSManager detected, switch to update mode"
+ [ -d $mcsmPath ] && mode="update"
+ mkdir -p $mcsmPath
+
+ # Install dependencies
+ LEcho cyan "[*] 正在安装安装所需的工具" "[*] Installing the tools required for installation"
+ if [ "$os" == "debian" ]; then
+ apt-get update
+ apt-get install -y curl git wget
+ elif [ "$os" == "redhat" ]; then
+ yum install -y curl git wget
+ fi
+
+ # Install nodejs
+ if ! CheckNode;then
+ LEcho cyan "[*] 正在安装 Node.js" "[*] Installing Node.js"
+ # Download nodejs files
+ wget -t=3 -q --no-check-certificate --show-progress -O $tmpDir/node.tar.gz "$nodeFileURL"
+ wget -t=3 -q --no-check-certificate --show-progress -O $tmpDir/node.sha256 "$nodeHashURL"
+
+ # Check nodejs files
+ if [ "$(sha256sum $tmpDir/node.tar.gz | awk '{print $1}')" != "$(cat $tmpDir/node.sha256)" ]; then
+ LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
+ fi
+
+ # Install nodejs
+ tar -xzf $tmpDir/node.tar.gz -C $tmpDir
+ cp -r "$tmpDir/node-$nodeVer-linux-$arch/*" $nodePath
+
+ LEcho cyan "===============================================" "==============================================="
+ LEcho cyan "Node.js 版本: $($nodeBin --version)" "Node.js version: $($nodeBin --version)"
+ LEcho cyan "NPM 版本: $($npmBin -v)" "NPM version: $($npmBin -v)"
+ LEcho cyan "===============================================" "==============================================="
+ else
+ Lecho cyan "[-] 检测到已安装 Node.js, 跳过安装" "[-] Detected installed Node.js, skip installation"
+ fi
+
+ # Install MCSManager
+ if [ $mode == "update" ];then
+ LEcho cyan "[*] 正在更新 MCSManager 前端管理面板" "[*] Updating MCSManager web panel"
+
+ cd $webPath || LEcho error "[x] 无法进入 MCSManager 前端管理面板目录, 请检查权限" "[x] Unable to enter MCSManager web panel directory, please check permissions"
+
+ # Clone MCSManager web panel
+ git remote set-url origin $webURL
+ git fetch origin
+ git checkout master
+ git reset --hard origin/master
+ git pull
+
+ LEcho cyan "[*] 正在更新 MCSManager 守护晨曦股" "[*] Updating MCSManager daemon"
+
+ cd $daemonPath || LEcho error "[x] 无法进入 MCSManager 守护程序目录, 请检查权限" "[x] Unable to enter MCSManager daemon directory, please check permissions"
+
+ # Clone MCSManager daemon
+ git remote set-url origin $daemonURL
+ git fetch origin
+ git checkout master
+ git reset --hard origin/master
+ git pull
+ else
+ # Clone MCSManager web panel
+ LEcho cyan "[*] 正在安装 MCSManager 前端管理面板" "[*] Installing MCSManager web panel"
+ git clone --single-branch -b master --depth 1 $webURL $webPath
+
+ # Clone MCSManager daemon
+ LEcho cyan "[*] 正在安装 MCSManager 守护程序" "[*] Installing MCSManager web panel"
+ git clone --single-branch -b master --depth 1 $daemonURL $daemonPath
+ fi
+ # Update dependencies
+ LEcho cyan "[*] 正在更新依赖" "[*] Updating dependencies"
+ cd $webPath || LEcho error "[x] 无法进入 MCSManager 前端管理目录, 请检查权限" "[x] Unable to enter MCSManager web panel directory, please check permissions"
+ [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
+ [ $cn == 0 ] && $npmBin install
+ cd $daemonPath || LEcho error "[x] 无法进入 MCSManager 守护程序目录, 请检查权限" "[x] Unable to enter MCSManager daemon directory, please check permissions"
+ [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
+ [ $cn == 0 ] && $npmBin install
+
+ # Create systemd service
+ LEcho cyan "[*] 正在创建 systemd 服务" "[*] Creating systemd service"
+ cat > /etc/systemd/system/mcsm-web.service << EOF
+ [Unit]
+ Description=MCSManager Web Panel Service
+ After=network.target
+
+ [Service]
+ User=root
+ WorkingDirectory="$webPath"
+ ExecStart="$nodeBin" "$webPath/app.js"
+ Restart=always
+
+ [Install]
+ WantedBy=multi-user.target
+EOF
+ cat > /etc/systemd/system/mcsm-daemon.service << EOF
+ [Unit]
+ Description=MCSManager Daemon Service
+ After=network.target
+
+ [Service]
+ User=root
+ WorkingDirectory="$daemonPath"
+ ExecStart="$nodeBin" "$daemonPath/app.js"
+ Restart=always
+
+ [Install]
+ WantedBy=multi-user.target
+EOF
+ # Enable systemd service
+ LEcho cyan "[*] 正在启动 MCSManager 服务" "[*] Starting MCSManager services"
+ systemctl daemon-reload
+ systemctl enable mcsm-web --now || LEcho error "[x] 无法启动 MCSManager 前端管理面板服务" "[x] Unable to start MCSManager web panel service"
+ systemctl enable mcsm-daemon --now || LEcho error "[x] 无法启动 MCSManager 守护程序服务" "[x] Unable to start MCSManager daemon service"
+
+ # Output login info
+ LEcho green "[√] MCSManager 安装完毕" "[√] MCSManager installation completed"
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho green "欢迎使用 MCSManager, 您可以通过以下方式访问: " "Welcome to use MCSManager, you can access it through the following ways:"
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho cyan_n "控制面板地址: " "Control panel address: "
+ LEcho yellow "http://localhost:23333" "http://localhost:23333"
+ LEcho red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。" "If you can't access the panel, please check if the firewall/security group has opened the panel 23333 and 24444 ports. The control panel needs these two ports to work properly."
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho cyan "重启 systemctl restart mcsm-{daemon,web}.service" "Restart systemctl restart mcsm-{daemon,web}.service"
+ LEcho cyan "禁用 systemctl disable mcsm-{daemon,web}.service" "Disable systemctl disable mcsm-{daemon,web}.service"
+ LEcho cyan "启用 systemctl enable mcsm-{daemon,web}.service" "Enable systemctl enable mcsm-{daemon,web}.service"
+ LEcho cyan "启动 systemctl start mcsm-{daemon,web}.service" "Start systemctl start mcsm-{daemon,web}.service"
+ LEcho cyan "停止 systemctl stop mcsm-{daemon,web}.service" "Stop systemctl stop mcsm-{daemon,web}.service"
+ LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More usage instructions, please refer to: https://docs.mcsmanager.com/"
+ LEcho yellow "==================================================================" "=================================================================="
+
+ # Clean up
+ rm -rf $tmpDir
+ return
+}
+
+## Remove MCSManager
+Remove() {
+ clear
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho yellow "[!] 你确定要删除 MCSManager 吗" "[!] Are you sure you want to delete MCSManager"
+ LEcho yellow "[!] 删除 MCSManager 后, 所有服务器数据将会丢失" "[!] All server data will be lost after deleting MCSManager"
+ LEcho yellow "[!] 请在 10 秒内按下 Ctrl + C 取消删除" "[!] Please press Ctrl + C within 10 seconds to cancel deletion"
+ LEcho yellow "==================================================================" "=================================================================="
+ sleep 10
+
+ LEcho cyan "[*] 正在停止 MCSManager 服务" "[*] Stopping MCSManager service"
+ systemctl disable mcsm-daemon --now || LEcho error "[x] 无法停止 MCSManager 守护程序服务" "[x] Unable to stop MCSManager daemon service"
+ systemctl disable mcsm-web --now || LEcho error "[x] 无法停止 MCSManager 前端管理面板服务" "[x] Unable to stop MCSManager web panel service"
+
+ LEcho cyan "[*] 正在删除 MCSManager 服务" "[*] Deleting MCSManager service"
+ rm -rf /etc/systemd/system/mcsm-daemon.service
+ rm -rf /etc/systemd/system/mcsm-web.service
+ systemctl daemon-reload
+
+ LEcho cyan "[*] 正在删除 MCSManager 目录" "[*] Deleting MCSManager directory"
+ rm -rf $mcsmPath
+
+ LEcho green "[√] MCSManager 删除完毕" "[√] MCSManager deletion completed"
+ return
+}
+
+## Clean up
+Clean() {
+ LEcho cyan "[*] 正在清理残余文件" "[*] Cleaning up"
+ rm -rf $tmpDir
+ [ $mode != "update" ] && rm -rf $mcsmPath
+ return
+}
+
+### Start
+
+LEcho echo "[-] 正在检查基础环境, 请稍等" "[-] Checking basic environment, please wait"
+CheckRoot
+CheckArch
+CheckOS
+CheckCN
+GUI
+LEcho cyan "[-] 期待与您的下次见面" "[-] Looking forward to seeing you again"
\ No newline at end of file
From 92076ad9fb5fa2e3206b472c55d2fd426aba5494 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 18:48:20 +0800
Subject: [PATCH 015/460] Fixed some stupid questions
---
setup.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/setup.sh b/setup.sh
index d304de4..aed8135 100644
--- a/setup.sh
+++ b/setup.sh
@@ -275,7 +275,7 @@ Install() {
LEcho cyan "NPM 版本: $($npmBin -v)" "NPM version: $($npmBin -v)"
LEcho cyan "===============================================" "==============================================="
else
- Lecho cyan "[-] 检测到已安装 Node.js, 跳过安装" "[-] Detected installed Node.js, skip installation"
+ LEcho cyan "[-] 检测到已安装 Node.js, 跳过安装" "[-] Detected installed Node.js, skip installation"
fi
# Install MCSManager
@@ -328,8 +328,8 @@ Install() {
[Service]
User=root
- WorkingDirectory="$webPath"
- ExecStart="$nodeBin" "$webPath/app.js"
+ WorkingDirectory="\$webPath"
+ ExecStart="\$nodeBin" "\$webPath/app.js"
Restart=always
[Install]
@@ -342,8 +342,8 @@ EOF
[Service]
User=root
- WorkingDirectory="$daemonPath"
- ExecStart="$nodeBin" "$daemonPath/app.js"
+ WorkingDirectory="\$daemonPath"
+ ExecStart="\$nodeBin" "\$daemonPath/app.js"
Restart=always
[Install]
From d75edb05bad7036669aecc7abc9278ffd12961ee Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 18:56:19 +0800
Subject: [PATCH 016/460] Improve the installed Node detection function
---
setup.sh | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/setup.sh b/setup.sh
index aed8135..0c42cfd 100644
--- a/setup.sh
+++ b/setup.sh
@@ -44,6 +44,10 @@ else
zh=0
fi
+## Systemd service command
+webExecStart="\"$nodeBin\" \"$webPath/app.js\""
+daemonExecStart="\"$nodeBin\" \"$daemonPath/app.js\""
+
## Debug
debug=0
@@ -276,6 +280,8 @@ Install() {
LEcho cyan "===============================================" "==============================================="
else
LEcho cyan "[-] 检测到已安装 Node.js, 跳过安装" "[-] Detected installed Node.js, skip installation"
+ nodeBin="$(which node)"
+ npmBin="$(which npm)"
fi
# Install MCSManager
@@ -328,8 +334,8 @@ Install() {
[Service]
User=root
- WorkingDirectory="\$webPath"
- ExecStart="\$nodeBin" "\$webPath/app.js"
+ WorkingDirectory=\"$webPath\"
+ ExecStart=$webExecStart
Restart=always
[Install]
@@ -342,8 +348,8 @@ EOF
[Service]
User=root
- WorkingDirectory="\$daemonPath"
- ExecStart="\$nodeBin" "\$daemonPath/app.js"
+ WorkingDirectory=\"$daemonPath\"
+ ExecStart=$daemonExecStart
Restart=always
[Install]
@@ -390,15 +396,15 @@ Remove() {
LEcho cyan "[*] 正在停止 MCSManager 服务" "[*] Stopping MCSManager service"
systemctl disable mcsm-daemon --now || LEcho error "[x] 无法停止 MCSManager 守护程序服务" "[x] Unable to stop MCSManager daemon service"
systemctl disable mcsm-web --now || LEcho error "[x] 无法停止 MCSManager 前端管理面板服务" "[x] Unable to stop MCSManager web panel service"
-
+
LEcho cyan "[*] 正在删除 MCSManager 服务" "[*] Deleting MCSManager service"
rm -rf /etc/systemd/system/mcsm-daemon.service
rm -rf /etc/systemd/system/mcsm-web.service
systemctl daemon-reload
-
+
LEcho cyan "[*] 正在删除 MCSManager 目录" "[*] Deleting MCSManager directory"
rm -rf $mcsmPath
-
+
LEcho green "[√] MCSManager 删除完毕" "[√] MCSManager deletion completed"
return
}
From 34c57ccf4b7463c55adee025e3cd29d72486c202 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 19:14:07 +0800
Subject: [PATCH 017/460] fix
---
setup.sh | 56 ++++++++++++++++++++++++--------------------------------
1 file changed, 24 insertions(+), 32 deletions(-)
diff --git a/setup.sh b/setup.sh
index 0c42cfd..00bca7c 100644
--- a/setup.sh
+++ b/setup.sh
@@ -118,8 +118,6 @@ LEcho() {
## Check root
CheckRoot() {
if [[ $EUID -ne 0 ]]; then
- LEcho debug "User: $(whoami)"
- LEcho debug "EUID: $EUID"
LEcho error "[!] 请使用 root 用户运行此脚本" "[!] Please run this script as root"
fi
return
@@ -128,11 +126,9 @@ CheckRoot() {
## Detect server geographic location
CheckCN() {
LEcho echo "[*] 正在检查服务器地理位置" "[*] Checking server location"
- if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
+ server_ip=$(curl -s ifconfig.me)
+ if [[ "$(curl -s "http://ip-api.com/json/${server_ip}?fields=countryCode" | jq -r '.countryCode')" == "CN" ]]; then
LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国, 已自动切换为中国镜像源" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China, and the Chinese mirror source has been automatically switched"
- LEcho debug "=============================================="
- LEcho debug "Raw data: $(curl -m 10 -s https://ipapi.co/json)"
- LEcho debug "=============================================="
daemonURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
webURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
nodeBaseURL="https://npmmirror.com/mirrors/node"
@@ -146,7 +142,6 @@ CheckCN() {
## Detect system architecture
CheckArch() {
LEcho echo "[*] 正在检查系统架构" "[*] Checking system architecture"
- LEcho debug "Raw architecture: $arch"
arch=$(uname -m)
case $arch in
x86_64)
@@ -176,9 +171,6 @@ CheckOS() {
if [ -f /etc/os-release ]; then
# shellcheck source=/dev/null
. /etc/os-release
- LEcho debug "========================================"
- LEcho debug "Raw data: $(cat /etc/os-release)"
- LEcho debug "========================================"
case "$ID" in
debian|ubuntu)
os="debian"
@@ -253,9 +245,9 @@ Install() {
LEcho cyan "[*] 正在安装安装所需的工具" "[*] Installing the tools required for installation"
if [ "$os" == "debian" ]; then
apt-get update
- apt-get install -y curl git wget
+ apt-get install -y curl git wget jq
elif [ "$os" == "redhat" ]; then
- yum install -y curl git wget
+ yum install -y curl git wget jq
fi
# Install nodejs
@@ -328,32 +320,32 @@ Install() {
# Create systemd service
LEcho cyan "[*] 正在创建 systemd 服务" "[*] Creating systemd service"
cat > /etc/systemd/system/mcsm-web.service << EOF
- [Unit]
- Description=MCSManager Web Panel Service
- After=network.target
+[Unit]
+Description=MCSManager Web Panel Service
+After=network.target
- [Service]
- User=root
- WorkingDirectory=\"$webPath\"
- ExecStart=$webExecStart
- Restart=always
+[Service]
+User=root
+WorkingDirectory="$webPath"
+ExecStart=$webExecStart
+Restart=always
- [Install]
- WantedBy=multi-user.target
+[Install]
+WantedBy=multi-user.target
EOF
cat > /etc/systemd/system/mcsm-daemon.service << EOF
- [Unit]
- Description=MCSManager Daemon Service
- After=network.target
+[Unit]
+Description=MCSManager Daemon Service
+After=network.target
- [Service]
- User=root
- WorkingDirectory=\"$daemonPath\"
- ExecStart=$daemonExecStart
- Restart=always
+[Service]
+User=root
+WorkingDirectory="$daemonPath"
+ExecStart=$daemonExecStart
+Restart=always
- [Install]
- WantedBy=multi-user.target
+[Install]
+WantedBy=multi-user.target
EOF
# Enable systemd service
LEcho cyan "[*] 正在启动 MCSManager 服务" "[*] Starting MCSManager services"
From 033914a9a3d8c8281cdbd85f2af49a2ac6f63042 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 19:20:24 +0800
Subject: [PATCH 018/460] fix
---
setup.sh | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/setup.sh b/setup.sh
index 00bca7c..314bfe6 100644
--- a/setup.sh
+++ b/setup.sh
@@ -133,8 +133,6 @@ CheckCN() {
webURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
nodeBaseURL="https://npmmirror.com/mirrors/node"
cn=1
- else
- LEcho cyan "[-] 检测服务器地理位置出错, 跳过检测" "[-] Error detecting server location, skipping detection"
fi
return
}
@@ -326,7 +324,7 @@ After=network.target
[Service]
User=root
-WorkingDirectory="$webPath"
+WorkingDirectory=$webPath
ExecStart=$webExecStart
Restart=always
@@ -340,7 +338,7 @@ After=network.target
[Service]
User=root
-WorkingDirectory="$daemonPath"
+WorkingDirectory=$daemonPath
ExecStart=$daemonExecStart
Restart=always
@@ -350,8 +348,13 @@ EOF
# Enable systemd service
LEcho cyan "[*] 正在启动 MCSManager 服务" "[*] Starting MCSManager services"
systemctl daemon-reload
- systemctl enable mcsm-web --now || LEcho error "[x] 无法启动 MCSManager 前端管理面板服务" "[x] Unable to start MCSManager web panel service"
- systemctl enable mcsm-daemon --now || LEcho error "[x] 无法启动 MCSManager 守护程序服务" "[x] Unable to start MCSManager daemon service"
+ if [ $mode == "update" ];then
+ systemctl restart mcsm-web || LEcho error "[x] 无法启动 MCSManager 前端管理面板服务" "[x] Unable to start MCSManager web panel service"
+ systemctl restart mcsm-daemon || LEcho error "[x] 无法启动 MCSManager 守护程序服务" "[x] Unable to start MCSManager daemon service"
+ else
+ systemctl enable mcsm-web --now || LEcho error "[x] 无法启动 MCSManager 前端管理面板服务" "[x] Unable to start MCSManager web panel service"
+ systemctl enable mcsm-daemon --now || LEcho error "[x] 无法启动 MCSManager 守护程序服务" "[x] Unable to start MCSManager daemon service"
+ fi
# Output login info
LEcho green "[√] MCSManager 安装完毕" "[√] MCSManager installation completed"
From e315f4e98f9d377956b9bc05a467c0319d41d0f9 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 19:21:56 +0800
Subject: [PATCH 019/460] fix
---
setup.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/setup.sh b/setup.sh
index 314bfe6..31ce1d8 100644
--- a/setup.sh
+++ b/setup.sh
@@ -125,7 +125,7 @@ CheckRoot() {
## Detect server geographic location
CheckCN() {
- LEcho echo "[*] 正在检查服务器地理位置" "[*] Checking server location"
+ LEcho cyan "[*] 正在检查服务器地理位置" "[*] Checking server location"
server_ip=$(curl -s ifconfig.me)
if [[ "$(curl -s "http://ip-api.com/json/${server_ip}?fields=countryCode" | jq -r '.countryCode')" == "CN" ]]; then
LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国, 已自动切换为中国镜像源" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China, and the Chinese mirror source has been automatically switched"
@@ -139,7 +139,7 @@ CheckCN() {
## Detect system architecture
CheckArch() {
- LEcho echo "[*] 正在检查系统架构" "[*] Checking system architecture"
+ LEcho cyan "[*] 正在检查系统架构" "[*] Checking system architecture"
arch=$(uname -m)
case $arch in
x86_64)
@@ -166,6 +166,7 @@ CheckArch() {
## Detect system version
CheckOS() {
+ LEcho cyan "[*] 正在检查系统版本" "[*] Checking system version"
if [ -f /etc/os-release ]; then
# shellcheck source=/dev/null
. /etc/os-release
From 86c96fe28f88b640077ba5b3b75c333d77a4a780 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 19:26:43 +0800
Subject: [PATCH 020/460] Fix a color question
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 31ce1d8..2930ead 100644
--- a/setup.sh
+++ b/setup.sh
@@ -415,7 +415,7 @@ Clean() {
### Start
-LEcho echo "[-] 正在检查基础环境, 请稍等" "[-] Checking basic environment, please wait"
+LEcho cyan "[-] 正在检查基础环境, 请稍等" "[-] Checking basic environment, please wait"
CheckRoot
CheckArch
CheckOS
From e93bf10dae01bfb02a46fb016f1751cee8e2d2cb Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 19:28:13 +0800
Subject: [PATCH 021/460] Fixed a priority issue
---
setup.sh | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/setup.sh b/setup.sh
index 2930ead..37e4ab3 100644
--- a/setup.sh
+++ b/setup.sh
@@ -44,10 +44,6 @@ else
zh=0
fi
-## Systemd service command
-webExecStart="\"$nodeBin\" \"$webPath/app.js\""
-daemonExecStart="\"$nodeBin\" \"$daemonPath/app.js\""
-
## Debug
debug=0
@@ -318,6 +314,9 @@ Install() {
# Create systemd service
LEcho cyan "[*] 正在创建 systemd 服务" "[*] Creating systemd service"
+
+ webExecStart="\"$nodeBin\" \"$webPath/app.js\""
+ daemonExecStart="\"$nodeBin\" \"$daemonPath/app.js\""
cat > /etc/systemd/system/mcsm-web.service << EOF
[Unit]
Description=MCSManager Web Panel Service
From d89591bc2123456f20db821bf8a90fc38590e34b Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 21:03:45 +0800
Subject: [PATCH 022/460] Bring forward the tool installation operation
---
setup.sh | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/setup.sh b/setup.sh
index 37e4ab3..27ab570 100644
--- a/setup.sh
+++ b/setup.sh
@@ -180,6 +180,15 @@ CheckOS() {
else
LEcho error "[x] 未能正常检测到系统类型, 无法继续安装" "[x] Unable to detect system type, installation cannot continue"
fi
+
+ # Install dependencies
+ LEcho cyan "[*] 正在安装安装所需的工具" "[*] Installing the tools required for installation"
+ if [ "$os" == "debian" ]; then
+ apt-get update
+ apt-get install -y curl git wget jq
+ elif [ "$os" == "redhat" ]; then
+ yum install -y curl git wget jq
+ fi
return
}
@@ -236,15 +245,6 @@ Install() {
[ -d $mcsmPath ] && mode="update"
mkdir -p $mcsmPath
- # Install dependencies
- LEcho cyan "[*] 正在安装安装所需的工具" "[*] Installing the tools required for installation"
- if [ "$os" == "debian" ]; then
- apt-get update
- apt-get install -y curl git wget jq
- elif [ "$os" == "redhat" ]; then
- yum install -y curl git wget jq
- fi
-
# Install nodejs
if ! CheckNode;then
LEcho cyan "[*] 正在安装 Node.js" "[*] Installing Node.js"
From 03cdece0f0b68301958dd58ad0193ef50e16ce47 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 21:14:22 +0800
Subject: [PATCH 023/460] Fix the problem that RHEL cannot install some
software
---
setup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/setup.sh b/setup.sh
index 27ab570..4814de5 100644
--- a/setup.sh
+++ b/setup.sh
@@ -187,6 +187,7 @@ CheckOS() {
apt-get update
apt-get install -y curl git wget jq
elif [ "$os" == "redhat" ]; then
+ yum install -y epel-release
yum install -y curl git wget jq
fi
return
From cbcc457281d6869509e1d0ce789325cade68f720 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 21:22:57 +0800
Subject: [PATCH 024/460] Fix no error handler for Node installation errors
---
setup.sh | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/setup.sh b/setup.sh
index 4814de5..cfe2bba 100644
--- a/setup.sh
+++ b/setup.sh
@@ -250,8 +250,8 @@ Install() {
if ! CheckNode;then
LEcho cyan "[*] 正在安装 Node.js" "[*] Installing Node.js"
# Download nodejs files
- wget -t=3 -q --no-check-certificate --show-progress -O $tmpDir/node.tar.gz "$nodeFileURL"
- wget -t=3 -q --no-check-certificate --show-progress -O $tmpDir/node.sha256 "$nodeHashURL"
+ wget -q --no-check-certificate --show-progress -O $tmpDir/node.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
+ wget -q --no-check-certificate --show-progress -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
# Check nodejs files
if [ "$(sha256sum $tmpDir/node.tar.gz | awk '{print $1}')" != "$(cat $tmpDir/node.sha256)" ]; then
@@ -262,10 +262,14 @@ Install() {
tar -xzf $tmpDir/node.tar.gz -C $tmpDir
cp -r "$tmpDir/node-$nodeVer-linux-$arch/*" $nodePath
- LEcho cyan "===============================================" "==============================================="
- LEcho cyan "Node.js 版本: $($nodeBin --version)" "Node.js version: $($nodeBin --version)"
- LEcho cyan "NPM 版本: $($npmBin -v)" "NPM version: $($npmBin -v)"
- LEcho cyan "===============================================" "==============================================="
+ if command -v $nodeBin > /dev/null; then
+ LEcho cyan "===============================================" "==============================================="
+ LEcho cyan "Node.js 版本: $($nodeBin --version)" "Node.js version: $($nodeBin --version)"
+ LEcho cyan "NPM 版本: $($npmBin -v)" "NPM version: $($npmBin -v)"
+ LEcho cyan "===============================================" "==============================================="
+ else
+ LEcho error "[x] Node.js 安装失败, 请重试" "[x] Node.js installation failed, please try again"
+ fi
else
LEcho cyan "[-] 检测到已安装 Node.js, 跳过安装" "[-] Detected installed Node.js, skip installation"
nodeBin="$(which node)"
From 4edf404e95c0e50d1d5bda32cf6cc0db0f30cc95 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 21:39:51 +0800
Subject: [PATCH 025/460] Modify the download command to make it available on
RHEL
---
setup.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/setup.sh b/setup.sh
index cfe2bba..74469bb 100644
--- a/setup.sh
+++ b/setup.sh
@@ -226,7 +226,7 @@ GUI(){
return
;;
*)
- LEcho error "[x] 无效的选项" "[x] Invalid option"
+ LEcho red "[x] 无效的选项" "[x] Invalid option"
GUI
;;
esac
@@ -250,8 +250,8 @@ Install() {
if ! CheckNode;then
LEcho cyan "[*] 正在安装 Node.js" "[*] Installing Node.js"
# Download nodejs files
- wget -q --no-check-certificate --show-progress -O $tmpDir/node.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
- wget -q --no-check-certificate --show-progress -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
+ wget -q --no-check-certificate -O $tmpDir/node.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
+ wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
# Check nodejs files
if [ "$(sha256sum $tmpDir/node.tar.gz | awk '{print $1}')" != "$(cat $tmpDir/node.sha256)" ]; then
From 0295f10d48ba442fe723769b594407a0496624f9 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 22:08:28 +0800
Subject: [PATCH 026/460] fix
---
setup.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup.sh b/setup.sh
index 74469bb..c59913b 100644
--- a/setup.sh
+++ b/setup.sh
@@ -30,8 +30,6 @@ mode="install"
## URLs
# Node.js
nodeBaseURL="https://nodejs.org/dist"
-nodeFileURL="$nodeBaseURL/$nodeVer/node-$nodeVer-linux-$arch.tar.gz"
-nodeHashURL="$nodeBaseURL/$nodeVer/SHASUMS256.txt"
# MCSManager
daemonURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
@@ -250,6 +248,8 @@ Install() {
if ! CheckNode;then
LEcho cyan "[*] 正在安装 Node.js" "[*] Installing Node.js"
# Download nodejs files
+ nodeFileURL="$nodeBaseURL/$nodeVer/node-$nodeVer-linux-$arch.tar.gz"
+ nodeHashURL="$nodeBaseURL/$nodeVer/SHASUMS256.txt"
wget -q --no-check-certificate -O $tmpDir/node.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
From ba71ae596e20de6ebdee834b91463a0e8598d283 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 22:13:08 +0800
Subject: [PATCH 027/460] fix
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index c59913b..7385cd2 100644
--- a/setup.sh
+++ b/setup.sh
@@ -254,7 +254,7 @@ Install() {
wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
# Check nodejs files
- if [ "$(sha256sum $tmpDir/node.tar.gz | awk '{print $1}')" != "$(cat $tmpDir/node.sha256)" ]; then
+ if [ "$(sha256sum $tmpDir/node.tar.gz | awk '{print $1}')" != "$(cat $tmpDir/node.sha256 | grep "node-$nodeVer-linux-$arch.tar.gz")" ]; then
LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
fi
From 15fcc850083e340fb1f9f76d64edc9f660242fdb Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 22:15:25 +0800
Subject: [PATCH 028/460] fix
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 7385cd2..3b24c10 100644
--- a/setup.sh
+++ b/setup.sh
@@ -254,7 +254,7 @@ Install() {
wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
# Check nodejs files
- if [ "$(sha256sum $tmpDir/node.tar.gz | awk '{print $1}')" != "$(cat $tmpDir/node.sha256 | grep "node-$nodeVer-linux-$arch.tar.gz")" ]; then
+ if [ "$(sha256sum $tmpDir/node.tar.gz)" != "$(cat $tmpDir/node.sha256 | grep "node-$nodeVer-linux-$arch.tar.gz")" ]; then
LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
fi
From b4a2e46ab1b338283c02d68359af3f6572ffa10d Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 22:18:39 +0800
Subject: [PATCH 029/460] fix
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 3b24c10..1f3feb2 100644
--- a/setup.sh
+++ b/setup.sh
@@ -250,7 +250,7 @@ Install() {
# Download nodejs files
nodeFileURL="$nodeBaseURL/$nodeVer/node-$nodeVer-linux-$arch.tar.gz"
nodeHashURL="$nodeBaseURL/$nodeVer/SHASUMS256.txt"
- wget -q --no-check-certificate -O $tmpDir/node.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
+ wget -q --no-check-certificate -O $tmpDir/node-$nodeVer-linux-$arch.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
# Check nodejs files
From f833a3e7bb58c31a3e72cf4c9a2bcd1bcca9f361 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 22:20:27 +0800
Subject: [PATCH 030/460] last fix?
---
setup.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup.sh b/setup.sh
index 1f3feb2..949ce2d 100644
--- a/setup.sh
+++ b/setup.sh
@@ -254,12 +254,12 @@ Install() {
wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
# Check nodejs files
- if [ "$(sha256sum $tmpDir/node.tar.gz)" != "$(cat $tmpDir/node.sha256 | grep "node-$nodeVer-linux-$arch.tar.gz")" ]; then
+ if [ "$(sha256sum $tmpDir/node-$nodeVer-linux-$arch.tar.gz)" != "$(cat $tmpDir/node.sha256 | grep "node-$nodeVer-linux-$arch.tar.gz")" ]; then
LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
fi
# Install nodejs
- tar -xzf $tmpDir/node.tar.gz -C $tmpDir
+ tar -xzf $tmpDir/node-$nodeVer-linux-$arch.tar.gz -C $tmpDir
cp -r "$tmpDir/node-$nodeVer-linux-$arch/*" $nodePath
if command -v $nodeBin > /dev/null; then
From 770acce4903246c640395c0e17d0fcc3fd783866 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 22:23:06 +0800
Subject: [PATCH 031/460] Fix a copyright problem
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 949ce2d..57a6228 100644
--- a/setup.sh
+++ b/setup.sh
@@ -122,7 +122,7 @@ CheckCN() {
LEcho cyan "[*] 正在检查服务器地理位置" "[*] Checking server location"
server_ip=$(curl -s ifconfig.me)
if [[ "$(curl -s "http://ip-api.com/json/${server_ip}?fields=countryCode" | jq -r '.countryCode')" == "CN" ]]; then
- LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国, 已自动切换为中国镜像源" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China, and the Chinese mirror source has been automatically switched"
+ LEcho yellow "[!] 根据 'ip-api.com' 提供的信息, 当前服务器可能在中国, 已自动切换为中国镜像源" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China, and the Chinese mirror source has been automatically switched"
daemonURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
webURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
nodeBaseURL="https://npmmirror.com/mirrors/node"
From 1c306d2d8ad06e40e0d8104674f5f1e950f1ed61 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 22:30:55 +0800
Subject: [PATCH 032/460] fix
---
setup.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/setup.sh b/setup.sh
index 57a6228..6ef804c 100644
--- a/setup.sh
+++ b/setup.sh
@@ -250,16 +250,16 @@ Install() {
# Download nodejs files
nodeFileURL="$nodeBaseURL/$nodeVer/node-$nodeVer-linux-$arch.tar.gz"
nodeHashURL="$nodeBaseURL/$nodeVer/SHASUMS256.txt"
- wget -q --no-check-certificate -O $tmpDir/node-$nodeVer-linux-$arch.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
+ wget -q --no-check-certificate -O $tmpDir/node.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
# Check nodejs files
- if [ "$(sha256sum $tmpDir/node-$nodeVer-linux-$arch.tar.gz)" != "$(cat $tmpDir/node.sha256 | grep "node-$nodeVer-linux-$arch.tar.gz")" ]; then
+ if ! grep "node-$nodeVer-linux-$arch.tar.gz" sha256sum.txt | cut -d ' ' -f 1 | xargs sha256sum -c $tmpDir/node.tar.gz; then
LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
fi
# Install nodejs
- tar -xzf $tmpDir/node-$nodeVer-linux-$arch.tar.gz -C $tmpDir
+ tar -xzf "$tmpDir/node.tar.gz" -C $tmpDir
cp -r "$tmpDir/node-$nodeVer-linux-$arch/*" $nodePath
if command -v $nodeBin > /dev/null; then
From e6b254a662eaaa461dd86d4c630ec659eb5d91e4 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 22:31:56 +0800
Subject: [PATCH 033/460] fix
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 6ef804c..e1390be 100644
--- a/setup.sh
+++ b/setup.sh
@@ -254,7 +254,7 @@ Install() {
wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
# Check nodejs files
- if ! grep "node-$nodeVer-linux-$arch.tar.gz" sha256sum.txt | cut -d ' ' -f 1 | xargs sha256sum -c $tmpDir/node.tar.gz; then
+ if ! grep "node-$nodeVer-linux-$arch.tar.gz" $tmpDir/node.sha256 | cut -d ' ' -f 1 | xargs sha256sum -c $tmpDir/node.tar.gz; then
LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
fi
From 1a87b536aa1f36b2eba4aba9a0a711d9a06153d9 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 22:52:09 +0800
Subject: [PATCH 034/460] That's it for tonight.
---
setup.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/setup.sh b/setup.sh
index e1390be..1df7c8c 100644
--- a/setup.sh
+++ b/setup.sh
@@ -254,13 +254,15 @@ Install() {
wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
# Check nodejs files
- if ! grep "node-$nodeVer-linux-$arch.tar.gz" $tmpDir/node.sha256 | cut -d ' ' -f 1 | xargs sha256sum -c $tmpDir/node.tar.gz; then
+ if [ "$(sha256sum $tmpDir/node.tar.gz | cut -d ' ' -f 1)" != "$(grep "node-$nodeVer-linux-$arch.tar.gz" $tmpDir/node.sha256 | cut -d ' ' -f 1)" ]; then
LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
fi
# Install nodejs
+ [ -d $nodePath ] && rm -rf $nodePath
+ mkdir -p $nodePath
tar -xzf "$tmpDir/node.tar.gz" -C $tmpDir
- cp -r "$tmpDir/node-$nodeVer-linux-$arch/*" $nodePath
+ mv -f "$tmpDir/node-$nodeVer-linux-$arch/*" $nodePath
if command -v $nodeBin > /dev/null; then
LEcho cyan "===============================================" "==============================================="
From c8a3bd59c74edf2ca8ca20651233ec7142dcff93 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 23:02:11 +0800
Subject: [PATCH 035/460] Last fix?!
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 1df7c8c..e4f0051 100644
--- a/setup.sh
+++ b/setup.sh
@@ -262,7 +262,7 @@ Install() {
[ -d $nodePath ] && rm -rf $nodePath
mkdir -p $nodePath
tar -xzf "$tmpDir/node.tar.gz" -C $tmpDir
- mv -f "$tmpDir/node-$nodeVer-linux-$arch/*" $nodePath
+ mv -f "$tmpDir/node-$nodeVer-linux-$arch/" "$mcsmPath/node"
if command -v $nodeBin > /dev/null; then
LEcho cyan "===============================================" "==============================================="
From 0b180fcd7470c8ff77d1e8f5f5c2c9784cd833ff Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Fri, 17 Mar 2023 23:03:41 +0800
Subject: [PATCH 036/460] ok, last fix now(maybe?
---
setup.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/setup.sh b/setup.sh
index e4f0051..c12beff 100644
--- a/setup.sh
+++ b/setup.sh
@@ -261,8 +261,7 @@ Install() {
# Install nodejs
[ -d $nodePath ] && rm -rf $nodePath
mkdir -p $nodePath
- tar -xzf "$tmpDir/node.tar.gz" -C $tmpDir
- mv -f "$tmpDir/node-$nodeVer-linux-$arch/" "$mcsmPath/node"
+ tar -xzf "$tmpDir/node.tar.gz" -C $nodePath
if command -v $nodeBin > /dev/null; then
LEcho cyan "===============================================" "==============================================="
From 1dc7c6deae0615c4707efd819beecbaea59b92a3 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Sat, 18 Mar 2023 11:09:44 +0800
Subject: [PATCH 037/460] Smaller! Better! Stronger!
---
setup.sh | 76 +++++++++++++++++++++++++++++---------------------------
1 file changed, 39 insertions(+), 37 deletions(-)
diff --git a/setup.sh b/setup.sh
index c12beff..87c4dd6 100644
--- a/setup.sh
+++ b/setup.sh
@@ -16,7 +16,7 @@ webPath="$mcsmPath/web"
# Node.js
nodePath="$mcsmPath/node"
nodeBin="$nodePath/bin/node"
-npmBin="$nodePath/bin/npm"
+npmBin="$nodeBin $nodePath/bin/npm"
# Junk
tmpDir="/tmp/mcsmanager"
@@ -178,7 +178,7 @@ CheckOS() {
else
LEcho error "[x] 未能正常检测到系统类型, 无法继续安装" "[x] Unable to detect system type, installation cannot continue"
fi
-
+
# Install dependencies
LEcho cyan "[*] 正在安装安装所需的工具" "[*] Installing the tools required for installation"
if [ "$os" == "debian" ]; then
@@ -261,14 +261,9 @@ Install() {
# Install nodejs
[ -d $nodePath ] && rm -rf $nodePath
mkdir -p $nodePath
- tar -xzf "$tmpDir/node.tar.gz" -C $nodePath
+ tar -xzf "$tmpDir/node.tar.gz" -C $nodePath --strip-components=1
- if command -v $nodeBin > /dev/null; then
- LEcho cyan "===============================================" "==============================================="
- LEcho cyan "Node.js 版本: $($nodeBin --version)" "Node.js version: $($nodeBin --version)"
- LEcho cyan "NPM 版本: $($npmBin -v)" "NPM version: $($npmBin -v)"
- LEcho cyan "===============================================" "==============================================="
- else
+ if ! command -v $nodeBin ; then
LEcho error "[x] Node.js 安装失败, 请重试" "[x] Node.js installation failed, please try again"
fi
else
@@ -277,6 +272,11 @@ Install() {
npmBin="$(which npm)"
fi
+ LEcho yellow "===============================================" "==============================================="
+ LEcho cyan "Node.js 版本: $($nodeBin --version)" "Node.js version: $($nodeBin --version)"
+ LEcho cyan "NPM 版本: $($npmBin -v)" "NPM version: $($npmBin -v)"
+ LEcho yellow "===============================================" "==============================================="
+
# Install MCSManager
if [ $mode == "update" ];then
LEcho cyan "[*] 正在更新 MCSManager 前端管理面板" "[*] Updating MCSManager web panel"
@@ -288,7 +288,7 @@ Install() {
git fetch origin
git checkout master
git reset --hard origin/master
- git pull
+ git pull
LEcho cyan "[*] 正在更新 MCSManager 守护晨曦股" "[*] Updating MCSManager daemon"
@@ -299,24 +299,24 @@ Install() {
git fetch origin
git checkout master
git reset --hard origin/master
- git pull
+ git pull
else
# Clone MCSManager web panel
LEcho cyan "[*] 正在安装 MCSManager 前端管理面板" "[*] Installing MCSManager web panel"
- git clone --single-branch -b master --depth 1 $webURL $webPath
+ git clone --single-branch -b master --depth 1 $webURL $webPath
# Clone MCSManager daemon
LEcho cyan "[*] 正在安装 MCSManager 守护程序" "[*] Installing MCSManager web panel"
- git clone --single-branch -b master --depth 1 $daemonURL $daemonPath
+ git clone --single-branch -b master --depth 1 $daemonURL $daemonPath
fi
# Update dependencies
LEcho cyan "[*] 正在更新依赖" "[*] Updating dependencies"
cd $webPath || LEcho error "[x] 无法进入 MCSManager 前端管理目录, 请检查权限" "[x] Unable to enter MCSManager web panel directory, please check permissions"
- [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
- [ $cn == 0 ] && $npmBin install
+ [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
+ [ $cn == 0 ] && $npmBin install
cd $daemonPath || LEcho error "[x] 无法进入 MCSManager 守护程序目录, 请检查权限" "[x] Unable to enter MCSManager daemon directory, please check permissions"
- [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
- [ $cn == 0 ] && $npmBin install
+ [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
+ [ $cn == 0 ] && $npmBin install
# Create systemd service
LEcho cyan "[*] 正在创建 systemd 服务" "[*] Creating systemd service"
@@ -364,20 +364,22 @@ EOF
# Output login info
LEcho green "[√] MCSManager 安装完毕" "[√] MCSManager installation completed"
- LEcho yellow "==================================================================" "=================================================================="
- LEcho green "欢迎使用 MCSManager, 您可以通过以下方式访问: " "Welcome to use MCSManager, you can access it through the following ways:"
- LEcho yellow "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板地址: " "Control panel address: "
- LEcho yellow "http://localhost:23333" "http://localhost:23333"
+ sleep 3
+ clear
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho green "欢迎使用 MCSManager, 您可以通过以下方式访问: " "Welcome to MCSManager, you can access it through the following ways:"
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho cyan_n "控制面板默认访问地址: " "Control panel default address: "
+ LEcho yellow "http://localhost:23333" "http://localhost:23333"
LEcho red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。" "If you can't access the panel, please check if the firewall/security group has opened the panel 23333 and 24444 ports. The control panel needs these two ports to work properly."
- LEcho yellow "==================================================================" "=================================================================="
- LEcho cyan "重启 systemctl restart mcsm-{daemon,web}.service" "Restart systemctl restart mcsm-{daemon,web}.service"
- LEcho cyan "禁用 systemctl disable mcsm-{daemon,web}.service" "Disable systemctl disable mcsm-{daemon,web}.service"
- LEcho cyan "启用 systemctl enable mcsm-{daemon,web}.service" "Enable systemctl enable mcsm-{daemon,web}.service"
- LEcho cyan "启动 systemctl start mcsm-{daemon,web}.service" "Start systemctl start mcsm-{daemon,web}.service"
- LEcho cyan "停止 systemctl stop mcsm-{daemon,web}.service" "Stop systemctl stop mcsm-{daemon,web}.service"
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More usage instructions, please refer to: https://docs.mcsmanager.com/"
- LEcho yellow "==================================================================" "=================================================================="
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho cyan "启动 MCSM: systemctl start mcsm-{daemon,web}.service" "Start MCSM: systemctl start mcsm-{daemon,web}.service"
+ LEcho cyan "重启 MCSM: systemctl restart mcsm-{daemon,web}.service" "Restart MCSM: systemctl restart mcsm-{daemon,web}.service"
+ LEcho cyan "停止 MCSM: systemctl stop mcsm-{daemon,web}.service" "Stop MCSM: systemctl stop mcsm-{daemon,web}.service"
+ LEcho cyan "启用自启动: systemctl enable mcsm-{daemon,web}.service" "Enable: systemctl enable mcsm-{daemon,web}.service"
+ LEcho cyan "禁用自启动: systemctl disable mcsm-{daemon,web}.service" "Disable: systemctl disable mcsm-{daemon,web}.service"
+ LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More usage instructions, please refer to: https://docs.mcsmanager.com/"
+ LEcho yellow "==================================================================" "=================================================================="
# Clean up
rm -rf $tmpDir
@@ -387,16 +389,16 @@ EOF
## Remove MCSManager
Remove() {
clear
- LEcho yellow "==================================================================" "=================================================================="
- LEcho yellow "[!] 你确定要删除 MCSManager 吗" "[!] Are you sure you want to delete MCSManager"
- LEcho yellow "[!] 删除 MCSManager 后, 所有服务器数据将会丢失" "[!] All server data will be lost after deleting MCSManager"
- LEcho yellow "[!] 请在 10 秒内按下 Ctrl + C 取消删除" "[!] Please press Ctrl + C within 10 seconds to cancel deletion"
- LEcho yellow "==================================================================" "=================================================================="
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho yellow "[!] 你确定要卸载 MCSManager 吗" "[!] Are you sure you want to uninstall MCSManager"
+ LEcho yellow "[!] 卸载 MCSManager 后, 所有由 MCSManager 自动创建实例文件夹内的服务器数据将会丢失" "[!] After uninstalling MCSManager, all server data in the automatically created instance folder will be lost"
+ LEcho yellow "[!] 请在 10 秒内按下 Ctrl + C 取消卸载" "[!] Please press Ctrl + C within 10 seconds to cancel the uninstall"
+ LEcho yellow "==================================================================" "=================================================================="
sleep 10
LEcho cyan "[*] 正在停止 MCSManager 服务" "[*] Stopping MCSManager service"
- systemctl disable mcsm-daemon --now || LEcho error "[x] 无法停止 MCSManager 守护程序服务" "[x] Unable to stop MCSManager daemon service"
- systemctl disable mcsm-web --now || LEcho error "[x] 无法停止 MCSManager 前端管理面板服务" "[x] Unable to stop MCSManager web panel service"
+ systemctl disable mcsm-daemon --now || LEcho error "[x] 无法停止 MCSManager 守护程序服务" "[x] Unable to stop MCSManager daemon service"
+ systemctl disable mcsm-web --now || LEcho error "[x] 无法停止 MCSManager 前端管理面板服务" "[x] Unable to stop MCSManager web panel service"
LEcho cyan "[*] 正在删除 MCSManager 服务" "[*] Deleting MCSManager service"
rm -rf /etc/systemd/system/mcsm-daemon.service
From b549fc99199637f1929f5a40e9e479dccd9ca905 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Sat, 18 Mar 2023 12:29:11 +0800
Subject: [PATCH 038/460] Remove GUI and uninstall feature
---
setup.sh | 58 +-------------------------------------------------------
1 file changed, 1 insertion(+), 57 deletions(-)
diff --git a/setup.sh b/setup.sh
index 87c4dd6..cbb85da 100644
--- a/setup.sh
+++ b/setup.sh
@@ -201,36 +201,6 @@ CheckNode() {
return 1
}
-## Main GUI
-GUI(){
- clear
- LEcho cyan "===============================================" "==============================================="
- LEcho cyan "MCSManager Installer" "MCSManager Installer"
- LEcho cyan "===============================================" "==============================================="
- LEcho cyan "1. 安装 MCSManager" "1. Install MCSManager"
- LEcho cyan "2. 卸载 MCSManager" "2. Uninstall MCSManager"
- LEcho cyan "3. 退出" "3. Exit"
- LEcho cyan "===============================================" "==============================================="
- LEcho cyan_n "请输入选项: " "Please enter an option: "
- read -r option
- case $option in
- 1)
- Install
- ;;
- 2)
- Remove
- ;;
- 3)
- return
- ;;
- *)
- LEcho red "[x] 无效的选项" "[x] Invalid option"
- GUI
- ;;
- esac
- return
-}
-
## Install MCSManager
Install() {
clear
@@ -386,32 +356,6 @@ EOF
return
}
-## Remove MCSManager
-Remove() {
- clear
- LEcho yellow "==================================================================" "=================================================================="
- LEcho yellow "[!] 你确定要卸载 MCSManager 吗" "[!] Are you sure you want to uninstall MCSManager"
- LEcho yellow "[!] 卸载 MCSManager 后, 所有由 MCSManager 自动创建实例文件夹内的服务器数据将会丢失" "[!] After uninstalling MCSManager, all server data in the automatically created instance folder will be lost"
- LEcho yellow "[!] 请在 10 秒内按下 Ctrl + C 取消卸载" "[!] Please press Ctrl + C within 10 seconds to cancel the uninstall"
- LEcho yellow "==================================================================" "=================================================================="
- sleep 10
-
- LEcho cyan "[*] 正在停止 MCSManager 服务" "[*] Stopping MCSManager service"
- systemctl disable mcsm-daemon --now || LEcho error "[x] 无法停止 MCSManager 守护程序服务" "[x] Unable to stop MCSManager daemon service"
- systemctl disable mcsm-web --now || LEcho error "[x] 无法停止 MCSManager 前端管理面板服务" "[x] Unable to stop MCSManager web panel service"
-
- LEcho cyan "[*] 正在删除 MCSManager 服务" "[*] Deleting MCSManager service"
- rm -rf /etc/systemd/system/mcsm-daemon.service
- rm -rf /etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
-
- LEcho cyan "[*] 正在删除 MCSManager 目录" "[*] Deleting MCSManager directory"
- rm -rf $mcsmPath
-
- LEcho green "[√] MCSManager 删除完毕" "[√] MCSManager deletion completed"
- return
-}
-
## Clean up
Clean() {
LEcho cyan "[*] 正在清理残余文件" "[*] Cleaning up"
@@ -427,5 +371,5 @@ CheckRoot
CheckArch
CheckOS
CheckCN
-GUI
+Install
LEcho cyan "[-] 期待与您的下次见面" "[-] Looking forward to seeing you again"
\ No newline at end of file
From de7c4dc2494495f71da4cb2b0cde4bab89583ca9 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Sat, 18 Mar 2023 12:47:43 +0800
Subject: [PATCH 039/460] Fix the problem of incomplete systemd file
---
setup_cn.sh | 381 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 381 insertions(+)
create mode 100644 setup_cn.sh
diff --git a/setup_cn.sh b/setup_cn.sh
new file mode 100644
index 0000000..a2d5dca
--- /dev/null
+++ b/setup_cn.sh
@@ -0,0 +1,381 @@
+#!/usr/bin/env bash
+
+#### MCSManager Installer
+#### Made by BlueFunny
+#### Originally written by nuomiaa, CreeperKong, unitwk
+
+#### Copyright © 2023 MCSManager All rights reserved.
+
+### Variables
+## Files
+# MCSManager
+mcsmPath="/opt/mcsmanager"
+daemonPath="$mcsmPath/daemon"
+webPath="$mcsmPath/web"
+
+# Node.js
+nodePath="$mcsmPath/node"
+nodeBin="$nodePath/bin/node"
+npmBin="$nodeBin $nodePath/bin/npm"
+
+# Junk
+tmpDir="/tmp/mcsmanager"
+
+## Node info
+nodeVer="v16.13.0"
+
+## Install mode
+mode="install"
+
+## URLs
+# Node.js
+nodeBaseURL="https://nodejs.org/dist"
+
+# MCSManager
+daemonURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
+webURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
+
+## Language
+if [ "$(echo "$LANG" | grep "zh_CN")" != "" ]; then
+ zh=1
+else
+ zh=0
+fi
+
+## Debug
+debug=0
+
+## Other
+cn=0
+
+### Functions
+## Localize echo
+# $1: color
+# $2: zh
+# $3: en
+LEcho() {
+ case $1 in
+ # Red color echo
+ red)
+ [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
+ ;;
+
+ # Green color echo
+ green)
+ [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
+ ;;
+
+ # Cyan color echo
+ cyan)
+ [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
+ ;;
+
+ # Cyan color echo (No line break)
+ cyan_n)
+ [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
+ ;;
+
+ # Yellow color echo
+ yellow)
+ [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
+ ;;
+
+ # Red error echo
+ error)
+ Clean
+ echo '================================================='
+ [ "$zh" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
+ [ "$zh" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
+ echo '================================================='
+ exit 1
+ ;;
+
+ # Debug echo
+ debug)
+ [ "$debug" == 1 ] && printf '\033[1;35m%b\033[0m\n' "[DEBUG] $2"
+ ;;
+
+ # No color echo
+ *)
+ [ "$zh" == 1 ] && echo "$2"
+ [ "$zh" == 0 ] && echo "$3"
+ ;;
+ esac
+ return
+}
+
+## Check root
+CheckRoot() {
+ if [[ $EUID -ne 0 ]]; then
+ LEcho error "[!] 请使用 root 用户运行此脚本" "[!] Please run this script as root"
+ fi
+ return
+}
+
+## Detect server geographic location
+CheckCN() {
+ LEcho cyan "[*] 正在检查服务器地理位置" "[*] Checking server location"
+ server_ip=$(curl -s ifconfig.me)
+ if [[ "$(curl -s "http://ip-api.com/json/${server_ip}?fields=countryCode" | jq -r '.countryCode')" == "CN" ]]; then
+ LEcho yellow "[!] 根据 'ip-api.com' 提供的信息, 当前服务器可能在中国, 已自动切换为中国镜像源" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China, and the Chinese mirror source has been automatically switched"
+ daemonURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
+ webURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
+ nodeBaseURL="https://npmmirror.com/mirrors/node"
+ cn=1
+ fi
+ return
+}
+
+## Detect system architecture
+CheckArch() {
+ LEcho cyan "[*] 正在检查系统架构" "[*] Checking system architecture"
+ arch=$(uname -m)
+ case $arch in
+ x86_64)
+ arch="x64"
+ ;;
+ aarch64)
+ arch="arm64"
+ ;;
+ arm)
+ arch="armv7l"
+ ;;
+ ppc64le)
+ arch="ppc64le"
+ ;;
+ s390x)
+ arch="s390x"
+ ;;
+ *)
+ LEcho error "[x] MCSManager 暂不支持当前系统架构" "[x] MCSManager does not currently support the current system architecture"
+ ;;
+ esac
+ return
+}
+
+## Detect system version
+CheckOS() {
+ LEcho cyan "[*] 正在检查系统版本" "[*] Checking system version"
+ if [ -f /etc/os-release ]; then
+ # shellcheck source=/dev/null
+ . /etc/os-release
+ case "$ID" in
+ debian|ubuntu)
+ os="debian"
+ ;;
+ centos|rhel|fedora)
+ os="redhat"
+ ;;
+ *)
+ LEcho error "[x] 本脚本仅支持 Ubuntu/Debian/CentOS 系统!" "[x] This script only supports Ubuntu/Debian/CentOS systems!"
+ ;;
+ esac
+ else
+ LEcho error "[x] 未能正常检测到系统类型, 无法继续安装" "[x] Unable to detect system type, installation cannot continue"
+ fi
+
+ # Install dependencies
+ LEcho cyan "[*] 正在安装安装所需的工具" "[*] Installing the tools required for installation"
+ if [ "$os" == "debian" ]; then
+ apt-get update
+ apt-get install -y curl git wget jq
+ elif [ "$os" == "redhat" ]; then
+ yum install -y epel-release
+ yum install -y curl git wget jq
+ fi
+ return
+}
+
+## Detect nodejs version
+CheckNode() {
+ if command -v node > /dev/null; then
+ if [ "$(node -v | cut -c2- | awk -F. '{print $1}')" -ge 14 ]; then
+ return 0
+ fi
+ fi
+ return 1
+}
+
+## Install MCSManager
+Install() {
+ clear
+ LEcho cyan "[-] 开始安装 MCSManager" "[-] Start installing MCSManager"
+ # Init work environment
+ LEcho cyan "[*] 正在初始化工作环境" "[*] Initializing work environment"
+ mkdir -p $tmpDir
+
+ # Detect old MCSManager
+ [ -d $mcsmPath ] && LEcho yellow "[!] 检测到旧版 MCSManager, 切换为更新模式" "[!] Old version of MCSManager detected, switch to update mode"
+ [ -d $mcsmPath ] && mode="update"
+ mkdir -p $mcsmPath
+
+ # Install nodejs
+ if ! CheckNode;then
+ LEcho cyan "[*] 正在安装 Node.js" "[*] Installing Node.js"
+ # Download nodejs files
+ nodeFileURL="$nodeBaseURL/$nodeVer/node-$nodeVer-linux-$arch.tar.gz"
+ nodeHashURL="$nodeBaseURL/$nodeVer/SHASUMS256.txt"
+ wget -q --no-check-certificate -O $tmpDir/node.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
+ wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
+
+ # Check nodejs files
+ if [ "$(sha256sum $tmpDir/node.tar.gz | cut -d ' ' -f 1)" != "$(grep "node-$nodeVer-linux-$arch.tar.gz" $tmpDir/node.sha256 | cut -d ' ' -f 1)" ]; then
+ LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
+ fi
+
+ # Install nodejs
+ [ -d $nodePath ] && rm -rf $nodePath
+ mkdir -p $nodePath
+ tar -xzf "$tmpDir/node.tar.gz" -C $nodePath --strip-components=1
+
+ if ! command -v $nodeBin ; then
+ LEcho error "[x] Node.js 安装失败, 请重试" "[x] Node.js installation failed, please try again"
+ fi
+ else
+ LEcho cyan "[-] 检测到已安装 Node.js, 跳过安装" "[-] Detected installed Node.js, skip installation"
+ nodeBin="$(which node)"
+ npmBin="$(which npm)"
+ fi
+
+ LEcho yellow "===============================================" "==============================================="
+ LEcho cyan "Node.js 版本: $($nodeBin --version)" "Node.js version: $($nodeBin --version)"
+ LEcho cyan "NPM 版本: $($npmBin -v)" "NPM version: $($npmBin -v)"
+ LEcho yellow "===============================================" "==============================================="
+
+ # Install MCSManager
+ if [ $mode == "update" ];then
+ LEcho cyan "[*] 正在更新 MCSManager 前端管理面板" "[*] Updating MCSManager web panel"
+
+ cd $webPath || LEcho error "[x] 无法进入 MCSManager 前端管理面板目录, 请检查权限" "[x] Unable to enter MCSManager web panel directory, please check permissions"
+
+ # Clone MCSManager web panel
+ git remote set-url origin $webURL
+ git fetch origin
+ git checkout master
+ git reset --hard origin/master
+ git pull
+
+ LEcho cyan "[*] 正在更新 MCSManager 守护晨曦股" "[*] Updating MCSManager daemon"
+
+ cd $daemonPath || LEcho error "[x] 无法进入 MCSManager 守护程序目录, 请检查权限" "[x] Unable to enter MCSManager daemon directory, please check permissions"
+
+ # Clone MCSManager daemon
+ git remote set-url origin $daemonURL
+ git fetch origin
+ git checkout master
+ git reset --hard origin/master
+ git pull
+ else
+ # Clone MCSManager web panel
+ LEcho cyan "[*] 正在安装 MCSManager 前端管理面板" "[*] Installing MCSManager web panel"
+ git clone --single-branch -b master --depth 1 $webURL $webPath
+
+ # Clone MCSManager daemon
+ LEcho cyan "[*] 正在安装 MCSManager 守护程序" "[*] Installing MCSManager web panel"
+ git clone --single-branch -b master --depth 1 $daemonURL $daemonPath
+ fi
+ # Update dependencies
+ LEcho cyan "[*] 正在更新依赖" "[*] Updating dependencies"
+ cd $webPath || LEcho error "[x] 无法进入 MCSManager 前端管理目录, 请检查权限" "[x] Unable to enter MCSManager web panel directory, please check permissions"
+ [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
+ [ $cn == 0 ] && $npmBin install
+ cd $daemonPath || LEcho error "[x] 无法进入 MCSManager 守护程序目录, 请检查权限" "[x] Unable to enter MCSManager daemon directory, please check permissions"
+ [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
+ [ $cn == 0 ] && $npmBin install
+
+ # Create systemd service
+ LEcho cyan "[*] 正在创建 systemd 服务" "[*] Creating systemd service"
+
+ webExecStart="\"$nodeBin\" \"$webPath/app.js\""
+ daemonExecStart="\"$nodeBin\" \"$daemonPath/app.js\""
+ cat > /etc/systemd/system/mcsm-web.service << EOF
+[Unit]
+Description=MCSManager Web Panel Service
+After=network.target
+
+[Service]
+User=root
+WorkingDirectory=$webPath
+ExecStart=$webExecStart
+ExecReload=/bin/kill -s HUP $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+EOF
+ cat > /etc/systemd/system/mcsm-daemon.service << EOF
+[Unit]
+Description=MCSManager Daemon Service
+After=network.target
+
+[Service]
+User=root
+WorkingDirectory=$daemonPath
+ExecStart=$daemonExecStart
+ExecReload=/bin/kill -s HUP $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+EOF
+ # Enable systemd service
+ LEcho cyan "[*] 正在启动 MCSManager 服务" "[*] Starting MCSManager services"
+ systemctl daemon-reload
+ if [ $mode == "update" ];then
+ systemctl restart mcsm-web || LEcho error "[x] 无法启动 MCSManager 前端管理面板服务" "[x] Unable to start MCSManager web panel service"
+ systemctl restart mcsm-daemon || LEcho error "[x] 无法启动 MCSManager 守护程序服务" "[x] Unable to start MCSManager daemon service"
+ else
+ systemctl enable mcsm-web --now || LEcho error "[x] 无法启动 MCSManager 前端管理面板服务" "[x] Unable to start MCSManager web panel service"
+ systemctl enable mcsm-daemon --now || LEcho error "[x] 无法启动 MCSManager 守护程序服务" "[x] Unable to start MCSManager daemon service"
+ fi
+
+ # Output login info
+ LEcho green "[√] MCSManager 安装完毕" "[√] MCSManager installation completed"
+ sleep 3
+ clear
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho green "欢迎使用 MCSManager, 您可以通过以下方式访问: " "Welcome to MCSManager, you can access it through the following ways:"
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho cyan_n "控制面板默认访问地址: " "Control panel default address: "
+ LEcho yellow "http://localhost:23333" "http://localhost:23333"
+ LEcho red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。" "If you can't access the panel, please check if the firewall/security group has opened the panel 23333 and 24444 ports. The control panel needs these two ports to work properly."
+ LEcho yellow "==================================================================" "=================================================================="
+ LEcho cyan "启动 MCSM: systemctl start mcsm-{daemon,web}.service" "Start MCSM: systemctl start mcsm-{daemon,web}.service"
+ LEcho cyan "重启 MCSM: systemctl restart mcsm-{daemon,web}.service" "Restart MCSM: systemctl restart mcsm-{daemon,web}.service"
+ LEcho cyan "停止 MCSM: systemctl stop mcsm-{daemon,web}.service" "Stop MCSM: systemctl stop mcsm-{daemon,web}.service"
+ LEcho cyan "启用自启动: systemctl enable mcsm-{daemon,web}.service" "Enable: systemctl enable mcsm-{daemon,web}.service"
+ LEcho cyan "禁用自启动: systemctl disable mcsm-{daemon,web}.service" "Disable: systemctl disable mcsm-{daemon,web}.service"
+ LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More usage instructions, please refer to: https://docs.mcsmanager.com/"
+ LEcho yellow "==================================================================" "=================================================================="
+
+ # Clean up
+ rm -rf $tmpDir
+ return
+}
+
+## Clean up
+Clean() {
+ LEcho cyan "[*] 正在清理残余文件" "[*] Cleaning up"
+ rm -rf $tmpDir
+ [ $mode != "update" ] && rm -rf $mcsmPath
+ return
+}
+
+### Start
+
+LEcho cyan "[-] 正在检查基础环境, 请稍等" "[-] Checking basic environment, please wait"
+CheckRoot
+CheckArch
+CheckOS
+CheckCN
+Install
+LEcho cyan "[-] 期待与您的下次见面" "[-] Looking forward to seeing you again"
\ No newline at end of file
From 4756cb728b9e7192fc52fa6032be85b8c6cccda1 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Sat, 18 Mar 2023 12:48:25 +0800
Subject: [PATCH 040/460] Restore the original script
---
setup.sh | 650 +++++++++++++++++++++++++--------------------------
setup_en.sh | 263 +++++++++++++++++++++
setup_old.sh | 371 -----------------------------
3 files changed, 586 insertions(+), 698 deletions(-)
create mode 100644 setup_en.sh
delete mode 100644 setup_old.sh
diff --git a/setup.sh b/setup.sh
index cbb85da..dfd530e 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,375 +1,371 @@
-#!/usr/bin/env bash
+#!/bin/bash
+printf "\033c"
-#### MCSManager Installer
-#### Made by BlueFunny
-#### Originally written by nuomiaa, CreeperKong, unitwk
+error=""
+node="v14.19.1"
+arch=$(uname -m)
+mcsmanager_install_path="/opt/mcsmanager"
+zh=$(
+ [[ $(locale -a) =~ "zh" ]] && echo 1
+ export LANG=zh_CN.UTF-8 || echo 0
+)
-#### Copyright © 2023 MCSManager All rights reserved.
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
+
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
-### Variables
-## Files
-# MCSManager
-mcsmPath="/opt/mcsmanager"
-daemonPath="$mcsmPath/daemon"
-webPath="$mcsmPath/web"
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
-# Node.js
-nodePath="$mcsmPath/node"
-nodeBin="$nodePath/bin/node"
-npmBin="$nodeBin $nodePath/bin/npm"
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
-# Junk
-tmpDir="/tmp/mcsmanager"
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
-## Node info
-nodeVer="v16.13.0"
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
+}
-## Install mode
-mode="install"
+Install_Node() {
+ if [ "$zh" == 1 ]; then
+ echo_cyan_n "[+] 安装 Node 环境... "
+ else
+ echo_cyan_n "[+] Install Node environment... "
+ fi
-## URLs
-# Node.js
-nodeBaseURL="https://nodejs.org/dist"
+ rm -irf "$node_install_path"
-# MCSManager
-daemonURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
-webURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
+ cd /opt || exit
-## Language
-if [ "$(echo "$LANG" | grep "zh_CN")" != "" ]; then
- zh=1
-else
- zh=0
-fi
+ wget -o /dev/null https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
-## Debug
-debug=0
-
-## Other
-cn=0
-
-### Functions
-## Localize echo
-# $1: color
-# $2: zh
-# $3: en
-LEcho() {
- case $1 in
- # Red color echo
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
-
- # Green color echo
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
-
- # Cyan color echo
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
-
- # Cyan color echo (No line break)
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
-
- # Yellow color echo
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
-
- # Red error echo
- error)
- Clean
- echo '================================================='
- [ "$zh" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "$zh" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
-
- # Debug echo
- debug)
- [ "$debug" == 1 ] && printf '\033[1;35m%b\033[0m\n' "[DEBUG] $2"
- ;;
-
- # No color echo
- *)
- [ "$zh" == 1 ] && echo "$2"
- [ "$zh" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
+ tar -zxf node-"$node"-linux-"$arch".tar.gz
-## Check root
-CheckRoot() {
- if [[ $EUID -ne 0 ]]; then
- LEcho error "[!] 请使用 root 用户运行此脚本" "[!] Please run this script as root"
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
+ if [ ! -L /usr/bin/node ] && [ ! -f /usr/bin/node ]; then
+ ln -s "$node_install_path"/bin/node /usr/bin/node
+ fi
+ if [ ! -L /usr/bin/npm ] && [ ! -f /usr/bin/npm ]; then
+ ln -s "$node_install_path"/bin/npm /usr/bin/npm
fi
- return
-}
-## Detect server geographic location
-CheckCN() {
- LEcho cyan "[*] 正在检查服务器地理位置" "[*] Checking server location"
- server_ip=$(curl -s ifconfig.me)
- if [[ "$(curl -s "http://ip-api.com/json/${server_ip}?fields=countryCode" | jq -r '.countryCode')" == "CN" ]]; then
- LEcho yellow "[!] 根据 'ip-api.com' 提供的信息, 当前服务器可能在中国, 已自动切换为中国镜像源" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China, and the Chinese mirror source has been automatically switched"
- daemonURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- webURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- nodeBaseURL="https://npmmirror.com/mirrors/node"
- cn=1
+ chmod +x "$node_install_path"/bin/node
+ chmod +x "$node_install_path"/bin/npm
+
+ if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]; then
+ if [ "$zh" == 1 ]; then
+ echo_green "成功"
+ else
+ echo_green "Success"
+ fi
+ else
+ if [ "$zh" == 1 ]; then
+ echo_red "失败"
+ Red_Error "[x] Node 安装失败!"
+ else
+ echo_red "Failed"
+ Red_Error "[x] Node installation failed!"
+ fi
fi
- return
-}
-## Detect system architecture
-CheckArch() {
- LEcho cyan "[*] 正在检查系统架构" "[*] Checking system architecture"
- arch=$(uname -m)
- case $arch in
- x86_64)
- arch="x64"
- ;;
- aarch64)
- arch="arm64"
- ;;
- arm)
- arch="armv7l"
- ;;
- ppc64le)
- arch="ppc64le"
- ;;
- s390x)
- arch="s390x"
- ;;
- *)
- LEcho error "[x] MCSManager 暂不支持当前系统架构" "[x] MCSManager does not currently support the current system architecture"
- ;;
- esac
- return
+ echo
+ echo_yellow "=============== Node Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node Version ==============="
+ echo
+
+ sleep 3
}
-## Detect system version
-CheckOS() {
- LEcho cyan "[*] 正在检查系统版本" "[*] Checking system version"
- if [ -f /etc/os-release ]; then
- # shellcheck source=/dev/null
- . /etc/os-release
- case "$ID" in
- debian|ubuntu)
- os="debian"
- ;;
- centos|rhel|fedora)
- os="redhat"
- ;;
- *)
- LEcho error "[x] 本脚本仅支持 Ubuntu/Debian/CentOS 系统!" "[x] This script only supports Ubuntu/Debian/CentOS systems!"
- ;;
- esac
+Install_MCSManager() {
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 安装 MCSManager..."
+ else
+ echo_cyan "[+] Install MCSManager..."
+ fi
+
+ # 删除服务
+ rm -f /etc/systemd/system/mcsm-daemon.service
+ rm -f /etc/systemd/system/mcsm-web.service
+
+ # 重载
+ systemctl daemon-reload
+
+ # echo "[x] Delete the original MCSManager"
+ rm -irf ${mcsmanager_install_path}
+
+ # echo "[+] mkdir -p ${mcsmanager_install_path}"
+ mkdir -p ${mcsmanager_install_path} || exit
+
+ # echo "[→] cd ${mcsmanager_install_path}"
+ cd ${mcsmanager_install_path} || exit
+
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[↓] Git 克隆 MCSManager-Daemon..."
else
- LEcho error "[x] 未能正常检测到系统类型, 无法继续安装" "[x] Unable to detect system type, installation cannot continue"
+ echo_cyan "[↓] Git clone MCSManager-Daemon..."
fi
+ git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git daemon
+
+ # echo "[→] cd daemon"
+ cd daemon || exit
- # Install dependencies
- LEcho cyan "[*] 正在安装安装所需的工具" "[*] Installing the tools required for installation"
- if [ "$os" == "debian" ]; then
- apt-get update
- apt-get install -y curl git wget jq
- elif [ "$os" == "redhat" ]; then
- yum install -y epel-release
- yum install -y curl git wget jq
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 安装 MCSManager-Daemon 依赖库..."
+ else
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
fi
- return
-}
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
-## Detect nodejs version
-CheckNode() {
- if command -v node > /dev/null; then
- if [ "$(node -v | cut -c2- | awk -F. '{print $1}')" -ge 14 ]; then
- return 0
- fi
+ # echo "[←] cd .."
+ cd ..
+
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[↓] Git 克隆 MCSManager-Web..."
+ else
+ echo_cyan "[↓] Git clone MCSManager-Web..."
fi
- return 1
-}
+ git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Web-Production.git web
-## Install MCSManager
-Install() {
- clear
- LEcho cyan "[-] 开始安装 MCSManager" "[-] Start installing MCSManager"
- # Init work environment
- LEcho cyan "[*] 正在初始化工作环境" "[*] Initializing work environment"
- mkdir -p $tmpDir
-
- # Detect old MCSManager
- [ -d $mcsmPath ] && LEcho yellow "[!] 检测到旧版 MCSManager, 切换为更新模式" "[!] Old version of MCSManager detected, switch to update mode"
- [ -d $mcsmPath ] && mode="update"
- mkdir -p $mcsmPath
-
- # Install nodejs
- if ! CheckNode;then
- LEcho cyan "[*] 正在安装 Node.js" "[*] Installing Node.js"
- # Download nodejs files
- nodeFileURL="$nodeBaseURL/$nodeVer/node-$nodeVer-linux-$arch.tar.gz"
- nodeHashURL="$nodeBaseURL/$nodeVer/SHASUMS256.txt"
- wget -q --no-check-certificate -O $tmpDir/node.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
- wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
-
- # Check nodejs files
- if [ "$(sha256sum $tmpDir/node.tar.gz | cut -d ' ' -f 1)" != "$(grep "node-$nodeVer-linux-$arch.tar.gz" $tmpDir/node.sha256 | cut -d ' ' -f 1)" ]; then
- LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
- fi
-
- # Install nodejs
- [ -d $nodePath ] && rm -rf $nodePath
- mkdir -p $nodePath
- tar -xzf "$tmpDir/node.tar.gz" -C $nodePath --strip-components=1
-
- if ! command -v $nodeBin ; then
- LEcho error "[x] Node.js 安装失败, 请重试" "[x] Node.js installation failed, please try again"
- fi
+ # echo "[→] cd web"
+ cd web || exit
+
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 安装 MCSManager-Web 依赖库..."
else
- LEcho cyan "[-] 检测到已安装 Node.js, 跳过安装" "[-] Detected installed Node.js, skip installation"
- nodeBin="$(which node)"
- npmBin="$(which npm)"
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
fi
-
- LEcho yellow "===============================================" "==============================================="
- LEcho cyan "Node.js 版本: $($nodeBin --version)" "Node.js version: $($nodeBin --version)"
- LEcho cyan "NPM 版本: $($npmBin -v)" "NPM version: $($npmBin -v)"
- LEcho yellow "===============================================" "==============================================="
-
- # Install MCSManager
- if [ $mode == "update" ];then
- LEcho cyan "[*] 正在更新 MCSManager 前端管理面板" "[*] Updating MCSManager web panel"
-
- cd $webPath || LEcho error "[x] 无法进入 MCSManager 前端管理面板目录, 请检查权限" "[x] Unable to enter MCSManager web panel directory, please check permissions"
-
- # Clone MCSManager web panel
- git remote set-url origin $webURL
- git fetch origin
- git checkout master
- git reset --hard origin/master
- git pull
-
- LEcho cyan "[*] 正在更新 MCSManager 守护晨曦股" "[*] Updating MCSManager daemon"
-
- cd $daemonPath || LEcho error "[x] 无法进入 MCSManager 守护程序目录, 请检查权限" "[x] Unable to enter MCSManager daemon directory, please check permissions"
-
- # Clone MCSManager daemon
- git remote set-url origin $daemonURL
- git fetch origin
- git checkout master
- git reset --hard origin/master
- git pull
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
+
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green " Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ if [ "$zh" == 1 ]; then
+ echo_green "[+] MCSManager 安装成功!"
+ else
+ echo_green "[+] MCSManager installation success!"
+ fi
+
+ sleep 3
+}
+
+Create_Service() {
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 创建 MCSManager 服务..."
else
- # Clone MCSManager web panel
- LEcho cyan "[*] 正在安装 MCSManager 前端管理面板" "[*] Installing MCSManager web panel"
- git clone --single-branch -b master --depth 1 $webURL $webPath
-
- # Clone MCSManager daemon
- LEcho cyan "[*] 正在安装 MCSManager 守护程序" "[*] Installing MCSManager web panel"
- git clone --single-branch -b master --depth 1 $daemonURL $daemonPath
+ echo_cyan "[+] Create MCSManager service..."
fi
- # Update dependencies
- LEcho cyan "[*] 正在更新依赖" "[*] Updating dependencies"
- cd $webPath || LEcho error "[x] 无法进入 MCSManager 前端管理目录, 请检查权限" "[x] Unable to enter MCSManager web panel directory, please check permissions"
- [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
- [ $cn == 0 ] && $npmBin install
- cd $daemonPath || LEcho error "[x] 无法进入 MCSManager 守护程序目录, 请检查权限" "[x] Unable to enter MCSManager daemon directory, please check permissions"
- [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
- [ $cn == 0 ] && $npmBin install
-
- # Create systemd service
- LEcho cyan "[*] 正在创建 systemd 服务" "[*] Creating systemd service"
-
- webExecStart="\"$nodeBin\" \"$webPath/app.js\""
- daemonExecStart="\"$nodeBin\" \"$daemonPath/app.js\""
- cat > /etc/systemd/system/mcsm-web.service << EOF
+
+ echo "
[Unit]
-Description=MCSManager Web Panel Service
-After=network.target
+Description=MCSManager Daemon
[Service]
-User=root
-WorkingDirectory=$webPath
-ExecStart=$webExecStart
-Restart=always
+WorkingDirectory=/opt/mcsmanager/daemon
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s HUP $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-EOF
- cat > /etc/systemd/system/mcsm-daemon.service << EOF
+" >/etc/systemd/system/mcsm-daemon.service
+
+ echo "
[Unit]
-Description=MCSManager Daemon Service
-After=network.target
+Description=MCSManager Web
[Service]
-User=root
-WorkingDirectory=$daemonPath
-ExecStart=$daemonExecStart
-Restart=always
+WorkingDirectory=/opt/mcsmanager/web
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s HUP $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-EOF
- # Enable systemd service
- LEcho cyan "[*] 正在启动 MCSManager 服务" "[*] Starting MCSManager services"
+" >/etc/systemd/system/mcsm-web.service
+
+ # 重载
systemctl daemon-reload
- if [ $mode == "update" ];then
- systemctl restart mcsm-web || LEcho error "[x] 无法启动 MCSManager 前端管理面板服务" "[x] Unable to start MCSManager web panel service"
- systemctl restart mcsm-daemon || LEcho error "[x] 无法启动 MCSManager 守护程序服务" "[x] Unable to start MCSManager daemon service"
+
+ # 创建 Daemon 服务
+ systemctl enable mcsm-daemon.service --now
+
+ # 创建 Web 服务
+ systemctl enable mcsm-web.service --now
+
+ sleep 3
+
+ printf "\033c"
+ echo_yellow "=================================================================="
+ if [ "$zh" == 1 ]; then
+ echo_green "欢迎使用 MCSManager,您可以通过以下方式访问:"
+ echo_yellow "=================================================================="
+ echo_cyan_n "控制面板地址: "
+ echo_yellow "http://localhost:23333"
+ echo_red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。"
+ echo_yellow "=================================================================="
+ echo_cyan "重启 systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "禁用 systemctl disable mcsm-{daemon,web}.service"
+ echo_cyan "启用 systemctl enable mcsm-{daemon,web}.service"
+ echo_cyan "启动 systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "停止 systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "更多使用说明,请参考:https://docs.mcsmanager.com/"
else
- systemctl enable mcsm-web --now || LEcho error "[x] 无法启动 MCSManager 前端管理面板服务" "[x] Unable to start MCSManager web panel service"
- systemctl enable mcsm-daemon --now || LEcho error "[x] 无法启动 MCSManager 守护程序服务" "[x] Unable to start MCSManager daemon service"
+ echo_green "Welcome to MCSManager, you can access it by the following ways:"
+ echo_yellow "=================================================================="
+ echo_cyan_n "Web Service Address: "
+ echo_yellow "http://localhost:23333"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow "=================================================================="
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "systemctl disable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl enable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "More info: https://docs.mcsmanager.com/"
fi
-
- # Output login info
- LEcho green "[√] MCSManager 安装完毕" "[√] MCSManager installation completed"
- sleep 3
- clear
- LEcho yellow "==================================================================" "=================================================================="
- LEcho green "欢迎使用 MCSManager, 您可以通过以下方式访问: " "Welcome to MCSManager, you can access it through the following ways:"
- LEcho yellow "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板默认访问地址: " "Control panel default address: "
- LEcho yellow "http://localhost:23333" "http://localhost:23333"
- LEcho red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。" "If you can't access the panel, please check if the firewall/security group has opened the panel 23333 and 24444 ports. The control panel needs these two ports to work properly."
- LEcho yellow "==================================================================" "=================================================================="
- LEcho cyan "启动 MCSM: systemctl start mcsm-{daemon,web}.service" "Start MCSM: systemctl start mcsm-{daemon,web}.service"
- LEcho cyan "重启 MCSM: systemctl restart mcsm-{daemon,web}.service" "Restart MCSM: systemctl restart mcsm-{daemon,web}.service"
- LEcho cyan "停止 MCSM: systemctl stop mcsm-{daemon,web}.service" "Stop MCSM: systemctl stop mcsm-{daemon,web}.service"
- LEcho cyan "启用自启动: systemctl enable mcsm-{daemon,web}.service" "Enable: systemctl enable mcsm-{daemon,web}.service"
- LEcho cyan "禁用自启动: systemctl disable mcsm-{daemon,web}.service" "Disable: systemctl disable mcsm-{daemon,web}.service"
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More usage instructions, please refer to: https://docs.mcsmanager.com/"
- LEcho yellow "==================================================================" "=================================================================="
-
- # Clean up
- rm -rf $tmpDir
- return
-}
+ echo_yellow "=================================================================="
-## Clean up
-Clean() {
- LEcho cyan "[*] 正在清理残余文件" "[*] Cleaning up"
- rm -rf $tmpDir
- [ $mode != "update" ] && rm -rf $mcsmPath
- return
}
-### Start
+# ----------------- 程序启动 -----------------
+
+# 删除 Shell 脚本自身
+rm -f "$0"
+
+# 检查执行用户权限
+if [ "$(whoami)" != "root" ]; then
+ if [ "$zh" == 1 ]; then
+ Red_Error "[x] 请使用 root 权限执行 MCSManager 安装命令!"
+ else
+ Red_Error "[x] Please execute the MCSManager installation command with root permission!"
+ fi
+fi
+
+echo_cyan "+----------------------------------------------------------------------
+| MCSManager Installer
++----------------------------------------------------------------------
+| Copyright © 2022 MCSManager All rights reserved.
++----------------------------------------------------------------------
+| Shell Install Script by Nuomiaa & CreeperKong
++----------------------------------------------------------------------
+"
+
+# 环境检查
+if [ "$arch" == x86_64 ]; then
+ arch=x64
+ #echo "[-] x64 architecture detected"
+elif [ $arch == aarch64 ]; then
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
+elif [ $arch == arm ]; then
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
+elif [ $arch == ppc64le ]; then
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
+elif [ $arch == s390x ]; then
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
+else
+ if [ "$zh" == 1 ]; then
+ Red_Error "[x] 抱歉,暂不支持您的 体系架构($arch)!"
+ else
+ Red_Error "[x] Sorry, this architecture is not supported yet!"
+ fi
+ exit
+fi
+
+# 定义变量 Node 安装目录
+node_install_path="/opt/node-$node-linux-$arch"
+
+# 检查网络连接
+if [ "$zh" == 1 ]; then
+ echo_cyan "[-] 体系架构:$arch"
+else
+ echo_cyan "[-] Architecture: $arch"
+fi
+
+# MCSManager 已安装
+if [ -d "$mcsmanager_install_path" ]; then
+ printf "\033c"
+ if [ "$zh" == 1 ]; then
+ echo_red "----------------------------------------------------
+检查到已有 MCSManager 安装在 \"$mcsmanager_install_path\"
+继续安装会删除原有 MCSManager 面版的所有数据!
+----------------------------------------------------
+将在 10 秒后继续安装,取消请按 Ctrl + Z/C 键!"
+ else
+ echo_red "----------------------------------------------------
+MCSManager is installed at \"$mcsmanager_install_path\"
+Continuing the installation will delete the original MCSManager!
+----------------------------------------------------
+Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
+ fi
+ sleep 10
+fi
+
+# 安装相关软件
+if [ "$zh" == 1 ]; then
+ echo_cyan_n "[-] 安装相关软件(git,tar)... "
+else
+ echo_cyan_n "[+] Installing dependent software(git,tar)... "
+fi
+if [ -x "$(command -v yum)" ]; then
+ yum install -y git tar >error
+elif [ -x "$(command -v apt-get)" ]; then
+ apt-get install -y git tar >error
+elif [ -x "$(command -v pacman)" ]; then
+ pacman -Syu --noconfirm git tar >error
+elif [ -x "$(command -v zypper)" ]; then
+ zypper --non-interactive install git tar >error
+fi
+
+# 判断相关软件是否安装成功
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
+ if [ "$zh" == 1 ]; then
+ echo_green "成功"
+ else
+ echo_green "Success"
+ fi
+else
+ if [ "$zh" == 1 ]; then
+ echo_red "失败"
+ else
+ echo_red "Failed"
+ fi
+ echo "$error"
+ if [ "$zh" == 1 ]; then
+ Red_Error "[x] 相关软件安装失败,请手动安装 git 和 tar 软件包!"
+ else
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
+ fi
+ exit
+fi
+
+# 安装 Node 环境
+Install_Node
+
+# 安装 MCSManager
+Install_MCSManager
-LEcho cyan "[-] 正在检查基础环境, 请稍等" "[-] Checking basic environment, please wait"
-CheckRoot
-CheckArch
-CheckOS
-CheckCN
-Install
-LEcho cyan "[-] 期待与您的下次见面" "[-] Looking forward to seeing you again"
\ No newline at end of file
+# 创建 MCSManager 后台服务
+Create_Service
diff --git a/setup_en.sh b/setup_en.sh
new file mode 100644
index 0000000..90f389e
--- /dev/null
+++ b/setup_en.sh
@@ -0,0 +1,263 @@
+#!/bin/bash
+printf "\033c"
+
+error=""
+node="v14.19.1"
+arch=$(uname -m)
+mcsmanager_install_path="/opt/mcsmanager"
+
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
+
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
+
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
+
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
+
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
+
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
+}
+
+Install_Node() {
+ echo_cyan_n "[+] Install Node environment... "
+
+ rm -irf "$node_install_path"
+
+ cd /opt || exit
+
+ wget -o /dev/null https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
+
+ tar -zxf node-"$node"-linux-"$arch".tar.gz
+
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
+ if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ Red_Error "[x] Node installation failed!"
+ fi
+
+ echo
+ echo_yellow "=============== Node Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node Version ==============="
+ echo
+
+ sleep 3
+}
+
+Install_MCSManager() {
+ echo_cyan "[+] Install MCSManager..."
+
+ # delete service
+ rm -f /etc/systemd/system/mcsm-daemon.service
+ rm -f /etc/systemd/system/mcsm-web.service
+
+ # reload
+ systemctl daemon-reload
+
+ # echo "[x] Delete the original MCSManager"
+ rm -irf ${mcsmanager_install_path}
+
+ # echo "[+] mkdir -p ${mcsmanager_install_path}"
+ mkdir -p ${mcsmanager_install_path} || exit
+
+ # echo "[→] cd ${mcsmanager_install_path}"
+ cd ${mcsmanager_install_path} || exit
+
+ echo_cyan "[↓] Git clone MCSManager-Daemon..."
+ git clone --single-branch -b master --depth 1 https://github.com/MCSManager/MCSManager-Daemon-Production.git daemon
+
+ # echo "[→] cd daemon"
+ cd daemon || exit
+
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
+
+ # echo "[←] cd .."
+ cd ..
+
+ echo_cyan "[↓] Git clone MCSManager-Web..."
+ git clone --single-branch -b master --depth 1 https://github.com/MCSManager/MCSManager-Web-Production.git web
+
+ # echo "[→] cd web"
+ cd web || exit
+
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
+
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green " Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ echo_green "[+] MCSManager installation success!"
+
+ sleep 3
+}
+
+Create_Service() {
+ echo_cyan "[+] Create MCSManager service..."
+
+ echo "
+[Unit]
+Description=MCSManager Daemon
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/daemon
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s HUP $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
+[Install]
+WantedBy=multi-user.target
+" > /etc/systemd/system/mcsm-daemon.service
+
+ echo "
+[Unit]
+Description=MCSManager Web
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/web
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s HUP $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
+[Install]
+WantedBy=multi-user.target
+" > /etc/systemd/system/mcsm-web.service
+
+ systemctl daemon-reload
+ systemctl enable mcsm-daemon.service --now
+ systemctl enable mcsm-web.service --now
+
+ sleep 3
+
+ printf "\033c"
+ echo_yellow "=================================================================="
+ echo_green "Welcome to MCSManager, you can access it by the following ways:"
+ echo_yellow "=================================================================="
+ echo_cyan_n "Daemon Service Address: "; echo_yellow "http://localhost:24444"
+ echo_cyan_n "Web Service Address: "; echo_yellow "http://localhost:23333"
+ echo_cyan_n "Username: "; echo_yellow "root"
+ echo_cyan_n "Password: "; echo_yellow "123456"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow "=================================================================="
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "systemctl disable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl enable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "More info: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+
+
+}
+
+
+# ----------------- Program Start -----------------
+
+# delete the shell script itself
+rm -f "$0"
+
+# Check execute user permissions
+if [ "$(whoami)" != "root" ]; then
+ Red_Error "[x] Please execute the MCSManager installation command with root permission!"
+fi
+
+echo_cyan "+----------------------------------------------------------------------
+| MCSManager Installer
++----------------------------------------------------------------------
+| Copyright © 2022 MCSManager All rights reserved.
++----------------------------------------------------------------------
+| Shell Install Script by Nuomiaa & CreeperKong
++----------------------------------------------------------------------
+"
+
+# Environmental inspection
+if [ "$arch" == x86_64 ]; then
+ arch=x64
+ #echo "[-] x64 architecture detected"
+elif [ $arch == aarch64 ]; then
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
+elif [ $arch == arm ]; then
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
+elif [ $arch == ppc64le ]; then
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
+elif [ $arch == s390x ]; then
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
+else
+ Red_Error "[x] Sorry, this architecture is not supported yet!"
+ exit
+fi
+
+# Define the variable Node installation directory
+node_install_path="/opt/node-$node-linux-$arch"
+
+# Check network connection
+echo_cyan "[-] Architecture: $arch"
+
+# MCSManager Installed
+if [ -d "$mcsmanager_install_path" ]; then
+ printf "\033c"
+ echo_red "----------------------------------------------------
+MCSManager is installed at \"$mcsmanager_install_path\"
+Continuing the installation will delete the original MCSManager!
+----------------------------------------------------
+Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
+ sleep 10
+fi
+
+# Install related software
+echo_cyan_n "[+] Installing dependent software(git,tar)... "
+if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
+elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
+elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
+elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
+fi
+
+# Determine whether the relevant software is installed successfully
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ echo "$error"
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
+ exit
+fi
+
+
+# Install the Node environment
+Install_Node
+
+# Install MCSManager
+Install_MCSManager
+
+# Create MCSManager background service
+Create_Service
diff --git a/setup_old.sh b/setup_old.sh
deleted file mode 100644
index dfd530e..0000000
--- a/setup_old.sh
+++ /dev/null
@@ -1,371 +0,0 @@
-#!/bin/bash
-printf "\033c"
-
-error=""
-node="v14.19.1"
-arch=$(uname -m)
-mcsmanager_install_path="/opt/mcsmanager"
-zh=$(
- [[ $(locale -a) =~ "zh" ]] && echo 1
- export LANG=zh_CN.UTF-8 || echo 0
-)
-
-Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
-}
-
-echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
-}
-
-echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
-
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
-
-echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
-}
-
-echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
-}
-
-Install_Node() {
- if [ "$zh" == 1 ]; then
- echo_cyan_n "[+] 安装 Node 环境... "
- else
- echo_cyan_n "[+] Install Node environment... "
- fi
-
- rm -irf "$node_install_path"
-
- cd /opt || exit
-
- wget -o /dev/null https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
-
- tar -zxf node-"$node"-linux-"$arch".tar.gz
-
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- if [ ! -L /usr/bin/node ] && [ ! -f /usr/bin/node ]; then
- ln -s "$node_install_path"/bin/node /usr/bin/node
- fi
- if [ ! -L /usr/bin/npm ] && [ ! -f /usr/bin/npm ]; then
- ln -s "$node_install_path"/bin/npm /usr/bin/npm
- fi
-
- chmod +x "$node_install_path"/bin/node
- chmod +x "$node_install_path"/bin/npm
-
- if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]; then
- if [ "$zh" == 1 ]; then
- echo_green "成功"
- else
- echo_green "Success"
- fi
- else
- if [ "$zh" == 1 ]; then
- echo_red "失败"
- Red_Error "[x] Node 安装失败!"
- else
- echo_red "Failed"
- Red_Error "[x] Node installation failed!"
- fi
- fi
-
- echo
- echo_yellow "=============== Node Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node Version ==============="
- echo
-
- sleep 3
-}
-
-Install_MCSManager() {
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 安装 MCSManager..."
- else
- echo_cyan "[+] Install MCSManager..."
- fi
-
- # 删除服务
- rm -f /etc/systemd/system/mcsm-daemon.service
- rm -f /etc/systemd/system/mcsm-web.service
-
- # 重载
- systemctl daemon-reload
-
- # echo "[x] Delete the original MCSManager"
- rm -irf ${mcsmanager_install_path}
-
- # echo "[+] mkdir -p ${mcsmanager_install_path}"
- mkdir -p ${mcsmanager_install_path} || exit
-
- # echo "[→] cd ${mcsmanager_install_path}"
- cd ${mcsmanager_install_path} || exit
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[↓] Git 克隆 MCSManager-Daemon..."
- else
- echo_cyan "[↓] Git clone MCSManager-Daemon..."
- fi
- git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git daemon
-
- # echo "[→] cd daemon"
- cd daemon || exit
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 安装 MCSManager-Daemon 依赖库..."
- else
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- fi
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
-
- # echo "[←] cd .."
- cd ..
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[↓] Git 克隆 MCSManager-Web..."
- else
- echo_cyan "[↓] Git clone MCSManager-Web..."
- fi
- git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Web-Production.git web
-
- # echo "[→] cd web"
- cd web || exit
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 安装 MCSManager-Web 依赖库..."
- else
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- fi
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
-
- echo
- echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
- echo
- if [ "$zh" == 1 ]; then
- echo_green "[+] MCSManager 安装成功!"
- else
- echo_green "[+] MCSManager installation success!"
- fi
-
- sleep 3
-}
-
-Create_Service() {
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 创建 MCSManager 服务..."
- else
- echo_cyan "[+] Create MCSManager service..."
- fi
-
- echo "
-[Unit]
-Description=MCSManager Daemon
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-daemon.service
-
- echo "
-[Unit]
-Description=MCSManager Web
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/web
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-web.service
-
- # 重载
- systemctl daemon-reload
-
- # 创建 Daemon 服务
- systemctl enable mcsm-daemon.service --now
-
- # 创建 Web 服务
- systemctl enable mcsm-web.service --now
-
- sleep 3
-
- printf "\033c"
- echo_yellow "=================================================================="
- if [ "$zh" == 1 ]; then
- echo_green "欢迎使用 MCSManager,您可以通过以下方式访问:"
- echo_yellow "=================================================================="
- echo_cyan_n "控制面板地址: "
- echo_yellow "http://localhost:23333"
- echo_red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。"
- echo_yellow "=================================================================="
- echo_cyan "重启 systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "禁用 systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "启用 systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "启动 systemctl start mcsm-{daemon,web}.service"
- echo_cyan "停止 systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "更多使用说明,请参考:https://docs.mcsmanager.com/"
- else
- echo_green "Welcome to MCSManager, you can access it by the following ways:"
- echo_yellow "=================================================================="
- echo_cyan_n "Web Service Address: "
- echo_yellow "http://localhost:23333"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow "=================================================================="
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "More info: https://docs.mcsmanager.com/"
- fi
- echo_yellow "=================================================================="
-
-}
-
-# ----------------- 程序启动 -----------------
-
-# 删除 Shell 脚本自身
-rm -f "$0"
-
-# 检查执行用户权限
-if [ "$(whoami)" != "root" ]; then
- if [ "$zh" == 1 ]; then
- Red_Error "[x] 请使用 root 权限执行 MCSManager 安装命令!"
- else
- Red_Error "[x] Please execute the MCSManager installation command with root permission!"
- fi
-fi
-
-echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-+----------------------------------------------------------------------
-"
-
-# 环境检查
-if [ "$arch" == x86_64 ]; then
- arch=x64
- #echo "[-] x64 architecture detected"
-elif [ $arch == aarch64 ]; then
- arch=arm64
- #echo "[-] 64-bit ARM architecture detected"
-elif [ $arch == arm ]; then
- arch=armv7l
- #echo "[-] 32-bit ARM architecture detected"
-elif [ $arch == ppc64le ]; then
- arch=ppc64le
- #echo "[-] IBM POWER architecture detected"
-elif [ $arch == s390x ]; then
- arch=s390x
- #echo "[-] IBM LinuxONE architecture detected"
-else
- if [ "$zh" == 1 ]; then
- Red_Error "[x] 抱歉,暂不支持您的 体系架构($arch)!"
- else
- Red_Error "[x] Sorry, this architecture is not supported yet!"
- fi
- exit
-fi
-
-# 定义变量 Node 安装目录
-node_install_path="/opt/node-$node-linux-$arch"
-
-# 检查网络连接
-if [ "$zh" == 1 ]; then
- echo_cyan "[-] 体系架构:$arch"
-else
- echo_cyan "[-] Architecture: $arch"
-fi
-
-# MCSManager 已安装
-if [ -d "$mcsmanager_install_path" ]; then
- printf "\033c"
- if [ "$zh" == 1 ]; then
- echo_red "----------------------------------------------------
-检查到已有 MCSManager 安装在 \"$mcsmanager_install_path\"
-继续安装会删除原有 MCSManager 面版的所有数据!
-----------------------------------------------------
-将在 10 秒后继续安装,取消请按 Ctrl + Z/C 键!"
- else
- echo_red "----------------------------------------------------
-MCSManager is installed at \"$mcsmanager_install_path\"
-Continuing the installation will delete the original MCSManager!
-----------------------------------------------------
-Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
- fi
- sleep 10
-fi
-
-# 安装相关软件
-if [ "$zh" == 1 ]; then
- echo_cyan_n "[-] 安装相关软件(git,tar)... "
-else
- echo_cyan_n "[+] Installing dependent software(git,tar)... "
-fi
-if [ -x "$(command -v yum)" ]; then
- yum install -y git tar >error
-elif [ -x "$(command -v apt-get)" ]; then
- apt-get install -y git tar >error
-elif [ -x "$(command -v pacman)" ]; then
- pacman -Syu --noconfirm git tar >error
-elif [ -x "$(command -v zypper)" ]; then
- zypper --non-interactive install git tar >error
-fi
-
-# 判断相关软件是否安装成功
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
- if [ "$zh" == 1 ]; then
- echo_green "成功"
- else
- echo_green "Success"
- fi
-else
- if [ "$zh" == 1 ]; then
- echo_red "失败"
- else
- echo_red "Failed"
- fi
- echo "$error"
- if [ "$zh" == 1 ]; then
- Red_Error "[x] 相关软件安装失败,请手动安装 git 和 tar 软件包!"
- else
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- fi
- exit
-fi
-
-# 安装 Node 环境
-Install_Node
-
-# 安装 MCSManager
-Install_MCSManager
-
-# 创建 MCSManager 后台服务
-Create_Service
From 6b505c9378a587f14c75d5de72e538293f151c9c Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Tue, 21 Mar 2023 22:27:12 +0800
Subject: [PATCH 041/460] Add Docker installation method
---
README.md | 8 +++-
README_cn.md | 10 ++++-
docker/README.md | 76 +++++++++++++++++++++++++++++++++
docker/README_cn.md | 77 ++++++++++++++++++++++++++++++++++
docker/examples/cn/daemon.yaml | 15 +++++++
docker/examples/cn/full.yaml | 28 +++++++++++++
docker/examples/cn/web.yaml | 15 +++++++
docker/examples/en/daemon.yaml | 15 +++++++
docker/examples/en/full.yaml | 28 +++++++++++++
docker/examples/en/web.yaml | 15 +++++++
10 files changed, 284 insertions(+), 3 deletions(-)
create mode 100644 docker/README.md
create mode 100644 docker/README_cn.md
create mode 100644 docker/examples/cn/daemon.yaml
create mode 100644 docker/examples/cn/full.yaml
create mode 100644 docker/examples/cn/web.yaml
create mode 100644 docker/examples/en/daemon.yaml
create mode 100644 docker/examples/en/full.yaml
create mode 100644 docker/examples/en/web.yaml
diff --git a/README.md b/README.md
index 3d08d19..4b77c7f 100644
--- a/README.md
+++ b/README.md
@@ -14,10 +14,16 @@ The default installation script on the official website is the `setup.sh` file o
You can also use the following one-click command to perform a quick installation
-## Installation commands
+## Installation method
+
+### One-click installation command
```bash
wget https://raw.githubusercontent.com/MCSManager/Script/master/setup.sh -O setup.sh && bash setup.sh
```
+### Docker (Beta)
+
+Please check this [tutorial](https://github.com/MCSManager/Script/blob/master/docker/README.md)
+
diff --git a/README_cn.md b/README_cn.md
index 5f55c3a..5a49951 100644
--- a/README_cn.md
+++ b/README_cn.md
@@ -14,16 +14,22 @@
你也可以使用下列一键命令安装 MCSManager 9
-## 安装命令
+## 安装方法
+
+### 一键命令安装
```bash
wget https://raw.githubusercontent.com/MCSManager/Script/master/setup.sh -O setup.sh && bash setup.sh
```
-当然, 一般国内用户因为某些神奇的原因都连不上 Github, 下方为 Gitee 国内镜像源链接
+_当然, 一般国内用户因为某些神奇的原因都连不上 Github, 下方为 Gitee 国内镜像源链接_
```bash
wget https://gitee.com/mcsmanager/script/raw/master/setup.sh -O setup.sh && bash setup.sh
```
+### Docker (Beta)
+
+请查看此[教程](https://github.com/MCSManager/Script/blob/master/docker/README_cn.md)
+
diff --git a/docker/README.md b/docker/README.md
new file mode 100644
index 0000000..8e0ccc3
--- /dev/null
+++ b/docker/README.md
@@ -0,0 +1,76 @@
+# Install MCSManager with Docker
+
+## Prerequisites
+
+You need to prepare the following before installation:
+
+- `docker` version `17.12.0+` has been installed
+- `docker-compose` has been installed
+
+## Start installation
+
+First, use the following command to create the basic directory of `docker-compose`
+
+```bash
+mkdir -p mcsmanager
+cd mcsmanager
+```
+
+Then, create an empty file named `docker-compose.yaml`
+
+```bash
+touch docker-compose.yaml
+```
+
+If you are a new user, please copy the configuration file below, modify the part marked with comments, and paste it into `docker-compose.yaml`
+
+If you cannot copy or paste this file, you can also click [here](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/full.yaml) to get the sample file
+
+```yaml
+version: "2.4"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ volumes:
+ # This is the MCSManager control panel log storage directory
+ # The default is [/var/logs/mcsmanager/web]
+ - /var/logs/mcsmanager/web:/logs
+
+ # This is the MCSManager control panel log storage directory
+ # The default is the data/web folder under the current directory
+ - ./data/web:/data
+ network_mode: host
+ command: /start
+
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ volumes:
+ # This is the MCSManager control panel log storage directory
+ # The default is [/var/logs/mcsmanager/daemon]
+ - /var/logs/mcsmanager/daemon:/logs
+
+ # This is the MCSManager control panel log storage directory
+ # The default is the data/daemon folder under the current directory
+ - ./data/daemon:/data
+ network_mode: host
+ command: /start
+```
+
+If you are an old user and only plan to install a certain component of MCSManager (such as only installing the MCSManager daemon), please refer to the following two sample files and modify the part marked with comments
+
+- [MCSManager web](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/web.yaml)
+- [MCSManager daemon](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/daemon.yaml)
+
+After all the above operations are completed, please run the following command to start MCSManager
+
+```bash
+docker-compose -f docker-compose.yaml up -d
+```
+
+If everything runs normally, you can soon access `http://127.0.0.1:23333` to view the panel you just built!
+
+If you modify (or update) the `docker-compose.yaml` file later, please move it back to the directory and run the following command to make the modification take effect
+
+```bash
+docker-compose up -d
diff --git a/docker/README_cn.md b/docker/README_cn.md
new file mode 100644
index 0000000..e78511a
--- /dev/null
+++ b/docker/README_cn.md
@@ -0,0 +1,77 @@
+# 通过 Docker 安装 MCSManager
+
+## 预先准备
+
+你需要提前做好以下几点准备
+
+- 已经安装了 `17.12.0+` 版本的 `docker`
+- 已经安装了 `docker-compose`
+
+## 开始安装
+
+首先, 请先使用以下命令创建 `docker-compose` 基本目录
+
+```bash
+mkdir -p mcsmanager
+cd mcsmanager
+```
+
+然后, 创建一个名为 `docker-compose.yaml` 的空文件
+
+```bash
+touch docker-compose.yaml
+```
+
+如果你是一个新用户, 请复制下面的配置文件, 修改其中注释标出的部分, 粘贴到 `docker-compose.yaml` 中即可
+
+如果你无法复制或粘贴此文件, 你也可以[点击此处](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/full.yaml)获取示例文件
+
+```yaml
+version: "2.4"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ volumes:
+ # 此处为 MCSManager 控制面板日志存储目录
+ # 默认为 [/var/logs/mcsmanager/web]
+ - /var/logs/mcsmanager/web:/logs
+
+ # 此处为 MCSManager 控制面板日志存储目录
+ # 默认为当前目录下的 data/web 文件夹
+ - ./data/web:/data
+ network_mode: host
+ command: /start
+
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ volumes:
+ # 此处为 MCSManager 控制面板日志存储目录
+ # 默认为 [/var/logs/mcsmanager/daemon]
+ - /var/logs/mcsmanager/daemon:/logs
+
+ # 此处为 MCSManager 控制面板日志存储目录
+ # 默认为当前目录下的 data/daemon 文件夹
+ - ./data/daemon:/data
+ network_mode: host
+ command: /start
+```
+
+如果你是一个老用户, 并且只准备安装 MCSManager 的某个组件 (如仅安装 MCSManager 守护程序), 请查看下面这两个示例文件, 并修改其中注释标出的部分
+
+- [MCSManager 控制面板](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/web.yaml)
+- [MCSManager 守护程序](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/daemon.yaml)
+
+当上述操作全部完成后, 请运行以下命令以启动 MCSManager
+
+```bash
+docker-compose -f docker-compose.yaml up -d
+```
+
+如果一切都运行正常, 那么不久后你就可以访问 `http://127.0.0.1:23333` 来查看你刚刚搭建好的面板了 !
+
+如果你后期修改(或更新)了 `docker-compose.yaml` 文件, 请重新移动到该目录, 并运行以下命令以使修改生效
+
+```bash
+docker-compose up -d
+```
diff --git a/docker/examples/cn/daemon.yaml b/docker/examples/cn/daemon.yaml
new file mode 100644
index 0000000..903bce3
--- /dev/null
+++ b/docker/examples/cn/daemon.yaml
@@ -0,0 +1,15 @@
+version: "2.4"
+
+services:
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ volumes:
+ # 此处为 MCSManager 守护程序日志存储目录
+ # 默认为 [/var/logs/mcsmanager/daemon]
+ - /var/logs/mcsmanager/daemon:/logs
+
+ # 此处为 MCSManager 守护程序日志存储目录
+ # 默认为当前目录下的 data/daemon 文件夹
+ - ./data/daemon:/data
+ network_mode: host
+ command: /start
diff --git a/docker/examples/cn/full.yaml b/docker/examples/cn/full.yaml
new file mode 100644
index 0000000..15ad729
--- /dev/null
+++ b/docker/examples/cn/full.yaml
@@ -0,0 +1,28 @@
+version: "2.4"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ volumes:
+ # 此处为 MCSManager 控制面板日志存储目录
+ # 默认为 [/var/logs/mcsmanager/web]
+ - /var/logs/mcsmanager/web:/logs
+
+ # 此处为 MCSManager 控制面板日志存储目录
+ # 默认为当前目录下的 data/web 文件夹
+ - ./data/web:/data
+ network_mode: host
+ command: /start
+
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ volumes:
+ # 此处为 MCSManager 守护程序日志存储目录
+ # 默认为 [/var/logs/mcsmanager/daemon]
+ - /var/logs/mcsmanager/daemon:/logs
+
+ # 此处为 MCSManager 守护程序日志存储目录
+ # 默认为当前目录下的 data/daemon 文件夹
+ - ./data/daemon:/data
+ network_mode: host
+ command: /start
diff --git a/docker/examples/cn/web.yaml b/docker/examples/cn/web.yaml
new file mode 100644
index 0000000..6f612b3
--- /dev/null
+++ b/docker/examples/cn/web.yaml
@@ -0,0 +1,15 @@
+version: "2.4"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ volumes:
+ # 此处为 MCSManager 控制面板日志存储目录
+ # 默认为 [/var/logs/mcsmanager/web]
+ - /var/logs/mcsmanager/web:/logs
+
+ # 此处为 MCSManager 控制面板日志存储目录
+ # 默认为当前目录下的 data/web 文件夹
+ - ./data/web:/data
+ network_mode: host
+ command: /start
diff --git a/docker/examples/en/daemon.yaml b/docker/examples/en/daemon.yaml
new file mode 100644
index 0000000..4ae4580
--- /dev/null
+++ b/docker/examples/en/daemon.yaml
@@ -0,0 +1,15 @@
+version: "2.4"
+
+services:
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ volumes:
+ # This is the MCSManager web panel log storage directory
+ # Default is [/var/logs/mcsmanager/daemon]
+ - /var/logs/mcsmanager/daemon:/logs
+
+ # This is the MCSManager daemon data storage directory
+ # Default is the data/daemon folder in the current directory
+ - ./data/daemon:/data
+ network_mode: host
+ command: /start
diff --git a/docker/examples/en/full.yaml b/docker/examples/en/full.yaml
new file mode 100644
index 0000000..f8d00ce
--- /dev/null
+++ b/docker/examples/en/full.yaml
@@ -0,0 +1,28 @@
+version: "2.4"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ volumes:
+ # This is the MCSManager web panel log storage directory
+ # The default is [/var/logs/mcsmanager/web]
+ - /var/logs/mcsmanager/web:/logs
+
+ # This is the MCSManager web panel data storage directory
+ # The default is the data/web folder in the current directory
+ - ./data/web:/data
+ network_mode: host
+ command: /start
+
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ volumes:
+ # This is the MCSManager daemon log storage directory
+ # The default is [/var/logs/mcsmanager/daemon]
+ - /var/logs/mcsmanager/daemon:/logs
+
+ # This is the MCSManager daemon data storage directory
+ # The default is the data/daemon folder in the current directory
+ - ./data/daemon:/data
+ network_mode: host
+ command: /start
diff --git a/docker/examples/en/web.yaml b/docker/examples/en/web.yaml
new file mode 100644
index 0000000..cb5ae2b
--- /dev/null
+++ b/docker/examples/en/web.yaml
@@ -0,0 +1,15 @@
+version: "2.4"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ volumes:
+ # This is the MCSManager daemon log storage directory
+ # The default is [/var/logs/mcsmanager/web]
+ - /var/logs/mcsmanager/web:/logs
+
+ # This is the MCSManager daemon data storage directory
+ # The default is the data/web folder in the current directory
+ - ./data/web:/data
+ network_mode: host
+ command: /start
From e036a473b1bbd4d6f5ea8113d67993302d52e2cb Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 22 Mar 2023 17:16:04 +0800
Subject: [PATCH 042/460] Emergency fix for data loss issue
---
setup_cn.sh | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index a2d5dca..eae0d82 100644
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -109,6 +109,11 @@ LEcho() {
return
}
+# Detect old MCSManager
+[ -d $mcsmPath ] && LEcho yellow "[!] 检测到旧版 MCSManager, 切换为更新模式" "[!] Old version of MCSManager detected, switch to update mode"
+[ -d $mcsmPath ] && mode="update"
+[ ! -d $mcsmPath ] && mkdir -p $mcsmPath
+
## Check root
CheckRoot() {
if [[ $EUID -ne 0 ]]; then
@@ -178,7 +183,7 @@ CheckOS() {
else
LEcho error "[x] 未能正常检测到系统类型, 无法继续安装" "[x] Unable to detect system type, installation cannot continue"
fi
-
+
# Install dependencies
LEcho cyan "[*] 正在安装安装所需的工具" "[*] Installing the tools required for installation"
if [ "$os" == "debian" ]; then
@@ -209,11 +214,6 @@ Install() {
LEcho cyan "[*] 正在初始化工作环境" "[*] Initializing work environment"
mkdir -p $tmpDir
- # Detect old MCSManager
- [ -d $mcsmPath ] && LEcho yellow "[!] 检测到旧版 MCSManager, 切换为更新模式" "[!] Old version of MCSManager detected, switch to update mode"
- [ -d $mcsmPath ] && mode="update"
- mkdir -p $mcsmPath
-
# Install nodejs
if ! CheckNode;then
LEcho cyan "[*] 正在安装 Node.js" "[*] Installing Node.js"
@@ -258,7 +258,7 @@ Install() {
git fetch origin
git checkout master
git reset --hard origin/master
- git pull
+ git pull
LEcho cyan "[*] 正在更新 MCSManager 守护晨曦股" "[*] Updating MCSManager daemon"
@@ -269,24 +269,24 @@ Install() {
git fetch origin
git checkout master
git reset --hard origin/master
- git pull
+ git pull
else
# Clone MCSManager web panel
LEcho cyan "[*] 正在安装 MCSManager 前端管理面板" "[*] Installing MCSManager web panel"
- git clone --single-branch -b master --depth 1 $webURL $webPath
+ git clone --single-branch -b master --depth 1 $webURL $webPath
# Clone MCSManager daemon
LEcho cyan "[*] 正在安装 MCSManager 守护程序" "[*] Installing MCSManager web panel"
- git clone --single-branch -b master --depth 1 $daemonURL $daemonPath
+ git clone --single-branch -b master --depth 1 $daemonURL $daemonPath
fi
# Update dependencies
LEcho cyan "[*] 正在更新依赖" "[*] Updating dependencies"
cd $webPath || LEcho error "[x] 无法进入 MCSManager 前端管理目录, 请检查权限" "[x] Unable to enter MCSManager web panel directory, please check permissions"
- [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
- [ $cn == 0 ] && $npmBin install
+ [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
+ [ $cn == 0 ] && $npmBin install
cd $daemonPath || LEcho error "[x] 无法进入 MCSManager 守护程序目录, 请检查权限" "[x] Unable to enter MCSManager daemon directory, please check permissions"
- [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
- [ $cn == 0 ] && $npmBin install
+ [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
+ [ $cn == 0 ] && $npmBin install
# Create systemd service
LEcho cyan "[*] 正在创建 systemd 服务" "[*] Creating systemd service"
From 57d4eb36252f723f44df4d1d608fa71bf4ce0453 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 22 Mar 2023 17:32:36 +0800
Subject: [PATCH 043/460] Fix a f**king problem
---
setup_cn.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index eae0d82..c7d7b58 100644
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -260,7 +260,7 @@ Install() {
git reset --hard origin/master
git pull
- LEcho cyan "[*] 正在更新 MCSManager 守护晨曦股" "[*] Updating MCSManager daemon"
+ LEcho cyan "[*] 正在更新 MCSManager 守护程序" "[*] Updating MCSManager daemon"
cd $daemonPath || LEcho error "[x] 无法进入 MCSManager 守护程序目录, 请检查权限" "[x] Unable to enter MCSManager daemon directory, please check permissions"
From 2c14ea06bd39f0bde7cdfd522340417df563c866 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Wed, 22 Mar 2023 17:37:38 +0800
Subject: [PATCH 044/460] Update README_cn.md
---
README_cn.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README_cn.md b/README_cn.md
index 5a49951..824d0ca 100644
--- a/README_cn.md
+++ b/README_cn.md
@@ -22,7 +22,7 @@
wget https://raw.githubusercontent.com/MCSManager/Script/master/setup.sh -O setup.sh && bash setup.sh
```
-_当然, 一般国内用户因为某些神奇的原因都连不上 Github, 下方为 Gitee 国内镜像源链接_
+_当然, 一般国内用户因为众所周知的原因都连不上 Github, 下方为 Gitee 国内镜像源链接_
```bash
wget https://gitee.com/mcsmanager/script/raw/master/setup.sh -O setup.sh && bash setup.sh
From f785157683d78f59a2a48747a630997e16694619 Mon Sep 17 00:00:00 2001
From: BlueFunny
Date: Thu, 23 Mar 2023 08:55:34 +0800
Subject: [PATCH 045/460] Deprecated
---
setup.sh.bak | 614 ---------------------------------------------------
setup_en.sh | 263 ----------------------
2 files changed, 877 deletions(-)
delete mode 100644 setup.sh.bak
delete mode 100644 setup_en.sh
diff --git a/setup.sh.bak b/setup.sh.bak
deleted file mode 100644
index bea835f..0000000
--- a/setup.sh.bak
+++ /dev/null
@@ -1,614 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSM Install Script
-#### Made By nuomiaa, CreeperKong, unitwk
-#### Recode By BlueFunny_
-
-### Variables ###
-## Files
-mcsmPath="/opt/mcsmanager"
-mcsmDaemonDPath="${mcsmPath}/daemon/data"
-mcsmWebDPath="${mcsmPath}/web/data"
-nodePath="${mcsmPath}/node"
-tmpPath="/tmp/mcsmanager-setup"
-
-## Node
-nodeVersion="v14.19.1"
-node="${nodePath}/bin/node"
-npm="${nodePath}/bin/npm"
-
-## Setup tools mode
-mode="install"
-
-## URL
-nodeMirror="https://nodejs.org/dist"
-daemonCloneURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
-webCloneURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
-nodeFileURL="${nodeMirror}/${nodeVersion}/node-${nodeVersion}-linux-${arch}.tar.gz"
-nodeHashURL="${nodeMirror}/${nodeVersion}/SHASUMS256.txt"
-
-## Language
-if [ "$(locale -a | grep "zh_CN")" != "" ]; then
- zh=1
- export LANG="zh_CN.UTF-8"
-else
- zh=0
-fi
-
-## Other
-try=1
-os=$(uname -a)
-arch=$(uname -m)
-skipNodeInstall=0
-skipMCSMInstall=0
-#oldSystem=0
-
-### Tools ###
-## Localize echo
-# $1: color
-# $2: zh
-# $3: en
-LEcho() {
- case $1 in
- # Red color echo
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
-
- # Green color echo
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
-
- # Cyan color echo
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
-
- # Cyan color echo (No line break)
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
-
- # Yellow color echo
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
-
- # Red error echo
- error)
- echo '================================================='
- [ "${zh}" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- Clean
- exit 1
- ;;
-
- # No color echo
- *)
- [ "${zh}" == 1 ] && echo "$2"
- [ "${zh}" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-### Entry Point ###
-## Program entry point
-Main() {
- LEcho cyan "[-] 正在检查环境..." "[-] Initializing environment..."
-
- # Check mode
- if [ "$1" == "uninstall" ]; then
- mode="uninstall"
- fi
-
- # Create temp dir
- [ ! -d "${tmpPath}" ] && mkdir -p "${tmpPath}" || rm -rf "${tmpPath}" && mkdir -p "${tmpPath}"
- if [ ! -d "${tmpPath}" ]; then
- CheckRoot
- LEcho error "[x] 未能成功创建临时目录, 请检查权限" "[x] Failed to create temporary directory, please check permissions"
- fi
-
- # Check functions collection
- if [ "${mode}" == "install" ]; then
- # Install
- CheckSystem
- CheckOldFiles "$1"
- CheckNetwork
- CheckCN
- SetArgs "$1" "$2"
-
- LEcho cyan "[-] 环境检查完毕, 开始安装 MCSManager" "[-] Environment check completed, start installing MCSManager"
-
- Install
-
- if [ -d "${tmpPath}"/mcsmanager ] || [ -d "${tmpPath}"/node ]; then
- LEcho cyan "[-] 检测到备份文件, 正在恢复中..." "[-] Backup files detected, recovering..."
- MirgrateFiles
- fi
- else
- # Uninstall
- CheckRoot
- CheckInstall
-
- LEcho cyan "[-] 环境校验完毕, 开始卸载 MCSManager" "[-] Environment check completed, start uninstalling MCSManager"
-
- Remove "$1"
- fi
-
- return
-}
-
-### Init ###
-## Check if mcsm installed
-CheckInstall() {
- if [ ! -d ${mcsmPath} ]; then
- LEcho error "[x] 检测到您没有安装 MCSManager, 谨慎的拒绝卸载请求" "[x] It is detected that you have not installed MCSManager, and the uninstall request is rejected"
- fi
- return
-}
-
-## Check OS
-CheckOS() {
- if [ "$(echo "${os}" | grep "Ubuntu")" == "" ] && [ "$(echo "${os}" | grep "Debian")" == "" ] && [ "$(echo "${os}" | grep "CentOS")" == "" ]; then
- LEcho error "[x] 本脚本仅支持 Ubuntu/Debian/CentOS 系统!" "[x] This script only supports Ubuntu/Debian/CentOS systems!"
- fi
- if [ "$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')" ]; then
- # LEcho yellow "[!] 检测到您的系统版本过低, 可能会存在一定的兼容性问题, 请了解" "[!] It is detected that your system version is too low, there may be certain compatibility issues, please understand"
- # LEcho cyan "[-] 切换为兼容性模式" "[-] Switch to compatibility mode"
- # oldSystem=1
- LEcho error "[x] 本脚本不支持 CentOS 6, 请升级到 CentOS 7 或更高版本" "[x] This script does not support CentOS 6, please upgrade to CentOS 7 or higher"
- fi
- if [ "$(cat /etc/issue | grep Ubuntu | awk '{print $2}' | cut -f 1 -d '.')" ] && [ "$(cat /etc/issue | grep Ubuntu | awk '{print $2}' | cut -f 1 -d '.')" -lt "16" ]; then
- # LEcho yellow "[!] 检测到您的系统版本过低, 可能会存在一定的兼容性问题, 请了解" "[!] It is detected that your system version is too low, there may be certain compatibility issues, please understand"
- # LEcho cyan "[-] 切换为兼容性模式" "[-] Switch to compatibility mode"
- # oldSystem=1
- LEcho error "[x] 本脚本不支持 Ubuntu 14, 请升级到 Ubuntu 16 或更高版本" "[x] This script does not support Ubuntu 14, please upgrade to Ubuntu 16 or higher"
- fi
- return
-}
-
-## Check user permission
-CheckRoot() {
- if [ "$(whoami)" != "root" ]; then
- LEcho error "[x] 请使用 root 用户或者使用 sudo 命令执行脚本!" "[x] Please use root user or use sudo command to execute the script!"
- fi
- return
-}
-
-## Check system environment
-CheckSystem() {
- # Function reuse
- CheckRoot
- CheckOS
-
- # Check Tools
- if [ -f /etc/redhat-release ]; then
- yum install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
- else
- #if [ ${oldSystem} == 1 ]; then
- # apt-get install --force-yes -y git tar wget curl systemctl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
- #else
- # apt-get install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
- #fi
- apt-get install -y git tar wget curl || LEcho error "[x] 未能成功安装必备软件包" "[x] Failed to install required software packages"
- fi
-
- # Check Arch
- case "${arch}" in
- x86_64)
- arch=x64
- ;;
- aarch64)
- arch=arm64
- ;;
- arm)
- arch=armv7l
- ;;
- ppc64le)
- arch=ppc64le
- ;;
- s390x)
- arch=s390x
- ;;
- *)
- LEcho error "[x] 当前系统架构暂不受 Node.js 支持, 无法安装 MCSManager" "[x] The current system architecture is not supported by Node.js, MCSManager cannot be installed"
- ;;
- esac
-
- LEcho green "[√] 系统环境检查完成" "[√] System environment check completed"
- return
-}
-
-## Check if MCSManager is already installed on system
-CheckOldFiles() {
- # Check old MCSManager files
- if [ -d ${mcsmPath} ]; then
- LEcho echo "[-] 检测到旧版本 MCSManager, 正在迁移文件中" "[-] Old version MCSManager detected, migrating files"
- # Create backup dir
- [ ! -d ${tmpPath}/mcsmanager ] && mkdir -p ${tmpPath}/mcsmanager
- [ ! -d ${tmpPath}/systemd ] && mkdir -p ${tmpPath}/systemd
-
- # Stop service
- systemctl stop mcsm-daemson.service
- systemctl stop mcsm-web.service
- systemctl disable mcsm-daemon.service
- systemctl disable mcsm-web.service
-
- # Move files
- mv -f ${mcsmPath}/web ${tmpPath}/mcsmanager/web
- mv -f ${mcsmPath}/daemon ${tmpPath}/mcsmanager/daemon
- mv -f /etc/systemd/system/mcsm-daemon.service "${tmpPath}"/systemd/mcsm-daemon.service
- mv -f /etc/systemd/system/mcsm-web.service "${tmpPath}"/systemd/mcsm-web.service
- fi
-
- # Check old node files
- if [ -d ${nodePath} ]; then
- LEcho echo "[-] 检测到旧版本 Node.js, 正在比对版本中" "[-] Old version Node.js detected, comparing versions"
-
- # Check node version
- if [ "$(${node} -v)" == "${nodeVersion}" ]; then
- LEcho echo "[-] Node.js 版本匹配, 跳过 Node.js 下载" "[-] Node.js version matches, skipping Node.js download"
- mv -f ${nodePath} ${tmpPath}/node
- skipNodeInstall=1
- fi
- fi
-
- # Remove old files
- Remove "$1"
-
- # Create new dir
- mkdir -p ${mcsmPath}
-
- LEcho green "[√] 旧文件检查完毕" "[√] Old file check completed"
- return
-}
-
-# Check network
-CheckNetwork() {
- if [ "$(curl -m 10 -s https://www.baidu.com)" == "" ]; then
- LEcho error "[x] 未能成功连接到网络, 请检查网络连接后重试" "[x] Failed to connect to the network, please check the network connection and try again"
- fi
- LEcho green "[√] 网络连接正常" "[√] Network connection is normal"
- return
-}
-
-# Check if the server is in China
-CheckCN() {
- if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
- # LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China"
- # [ "${zh}" == 1 ] && read -e -r -p "[?] 是否选用中国镜像完成安装? [y/n] " input
- # [ "${zh}" == 0 ] && read -e -r -p "[?] Whether to use the Chinese mirror to complete the installation? [y/n] " input
- # case ${input} in
- # [yY][eE][sS] | [yY])
- # LEcho cyan "[-] 选用中国镜像" "[-] Use Chinese mirror"
- # daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- # webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- # nodeMirror="https://npmmirror.com/mirrors/node"
- # ;;
- # *)
- # LEcho cyan "[-] 不选用中国镜像" "[-] Do not use Chinese mirror"
- # ;;
- # esac
- LEcho yellow "[!] 根据 'ipapi.co' 提供的信息, 当前服务器可能在中国, 已自动切换为中国镜像源" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China, and the Chinese mirror source has been automatically switched"
- daemonCloneURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- webCloneURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- nodeMirror="https://npmmirror.com/mirrors/node"
- else
- LEcho cyan "[-] 检测服务器地理位置出错, 跳过检测" "[-] Error detecting server location, skipping detection"
- fi
- LEcho green "[√] 服务器地理位置检查完毕" "[√] Location check completed"
- return
-}
-
-# Set Debug Args
-SetArgs() {
- # Warning
- LEcho yellow "[!] 检测到您已启用 debug 功能, 安装可能会导致不可预知的错误" "[!] Debug mode is enabled, installation may cause unpredictable errors"
- LEcho yellow "[!] 此模式导致的任何问题都不会得到解决" "[!] Any problems caused by this mode will not be solved"
-
- # Set args
- if [ "$1" != "" ] && [ "$1" != "remove" ]; then
- if [ "$1" == "force" ]; then
- LEcho echo "[-] 强制下载 Node.js" "[-] Force download Node.js"
- skipNodeInstall=0
- fi
- if [ "$1" == "skipnode" ]; then
- LEcho echo "[-] 已跳过 Node.js 安装" "[-] Skipped Node.js installation"
- skipNodeInstall=1
- fi
- if [ "$1" == "skipmcsm" ]; then
- LEcho echo "[-] 已跳过 MCSManager 安装" "[-] Skipped MCSManager installation"
- skipMCSMInstall=1
- fi
- if [ "$1" == "custom" ] && [ "$2" != "" ]; then
- LEcho echo "[-] 自定义安装路径为: $2" "[-] Custom installation path: $2"
- mcsmPath="$2"
- fi
- if [ "$1" == "node" ] && [ "$2" != "" ]; then
- LEcho echo "[-] 自定义 Node.js 下载链接为: $2" "[-] Custom Node.js download link: $2"
- nodeMirror="$2"
- fi
- fi
-}
-
-### Main ###
-## Main install function
-Install() {
- InstallNode
- [ ${skipMCSMInstall} != 1 ] && InstallMCSM
-}
-
-## Install Node.js
-InstallNode() {
- if [ ${skipNodeInstall} == 1 ]; then
- if [ ! -d ${tmpPath}/node ]; then
- LEcho echo "[-] 跳过 Node.js 安装" "[-] Skipped Node.js installation"
- else
- mv -f ${tmpPath}/node ${nodePath}
- fi
- else
- LEcho echo "[+] 正在安装 Node.js" "[+] Installing Node.js"
-
- # Download Node.js
- #if [ ${oldSystem} != 1 ]; then
- # wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
- # wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
- #else
- # wget -t ${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
- # wget -t ${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
- #fi
- wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.tar.gz "${nodeFileURL}"
- wget -t=${try} -q --no-check-certificate --show-progress -O ${tmpPath}/node.sha256 "${nodeHashURL}"
-
- # Check hash
- cat ${tmpPath}/node.sha256 | grep "${nodeVersion}/node-${nodeVersion}-linux-${arch}.tar.gz" | tee ${tmpPath}/node.sha256
- cd ${tmpPath} || LEcho red "[x] 校验出错, 无法继续进行下一步, 退回操作中..." "[x] Verification error, unable to continue to the next step, returning to operation..." && Revert
- sha256sum -c ${tmpPath}/node.sha256 || LEcho red "[x] 校验出错, 无法继续进行下一步, 退回操作中..." "[x] Verification error, unable to continue to the next step, returning to operation..." && Revert
-
- # Extract Node.js
- tar -xzvf ${tmpPath}/node.tar.gz -C ${nodePath} --strip-components=1
-
- # Set permission
- chmod +x ${node}
- chmod +x ${npm}
-
- # Check Node.js installation
- if ! ${node} -v; then
- LEcho red "[x] Node.js 安装失败, 无法继续进行下一步, 退回操作中..." "[x] Node.js installation failed, please check the network connection"
- Revert
- fi
- if ! ${npm} -v; then
- LEcho red "[x] Node.js 安装失败, 无法继续进行下一步, 退回操作中..." "[x] Node.js installation failed, please check the network connection"
- Revert
- fi
-
- # Output Node.js version
- echo
- LEcho cyan "=============== Node 版本 ===============" "=============== Node Version ==============="
- LEcho cyan_n " Node: " " Node: "
- LEcho echo "$("${node}" -v)" "$("${node}" -v)"
- LEcho cyan_n " NPM: " " NPM: "
- LEcho echo "v$("${npm}" -v)" "v$("${npm}" -v)"
- LEcho cyan "=========================================" "=============== Node Version ==============="
- echo
-
- sleep 3
- LEcho green "[√] Node.js 安装完毕" "[√] Node.js installation completed"
- fi
- return
-}
-
-## Install MCSManager
-InstallMCSM() {
- # Clone MCSManager daemon and web
- git clone --single-branch -b master --depth 1 ${daemonCloneURL} "${mcsmPath}/daemon"
- git clone --single-branch -b master --depth 1 ${webCloneURL} "${mcsmPath}/web"
-
- # Install Node.js dependencies
- cd "${mcsmPath}/daemon" || LEcho red "[x] 无法进入 MCSManager 守护进程目录, 无法继续进行下一步, 退回操作中..." "[x] Unable to enter the MCSManager daemon directory, unable to continue to the next step, returning to operation..." && Revert
- ${npm} install --registry=https://registry.npmmirror.com >error
- cd "${mcsmPath}/web" || LEcho red "[x] 无法进入 MCSManager 网页面板目录, 无法继续进行下一步, 退回操作中..." "[x] Unable to enter the MCSManager web directory, unable to continue to the next step, returning to operation..." && Revert
- ${npm} install --registry=https://registry.npmmirror.com >error
-
- # Output MCSManager install path
- echo
- LEcho cyan "=============== MCSManager 安装目录 ===============" "=============== MCSManager Install Path ==============="
- LEcho cyan_n " Daemon: " " Daemon: "
- LEcho echo "${mcsmPath}/daemon" "${mcsmPath}/daemon"
- LEcho cyan_n " Web: " " Web: "
- LEcho echo "${mcsmPath}/web" "${mcsmPath}/web"
- LEcho cyan "==================================================" "=============== MCSManager Install Path ==============="
- echo
-
- # Function reuse
- CreateService
- MirgrateFiles
-
- # Test the availability of MCSManager
- if ! systemctl start mcsm-web; then
- LEcho red "[x] MCSManager 网页面板启动失败, 无法继续进行下一步, 退回操作中..." "[x] MCSManager installation failed, unable to continue to the next step, returning to operation..." && Revert
- else
- systemctl stop mcsm-web
- fi
- if ! systemctl start mcsm-daemon; then
- LEcho red "[x] MCSManager 守护进程启动失败, 无法继续进行下一步, 退回操作中..." "[x] MCSManager installation failed, unable to continue to the next step, returning to operation..." && Revert
- else
- systemctl stop mcsm-daemon
- fi
-
- LEcho green "[√] MCSManager 安装完毕" "[√] MCSManager installation completed"
-
- sleep 3
- Output
- return
-}
-
-## Create systemd service
-CreateService() {
- # Write systemd service
- echo "
-[Unit]
-Description=MCSManager Daemon
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
-ExecStart=${nodePath}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-daemon.service
-
- echo "
-[Unit]
-Description=MCSManager Web
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/web
-ExecStart=${nodePath}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-web.service
-
- # Enable systemd service
- systemctl daemon-reload
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
-
- sleep 3
- return
-}
-
-## Mirgrate data
-MirgrateFiles() {
- # Mirgrate mcsmanager data
- if [ -d "${tmpPath}"/mcsmanager ]; then
- [ ! -d "${mcsmWebDPath}" ] && mv -f "${tmpPath}"/mcsmanager/web/data "${mcsmWebDPath}" || rm -rf ${mcsmWebDPath} && mv -f "${tmpPath}"/mcsmanager/web/data "${mcsmWebDPath}"
- [ ! -d "${mcsmWebDPath}" ] && mv -f "${tmpPath}"/mcsmanager/daemon/data "${mcsmDaemonDPath}" || rm -rf ${mcsmDaemonDPath} && mv -f "${tmpPath}"/mcsmanager/daemon/data "${mcsmDaemonDPath}"
- fi
-
- # Mirgrate old node files
- if [ -d "${tmpPath}"/node ]; then
- mv -f "${tmpPath}"/node "${nodePath}"
- fi
-}
-
-## Output MCSManager information
-Output() {
- printf "\033c"
- LEcho yellow "==================================================================" "=================================================================="
- LEcho green "欢迎使用 MCSManager, 您可以通过以下方式访问: " "Welcome to use MCSManager, you can access it through the following ways:"
- LEcho yellow "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板地址: " "Control panel address: "
- LEcho yellow "http://localhost:23333" "http://localhost:23333"
- LEcho red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。" "If you can't access the panel, please check if the firewall/security group has opened the panel 23333 and 24444 ports. The control panel needs these two ports to work properly."
- LEcho yellow "==================================================================" "=================================================================="
- LEcho cyan "重启 systemctl restart mcsm-{daemon,web}.service" "Restart systemctl restart mcsm-{daemon,web}.service"
- LEcho cyan "禁用 systemctl disable mcsm-{daemon,web}.service" "Disable systemctl disable mcsm-{daemon,web}.service"
- LEcho cyan "启用 systemctl enable mcsm-{daemon,web}.service" "Enable systemctl enable mcsm-{daemon,web}.service"
- LEcho cyan "启动 systemctl start mcsm-{daemon,web}.service" "Start systemctl start mcsm-{daemon,web}.service"
- LEcho cyan "停止 systemctl stop mcsm-{daemon,web}.service" "Stop systemctl stop mcsm-{daemon,web}.service"
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More usage instructions, please refer to: https://docs.mcsmanager.com/"
- LEcho yellow "==================================================================" "=================================================================="
-}
-
-## Main remove function
-Remove() {
- # Stop systemd service
- if [ "$1" != "remove" ]; then
- systemctl stop mcsm-daemson.service
- systemctl stop mcsm-web.service
- systemctl disable mcsm-daemon.service
- systemctl disable mcsm-web.service
- fi
-
- # Remove systemd service
- [ -f /etc/systemd/system/mcsm-daemon.service ] && rm -rf /etc/systemd/system/mcsm-daemon.service
- [ -f /etc/systemd/system/mcsm-daemon.service ] && rm -rf /etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
-
- # Ask if data is retained
- if [ -d "${mcsmDaemonDPath}" ] || [ -d "${mcsmWebDPath}" ]; then
- LEcho yellow "[?] 是否保留数据?" "[?] Do you want to keep the data?"
- read -r -p "[y/N]:" input
- case ${input} in
- [yY][eE][sS] | [yY])
- LEcho echo "[-] 保留数据" "[-] Keep data"
- mv -f "${mcsmDaemonDPath}" "${tmpPath}"/mcsmanager/daemon
- mv -f "${mcsmWebDPath}" "${tmpPath}"/mcsmanager/web
- rm -rf "${mcsmPath}"
- mv -f "${tmpPath}"/mcsmanager "${mcsmPath}.old"
- ;;
- *)
- LEcho echo "[-] 删除数据" "[-] Delete data"
- rm -rf "${mcsmPath}"
- ;;
- esac
- fi
- return
-}
-
-### Other Functions ###
-## Revert Script Operation
-Revert() {
- # Remove new files
- rm -rf "${mcsmPath}"
- rm -rf "${nodePath}"
- rm -rf /etc/systemd/system/mcsm-daemon.service
- rm -rf /etc/systemd/system/mcsm-web.service
-
- # Restore old files
- mv -f "${tmpPath}"/mcsmanager "${mcsmPath}"
- mv -f "${tmpPath}"/node "${nodePath}"
- mv -f "${tmpPath}"/systemd/mcsm-daemon.service /etc/systemd/system/mcsm-daemon.service
- mv -f "${tmpPath}"/systemd/mcsm-web.service /etc/systemd/system/mcsm-web.service
-
- # Re-enable systemd service
- systemctl daemon-reload
- systemctl enable mcsm-daemon.service
- systemctl enable mcsm-web.service
-
- LEcho error "[x] 安装失败" "[x] Installation failed"
-}
-
-## Clean Function
-Clean() {
- rm -rf "${tmpPath}"
- return
-}
-
-### Start ###
-LEcho cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-| Remake By BlueFunny_
-+----------------------------------------------------------------------
-" "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-| Remake By BlueFunny_
-+----------------------------------------------------------------------
-"
-Main "$1" "$2" "$3"
-Clean
-exit 0
diff --git a/setup_en.sh b/setup_en.sh
deleted file mode 100644
index 90f389e..0000000
--- a/setup_en.sh
+++ /dev/null
@@ -1,263 +0,0 @@
-#!/bin/bash
-printf "\033c"
-
-error=""
-node="v14.19.1"
-arch=$(uname -m)
-mcsmanager_install_path="/opt/mcsmanager"
-
-Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
-}
-
-echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
-}
-
-echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
-
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
-
-echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
-}
-
-echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
-}
-
-Install_Node() {
- echo_cyan_n "[+] Install Node environment... "
-
- rm -irf "$node_install_path"
-
- cd /opt || exit
-
- wget -o /dev/null https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
-
- tar -zxf node-"$node"-linux-"$arch".tar.gz
-
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- Red_Error "[x] Node installation failed!"
- fi
-
- echo
- echo_yellow "=============== Node Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node Version ==============="
- echo
-
- sleep 3
-}
-
-Install_MCSManager() {
- echo_cyan "[+] Install MCSManager..."
-
- # delete service
- rm -f /etc/systemd/system/mcsm-daemon.service
- rm -f /etc/systemd/system/mcsm-web.service
-
- # reload
- systemctl daemon-reload
-
- # echo "[x] Delete the original MCSManager"
- rm -irf ${mcsmanager_install_path}
-
- # echo "[+] mkdir -p ${mcsmanager_install_path}"
- mkdir -p ${mcsmanager_install_path} || exit
-
- # echo "[→] cd ${mcsmanager_install_path}"
- cd ${mcsmanager_install_path} || exit
-
- echo_cyan "[↓] Git clone MCSManager-Daemon..."
- git clone --single-branch -b master --depth 1 https://github.com/MCSManager/MCSManager-Daemon-Production.git daemon
-
- # echo "[→] cd daemon"
- cd daemon || exit
-
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
-
- # echo "[←] cd .."
- cd ..
-
- echo_cyan "[↓] Git clone MCSManager-Web..."
- git clone --single-branch -b master --depth 1 https://github.com/MCSManager/MCSManager-Web-Production.git web
-
- # echo "[→] cd web"
- cd web || exit
-
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
-
- echo
- echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
- echo
- echo_green "[+] MCSManager installation success!"
-
- sleep 3
-}
-
-Create_Service() {
- echo_cyan "[+] Create MCSManager service..."
-
- echo "
-[Unit]
-Description=MCSManager Daemon
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-
-[Install]
-WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-daemon.service
-
- echo "
-[Unit]
-Description=MCSManager Web
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/web
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-
-[Install]
-WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-web.service
-
- systemctl daemon-reload
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
-
- sleep 3
-
- printf "\033c"
- echo_yellow "=================================================================="
- echo_green "Welcome to MCSManager, you can access it by the following ways:"
- echo_yellow "=================================================================="
- echo_cyan_n "Daemon Service Address: "; echo_yellow "http://localhost:24444"
- echo_cyan_n "Web Service Address: "; echo_yellow "http://localhost:23333"
- echo_cyan_n "Username: "; echo_yellow "root"
- echo_cyan_n "Password: "; echo_yellow "123456"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow "=================================================================="
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "More info: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
-
-
-}
-
-
-# ----------------- Program Start -----------------
-
-# delete the shell script itself
-rm -f "$0"
-
-# Check execute user permissions
-if [ "$(whoami)" != "root" ]; then
- Red_Error "[x] Please execute the MCSManager installation command with root permission!"
-fi
-
-echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-+----------------------------------------------------------------------
-"
-
-# Environmental inspection
-if [ "$arch" == x86_64 ]; then
- arch=x64
- #echo "[-] x64 architecture detected"
-elif [ $arch == aarch64 ]; then
- arch=arm64
- #echo "[-] 64-bit ARM architecture detected"
-elif [ $arch == arm ]; then
- arch=armv7l
- #echo "[-] 32-bit ARM architecture detected"
-elif [ $arch == ppc64le ]; then
- arch=ppc64le
- #echo "[-] IBM POWER architecture detected"
-elif [ $arch == s390x ]; then
- arch=s390x
- #echo "[-] IBM LinuxONE architecture detected"
-else
- Red_Error "[x] Sorry, this architecture is not supported yet!"
- exit
-fi
-
-# Define the variable Node installation directory
-node_install_path="/opt/node-$node-linux-$arch"
-
-# Check network connection
-echo_cyan "[-] Architecture: $arch"
-
-# MCSManager Installed
-if [ -d "$mcsmanager_install_path" ]; then
- printf "\033c"
- echo_red "----------------------------------------------------
-MCSManager is installed at \"$mcsmanager_install_path\"
-Continuing the installation will delete the original MCSManager!
-----------------------------------------------------
-Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
- sleep 10
-fi
-
-# Install related software
-echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
-elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
-elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
-elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
-fi
-
-# Determine whether the relevant software is installed successfully
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- echo "$error"
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- exit
-fi
-
-
-# Install the Node environment
-Install_Node
-
-# Install MCSManager
-Install_MCSManager
-
-# Create MCSManager background service
-Create_Service
From de2885cfa3e2b6cde81475c813b719b29d068710 Mon Sep 17 00:00:00 2001
From: BlueFunny
Date: Thu, 23 Mar 2023 08:56:21 +0800
Subject: [PATCH 046/460] Add copyright information
---
setup.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/setup.sh b/setup.sh
index dfd530e..9c4e4d3 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,4 +1,10 @@
#!/bin/bash
+
+#### MCSManager Command Line Interface
+#### Made by nuomiaa, CreeperKong, unitwk
+
+#### Copyright © 2023 MCSManager All rights reserved.
+
printf "\033c"
error=""
From fb781f11329b4a4b9320baa8ac4235503dda6ebc Mon Sep 17 00:00:00 2001
From: BlueFunny
Date: Thu, 23 Mar 2023 10:08:22 +0800
Subject: [PATCH 047/460] Complete start/stop management function
---
cli.sh | 373 +++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 258 insertions(+), 115 deletions(-)
diff --git a/cli.sh b/cli.sh
index 7fe12e9..bfd5bff 100644
--- a/cli.sh
+++ b/cli.sh
@@ -1,128 +1,271 @@
-#!/bin/bash
-printf "\033c"
+#!/usr/bin/env bash
-Red_Error() {
- printf '\033[1;31;40m%b\033[0m\n' "$@"
-}
-
-echo "============= MCSManager 命令行 ===============
-(1) 重启面版服务 (8) 重启守护进程
-(2) 停止面版服务 (9) 停止守护进程
-(3) 启动面版服务 (10) 启动守护进程
-(4) 禁用面版服务 (11) 禁用守护进程
-(5) 启用面版服务 (12) 启用守护进程
-(6) 修改管理密码 (13) 清理面版日志
-(7) 卸载管理面版 (14) 全部重启
-(0) 退出
-==============================================="
-
-read -r -p "[-] 请输入命令编号: " cmd;
-
-if [ "$cmd" ] && [ "$cmd" -gt 0 ] && [ "$cmd" -lt 15 ]; then
- echo "==============================================="
- echo "[-] 正在执行($cmd)..."
- echo "==============================================="
-fi
+#### MCSManager Command Line Interface
+#### Made by BlueFunny
-if [ "$cmd" == 1 ]
-then
- systemctl restart mcsm-web.service
-elif [ "$cmd" == 2 ]
-then
- systemctl stop mcsm-web.service
-elif [ "$cmd" == 3 ]
-then
- systemctl start mcsm-web.service
-elif [ "$cmd" == 4 ]
-then
- systemctl disable mcsm-web.service
-elif [ "$cmd" == 5 ]
-then
- systemctl enable mcsm-web.service
-elif [ "$cmd" == 6 ]
-then
- read -r -p "[+] 请输入新密码: " new1;
+#### Copyright © 2023 MCSManager All rights reserved.
- if [ "${#new1}" -lt 6 ]; then
- echo "==============================================="
- echo "[x] 密码长度不能小于 6"
- exit
- fi
+### Variables
+## Files
+mcsmPath="/opt/mcsmanager"
+daemonPath="$mcsmPath/daemon"
+webPath="$mcsmPath/web"
- read -r -p "[+] 请再次输入新密码: " new2;
+## Installed status
+daemonInstalled=0
+webInstalled=0
+status=0
- if [ "$new1" != "$new2" ]; then
- echo "==============================================="
- echo "[x] 两次输入的密码不一致"
- exit
- fi
+## Running status
+daemonRunning=0
+webRunning=0
- echo "[-] 修改 MCSManager-Web root 密码..."
- passWord_old=$(awk -F"\"" '/passWord/{print $4}' /opt/mcsmanager/web/data/User/root.json)
- passWord_new=$(echo -n "$new2" | md5sum | cut -d ' ' -f1)
- sed -e "s@$passWord_old@$passWord_new@g" -i /opt/mcsmanager/web/data/User/root.json
-
- echo "[-] 重启 MCSManager-Web 服务..."
- systemctl restart mcsm-web.service
-
- echo "[+] root 密码已更新!"
-elif [ "$cmd" == 7 ]
-then
- Red_Error "[!] 卸载后无法找回数据,请先备份必要数据!"
- read -r -p "[-] 确认已了解以上内容,我确定已备份完成 (输入yes继续卸载): " yes;
- if [ "$yes" != "yes" ]; then
- echo "==============================================="
- echo "已取消!"
- exit
- fi
-
- echo "[-] MCSManager 服务正在运行,停止服务..."
- systemctl stop mcsm-{daemon,web}.service
- systemctl disable mcsm-{daemon,web}.service
-
- echo "[x] 删除 MCSManager 服务"
- rm -f /etc/systemd/system/mcsm-daemon.service
- rm -f /etc/systemd/system/mcsm-web.service
+## Language
+if [ "$(echo "$LANG" | grep "zh_CN")" != "" ]; then
+ zh=1
+else
+ zh=0
+fi
- echo "[-] 重载服务配置文件"
- systemctl daemon-reload
+### Functions
+## Localize echo
+# $1: color
+# $2: zh
+# $3: en
+LEcho() {
+ case $1 in
+ # Red color echo
+ red)
+ [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
+ ;;
+
+ # Green color echo
+ green)
+ [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
+ ;;
+
+ # Cyan color echo
+ cyan)
+ [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
+ ;;
+
+ # Cyan color echo (No line break)
+ cyan_n)
+ [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
+ ;;
+
+ # Yellow color echo
+ yellow)
+ [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
+ [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
+ ;;
+
+ # Red error echo
+ error)
+ Clean
+ echo '================================================='
+ [ "$zh" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
+ [ "$zh" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
+ echo '================================================='
+ exit 1
+ ;;
+
+ # Debug echo
+ debug)
+ [ "$debug" == 1 ] && printf '\033[1;35m%b\033[0m\n' "[DEBUG] $2"
+ ;;
+
+ # No color echo
+ *)
+ [ "$zh" == 1 ] && echo "$2"
+ [ "$zh" == 0 ] && echo "$3"
+ ;;
+ esac
+ return
+}
- echo "[x] 删除 MCSManager 相关文件"
- rm -irf /opt/mcsmanager
+## Check the user is root
+CheckRoot() {
+ if [ "$(whoami)" != "root" ]; then
+ LEcho error "请使用 root 用户执行此命令" "Please run this command as root"
+ fi
+ return
+}
- echo "[x] 删除 MCSManager-命令行 相关文件"
- rm -f /usr/local/bin/mcsm
- rm -f /opt/mcsm.sh
+## Check mcsmanager installtion status
+CheckInstall() {
+ if [ -d "$daemonPath" ]; then
+ daemonInstalled=1
+ fi
+ if [ -d "$webPath" ]; then
+ webInstalled=1
+ fi
+ if [ $daemonInstalled == 1 ] && [ $webInstalled == 0 ] ;then
+ status=1
+ return
+ elif [ $daemonInstalled == 0 ] && [ $webInstalled == 1 ];then
+ status=2
+ return
+ elif [ $daemonInstalled == 1 ] && [ $webInstalled == 1 ];then
+ status=3
+ return
+ fi
+ LEcho error "[x] MCSManager 已损坏, 请尝试使用修复命令修复环境" "[x] MCSManager is broken, please try to use the repair command to repair the environment"
+}
- echo "==============================================="
- echo -e "\033[1;32m卸载完成,感谢使用 MCSManager!\033[0m"
+## Check mcsmanager running status
+CheckRun() {
+ if [ "$(systemctl is-active mcsm-web)" == "active" ];then
+ webRunning=1
+ fi
+ if [ "$(systemctl is-active mcsm-daemon)" == "active" ];then
+ daemonRunning=1
+ fi
+ return
+}
-elif [ "$cmd" == 8 ]
-then
- systemctl restart mcsm-daemon.service
-elif [ "$cmd" == 9 ]
-then
- systemctl stop mcsm-daemon.service
-elif [ "$cmd" == 10 ]
-then
- systemctl start mcsm-daemon.service
-elif [ "$cmd" == 11 ]
-then
- systemctl disable mcsm-daemon.service
-elif [ "$cmd" == 12 ]
-then
- systemctl enable mcsm-daemon.service
-elif [ "$cmd" == 13 ]
-then
- rm -ifr /opt/mcsmanager/web/logs
- mkdir -p /opt/mcsmanager/web/logs
- echo "[-] 已清空日志!"
-elif [ "$cmd" == 14 ]
-then
- systemctl restart mcsm-{daemon,web}.service
-else
- echo "==============================================="
- echo "[-] 已取消"
-fi
+## Check
+CheckMCSM() {
+ CheckInstall
+ CheckRun
+}
+## GUI
+GUI() {
+ LEcho yellow "===============================================" "==============================================="
+ LEcho cyan "MCSManager 命令行 v 1.0 " "MCSManager Command Line Interface v 1.0 "
+ LEcho yellow "===============================================" "==============================================="
+ LEcho cyan_n "(1) 启停管理" "(1) Start/Stop Control"
+ LEcho cyan "(2) 修改管理面板用户名" "(2) Modify the management panel username"
+ LEcho cyan "(3) 修改管理面板密码" "(3) Modify the management panel password"
+ LEcho cyan "(4) 修复 MCSManager" "(4) Repair MCSManager"
+ LEcho cyan "(5) 检查 MCSManager 更新" "(5) Check MCSManager update"
+ LEcho cyan "(6) 清理 MCSManager 日志" "(6) Clean MCSManager log"
+ LEcho cyan "(7) 退出" "(7) Exit"
+ LEcho yellow "===============================================" "==============================================="
+ LEcho cyan_n "请输入选项: " "Please enter an option: "
+ read -r option
+ case $option in
+ 1)
+ StartStop
+ ;;
+ 2)
+ ChangeUsername
+ ;;
+ 3)
+ ChangePassword
+ ;;
+ 4)
+ Repair
+ ;;
+ 5)
+ CheckUpdate
+ ;;
+ 6)
+ CleanLog
+ ;;
+ 7)
+ exit 0
+ ;;
+ *)
+ LEcho error "[x] 无效的选项, 请纠正输入" "[x] Invalid option, please correct the input"
+ ;;
+ esac
+ LEcho error "[x] 未知错误, 请尝试使用修复命令修复环境" "[x] Unknown error, please try to use the repair command to repair the environment"
+}
+## Start/Stop control
+StartStop() {
+ LEcho yellow "===============================================" "==============================================="
+ [ $status = 1 ] && LEcho cyan_n "当前 MCSManager 控制面板状态:" "Current MCSManager web panel status:"
+ [ $webRunning = 0 ] && LEcho red " 已停止" " Stopped"
+ [ $webRunning = 1 ] && LEcho green " 正在运行中" " Running"
+ [ $status = 2 ] && LEcho cyan_n "当前 MCSManager 守护程序状态:" "Current MCSManager daemon status:"
+ [ $daemonRunning = 0 ] && LEcho red " 已停止" " Stopped"
+ [ $daemonRunning = 1 ] && LEcho green " 正在运行中" " Running"
+ LEcho yellow "===============================================" "==============================================="
+ LEcho cyan_n "(1) 启动/重启" "(1) Start / Restart"
+ [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
+ [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
+ [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
+ LEcho cyan_n "(2) 停止" "(2) Stop"
+ [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
+ [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
+ [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
+ LEcho cyan "(3) 启用" "(3) Enable"
+ [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
+ [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
+ [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
+ LEcho cyan "(4) 禁用" "(4) Disable"
+ [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
+ [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
+ [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
+ LEcho cyan "(5) 返回" "(4) Back"
+ LEcho yellow "===============================================" "==============================================="
+ LEcho cyan_n "请输入选项: " "Please enter an option: "
+ read -r option
+ case $option in
+ 1)
+ if [ "$status" = 1 ]; then
+ systemctl restart mcsm-web || LEcho error "[x] 控制面板启动失败" "[x] Web panel start failed"
+ elif [ "$status" = 2 ]; then
+ systemctl restart mcsm-daemon || LEcho error "[x] 守护程序启动失败" "[x] Daemon start failed"
+ elif [ "$status" = 3 ]; then
+ systemctl restart mcsm-web || LEcho error "[x] 控制面板 & 守护程序启动失败" "[x] Web panel & daemon start failed"
+ systemctl start mcsm-daemon || LEcho error "[x] 控制面板 & 守护程序启动失败" "[x] Web panel & daemon start failed"
+ fi
+ LEcho green "[√] 启动成功" "[√] Start successfully"
+ sleep 3
+ StartStop
+ ;;
+ 2)
+ if [ "$status" = 1 ]; then
+ systemctl stop mcsm-web || LEcho error "[x] 控制面板停止失败" "[x] Web panel stop failed"
+ elif [ "$status" = 2 ]; then
+ systemctl stop mcsm-daemon || LEcho error "[x] 守护程序停止失败" "[x] Daemon stop failed"
+ elif [ "$status" = 3 ]; then
+ systemctl stop mcsm-web || LEcho error "[x] 控制面板 & 守护程序停止失败" "[x] Web panel & daemon stop failed"
+ systemctl stop mcsm-daemon || LEcho error "[x] 控制面板 & 守护程序停止失败" "[x] Web panel & daemon stop failed"
+ fi
+ LEcho green "[√] 停止成功" "[√] Stop successfully"
+ sleep 3
+ StartStop
+ ;;
+ 3)
+ if [ "$status" = 1 ]; then
+ systemctl enable mcsm-web || LEcho error "[x] 控制面板启用失败" "[x] Web panel enable failed"
+ elif [ "$status" = 2 ]; then
+ systemctl enable mcsm-daemon || LEcho error "[x] 守护程序启用失败" "[x] Daemon enable failed"
+ elif [ "$status" = 3 ]; then
+ systemctl enable mcsm-web || LEcho error "[x] 控制面板 & 守护程序启用失败" "[x] Web panel & daemon enable failed"
+ systemctl enable mcsm-daemon || LEcho error "[x] 控制面板 & 守护程序启用失败" "[x] Web panel & daemon enable failed"
+ fi
+ LEcho green "[√] 启用成功" "[√] Enable successfully"
+ sleep 3
+ StartStop
+ ;;
+ 4)
+ if [ "$status" = 1 ]; then
+ systemctl disable mcsm-web || LEcho error "[x] 控制面板禁用失败" "[x] Web panel disable failed"
+ elif [ "$status" = 2 ]; then
+ systemctl disable mcsm-daemon || LEcho error "[x] 守护程序禁用失败" "[x] Daemon disable failed"
+ elif [ "$status" = 3 ]; then
+ systemctl disable mcsm-web && systemctl disable mcsm-daemon || LEcho error "[x] 控制面板 & 守护程序禁用失败" "[x] Web panel & daemon disable failed"
+ fi
+ LEcho green "[√] 禁用成功" "[√] Disable successfully"
+ sleep 3
+ StartStop
+ ;;
+ 5)
+ GUI
+ ;;
+ *)
+ LEcho error "[x] 无效的选项, 请纠正输入" "[x] Invalid option, please correct the input"
+ ;;
+ esac
+ LEcho error "[x] 未知错误, 请尝试使用修复命令修复环境" "[x] Unknown error, please try to use the repair command to repair the environment"
+}
\ No newline at end of file
From 36a83b6c10f2d93b2698b514626dd3019bb61f4e Mon Sep 17 00:00:00 2001
From: BlueFunny
Date: Thu, 23 Mar 2023 10:09:07 +0800
Subject: [PATCH 048/460] Complete start/stop management function
---
cli.sh | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/cli.sh b/cli.sh
index bfd5bff..83af320 100644
--- a/cli.sh
+++ b/cli.sh
@@ -74,11 +74,6 @@ LEcho() {
exit 1
;;
- # Debug echo
- debug)
- [ "$debug" == 1 ] && printf '\033[1;35m%b\033[0m\n' "[DEBUG] $2"
- ;;
-
# No color echo
*)
[ "$zh" == 1 ] && echo "$2"
@@ -254,7 +249,8 @@ StartStop() {
elif [ "$status" = 2 ]; then
systemctl disable mcsm-daemon || LEcho error "[x] 守护程序禁用失败" "[x] Daemon disable failed"
elif [ "$status" = 3 ]; then
- systemctl disable mcsm-web && systemctl disable mcsm-daemon || LEcho error "[x] 控制面板 & 守护程序禁用失败" "[x] Web panel & daemon disable failed"
+ systemctl disable mcsm-web || LEcho error "[x] 控制面板 & 守护程序禁用失败" "[x] Web panel & daemon disable failed"
+ systemctl disable mcsm-daemon || LEcho error "[x] 控制面板 & 守护程序禁用失败" "[x] Web panel & daemon disable failed"
fi
LEcho green "[√] 禁用成功" "[√] Disable successfully"
sleep 3
From e70a839d1c5a22806a782a7e851f03b3963f76f0 Mon Sep 17 00:00:00 2001
From: BlueFunny
Date: Thu, 23 Mar 2023 10:23:49 +0800
Subject: [PATCH 049/460] Delete the password change function (this function is
not available at this stage)
---
cli.sh | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/cli.sh b/cli.sh
index 83af320..e0b3f24 100644
--- a/cli.sh
+++ b/cli.sh
@@ -135,12 +135,10 @@ GUI() {
LEcho cyan "MCSManager 命令行 v 1.0 " "MCSManager Command Line Interface v 1.0 "
LEcho yellow "===============================================" "==============================================="
LEcho cyan_n "(1) 启停管理" "(1) Start/Stop Control"
- LEcho cyan "(2) 修改管理面板用户名" "(2) Modify the management panel username"
- LEcho cyan "(3) 修改管理面板密码" "(3) Modify the management panel password"
- LEcho cyan "(4) 修复 MCSManager" "(4) Repair MCSManager"
- LEcho cyan "(5) 检查 MCSManager 更新" "(5) Check MCSManager update"
- LEcho cyan "(6) 清理 MCSManager 日志" "(6) Clean MCSManager log"
- LEcho cyan "(7) 退出" "(7) Exit"
+ LEcho cyan "(2) 修复 MCSManager" "(2) Repair MCSManager"
+ LEcho cyan "(3) 检查 MCSManager 更新" "(3) Check MCSManager update"
+ LEcho cyan "(4) 清理 MCSManager 日志" "(4) Clean MCSManager log"
+ LEcho cyan "(5) 退出" "(5) Exit"
LEcho yellow "===============================================" "==============================================="
LEcho cyan_n "请输入选项: " "Please enter an option: "
read -r option
@@ -149,21 +147,15 @@ GUI() {
StartStop
;;
2)
- ChangeUsername
- ;;
- 3)
- ChangePassword
- ;;
- 4)
Repair
;;
- 5)
+ 3)
CheckUpdate
;;
- 6)
+ 4)
CleanLog
;;
- 7)
+ 5)
exit 0
;;
*)
@@ -264,4 +256,6 @@ StartStop() {
;;
esac
LEcho error "[x] 未知错误, 请尝试使用修复命令修复环境" "[x] Unknown error, please try to use the repair command to repair the environment"
-}
\ No newline at end of file
+}
+
+ChangeUsername
\ No newline at end of file
From f4825cb50cd8ba65499a980b2d2face71c0914c1 Mon Sep 17 00:00:00 2001
From: BlueFunny
Date: Thu, 23 Mar 2023 10:25:07 +0800
Subject: [PATCH 050/460] Fix a hint problem
---
cli.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/cli.sh b/cli.sh
index e0b3f24..3a73444 100644
--- a/cli.sh
+++ b/cli.sh
@@ -86,7 +86,7 @@ LEcho() {
## Check the user is root
CheckRoot() {
if [ "$(whoami)" != "root" ]; then
- LEcho error "请使用 root 用户执行此命令" "Please run this command as root"
+ LEcho error "[x] 请使用 root 用户执行此命令" "[x] Please run this command as root"
fi
return
}
@@ -258,4 +258,3 @@ StartStop() {
LEcho error "[x] 未知错误, 请尝试使用修复命令修复环境" "[x] Unknown error, please try to use the repair command to repair the environment"
}
-ChangeUsername
\ No newline at end of file
From 3d6f405d6c7bf554049f7a99ed832b8c58eff988 Mon Sep 17 00:00:00 2001
From: BlueFunny
Date: Thu, 23 Mar 2023 11:04:18 +0800
Subject: [PATCH 051/460] Add the function of passing reference to run
---
cli.sh | 115 +++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 74 insertions(+), 41 deletions(-)
diff --git a/cli.sh b/cli.sh
index 3a73444..16db14d 100644
--- a/cli.sh
+++ b/cli.sh
@@ -83,6 +83,15 @@ LEcho() {
return
}
+Check() {
+ if [ "$1" != 2 ];then
+ CheckRoot
+ CheckInstall
+ CheckRun
+ fi
+ CheckArgs "$1"
+}
+
## Check the user is root
CheckRoot() {
if [ "$(whoami)" != "root" ]; then
@@ -91,6 +100,29 @@ CheckRoot() {
return
}
+## Check command args
+CheckArgs() {
+ case "${1}" in
+ 2)
+ Repair
+ ;;
+ 3)
+ CheckUpdate
+ ;;
+ 4)
+ CleanLog
+ ;;
+ 11 | 12 | 13 | 14)
+ StartStop "$1"
+ ;;
+ *)
+ LEcho error "[x] 无效的参数, 请纠正输入" "[x] Invalid parameter, please correct the input"
+ ;;
+ esac
+
+ return
+}
+
## Check mcsmanager installtion status
CheckInstall() {
if [ -d "$daemonPath" ]; then
@@ -123,12 +155,6 @@ CheckRun() {
return
}
-## Check
-CheckMCSM() {
- CheckInstall
- CheckRun
-}
-
## GUI
GUI() {
LEcho yellow "===============================================" "==============================================="
@@ -144,7 +170,7 @@ GUI() {
read -r option
case $option in
1)
- StartStop
+ StartStop $1
;;
2)
Repair
@@ -167,36 +193,40 @@ GUI() {
## Start/Stop control
StartStop() {
- LEcho yellow "===============================================" "==============================================="
- [ $status = 1 ] && LEcho cyan_n "当前 MCSManager 控制面板状态:" "Current MCSManager web panel status:"
- [ $webRunning = 0 ] && LEcho red " 已停止" " Stopped"
- [ $webRunning = 1 ] && LEcho green " 正在运行中" " Running"
- [ $status = 2 ] && LEcho cyan_n "当前 MCSManager 守护程序状态:" "Current MCSManager daemon status:"
- [ $daemonRunning = 0 ] && LEcho red " 已停止" " Stopped"
- [ $daemonRunning = 1 ] && LEcho green " 正在运行中" " Running"
- LEcho yellow "===============================================" "==============================================="
- LEcho cyan_n "(1) 启动/重启" "(1) Start / Restart"
- [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
- [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
- [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
- LEcho cyan_n "(2) 停止" "(2) Stop"
- [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
- [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
- [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
- LEcho cyan "(3) 启用" "(3) Enable"
- [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
- [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
- [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
- LEcho cyan "(4) 禁用" "(4) Disable"
- [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
- [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
- [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
- LEcho cyan "(5) 返回" "(4) Back"
- LEcho yellow "===============================================" "==============================================="
- LEcho cyan_n "请输入选项: " "Please enter an option: "
- read -r option
+ if [ "$1" != "" ];then
+ option=$1
+ else
+ LEcho yellow "===============================================" "==============================================="
+ [ $status = 1 ] && LEcho cyan_n "当前 MCSManager 控制面板状态:" "Current MCSManager web panel status:"
+ [ $webRunning = 0 ] && LEcho red " 已停止" " Stopped"
+ [ $webRunning = 1 ] && LEcho green " 正在运行中" " Running"
+ [ $status = 2 ] && LEcho cyan_n "当前 MCSManager 守护程序状态:" "Current MCSManager daemon status:"
+ [ $daemonRunning = 0 ] && LEcho red " 已停止" " Stopped"
+ [ $daemonRunning = 1 ] && LEcho green " 正在运行中" " Running"
+ LEcho yellow "===============================================" "==============================================="
+ LEcho cyan_n "(11) 启动/重启" "(11) Start / Restart"
+ [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
+ [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
+ [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
+ LEcho cyan_n "(12) 停止" "(12) Stop"
+ [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
+ [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
+ [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
+ LEcho cyan "(13) 启用" "(13) Enable"
+ [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
+ [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
+ [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
+ LEcho cyan "(14) 禁用" "(14) Disable"
+ [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
+ [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
+ [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
+ LEcho cyan "(15) 返回" "(15) Back"
+ LEcho yellow "===============================================" "==============================================="
+ LEcho cyan_n "请输入选项: " "Please enter an option: "
+ read -r option
+ fi
case $option in
- 1)
+ 11)
if [ "$status" = 1 ]; then
systemctl restart mcsm-web || LEcho error "[x] 控制面板启动失败" "[x] Web panel start failed"
elif [ "$status" = 2 ]; then
@@ -209,7 +239,7 @@ StartStop() {
sleep 3
StartStop
;;
- 2)
+ 12)
if [ "$status" = 1 ]; then
systemctl stop mcsm-web || LEcho error "[x] 控制面板停止失败" "[x] Web panel stop failed"
elif [ "$status" = 2 ]; then
@@ -222,7 +252,7 @@ StartStop() {
sleep 3
StartStop
;;
- 3)
+ 13)
if [ "$status" = 1 ]; then
systemctl enable mcsm-web || LEcho error "[x] 控制面板启用失败" "[x] Web panel enable failed"
elif [ "$status" = 2 ]; then
@@ -235,7 +265,7 @@ StartStop() {
sleep 3
StartStop
;;
- 4)
+ 14)
if [ "$status" = 1 ]; then
systemctl disable mcsm-web || LEcho error "[x] 控制面板禁用失败" "[x] Web panel disable failed"
elif [ "$status" = 2 ]; then
@@ -248,8 +278,8 @@ StartStop() {
sleep 3
StartStop
;;
- 5)
- GUI
+ 15)
+ GUI "$1"
;;
*)
LEcho error "[x] 无效的选项, 请纠正输入" "[x] Invalid option, please correct the input"
@@ -258,3 +288,6 @@ StartStop() {
LEcho error "[x] 未知错误, 请尝试使用修复命令修复环境" "[x] Unknown error, please try to use the repair command to repair the environment"
}
+### Start
+Check "$1"
+GUI "$1"
\ No newline at end of file
From 167aad2615de731a1080dc27723d67ee151ed98c Mon Sep 17 00:00:00 2001
From: BlueFunny
Date: Thu, 23 Mar 2023 11:13:58 +0800
Subject: [PATCH 052/460] Updadte
---
.gitignore | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.gitignore b/.gitignore
index 9067b5d..6741c00 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,6 @@ bin-release/
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
# should NOT be excluded as they contain compiler settings and other important
# information for Eclipse / Flash Builder.
+
+# Remove old cli sh
+cli_old.sh
From 5c8bc7e63f0091a9e584b72d8c9906eab96a6bda Mon Sep 17 00:00:00 2001
From: BlueFunny
Date: Thu, 23 Mar 2023 11:14:27 +0800
Subject: [PATCH 053/460] Move CLI file location (for later installer download)
---
cli.sh => tools/cli.sh | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename cli.sh => tools/cli.sh (100%)
diff --git a/cli.sh b/tools/cli.sh
similarity index 100%
rename from cli.sh
rename to tools/cli.sh
From 0fcfecabf4bba53da7ab5b088a7b65fa35c95cc8 Mon Sep 17 00:00:00 2001
From: BlueFunny
Date: Thu, 23 Mar 2023 11:18:13 +0800
Subject: [PATCH 054/460] Deprecated
---
setup_cn.sh | 8 --------
1 file changed, 8 deletions(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index c7d7b58..b677b9e 100644
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -42,9 +42,6 @@ else
zh=0
fi
-## Debug
-debug=0
-
## Other
cn=0
@@ -95,11 +92,6 @@ LEcho() {
exit 1
;;
- # Debug echo
- debug)
- [ "$debug" == 1 ] && printf '\033[1;35m%b\033[0m\n' "[DEBUG] $2"
- ;;
-
# No color echo
*)
[ "$zh" == 1 ] && echo "$2"
From f7502385f82cc07303211a090f973a7c7e1a9f99 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Mon, 24 Apr 2023 14:37:07 +0800
Subject: [PATCH 055/460] Remove the ability to detect local node
---
setup_cn.sh | 68 +++++++++++++++++++++++++++--------------------------
1 file changed, 35 insertions(+), 33 deletions(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index b677b9e..a850760 100644
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -183,20 +183,21 @@ CheckOS() {
apt-get install -y curl git wget jq
elif [ "$os" == "redhat" ]; then
yum install -y epel-release
+ yum update
yum install -y curl git wget jq
fi
return
}
## Detect nodejs version
-CheckNode() {
- if command -v node > /dev/null; then
- if [ "$(node -v | cut -c2- | awk -F. '{print $1}')" -ge 14 ]; then
- return 0
- fi
- fi
- return 1
-}
+# CheckNode() {
+# if command -v node > /dev/null; then
+# if [ "$(node -v | cut -c2- | awk -F. '{print $1}')" -ge 14 ]; then
+# return 0
+# fi
+# fi
+# return 1
+# }
## Install MCSManager
Install() {
@@ -207,32 +208,33 @@ Install() {
mkdir -p $tmpDir
# Install nodejs
- if ! CheckNode;then
- LEcho cyan "[*] 正在安装 Node.js" "[*] Installing Node.js"
- # Download nodejs files
- nodeFileURL="$nodeBaseURL/$nodeVer/node-$nodeVer-linux-$arch.tar.gz"
- nodeHashURL="$nodeBaseURL/$nodeVer/SHASUMS256.txt"
- wget -q --no-check-certificate -O $tmpDir/node.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
- wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
-
- # Check nodejs files
- if [ "$(sha256sum $tmpDir/node.tar.gz | cut -d ' ' -f 1)" != "$(grep "node-$nodeVer-linux-$arch.tar.gz" $tmpDir/node.sha256 | cut -d ' ' -f 1)" ]; then
- LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
- fi
-
- # Install nodejs
- [ -d $nodePath ] && rm -rf $nodePath
- mkdir -p $nodePath
- tar -xzf "$tmpDir/node.tar.gz" -C $nodePath --strip-components=1
-
- if ! command -v $nodeBin ; then
- LEcho error "[x] Node.js 安装失败, 请重试" "[x] Node.js installation failed, please try again"
- fi
- else
- LEcho cyan "[-] 检测到已安装 Node.js, 跳过安装" "[-] Detected installed Node.js, skip installation"
- nodeBin="$(which node)"
- npmBin="$(which npm)"
+ # if ! CheckNode;then
+ LEcho cyan "[*] 正在安装 Node.js" "[*] Installing Node.js"
+ # Download nodejs files
+ nodeFileURL="$nodeBaseURL/$nodeVer/node-$nodeVer-linux-$arch.tar.gz"
+ nodeHashURL="$nodeBaseURL/$nodeVer/SHASUMS256.txt"
+ wget -q --no-check-certificate -O $tmpDir/node.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
+ wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
+
+ # Check nodejs files
+ if [ "$(sha256sum $tmpDir/node.tar.gz | cut -d ' ' -f 1)" != "$(grep "node-$nodeVer-linux-$arch.tar.gz" $tmpDir/node.sha256 | cut -d ' ' -f 1)" ]; then
+ LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
+ fi
+
+ # Install nodejs
+ [ -d $nodePath ] && rm -rf $nodePath
+ mkdir -p $nodePath
+ tar -xzf "$tmpDir/node.tar.gz" -C $nodePath --strip-components=1
+
+ if ! command -v $nodeBin ; then
+ LEcho error "[x] Node.js 安装失败, 请重试" "[x] Node.js installation failed, please try again"
fi
+ # else
+ # LEcho cyan "[-] 检测到已安装 Node.js, 跳过安装" "[-] Detected installed Node.js, skip installation"
+ # nodeBin="$(which node)"
+ # npmBin="$(which npm)"
+ # fi
+
LEcho yellow "===============================================" "==============================================="
LEcho cyan "Node.js 版本: $($nodeBin --version)" "Node.js version: $($nodeBin --version)"
From f5aa6de1372f7168de921963d5c8e388fee1cd0a Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Mon, 24 Apr 2023 14:50:24 +0800
Subject: [PATCH 056/460] Modify mirror source priority
---
setup_cn.sh | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index a850760..4abb2b1 100644
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -29,11 +29,11 @@ mode="install"
## URLs
# Node.js
-nodeBaseURL="https://nodejs.org/dist"
+nodeBaseURL="https://npmmirror.com/mirrors/node"
# MCSManager
-daemonURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
-webURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
+daemonURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
+webURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
## Language
if [ "$(echo "$LANG" | grep "zh_CN")" != "" ]; then
@@ -44,6 +44,7 @@ fi
## Other
cn=0
+mirror=0
### Functions
## Localize echo
@@ -118,11 +119,13 @@ CheckRoot() {
CheckCN() {
LEcho cyan "[*] 正在检查服务器地理位置" "[*] Checking server location"
server_ip=$(curl -s ifconfig.me)
- if [[ "$(curl -s "http://ip-api.com/json/${server_ip}?fields=countryCode" | jq -r '.countryCode')" == "CN" ]]; then
- LEcho yellow "[!] 根据 'ip-api.com' 提供的信息, 当前服务器可能在中国, 已自动切换为中国镜像源" "[!] According to the information provided by 'ipapi.co', the current server IP may be in China, and the Chinese mirror source has been automatically switched"
- daemonURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
- webURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
- nodeBaseURL="https://npmmirror.com/mirrors/node"
+ [ "$(curl -s --connect-timeout 10 "http://ip-api.com/json/${server_ip}?fields=countryCode" | jq -r '.countryCode')" != "CN" ] && mirror=0
+ [ "$(curl -s --connect-timeout 10 "https://ipapi.co/${server_ip}/country_code/" | grep "CN")" == "" ] && mirror=0
+ if [ "$mirror" == "0" ]; then
+ LEcho yellow "[!] 根据 API 提供的信息, 当前服务器可能在国外, 已自动切换为 GitHub 源" "[!] According to the information provided by the API, the current server may be outside China, and the GitHub source has been automatically switched"
+ daemonURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
+ webURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
+ nodeBaseURL="https://nodejs.org/dist"
cn=1
fi
return
From b639d28bbcca03f30fc621833bbcb209bbd95a25 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Mon, 24 Apr 2023 14:59:25 +0800
Subject: [PATCH 057/460] Sync fork
---
setup_en.sh | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 264 insertions(+)
create mode 100644 setup_en.sh
diff --git a/setup_en.sh b/setup_en.sh
new file mode 100644
index 0000000..7f7dc35
--- /dev/null
+++ b/setup_en.sh
@@ -0,0 +1,264 @@
+#!/bin/bash
+printf "\033c"
+
+error=""
+node="v14.19.1"
+arch=$(uname -m)
+mcsmanager_install_path="/opt/mcsmanager"
+
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
+
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
+
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
+
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
+
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
+
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
+}
+
+Install_Node() {
+ echo_cyan_n "[+] Install Node environment... "
+
+ rm -irf "$node_install_path"
+
+ cd /opt || exit
+
+ wget -o /dev/null https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
+
+ tar -zxf node-"$node"-linux-"$arch".tar.gz
+
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
+ if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ Red_Error "[x] Node installation failed!"
+ fi
+
+ echo
+ echo_yellow "=============== Node Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node Version ==============="
+ echo
+
+ sleep 3
+}
+
+Install_MCSManager() {
+ echo_cyan "[+] Install MCSManager..."
+
+ # delete service
+ rm -f /etc/systemd/system/mcsm-daemon.service
+ rm -f /etc/systemd/system/mcsm-web.service
+
+ # reload
+ systemctl daemon-reload
+
+ # echo "[x] Delete the original MCSManager"
+ rm -irf ${mcsmanager_install_path}
+
+ # echo "[+] mkdir -p ${mcsmanager_install_path}"
+ mkdir -p ${mcsmanager_install_path} || exit
+
+ # echo "[→] cd ${mcsmanager_install_path}"
+ cd ${mcsmanager_install_path} || exit
+
+ echo_cyan "[↓] Git clone MCSManager-Daemon..."
+ git clone --single-branch -b master --depth 1 https://github.com/MCSManager/MCSManager-Daemon-Production.git daemon
+
+ # echo "[→] cd daemon"
+ cd daemon || exit
+
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
+
+ # echo "[←] cd .."
+ cd ..
+
+ echo_cyan "[↓] Git clone MCSManager-Web..."
+ git clone --single-branch -b master --depth 1 https://github.com/MCSManager/MCSManager-Web-Production.git web
+
+ # echo "[→] cd web"
+ cd web || exit
+
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
+
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green " Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ echo_green "[+] MCSManager installation success!"
+
+ sleep 3
+}
+
+Create_Service() {
+ echo_cyan "[+] Create MCSManager service..."
+
+ echo "
+[Unit]
+Description=MCSManager Daemon
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/daemon
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s HUP $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
+[Install]
+WantedBy=multi-user.target
+" > /etc/systemd/system/mcsm-daemon.service
+
+ echo "
+[Unit]
+Description=MCSManager Web
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/web
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s HUP $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
+[Install]
+WantedBy=multi-user.target
+" > /etc/systemd/system/mcsm-web.service
+
+ systemctl daemon-reload
+ systemctl enable mcsm-daemon.service --now
+ systemctl enable mcsm-web.service --now
+
+ sleep 3
+
+ printf "\033c"
+ echo_yellow "=================================================================="
+ echo_green "Welcome to MCSManager, you can access it by the following ways:"
+ echo_yellow "=================================================================="
+ echo_cyan_n "Daemon Service Address: "; echo_yellow "http://localhost:24444"
+ echo_cyan_n "Web Service Address: "; echo_yellow "http://localhost:23333"
+ echo_cyan_n "Username: "; echo_yellow "root"
+ echo_cyan_n "Password: "; echo_yellow "123456"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow "=================================================================="
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "systemctl disable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl enable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "More info: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+
+
+}
+
+
+# ----------------- Program Start -----------------
+
+# delete the shell script itself
+rm -f "$0"
+
+# Check execute user permissions
+if [ "$(whoami)" != "root" ]; then
+ Red_Error "[x] Please execute the MCSManager installation command with root permission!"
+fi
+
+echo_cyan "+----------------------------------------------------------------------
+| MCSManager Installer
++----------------------------------------------------------------------
+| Copyright © 2022 MCSManager All rights reserved.
++----------------------------------------------------------------------
+| Shell Install Script by Nuomiaa & CreeperKong
++----------------------------------------------------------------------
+"
+
+# Environmental inspection
+if [ "$arch" == x86_64 ]; then
+ arch=x64
+ #echo "[-] x64 architecture detected"
+elif [ $arch == aarch64 ]; then
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
+elif [ $arch == arm ]; then
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
+elif [ $arch == ppc64le ]; then
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
+elif [ $arch == s390x ]; then
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
+else
+ Red_Error "[x] Sorry, this architecture is not supported yet!"
+ exit
+fi
+
+# Define the variable Node installation directory
+node_install_path="/opt/node-$node-linux-$arch"
+
+# Check network connection
+echo_cyan "[-] Architecture: $arch"
+
+# MCSManager Installed
+if [ -d "$mcsmanager_install_path" ]; then
+ printf "\033c"
+ echo_red "----------------------------------------------------
+MCSManager is installed at \"$mcsmanager_install_path\"
+Continuing the installation will delete the original MCSManager!
+----------------------------------------------------
+Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
+ sleep 10
+fi
+
+# Install related software
+echo_cyan_n "[+] Installing dependent software(git,tar)... "
+if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
+elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
+elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
+elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
+fi
+
+# Determine whether the relevant software is installed successfully
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ echo "$error"
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
+ exit
+fi
+
+
+# Install the Node environment
+Install_Node
+
+# Install MCSManager
+Install_MCSManager
+
+# Create MCSManager background service
+Create_Service
+
From c93ad48fd97c0f0ef8fb7403b8bbc8734fb68027 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Mon, 24 Apr 2023 15:05:06 +0800
Subject: [PATCH 058/460] Exclude this file for now
---
tools/cli.sh | 293 ---------------------------------------------------
1 file changed, 293 deletions(-)
delete mode 100644 tools/cli.sh
diff --git a/tools/cli.sh b/tools/cli.sh
deleted file mode 100644
index 16db14d..0000000
--- a/tools/cli.sh
+++ /dev/null
@@ -1,293 +0,0 @@
-#!/usr/bin/env bash
-
-#### MCSManager Command Line Interface
-#### Made by BlueFunny
-
-#### Copyright © 2023 MCSManager All rights reserved.
-
-### Variables
-## Files
-mcsmPath="/opt/mcsmanager"
-daemonPath="$mcsmPath/daemon"
-webPath="$mcsmPath/web"
-
-## Installed status
-daemonInstalled=0
-webInstalled=0
-status=0
-
-## Running status
-daemonRunning=0
-webRunning=0
-
-## Language
-if [ "$(echo "$LANG" | grep "zh_CN")" != "" ]; then
- zh=1
-else
- zh=0
-fi
-
-### Functions
-## Localize echo
-# $1: color
-# $2: zh
-# $3: en
-LEcho() {
- case $1 in
- # Red color echo
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
-
- # Green color echo
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
-
- # Cyan color echo
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
-
- # Cyan color echo (No line break)
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
-
- # Yellow color echo
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
-
- # Red error echo
- error)
- Clean
- echo '================================================='
- [ "$zh" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "$zh" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
-
- # No color echo
- *)
- [ "$zh" == 1 ] && echo "$2"
- [ "$zh" == 0 ] && echo "$3"
- ;;
- esac
- return
-}
-
-Check() {
- if [ "$1" != 2 ];then
- CheckRoot
- CheckInstall
- CheckRun
- fi
- CheckArgs "$1"
-}
-
-## Check the user is root
-CheckRoot() {
- if [ "$(whoami)" != "root" ]; then
- LEcho error "[x] 请使用 root 用户执行此命令" "[x] Please run this command as root"
- fi
- return
-}
-
-## Check command args
-CheckArgs() {
- case "${1}" in
- 2)
- Repair
- ;;
- 3)
- CheckUpdate
- ;;
- 4)
- CleanLog
- ;;
- 11 | 12 | 13 | 14)
- StartStop "$1"
- ;;
- *)
- LEcho error "[x] 无效的参数, 请纠正输入" "[x] Invalid parameter, please correct the input"
- ;;
- esac
-
- return
-}
-
-## Check mcsmanager installtion status
-CheckInstall() {
- if [ -d "$daemonPath" ]; then
- daemonInstalled=1
- fi
- if [ -d "$webPath" ]; then
- webInstalled=1
- fi
- if [ $daemonInstalled == 1 ] && [ $webInstalled == 0 ] ;then
- status=1
- return
- elif [ $daemonInstalled == 0 ] && [ $webInstalled == 1 ];then
- status=2
- return
- elif [ $daemonInstalled == 1 ] && [ $webInstalled == 1 ];then
- status=3
- return
- fi
- LEcho error "[x] MCSManager 已损坏, 请尝试使用修复命令修复环境" "[x] MCSManager is broken, please try to use the repair command to repair the environment"
-}
-
-## Check mcsmanager running status
-CheckRun() {
- if [ "$(systemctl is-active mcsm-web)" == "active" ];then
- webRunning=1
- fi
- if [ "$(systemctl is-active mcsm-daemon)" == "active" ];then
- daemonRunning=1
- fi
- return
-}
-
-## GUI
-GUI() {
- LEcho yellow "===============================================" "==============================================="
- LEcho cyan "MCSManager 命令行 v 1.0 " "MCSManager Command Line Interface v 1.0 "
- LEcho yellow "===============================================" "==============================================="
- LEcho cyan_n "(1) 启停管理" "(1) Start/Stop Control"
- LEcho cyan "(2) 修复 MCSManager" "(2) Repair MCSManager"
- LEcho cyan "(3) 检查 MCSManager 更新" "(3) Check MCSManager update"
- LEcho cyan "(4) 清理 MCSManager 日志" "(4) Clean MCSManager log"
- LEcho cyan "(5) 退出" "(5) Exit"
- LEcho yellow "===============================================" "==============================================="
- LEcho cyan_n "请输入选项: " "Please enter an option: "
- read -r option
- case $option in
- 1)
- StartStop $1
- ;;
- 2)
- Repair
- ;;
- 3)
- CheckUpdate
- ;;
- 4)
- CleanLog
- ;;
- 5)
- exit 0
- ;;
- *)
- LEcho error "[x] 无效的选项, 请纠正输入" "[x] Invalid option, please correct the input"
- ;;
- esac
- LEcho error "[x] 未知错误, 请尝试使用修复命令修复环境" "[x] Unknown error, please try to use the repair command to repair the environment"
-}
-
-## Start/Stop control
-StartStop() {
- if [ "$1" != "" ];then
- option=$1
- else
- LEcho yellow "===============================================" "==============================================="
- [ $status = 1 ] && LEcho cyan_n "当前 MCSManager 控制面板状态:" "Current MCSManager web panel status:"
- [ $webRunning = 0 ] && LEcho red " 已停止" " Stopped"
- [ $webRunning = 1 ] && LEcho green " 正在运行中" " Running"
- [ $status = 2 ] && LEcho cyan_n "当前 MCSManager 守护程序状态:" "Current MCSManager daemon status:"
- [ $daemonRunning = 0 ] && LEcho red " 已停止" " Stopped"
- [ $daemonRunning = 1 ] && LEcho green " 正在运行中" " Running"
- LEcho yellow "===============================================" "==============================================="
- LEcho cyan_n "(11) 启动/重启" "(11) Start / Restart"
- [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
- [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
- [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
- LEcho cyan_n "(12) 停止" "(12) Stop"
- [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
- [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
- [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
- LEcho cyan "(13) 启用" "(13) Enable"
- [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
- [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
- [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
- LEcho cyan "(14) 禁用" "(14) Disable"
- [ $status = 1 ] && LEcho cyan "控制面板" "web panel"
- [ $status = 2 ] && LEcho cyan "守护程序" "daemon"
- [ $status = 3 ] && LEcho cyan "控制面板 & 守护程序" "web panel & daemon"
- LEcho cyan "(15) 返回" "(15) Back"
- LEcho yellow "===============================================" "==============================================="
- LEcho cyan_n "请输入选项: " "Please enter an option: "
- read -r option
- fi
- case $option in
- 11)
- if [ "$status" = 1 ]; then
- systemctl restart mcsm-web || LEcho error "[x] 控制面板启动失败" "[x] Web panel start failed"
- elif [ "$status" = 2 ]; then
- systemctl restart mcsm-daemon || LEcho error "[x] 守护程序启动失败" "[x] Daemon start failed"
- elif [ "$status" = 3 ]; then
- systemctl restart mcsm-web || LEcho error "[x] 控制面板 & 守护程序启动失败" "[x] Web panel & daemon start failed"
- systemctl start mcsm-daemon || LEcho error "[x] 控制面板 & 守护程序启动失败" "[x] Web panel & daemon start failed"
- fi
- LEcho green "[√] 启动成功" "[√] Start successfully"
- sleep 3
- StartStop
- ;;
- 12)
- if [ "$status" = 1 ]; then
- systemctl stop mcsm-web || LEcho error "[x] 控制面板停止失败" "[x] Web panel stop failed"
- elif [ "$status" = 2 ]; then
- systemctl stop mcsm-daemon || LEcho error "[x] 守护程序停止失败" "[x] Daemon stop failed"
- elif [ "$status" = 3 ]; then
- systemctl stop mcsm-web || LEcho error "[x] 控制面板 & 守护程序停止失败" "[x] Web panel & daemon stop failed"
- systemctl stop mcsm-daemon || LEcho error "[x] 控制面板 & 守护程序停止失败" "[x] Web panel & daemon stop failed"
- fi
- LEcho green "[√] 停止成功" "[√] Stop successfully"
- sleep 3
- StartStop
- ;;
- 13)
- if [ "$status" = 1 ]; then
- systemctl enable mcsm-web || LEcho error "[x] 控制面板启用失败" "[x] Web panel enable failed"
- elif [ "$status" = 2 ]; then
- systemctl enable mcsm-daemon || LEcho error "[x] 守护程序启用失败" "[x] Daemon enable failed"
- elif [ "$status" = 3 ]; then
- systemctl enable mcsm-web || LEcho error "[x] 控制面板 & 守护程序启用失败" "[x] Web panel & daemon enable failed"
- systemctl enable mcsm-daemon || LEcho error "[x] 控制面板 & 守护程序启用失败" "[x] Web panel & daemon enable failed"
- fi
- LEcho green "[√] 启用成功" "[√] Enable successfully"
- sleep 3
- StartStop
- ;;
- 14)
- if [ "$status" = 1 ]; then
- systemctl disable mcsm-web || LEcho error "[x] 控制面板禁用失败" "[x] Web panel disable failed"
- elif [ "$status" = 2 ]; then
- systemctl disable mcsm-daemon || LEcho error "[x] 守护程序禁用失败" "[x] Daemon disable failed"
- elif [ "$status" = 3 ]; then
- systemctl disable mcsm-web || LEcho error "[x] 控制面板 & 守护程序禁用失败" "[x] Web panel & daemon disable failed"
- systemctl disable mcsm-daemon || LEcho error "[x] 控制面板 & 守护程序禁用失败" "[x] Web panel & daemon disable failed"
- fi
- LEcho green "[√] 禁用成功" "[√] Disable successfully"
- sleep 3
- StartStop
- ;;
- 15)
- GUI "$1"
- ;;
- *)
- LEcho error "[x] 无效的选项, 请纠正输入" "[x] Invalid option, please correct the input"
- ;;
- esac
- LEcho error "[x] 未知错误, 请尝试使用修复命令修复环境" "[x] Unknown error, please try to use the repair command to repair the environment"
-}
-
-### Start
-Check "$1"
-GUI "$1"
\ No newline at end of file
From 563a6e72e526a224ef2b76cbc9600a3d089306dc Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 15 May 2023 14:13:50 +0800
Subject: [PATCH 059/460] Update setup_cn.sh
---
setup_cn.sh | 649 ++++++++++++++++++++++++++--------------------------
1 file changed, 324 insertions(+), 325 deletions(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index 4abb2b1..9c4e4d3 100644
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -1,378 +1,377 @@
-#!/usr/bin/env bash
+#!/bin/bash
-#### MCSManager Installer
-#### Made by BlueFunny
-#### Originally written by nuomiaa, CreeperKong, unitwk
+#### MCSManager Command Line Interface
+#### Made by nuomiaa, CreeperKong, unitwk
#### Copyright © 2023 MCSManager All rights reserved.
-### Variables
-## Files
-# MCSManager
-mcsmPath="/opt/mcsmanager"
-daemonPath="$mcsmPath/daemon"
-webPath="$mcsmPath/web"
+printf "\033c"
-# Node.js
-nodePath="$mcsmPath/node"
-nodeBin="$nodePath/bin/node"
-npmBin="$nodeBin $nodePath/bin/npm"
+error=""
+node="v14.19.1"
+arch=$(uname -m)
+mcsmanager_install_path="/opt/mcsmanager"
+zh=$(
+ [[ $(locale -a) =~ "zh" ]] && echo 1
+ export LANG=zh_CN.UTF-8 || echo 0
+)
-# Junk
-tmpDir="/tmp/mcsmanager"
-
-## Node info
-nodeVer="v16.13.0"
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
-## Install mode
-mode="install"
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
-## URLs
-# Node.js
-nodeBaseURL="https://npmmirror.com/mirrors/node"
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
-# MCSManager
-daemonURL="https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git"
-webURL="https://gitee.com/mcsmanager/MCSManager-Web-Production.git"
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
-## Language
-if [ "$(echo "$LANG" | grep "zh_CN")" != "" ]; then
- zh=1
-else
- zh=0
-fi
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
-## Other
-cn=0
-mirror=0
-
-### Functions
-## Localize echo
-# $1: color
-# $2: zh
-# $3: en
-LEcho() {
- case $1 in
- # Red color echo
- red)
- [ "${zh}" == 1 ] && printf '\033[1;31m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;31m%b\033[0m\n' "$3"
- ;;
-
- # Green color echo
- green)
- [ "${zh}" == 1 ] && printf '\033[1;32m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;32m%b\033[0m\n' "$3"
- ;;
-
- # Cyan color echo
- cyan)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m\n' "$3"
- ;;
-
- # Cyan color echo (No line break)
- cyan_n)
- [ "${zh}" == 1 ] && printf '\033[1;36m%b\033[0m' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;36m%b\033[0m' "$3"
- ;;
-
- # Yellow color echo
- yellow)
- [ "${zh}" == 1 ] && printf '\033[1;33m%b\033[0m\n' "$2"
- [ "${zh}" == 0 ] && printf '\033[1;33m%b\033[0m\n' "$3"
- ;;
-
- # Red error echo
- error)
- Clean
- echo '================================================='
- [ "$zh" == 1 ] && printf '\033[1;31;40m%b\033[0m\n' "$2"
- [ "$zh" == 0 ] && printf '\033[1;31;40m%b\033[0m\n' "$3"
- echo '================================================='
- exit 1
- ;;
-
- # No color echo
- *)
- [ "$zh" == 1 ] && echo "$2"
- [ "$zh" == 0 ] && echo "$3"
- ;;
- esac
- return
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
}
-# Detect old MCSManager
-[ -d $mcsmPath ] && LEcho yellow "[!] 检测到旧版 MCSManager, 切换为更新模式" "[!] Old version of MCSManager detected, switch to update mode"
-[ -d $mcsmPath ] && mode="update"
-[ ! -d $mcsmPath ] && mkdir -p $mcsmPath
+Install_Node() {
+ if [ "$zh" == 1 ]; then
+ echo_cyan_n "[+] 安装 Node 环境... "
+ else
+ echo_cyan_n "[+] Install Node environment... "
+ fi
+
+ rm -irf "$node_install_path"
+
+ cd /opt || exit
-## Check root
-CheckRoot() {
- if [[ $EUID -ne 0 ]]; then
- LEcho error "[!] 请使用 root 用户运行此脚本" "[!] Please run this script as root"
+ wget -o /dev/null https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
+
+ tar -zxf node-"$node"-linux-"$arch".tar.gz
+
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
+ if [ ! -L /usr/bin/node ] && [ ! -f /usr/bin/node ]; then
+ ln -s "$node_install_path"/bin/node /usr/bin/node
fi
- return
-}
+ if [ ! -L /usr/bin/npm ] && [ ! -f /usr/bin/npm ]; then
+ ln -s "$node_install_path"/bin/npm /usr/bin/npm
+ fi
+
+ chmod +x "$node_install_path"/bin/node
+ chmod +x "$node_install_path"/bin/npm
-## Detect server geographic location
-CheckCN() {
- LEcho cyan "[*] 正在检查服务器地理位置" "[*] Checking server location"
- server_ip=$(curl -s ifconfig.me)
- [ "$(curl -s --connect-timeout 10 "http://ip-api.com/json/${server_ip}?fields=countryCode" | jq -r '.countryCode')" != "CN" ] && mirror=0
- [ "$(curl -s --connect-timeout 10 "https://ipapi.co/${server_ip}/country_code/" | grep "CN")" == "" ] && mirror=0
- if [ "$mirror" == "0" ]; then
- LEcho yellow "[!] 根据 API 提供的信息, 当前服务器可能在国外, 已自动切换为 GitHub 源" "[!] According to the information provided by the API, the current server may be outside China, and the GitHub source has been automatically switched"
- daemonURL="https://github.com/mcsmanager/MCSManager-Daemon-Production.git"
- webURL="https://github.com/mcsmanager/MCSManager-Web-Production.git"
- nodeBaseURL="https://nodejs.org/dist"
- cn=1
+ if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]; then
+ if [ "$zh" == 1 ]; then
+ echo_green "成功"
+ else
+ echo_green "Success"
+ fi
+ else
+ if [ "$zh" == 1 ]; then
+ echo_red "失败"
+ Red_Error "[x] Node 安装失败!"
+ else
+ echo_red "Failed"
+ Red_Error "[x] Node installation failed!"
+ fi
fi
- return
-}
-## Detect system architecture
-CheckArch() {
- LEcho cyan "[*] 正在检查系统架构" "[*] Checking system architecture"
- arch=$(uname -m)
- case $arch in
- x86_64)
- arch="x64"
- ;;
- aarch64)
- arch="arm64"
- ;;
- arm)
- arch="armv7l"
- ;;
- ppc64le)
- arch="ppc64le"
- ;;
- s390x)
- arch="s390x"
- ;;
- *)
- LEcho error "[x] MCSManager 暂不支持当前系统架构" "[x] MCSManager does not currently support the current system architecture"
- ;;
- esac
- return
+ echo
+ echo_yellow "=============== Node Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node Version ==============="
+ echo
+
+ sleep 3
}
-## Detect system version
-CheckOS() {
- LEcho cyan "[*] 正在检查系统版本" "[*] Checking system version"
- if [ -f /etc/os-release ]; then
- # shellcheck source=/dev/null
- . /etc/os-release
- case "$ID" in
- debian|ubuntu)
- os="debian"
- ;;
- centos|rhel|fedora)
- os="redhat"
- ;;
- *)
- LEcho error "[x] 本脚本仅支持 Ubuntu/Debian/CentOS 系统!" "[x] This script only supports Ubuntu/Debian/CentOS systems!"
- ;;
- esac
+Install_MCSManager() {
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 安装 MCSManager..."
+ else
+ echo_cyan "[+] Install MCSManager..."
+ fi
+
+ # 删除服务
+ rm -f /etc/systemd/system/mcsm-daemon.service
+ rm -f /etc/systemd/system/mcsm-web.service
+
+ # 重载
+ systemctl daemon-reload
+
+ # echo "[x] Delete the original MCSManager"
+ rm -irf ${mcsmanager_install_path}
+
+ # echo "[+] mkdir -p ${mcsmanager_install_path}"
+ mkdir -p ${mcsmanager_install_path} || exit
+
+ # echo "[→] cd ${mcsmanager_install_path}"
+ cd ${mcsmanager_install_path} || exit
+
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[↓] Git 克隆 MCSManager-Daemon..."
else
- LEcho error "[x] 未能正常检测到系统类型, 无法继续安装" "[x] Unable to detect system type, installation cannot continue"
+ echo_cyan "[↓] Git clone MCSManager-Daemon..."
fi
-
- # Install dependencies
- LEcho cyan "[*] 正在安装安装所需的工具" "[*] Installing the tools required for installation"
- if [ "$os" == "debian" ]; then
- apt-get update
- apt-get install -y curl git wget jq
- elif [ "$os" == "redhat" ]; then
- yum install -y epel-release
- yum update
- yum install -y curl git wget jq
+ git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git daemon
+
+ # echo "[→] cd daemon"
+ cd daemon || exit
+
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 安装 MCSManager-Daemon 依赖库..."
+ else
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
fi
- return
-}
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
-## Detect nodejs version
-# CheckNode() {
-# if command -v node > /dev/null; then
-# if [ "$(node -v | cut -c2- | awk -F. '{print $1}')" -ge 14 ]; then
-# return 0
-# fi
-# fi
-# return 1
-# }
-
-## Install MCSManager
-Install() {
- clear
- LEcho cyan "[-] 开始安装 MCSManager" "[-] Start installing MCSManager"
- # Init work environment
- LEcho cyan "[*] 正在初始化工作环境" "[*] Initializing work environment"
- mkdir -p $tmpDir
-
- # Install nodejs
- # if ! CheckNode;then
- LEcho cyan "[*] 正在安装 Node.js" "[*] Installing Node.js"
- # Download nodejs files
- nodeFileURL="$nodeBaseURL/$nodeVer/node-$nodeVer-linux-$arch.tar.gz"
- nodeHashURL="$nodeBaseURL/$nodeVer/SHASUMS256.txt"
- wget -q --no-check-certificate -O $tmpDir/node.tar.gz "$nodeFileURL" || LEcho error "[x] 下载 Node.js 安装包失败, 请重试" "[x] Download Node.js installation package failed, please try again"
- wget -q --no-check-certificate -O $tmpDir/node.sha256 "$nodeHashURL" || LEcho error "[x] 下载 Node.js 安装包校验文件失败, 请重试" "[x] Download Node.js installation package verification file failed, please try again"
-
- # Check nodejs files
- if [ "$(sha256sum $tmpDir/node.tar.gz | cut -d ' ' -f 1)" != "$(grep "node-$nodeVer-linux-$arch.tar.gz" $tmpDir/node.sha256 | cut -d ' ' -f 1)" ]; then
- LEcho error "[x] Node.js 安装包校验失败, 请重试" "[x] Node.js installation package verification failed, please try again"
+ # echo "[←] cd .."
+ cd ..
+
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[↓] Git 克隆 MCSManager-Web..."
+ else
+ echo_cyan "[↓] Git clone MCSManager-Web..."
fi
-
- # Install nodejs
- [ -d $nodePath ] && rm -rf $nodePath
- mkdir -p $nodePath
- tar -xzf "$tmpDir/node.tar.gz" -C $nodePath --strip-components=1
-
- if ! command -v $nodeBin ; then
- LEcho error "[x] Node.js 安装失败, 请重试" "[x] Node.js installation failed, please try again"
+ git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Web-Production.git web
+
+ # echo "[→] cd web"
+ cd web || exit
+
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 安装 MCSManager-Web 依赖库..."
+ else
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
fi
- # else
- # LEcho cyan "[-] 检测到已安装 Node.js, 跳过安装" "[-] Detected installed Node.js, skip installation"
- # nodeBin="$(which node)"
- # npmBin="$(which npm)"
- # fi
-
-
- LEcho yellow "===============================================" "==============================================="
- LEcho cyan "Node.js 版本: $($nodeBin --version)" "Node.js version: $($nodeBin --version)"
- LEcho cyan "NPM 版本: $($npmBin -v)" "NPM version: $($npmBin -v)"
- LEcho yellow "===============================================" "==============================================="
-
- # Install MCSManager
- if [ $mode == "update" ];then
- LEcho cyan "[*] 正在更新 MCSManager 前端管理面板" "[*] Updating MCSManager web panel"
-
- cd $webPath || LEcho error "[x] 无法进入 MCSManager 前端管理面板目录, 请检查权限" "[x] Unable to enter MCSManager web panel directory, please check permissions"
-
- # Clone MCSManager web panel
- git remote set-url origin $webURL
- git fetch origin
- git checkout master
- git reset --hard origin/master
- git pull
-
- LEcho cyan "[*] 正在更新 MCSManager 守护程序" "[*] Updating MCSManager daemon"
-
- cd $daemonPath || LEcho error "[x] 无法进入 MCSManager 守护程序目录, 请检查权限" "[x] Unable to enter MCSManager daemon directory, please check permissions"
-
- # Clone MCSManager daemon
- git remote set-url origin $daemonURL
- git fetch origin
- git checkout master
- git reset --hard origin/master
- git pull
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
+
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green " Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ if [ "$zh" == 1 ]; then
+ echo_green "[+] MCSManager 安装成功!"
else
- # Clone MCSManager web panel
- LEcho cyan "[*] 正在安装 MCSManager 前端管理面板" "[*] Installing MCSManager web panel"
- git clone --single-branch -b master --depth 1 $webURL $webPath
-
- # Clone MCSManager daemon
- LEcho cyan "[*] 正在安装 MCSManager 守护程序" "[*] Installing MCSManager web panel"
- git clone --single-branch -b master --depth 1 $daemonURL $daemonPath
+ echo_green "[+] MCSManager installation success!"
fi
- # Update dependencies
- LEcho cyan "[*] 正在更新依赖" "[*] Updating dependencies"
- cd $webPath || LEcho error "[x] 无法进入 MCSManager 前端管理目录, 请检查权限" "[x] Unable to enter MCSManager web panel directory, please check permissions"
- [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
- [ $cn == 0 ] && $npmBin install
- cd $daemonPath || LEcho error "[x] 无法进入 MCSManager 守护程序目录, 请检查权限" "[x] Unable to enter MCSManager daemon directory, please check permissions"
- [ $cn == 1 ] && $npmBin install --registry=https://registry.npmmirror.com
- [ $cn == 0 ] && $npmBin install
-
- # Create systemd service
- LEcho cyan "[*] 正在创建 systemd 服务" "[*] Creating systemd service"
-
- webExecStart="\"$nodeBin\" \"$webPath/app.js\""
- daemonExecStart="\"$nodeBin\" \"$daemonPath/app.js\""
- cat > /etc/systemd/system/mcsm-web.service << EOF
+
+ sleep 3
+}
+
+Create_Service() {
+ if [ "$zh" == 1 ]; then
+ echo_cyan "[+] 创建 MCSManager 服务..."
+ else
+ echo_cyan "[+] Create MCSManager service..."
+ fi
+
+ echo "
[Unit]
-Description=MCSManager Web Panel Service
-After=network.target
+Description=MCSManager Daemon
[Service]
-User=root
-WorkingDirectory=$webPath
-ExecStart=$webExecStart
+WorkingDirectory=/opt/mcsmanager/daemon
+ExecStart=${node_install_path}/bin/node app.js
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Environment=\"PATH=${PATH}\"
-Restart=always
[Install]
WantedBy=multi-user.target
-EOF
- cat > /etc/systemd/system/mcsm-daemon.service << EOF
+" >/etc/systemd/system/mcsm-daemon.service
+
+ echo "
[Unit]
-Description=MCSManager Daemon Service
-After=network.target
+Description=MCSManager Web
[Service]
-User=root
-WorkingDirectory=$daemonPath
-ExecStart=$daemonExecStart
+WorkingDirectory=/opt/mcsmanager/web
+ExecStart=${node_install_path}/bin/node app.js
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Environment=\"PATH=${PATH}\"
-Restart=always
[Install]
WantedBy=multi-user.target
-EOF
- # Enable systemd service
- LEcho cyan "[*] 正在启动 MCSManager 服务" "[*] Starting MCSManager services"
+" >/etc/systemd/system/mcsm-web.service
+
+ # 重载
systemctl daemon-reload
- if [ $mode == "update" ];then
- systemctl restart mcsm-web || LEcho error "[x] 无法启动 MCSManager 前端管理面板服务" "[x] Unable to start MCSManager web panel service"
- systemctl restart mcsm-daemon || LEcho error "[x] 无法启动 MCSManager 守护程序服务" "[x] Unable to start MCSManager daemon service"
+
+ # 创建 Daemon 服务
+ systemctl enable mcsm-daemon.service --now
+
+ # 创建 Web 服务
+ systemctl enable mcsm-web.service --now
+
+ sleep 3
+
+ printf "\033c"
+ echo_yellow "=================================================================="
+ if [ "$zh" == 1 ]; then
+ echo_green "欢迎使用 MCSManager,您可以通过以下方式访问:"
+ echo_yellow "=================================================================="
+ echo_cyan_n "控制面板地址: "
+ echo_yellow "http://localhost:23333"
+ echo_red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。"
+ echo_yellow "=================================================================="
+ echo_cyan "重启 systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "禁用 systemctl disable mcsm-{daemon,web}.service"
+ echo_cyan "启用 systemctl enable mcsm-{daemon,web}.service"
+ echo_cyan "启动 systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "停止 systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "更多使用说明,请参考:https://docs.mcsmanager.com/"
else
- systemctl enable mcsm-web --now || LEcho error "[x] 无法启动 MCSManager 前端管理面板服务" "[x] Unable to start MCSManager web panel service"
- systemctl enable mcsm-daemon --now || LEcho error "[x] 无法启动 MCSManager 守护程序服务" "[x] Unable to start MCSManager daemon service"
+ echo_green "Welcome to MCSManager, you can access it by the following ways:"
+ echo_yellow "=================================================================="
+ echo_cyan_n "Web Service Address: "
+ echo_yellow "http://localhost:23333"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow "=================================================================="
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "systemctl disable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl enable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "More info: https://docs.mcsmanager.com/"
fi
-
- # Output login info
- LEcho green "[√] MCSManager 安装完毕" "[√] MCSManager installation completed"
- sleep 3
- clear
- LEcho yellow "==================================================================" "=================================================================="
- LEcho green "欢迎使用 MCSManager, 您可以通过以下方式访问: " "Welcome to MCSManager, you can access it through the following ways:"
- LEcho yellow "==================================================================" "=================================================================="
- LEcho cyan_n "控制面板默认访问地址: " "Control panel default address: "
- LEcho yellow "http://localhost:23333" "http://localhost:23333"
- LEcho red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。" "If you can't access the panel, please check if the firewall/security group has opened the panel 23333 and 24444 ports. The control panel needs these two ports to work properly."
- LEcho yellow "==================================================================" "=================================================================="
- LEcho cyan "启动 MCSM: systemctl start mcsm-{daemon,web}.service" "Start MCSM: systemctl start mcsm-{daemon,web}.service"
- LEcho cyan "重启 MCSM: systemctl restart mcsm-{daemon,web}.service" "Restart MCSM: systemctl restart mcsm-{daemon,web}.service"
- LEcho cyan "停止 MCSM: systemctl stop mcsm-{daemon,web}.service" "Stop MCSM: systemctl stop mcsm-{daemon,web}.service"
- LEcho cyan "启用自启动: systemctl enable mcsm-{daemon,web}.service" "Enable: systemctl enable mcsm-{daemon,web}.service"
- LEcho cyan "禁用自启动: systemctl disable mcsm-{daemon,web}.service" "Disable: systemctl disable mcsm-{daemon,web}.service"
- LEcho cyan "更多使用说明, 请参考: https://docs.mcsmanager.com/" "More usage instructions, please refer to: https://docs.mcsmanager.com/"
- LEcho yellow "==================================================================" "=================================================================="
-
- # Clean up
- rm -rf $tmpDir
- return
-}
+ echo_yellow "=================================================================="
-## Clean up
-Clean() {
- LEcho cyan "[*] 正在清理残余文件" "[*] Cleaning up"
- rm -rf $tmpDir
- [ $mode != "update" ] && rm -rf $mcsmPath
- return
}
-### Start
+# ----------------- 程序启动 -----------------
+
+# 删除 Shell 脚本自身
+rm -f "$0"
+
+# 检查执行用户权限
+if [ "$(whoami)" != "root" ]; then
+ if [ "$zh" == 1 ]; then
+ Red_Error "[x] 请使用 root 权限执行 MCSManager 安装命令!"
+ else
+ Red_Error "[x] Please execute the MCSManager installation command with root permission!"
+ fi
+fi
+
+echo_cyan "+----------------------------------------------------------------------
+| MCSManager Installer
++----------------------------------------------------------------------
+| Copyright © 2022 MCSManager All rights reserved.
++----------------------------------------------------------------------
+| Shell Install Script by Nuomiaa & CreeperKong
++----------------------------------------------------------------------
+"
+
+# 环境检查
+if [ "$arch" == x86_64 ]; then
+ arch=x64
+ #echo "[-] x64 architecture detected"
+elif [ $arch == aarch64 ]; then
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
+elif [ $arch == arm ]; then
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
+elif [ $arch == ppc64le ]; then
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
+elif [ $arch == s390x ]; then
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
+else
+ if [ "$zh" == 1 ]; then
+ Red_Error "[x] 抱歉,暂不支持您的 体系架构($arch)!"
+ else
+ Red_Error "[x] Sorry, this architecture is not supported yet!"
+ fi
+ exit
+fi
+
+# 定义变量 Node 安装目录
+node_install_path="/opt/node-$node-linux-$arch"
+
+# 检查网络连接
+if [ "$zh" == 1 ]; then
+ echo_cyan "[-] 体系架构:$arch"
+else
+ echo_cyan "[-] Architecture: $arch"
+fi
+
+# MCSManager 已安装
+if [ -d "$mcsmanager_install_path" ]; then
+ printf "\033c"
+ if [ "$zh" == 1 ]; then
+ echo_red "----------------------------------------------------
+检查到已有 MCSManager 安装在 \"$mcsmanager_install_path\"
+继续安装会删除原有 MCSManager 面版的所有数据!
+----------------------------------------------------
+将在 10 秒后继续安装,取消请按 Ctrl + Z/C 键!"
+ else
+ echo_red "----------------------------------------------------
+MCSManager is installed at \"$mcsmanager_install_path\"
+Continuing the installation will delete the original MCSManager!
+----------------------------------------------------
+Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
+ fi
+ sleep 10
+fi
+
+# 安装相关软件
+if [ "$zh" == 1 ]; then
+ echo_cyan_n "[-] 安装相关软件(git,tar)... "
+else
+ echo_cyan_n "[+] Installing dependent software(git,tar)... "
+fi
+if [ -x "$(command -v yum)" ]; then
+ yum install -y git tar >error
+elif [ -x "$(command -v apt-get)" ]; then
+ apt-get install -y git tar >error
+elif [ -x "$(command -v pacman)" ]; then
+ pacman -Syu --noconfirm git tar >error
+elif [ -x "$(command -v zypper)" ]; then
+ zypper --non-interactive install git tar >error
+fi
+
+# 判断相关软件是否安装成功
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
+ if [ "$zh" == 1 ]; then
+ echo_green "成功"
+ else
+ echo_green "Success"
+ fi
+else
+ if [ "$zh" == 1 ]; then
+ echo_red "失败"
+ else
+ echo_red "Failed"
+ fi
+ echo "$error"
+ if [ "$zh" == 1 ]; then
+ Red_Error "[x] 相关软件安装失败,请手动安装 git 和 tar 软件包!"
+ else
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
+ fi
+ exit
+fi
+
+# 安装 Node 环境
+Install_Node
+
+# 安装 MCSManager
+Install_MCSManager
-LEcho cyan "[-] 正在检查基础环境, 请稍等" "[-] Checking basic environment, please wait"
-CheckRoot
-CheckArch
-CheckOS
-CheckCN
-Install
-LEcho cyan "[-] 期待与您的下次见面" "[-] Looking forward to seeing you again"
\ No newline at end of file
+# 创建 MCSManager 后台服务
+Create_Service
From 54d90c4e64081812bf286fac2da3cf4d471644db Mon Sep 17 00:00:00 2001
From: unitwk
Date: Wed, 24 May 2023 15:11:28 +0800
Subject: [PATCH 060/460] Update Environment=\"PATH=${PATH}\"
---
setup_en.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup_en.sh b/setup_en.sh
index 7f7dc35..75f229f 100644
--- a/setup_en.sh
+++ b/setup_en.sh
@@ -127,7 +127,7 @@ WorkingDirectory=/opt/mcsmanager/daemon
ExecStart=${node_install_path}/bin/node app.js
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
-Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
@@ -142,7 +142,7 @@ WorkingDirectory=/opt/mcsmanager/web
ExecStart=${node_install_path}/bin/node app.js
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
-Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
From 7083da29eb0367d75629d04d390d5ca93a88da1e Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 15:04:13 +0800
Subject: [PATCH 061/460] Feat: add new script
---
install.sh | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 238 insertions(+)
create mode 100644 install.sh
diff --git a/install.sh b/install.sh
new file mode 100644
index 0000000..8f08881
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,238 @@
+#!/bin/bash
+
+printf "\033c"
+
+echo_cyan "+----------------------------------------------------------------------
+| MCSManager Installer
++----------------------------------------------------------------------
+| Copyright © 2023 MCSManager.
++----------------------------------------------------------------------
+| Contributors: nuomiaa, CreeperKong, unitwk, FunnyShadow
++----------------------------------------------------------------------
+"
+
+error=""
+node="v14.19.1"
+arch=$(uname -m)
+mcsmanager_install_path="/opt/mcsmanager"
+
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
+
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
+
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
+
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
+
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
+
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
+}
+
+Install_Node() {
+ echo_cyan_n "[+] Install Node.JS environment... "
+
+ rm -irf "$node_install_path"
+
+ cd /opt || exit
+
+ wget -o /dev/null https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
+
+ tar -zxf node-"$node"-linux-"$arch".tar.gz
+
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
+ if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ Red_Error "[x] Node installation failed!"
+ fi
+
+ echo
+ echo_yellow "=============== Node Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node Version ==============="
+ echo
+
+ sleep 3
+}
+
+
+Install_MCSManager() {
+ echo_cyan "[+] Install MCSManager..."
+
+ # delete service
+ rm -f /etc/systemd/system/mcsm-daemon.service
+ rm -f /etc/systemd/system/mcsm-web.service
+
+ # stop service
+ systemctl stop mcsm-{web,daemon}
+ mkdir -p ${mcsmanager_install_path} || exit
+
+ # cd /opt/mcsmanager
+ cd ${mcsmanager_install_path} || exit
+
+
+ # donwload MCSManager release
+ wget -o /dev/null https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz
+ tar -zxf mcsmanager_linux_release.tar.gz -o
+
+ # echo "[→] cd daemon"
+ cd daemon || exit
+
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install > error
+
+ # echo "[←] cd .."
+ cd ..
+
+ # echo "[→] cd web"
+ cd web || exit
+
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install > error
+
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green " Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ echo_green "[+] MCSManager installation success!"
+
+ sleep 3
+}
+
+Create_Service() {
+ echo_cyan "[+] Create MCSManager service..."
+
+ echo "
+[Unit]
+Description=MCSManager Daemon
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/daemon
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s QUIT $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" > /etc/systemd/system/mcsm-daemon.service
+
+ echo "
+[Unit]
+Description=MCSManager Web
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/web
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s QUIT $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" > /etc/systemd/system/mcsm-web.service
+
+ systemctl daemon-reload
+ systemctl enable mcsm-daemon.service --now
+ systemctl enable mcsm-web.service --now
+
+ sleep 3
+
+ printf "\n\n"
+
+ echo_yellow "=================================================================="
+ echo_green "Welcome to MCSManager!"
+ echo_yellow "=================================================================="
+ echo_cyan_n "HTTP Service Address: "; echo_yellow "http://localhost:23333"
+ echo_cyan_n "Daemon Address: "; echo_yellow "ws://localhost:24444"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow "=================================================================="
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "systemctl disable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl enable mcsm-{daemon,web}.service"
+ echo_cyan "More info: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+}
+
+
+
+# Environmental inspection
+if [ "$arch" == x86_64 ]; then
+ arch=x64
+ #echo "[-] x64 architecture detected"
+elif [ $arch == aarch64 ]; then
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
+elif [ $arch == arm ]; then
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
+elif [ $arch == ppc64le ]; then
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
+elif [ $arch == s390x ]; then
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
+else
+ Red_Error "[x] Sorry, this architecture is not supported yet!"
+ Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
+ exit
+fi
+
+# Define the variable Node installation directory
+node_install_path="/opt/node-$node-linux-$arch"
+
+# Check network connection
+echo_cyan "[-] Architecture: $arch"
+
+# Install related software
+echo_cyan_n "[+] Installing dependent software(git,tar)... "
+if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
+elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
+elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
+elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
+fi
+
+# Determine whether the relevant software is installed successfully
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ echo "$error"
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
+ exit
+fi
+
+
+# Install the Node environment
+Install_Node
+
+# Install MCSManager
+Install_MCSManager
+
+# Create MCSManager background service
+Create_Service
+
From 23ac575deaa26191f49ef72096736dc51be3441c Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 15:08:23 +0800
Subject: [PATCH 062/460] Fix: print function
---
install.sh | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/install.sh b/install.sh
index 8f08881..ba65ac6 100644
--- a/install.sh
+++ b/install.sh
@@ -2,6 +2,27 @@
printf "\033c"
+# print func
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
+
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
+
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
+
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
+}
+
+# script info
echo_cyan "+----------------------------------------------------------------------
| MCSManager Installer
+----------------------------------------------------------------------
@@ -23,25 +44,6 @@ Red_Error() {
exit 1
}
-echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
-}
-
-echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
-
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
-
-echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
-}
-
-echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
-}
Install_Node() {
echo_cyan_n "[+] Install Node.JS environment... "
From 4519749b47932cf25cd512bb8e874da5da4a83fd Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 15:13:18 +0800
Subject: [PATCH 063/460] Feat: add cn new script
---
install_cn.sh | 240 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 240 insertions(+)
create mode 100644 install_cn.sh
diff --git a/install_cn.sh b/install_cn.sh
new file mode 100644
index 0000000..4fc5aaa
--- /dev/null
+++ b/install_cn.sh
@@ -0,0 +1,240 @@
+#!/bin/bash
+
+printf "\033c"
+
+# print func
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
+
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
+
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
+
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
+}
+
+# script info
+echo_cyan "+----------------------------------------------------------------------
+| MCSManager Installer
++----------------------------------------------------------------------
+| Copyright © 2023 MCSManager.
++----------------------------------------------------------------------
+| Contributors: nuomiaa, CreeperKong, unitwk, FunnyShadow
++----------------------------------------------------------------------
+"
+
+error=""
+node="v14.19.1"
+arch=$(uname -m)
+mcsmanager_install_path="/opt/mcsmanager"
+
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
+
+
+Install_Node() {
+ echo_cyan_n "[+] Install Node.JS environment... "
+
+ rm -irf "$node_install_path"
+
+ cd /opt || exit
+
+ wget -o /dev/null https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
+
+ tar -zxf node-"$node"-linux-"$arch".tar.gz
+
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
+ if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ Red_Error "[x] Node installation failed!"
+ fi
+
+ echo
+ echo_yellow "=============== Node Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node Version ==============="
+ echo
+
+ sleep 3
+}
+
+
+Install_MCSManager() {
+ echo_cyan "[+] Install MCSManager..."
+
+ # delete service
+ rm -f /etc/systemd/system/mcsm-daemon.service
+ rm -f /etc/systemd/system/mcsm-web.service
+
+ # stop service
+ systemctl stop mcsm-{web,daemon}
+ mkdir -p ${mcsmanager_install_path} || exit
+
+ # cd /opt/mcsmanager
+ cd ${mcsmanager_install_path} || exit
+
+
+ # donwload MCSManager release
+ wget -o /dev/null https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz
+ tar -zxf mcsmanager_linux_release.tar.gz -o
+
+ # echo "[→] cd daemon"
+ cd daemon || exit
+
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production> error
+
+ # echo "[←] cd .."
+ cd ..
+
+ # echo "[→] cd web"
+ cd web || exit
+
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production> error
+
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green " Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ echo_green "[+] MCSManager installation success!"
+
+ sleep 3
+}
+
+Create_Service() {
+ echo_cyan "[+] Create MCSManager service..."
+
+ echo "
+[Unit]
+Description=MCSManager Daemon
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/daemon
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s QUIT $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" > /etc/systemd/system/mcsm-daemon.service
+
+ echo "
+[Unit]
+Description=MCSManager Web
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/web
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s QUIT $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" > /etc/systemd/system/mcsm-web.service
+
+ systemctl daemon-reload
+ systemctl enable mcsm-daemon.service --now
+ systemctl enable mcsm-web.service --now
+
+ sleep 3
+
+ printf "\n\n"
+
+ echo_yellow "=================================================================="
+ echo_green "Welcome to MCSManager!"
+ echo_yellow "=================================================================="
+ echo_cyan_n "HTTP Service Address: "; echo_yellow "http://localhost:23333"
+ echo_cyan_n "Daemon Address: "; echo_yellow "ws://localhost:24444"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow "=================================================================="
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "systemctl disable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl enable mcsm-{daemon,web}.service"
+ echo_cyan "More info: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+}
+
+
+
+# Environmental inspection
+if [ "$arch" == x86_64 ]; then
+ arch=x64
+ #echo "[-] x64 architecture detected"
+elif [ $arch == aarch64 ]; then
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
+elif [ $arch == arm ]; then
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
+elif [ $arch == ppc64le ]; then
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
+elif [ $arch == s390x ]; then
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
+else
+ Red_Error "[x] Sorry, this architecture is not supported yet!"
+ Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
+ exit
+fi
+
+# Define the variable Node installation directory
+node_install_path="/opt/node-$node-linux-$arch"
+
+# Check network connection
+echo_cyan "[-] Architecture: $arch"
+
+# Install related software
+echo_cyan_n "[+] Installing dependent software(git,tar)... "
+if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
+elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
+elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
+elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
+fi
+
+# Determine whether the relevant software is installed successfully
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ echo "$error"
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
+ exit
+fi
+
+
+# Install the Node environment
+Install_Node
+
+# Install MCSManager
+Install_MCSManager
+
+# Create MCSManager background service
+Create_Service
+
From 15fe53d99dd7ee7c5dfca5c0782d80af1538771f Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 15:31:18 +0800
Subject: [PATCH 064/460] Fix: print text
---
install_cn.sh | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/install_cn.sh b/install_cn.sh
index 4fc5aaa..0a08c90 100644
--- a/install_cn.sh
+++ b/install_cn.sh
@@ -95,12 +95,13 @@ Install_MCSManager() {
# donwload MCSManager release
wget -o /dev/null https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz
tar -zxf mcsmanager_linux_release.tar.gz -o
+ rm -rf "${mcsmanager_install_path}/mcsmanager_linux_release.tar.gz"
# echo "[→] cd daemon"
cd daemon || exit
echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production> error
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production > npm_install_log
# echo "[←] cd .."
cd ..
@@ -109,7 +110,7 @@ Install_MCSManager() {
cd web || exit
echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production> error
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production > npm_install_log
echo
echo_yellow "=============== MCSManager ==============="
@@ -166,16 +167,17 @@ WantedBy=multi-user.target
echo_yellow "=================================================================="
echo_green "Welcome to MCSManager!"
echo_yellow "=================================================================="
- echo_cyan_n "HTTP Service Address: "; echo_yellow "http://localhost:23333"
- echo_cyan_n "Daemon Address: "; echo_yellow "ws://localhost:24444"
+ echo_cyan_n "HTTP Web Service: "; echo_yellow "http://localhost:23333"
+ echo_cyan_n "Daemon Address: "; echo_yellow "ws://localhost:24444"
echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
echo_yellow "=================================================================="
+ echo_cyan "Command Usage:"
echo_cyan "systemctl start mcsm-{daemon,web}.service"
echo_cyan "systemctl stop mcsm-{daemon,web}.service"
echo_cyan "systemctl restart mcsm-{daemon,web}.service"
echo_cyan "systemctl disable mcsm-{daemon,web}.service"
echo_cyan "systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "More info: https://docs.mcsmanager.com/"
+ echo_green "More info: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
}
From b15e957febafd54fa582e1e1cee9d65f5d3b2ba7 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 15:46:27 +0800
Subject: [PATCH 065/460] Fix: print text & systemctl
---
install_cn.sh | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/install_cn.sh b/install_cn.sh
index 0a08c90..aa3f883 100644
--- a/install_cn.sh
+++ b/install_cn.sh
@@ -67,10 +67,10 @@ Install_Node() {
fi
echo
- echo_yellow "=============== Node Version ==============="
+ echo_yellow "=============== Node.JS Version ==============="
echo_yellow " node: $("$node_install_path"/bin/node -v)"
echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node Version ==============="
+ echo_yellow "=============== Node.JS Version ==============="
echo
sleep 3
@@ -80,12 +80,14 @@ Install_Node() {
Install_MCSManager() {
echo_cyan "[+] Install MCSManager..."
- # delete service
- rm -f /etc/systemd/system/mcsm-daemon.service
- rm -f /etc/systemd/system/mcsm-web.service
-
# stop service
systemctl stop mcsm-{web,daemon}
+
+ # delete service
+ rm -rf /etc/systemd/system/mcsm-daemon.service
+ rm -rf /etc/systemd/system/mcsm-web.service
+ systemctl daemon-reload
+
mkdir -p ${mcsmanager_install_path} || exit
# cd /opt/mcsmanager
@@ -104,10 +106,7 @@ Install_MCSManager() {
/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production > npm_install_log
# echo "[←] cd .."
- cd ..
-
- # echo "[→] cd web"
- cd web || exit
+ cd ../web || exit
echo_cyan "[+] Install MCSManager-Web dependencies..."
/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production > npm_install_log
From 8a88349550299360a5b88b6157226d17c71837f1 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 17:29:58 +0800
Subject: [PATCH 066/460] Feat: change addr
---
install_cn.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/install_cn.sh b/install_cn.sh
index aa3f883..e26e5ec 100644
--- a/install_cn.sh
+++ b/install_cn.sh
@@ -36,6 +36,7 @@ error=""
node="v14.19.1"
arch=$(uname -m)
mcsmanager_install_path="/opt/mcsmanager"
+mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
Red_Error() {
echo '================================================='
@@ -95,7 +96,7 @@ Install_MCSManager() {
# donwload MCSManager release
- wget -o /dev/null https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz
+ wget ${mcsmanager_donwload_addr}
tar -zxf mcsmanager_linux_release.tar.gz -o
rm -rf "${mcsmanager_install_path}/mcsmanager_linux_release.tar.gz"
From 1f91ad78025ca85f165d5988790f5c473ea15f0b Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 19:21:18 +0800
Subject: [PATCH 067/460] Fix: print text
---
install_cn.sh | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/install_cn.sh b/install_cn.sh
index e26e5ec..7633295 100644
--- a/install_cn.sh
+++ b/install_cn.sh
@@ -32,11 +32,13 @@ echo_cyan "+--------------------------------------------------------------------
+----------------------------------------------------------------------
"
-error=""
-node="v14.19.1"
-arch=$(uname -m)
+# Config
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+node="v14.19.1"
+
+error=""
+arch=$(uname -m)
Red_Error() {
echo '================================================='
@@ -53,7 +55,7 @@ Install_Node() {
cd /opt || exit
- wget -o /dev/null https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
+ wget https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
tar -zxf node-"$node"-linux-"$arch".tar.gz
From 6c1f174a68b3320b7a969bf1c65223c685b69fc0 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 20:03:55 +0800
Subject: [PATCH 068/460] Feat:
---
install.sh | 42 +++++++++++++++++++++++-------------------
install_cn.sh | 10 +++++-----
2 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/install.sh b/install.sh
index ba65ac6..e0364ef 100644
--- a/install.sh
+++ b/install.sh
@@ -32,10 +32,13 @@ echo_cyan "+--------------------------------------------------------------------
+----------------------------------------------------------------------
"
-error=""
+# Config
+mcsmanager_install_path="/opt/mcsmanager"
+mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
node="v14.19.1"
+
+error=""
arch=$(uname -m)
-mcsmanager_install_path="/opt/mcsmanager"
Red_Error() {
echo '================================================='
@@ -67,10 +70,10 @@ Install_Node() {
fi
echo
- echo_yellow "=============== Node Version ==============="
+ echo_yellow "=============== Node.JS Version ==============="
echo_yellow " node: $("$node_install_path"/bin/node -v)"
echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node Version ==============="
+ echo_yellow "=============== Node.JS Version ==============="
echo
sleep 3
@@ -80,12 +83,14 @@ Install_Node() {
Install_MCSManager() {
echo_cyan "[+] Install MCSManager..."
- # delete service
- rm -f /etc/systemd/system/mcsm-daemon.service
- rm -f /etc/systemd/system/mcsm-web.service
-
# stop service
systemctl stop mcsm-{web,daemon}
+
+ # delete service
+ rm -rf /etc/systemd/system/mcsm-daemon.service
+ rm -rf /etc/systemd/system/mcsm-web.service
+ systemctl daemon-reload
+
mkdir -p ${mcsmanager_install_path} || exit
# cd /opt/mcsmanager
@@ -93,23 +98,21 @@ Install_MCSManager() {
# donwload MCSManager release
- wget -o /dev/null https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz
+ wget ${mcsmanager_donwload_addr}
tar -zxf mcsmanager_linux_release.tar.gz -o
+ rm -rf "${mcsmanager_install_path}/mcsmanager_linux_release.tar.gz"
# echo "[→] cd daemon"
cd daemon || exit
echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install > error
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
# echo "[←] cd .."
- cd ..
-
- # echo "[→] cd web"
- cd web || exit
+ cd ../web || exit
echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install > error
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
echo
echo_yellow "=============== MCSManager ==============="
@@ -164,18 +167,19 @@ WantedBy=multi-user.target
printf "\n\n"
echo_yellow "=================================================================="
- echo_green "Welcome to MCSManager!"
+ echo_green "Welcome to use MCSManager!"
echo_yellow "=================================================================="
- echo_cyan_n "HTTP Service Address: "; echo_yellow "http://localhost:23333"
- echo_cyan_n "Daemon Address: "; echo_yellow "ws://localhost:24444"
+ echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
+ echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
echo_yellow "=================================================================="
+ echo_cyan "Usage:"
echo_cyan "systemctl start mcsm-{daemon,web}.service"
echo_cyan "systemctl stop mcsm-{daemon,web}.service"
echo_cyan "systemctl restart mcsm-{daemon,web}.service"
echo_cyan "systemctl disable mcsm-{daemon,web}.service"
echo_cyan "systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "More info: https://docs.mcsmanager.com/"
+ echo_green "Official Document: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
}
diff --git a/install_cn.sh b/install_cn.sh
index 7633295..c0edc2e 100644
--- a/install_cn.sh
+++ b/install_cn.sh
@@ -167,19 +167,19 @@ WantedBy=multi-user.target
printf "\n\n"
echo_yellow "=================================================================="
- echo_green "Welcome to MCSManager!"
+ echo_green "Welcome to use MCSManager!"
echo_yellow "=================================================================="
- echo_cyan_n "HTTP Web Service: "; echo_yellow "http://localhost:23333"
- echo_cyan_n "Daemon Address: "; echo_yellow "ws://localhost:24444"
+ echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
+ echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
echo_yellow "=================================================================="
- echo_cyan "Command Usage:"
+ echo_cyan "Usage:"
echo_cyan "systemctl start mcsm-{daemon,web}.service"
echo_cyan "systemctl stop mcsm-{daemon,web}.service"
echo_cyan "systemctl restart mcsm-{daemon,web}.service"
echo_cyan "systemctl disable mcsm-{daemon,web}.service"
echo_cyan "systemctl enable mcsm-{daemon,web}.service"
- echo_green "More info: https://docs.mcsmanager.com/"
+ echo_green "Official Document: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
}
From 5068744be2354b5927cb8ae5dd4bca618511ba0f Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 20:15:56 +0800
Subject: [PATCH 069/460] =?UTF-8?q?Feat:=20Finish=EF=BC=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
install.sh | 4 ++--
install_cn.sh | 35 ++++++++++++++++++++++++++++-------
2 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/install.sh b/install.sh
index e0364ef..b9b9fcd 100644
--- a/install.sh
+++ b/install.sh
@@ -28,7 +28,7 @@ echo_cyan "+--------------------------------------------------------------------
+----------------------------------------------------------------------
| Copyright © 2023 MCSManager.
+----------------------------------------------------------------------
-| Contributors: nuomiaa, CreeperKong, unitwk, FunnyShadow
+| Contributors: Nuomiaa, CreeperKong, Unitwk, FunnyShadow
+----------------------------------------------------------------------
"
@@ -167,7 +167,7 @@ WantedBy=multi-user.target
printf "\n\n"
echo_yellow "=================================================================="
- echo_green "Welcome to use MCSManager!"
+ echo_green "Installation is complete! Welcome to the MCSManager panel !!!"
echo_yellow "=================================================================="
echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
diff --git a/install_cn.sh b/install_cn.sh
index c0edc2e..1ade4e9 100644
--- a/install_cn.sh
+++ b/install_cn.sh
@@ -24,18 +24,25 @@ echo_yellow() {
# script info
echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer
+| MCSManager Installer (Chinese Version)
+----------------------------------------------------------------------
| Copyright © 2023 MCSManager.
+----------------------------------------------------------------------
-| Contributors: nuomiaa, CreeperKong, unitwk, FunnyShadow
+| Contributors: Nuomiaa, CreeperKong, Unitwk, FunnyShadow
+----------------------------------------------------------------------
+
+We will use servers in the China to speed up your installation!
+我们将使用中国地区的服务器来加速您的安装速度!
"
# Config
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
node="v14.19.1"
+zh=$(
+ [[ $(locale -a) =~ "zh" ]] && echo 1
+ export LANG=zh_CN.UTF-8 || echo 0
+)
error=""
arch=$(uname -m)
@@ -165,9 +172,24 @@ WantedBy=multi-user.target
sleep 3
printf "\n\n"
-
echo_yellow "=================================================================="
- echo_green "Welcome to use MCSManager!"
+ if [ "$zh" == 1 ]; then
+ echo_green "安装已完成!欢迎使用 MCSManager 面板!"
+ echo_yellow "=================================================================="
+ echo_cyan_n "控制面板地址: "
+ echo_yellow "http://你的公网IP:23333"
+ echo_red "你必须开放 23333(面板) 和 24444(守护进程用) 端口,控制面板需要这两个端口才能正常工作。"
+ echo_yellow "=================================================================="
+ echo_cyan "下面是常用的几个命令:"
+ echo_cyan "启动面板 systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "停止面板 systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "重启面板 systemctl restart mcsm-{daemon,web}.service"
+ echo_yellow "=================================================================="
+ echo_cyan "官方文档(必读):https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+ else
+ echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager panel!"
echo_yellow "=================================================================="
echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
@@ -177,10 +199,9 @@ WantedBy=multi-user.target
echo_cyan "systemctl start mcsm-{daemon,web}.service"
echo_cyan "systemctl stop mcsm-{daemon,web}.service"
echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "systemctl enable mcsm-{daemon,web}.service"
echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ echo_yellow "=================================================================="
+ fi
}
From 5c00e37f0acb8fc3ac169e2efbb24c2981f98ec0 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 20:20:12 +0800
Subject: [PATCH 070/460] Optimization: text typography
---
install.sh | 5 +++--
install_cn.sh | 13 +++++++------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/install.sh b/install.sh
index b9b9fcd..341fc97 100644
--- a/install.sh
+++ b/install.sh
@@ -168,17 +168,18 @@ WantedBy=multi-user.target
echo_yellow "=================================================================="
echo_green "Installation is complete! Welcome to the MCSManager panel !!!"
- echo_yellow "=================================================================="
+ echo_yellow " "
echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow "=================================================================="
+ echo_yellow " "
echo_cyan "Usage:"
echo_cyan "systemctl start mcsm-{daemon,web}.service"
echo_cyan "systemctl stop mcsm-{daemon,web}.service"
echo_cyan "systemctl restart mcsm-{daemon,web}.service"
echo_cyan "systemctl disable mcsm-{daemon,web}.service"
echo_cyan "systemctl enable mcsm-{daemon,web}.service"
+ echo_yellow " "
echo_green "Official Document: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
}
diff --git a/install_cn.sh b/install_cn.sh
index 1ade4e9..99d7fa7 100644
--- a/install_cn.sh
+++ b/install_cn.sh
@@ -175,30 +175,31 @@ WantedBy=multi-user.target
echo_yellow "=================================================================="
if [ "$zh" == 1 ]; then
echo_green "安装已完成!欢迎使用 MCSManager 面板!"
- echo_yellow "=================================================================="
+ echo_yellow " "
echo_cyan_n "控制面板地址: "
echo_yellow "http://你的公网IP:23333"
- echo_red "你必须开放 23333(面板) 和 24444(守护进程用) 端口,控制面板需要这两个端口才能正常工作。"
- echo_yellow "=================================================================="
+ echo_red "你必须开放 23333(面板)和 24444(守护进程用)端口,控制面板需要这两个端口才能正常工作。"
+ echo_yellow " "
echo_cyan "下面是常用的几个命令:"
echo_cyan "启动面板 systemctl start mcsm-{daemon,web}.service"
echo_cyan "停止面板 systemctl stop mcsm-{daemon,web}.service"
echo_cyan "重启面板 systemctl restart mcsm-{daemon,web}.service"
- echo_yellow "=================================================================="
+ echo_yellow " "
echo_cyan "官方文档(必读):https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
else
echo_yellow "=================================================================="
echo_green "Installation is complete! Welcome to the MCSManager panel!"
- echo_yellow "=================================================================="
+ echo_yellow " "
echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow "=================================================================="
+ echo_yellow " "
echo_cyan "Usage:"
echo_cyan "systemctl start mcsm-{daemon,web}.service"
echo_cyan "systemctl stop mcsm-{daemon,web}.service"
echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_yellow " "
echo_green "Official Document: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
fi
From 270216eefe99a6459b0eccc54fa0a8dabbd32789 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 20:58:45 +0800
Subject: [PATCH 071/460] Feat: update script
---
install.sh | 245 -------------------------
install_cn.sh | 266 ---------------------------
setup.sh | 474 ++++++++++++++++++------------------------------
setup_cn.sh | 489 +++++++++++++++++++-------------------------------
setup_en.sh | 145 +++++++--------
5 files changed, 423 insertions(+), 1196 deletions(-)
delete mode 100644 install.sh
delete mode 100644 install_cn.sh
diff --git a/install.sh b/install.sh
deleted file mode 100644
index 341fc97..0000000
--- a/install.sh
+++ /dev/null
@@ -1,245 +0,0 @@
-#!/bin/bash
-
-printf "\033c"
-
-# print func
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
-echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
-}
-
-echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
-
-echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
-}
-
-echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
-}
-
-# script info
-echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2023 MCSManager.
-+----------------------------------------------------------------------
-| Contributors: Nuomiaa, CreeperKong, Unitwk, FunnyShadow
-+----------------------------------------------------------------------
-"
-
-# Config
-mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
-node="v14.19.1"
-
-error=""
-arch=$(uname -m)
-
-Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
-}
-
-
-Install_Node() {
- echo_cyan_n "[+] Install Node.JS environment... "
-
- rm -irf "$node_install_path"
-
- cd /opt || exit
-
- wget -o /dev/null https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
-
- tar -zxf node-"$node"-linux-"$arch".tar.gz
-
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- Red_Error "[x] Node installation failed!"
- fi
-
- echo
- echo_yellow "=============== Node.JS Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node.JS Version ==============="
- echo
-
- sleep 3
-}
-
-
-Install_MCSManager() {
- echo_cyan "[+] Install MCSManager..."
-
- # stop service
- systemctl stop mcsm-{web,daemon}
-
- # delete service
- rm -rf /etc/systemd/system/mcsm-daemon.service
- rm -rf /etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
-
- mkdir -p ${mcsmanager_install_path} || exit
-
- # cd /opt/mcsmanager
- cd ${mcsmanager_install_path} || exit
-
-
- # donwload MCSManager release
- wget ${mcsmanager_donwload_addr}
- tar -zxf mcsmanager_linux_release.tar.gz -o
- rm -rf "${mcsmanager_install_path}/mcsmanager_linux_release.tar.gz"
-
- # echo "[→] cd daemon"
- cd daemon || exit
-
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
-
- # echo "[←] cd .."
- cd ../web || exit
-
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
-
- echo
- echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
- echo
- echo_green "[+] MCSManager installation success!"
-
- sleep 3
-}
-
-Create_Service() {
- echo_cyan "[+] Create MCSManager service..."
-
- echo "
-[Unit]
-Description=MCSManager Daemon
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-daemon.service
-
- echo "
-[Unit]
-Description=MCSManager Web
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/web
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-web.service
-
- systemctl daemon-reload
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
-
- sleep 3
-
- printf "\n\n"
-
- echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager panel !!!"
- echo_yellow " "
- echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
- echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "systemctl enable mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
-}
-
-
-
-# Environmental inspection
-if [ "$arch" == x86_64 ]; then
- arch=x64
- #echo "[-] x64 architecture detected"
-elif [ $arch == aarch64 ]; then
- arch=arm64
- #echo "[-] 64-bit ARM architecture detected"
-elif [ $arch == arm ]; then
- arch=armv7l
- #echo "[-] 32-bit ARM architecture detected"
-elif [ $arch == ppc64le ]; then
- arch=ppc64le
- #echo "[-] IBM POWER architecture detected"
-elif [ $arch == s390x ]; then
- arch=s390x
- #echo "[-] IBM LinuxONE architecture detected"
-else
- Red_Error "[x] Sorry, this architecture is not supported yet!"
- Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
- exit
-fi
-
-# Define the variable Node installation directory
-node_install_path="/opt/node-$node-linux-$arch"
-
-# Check network connection
-echo_cyan "[-] Architecture: $arch"
-
-# Install related software
-echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
-elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
-elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
-elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
-fi
-
-# Determine whether the relevant software is installed successfully
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- echo "$error"
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- exit
-fi
-
-
-# Install the Node environment
-Install_Node
-
-# Install MCSManager
-Install_MCSManager
-
-# Create MCSManager background service
-Create_Service
-
diff --git a/install_cn.sh b/install_cn.sh
deleted file mode 100644
index 99d7fa7..0000000
--- a/install_cn.sh
+++ /dev/null
@@ -1,266 +0,0 @@
-#!/bin/bash
-
-printf "\033c"
-
-# print func
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
-echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
-}
-
-echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
-
-echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
-}
-
-echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
-}
-
-# script info
-echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer (Chinese Version)
-+----------------------------------------------------------------------
-| Copyright © 2023 MCSManager.
-+----------------------------------------------------------------------
-| Contributors: Nuomiaa, CreeperKong, Unitwk, FunnyShadow
-+----------------------------------------------------------------------
-
-We will use servers in the China to speed up your installation!
-我们将使用中国地区的服务器来加速您的安装速度!
-"
-
-# Config
-mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
-node="v14.19.1"
-zh=$(
- [[ $(locale -a) =~ "zh" ]] && echo 1
- export LANG=zh_CN.UTF-8 || echo 0
-)
-
-error=""
-arch=$(uname -m)
-
-Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
-}
-
-
-Install_Node() {
- echo_cyan_n "[+] Install Node.JS environment... "
-
- rm -irf "$node_install_path"
-
- cd /opt || exit
-
- wget https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
-
- tar -zxf node-"$node"-linux-"$arch".tar.gz
-
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- Red_Error "[x] Node installation failed!"
- fi
-
- echo
- echo_yellow "=============== Node.JS Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node.JS Version ==============="
- echo
-
- sleep 3
-}
-
-
-Install_MCSManager() {
- echo_cyan "[+] Install MCSManager..."
-
- # stop service
- systemctl stop mcsm-{web,daemon}
-
- # delete service
- rm -rf /etc/systemd/system/mcsm-daemon.service
- rm -rf /etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
-
- mkdir -p ${mcsmanager_install_path} || exit
-
- # cd /opt/mcsmanager
- cd ${mcsmanager_install_path} || exit
-
-
- # donwload MCSManager release
- wget ${mcsmanager_donwload_addr}
- tar -zxf mcsmanager_linux_release.tar.gz -o
- rm -rf "${mcsmanager_install_path}/mcsmanager_linux_release.tar.gz"
-
- # echo "[→] cd daemon"
- cd daemon || exit
-
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production > npm_install_log
-
- # echo "[←] cd .."
- cd ../web || exit
-
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production > npm_install_log
-
- echo
- echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
- echo
- echo_green "[+] MCSManager installation success!"
-
- sleep 3
-}
-
-Create_Service() {
- echo_cyan "[+] Create MCSManager service..."
-
- echo "
-[Unit]
-Description=MCSManager Daemon
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-daemon.service
-
- echo "
-[Unit]
-Description=MCSManager Web
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/web
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-web.service
-
- systemctl daemon-reload
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
-
- sleep 3
-
- printf "\n\n"
- echo_yellow "=================================================================="
- if [ "$zh" == 1 ]; then
- echo_green "安装已完成!欢迎使用 MCSManager 面板!"
- echo_yellow " "
- echo_cyan_n "控制面板地址: "
- echo_yellow "http://你的公网IP:23333"
- echo_red "你必须开放 23333(面板)和 24444(守护进程用)端口,控制面板需要这两个端口才能正常工作。"
- echo_yellow " "
- echo_cyan "下面是常用的几个命令:"
- echo_cyan "启动面板 systemctl start mcsm-{daemon,web}.service"
- echo_cyan "停止面板 systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "重启面板 systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_cyan "官方文档(必读):https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
- else
- echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager panel!"
- echo_yellow " "
- echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
- echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
- fi
-}
-
-
-
-# Environmental inspection
-if [ "$arch" == x86_64 ]; then
- arch=x64
- #echo "[-] x64 architecture detected"
-elif [ $arch == aarch64 ]; then
- arch=arm64
- #echo "[-] 64-bit ARM architecture detected"
-elif [ $arch == arm ]; then
- arch=armv7l
- #echo "[-] 32-bit ARM architecture detected"
-elif [ $arch == ppc64le ]; then
- arch=ppc64le
- #echo "[-] IBM POWER architecture detected"
-elif [ $arch == s390x ]; then
- arch=s390x
- #echo "[-] IBM LinuxONE architecture detected"
-else
- Red_Error "[x] Sorry, this architecture is not supported yet!"
- Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
- exit
-fi
-
-# Define the variable Node installation directory
-node_install_path="/opt/node-$node-linux-$arch"
-
-# Check network connection
-echo_cyan "[-] Architecture: $arch"
-
-# Install related software
-echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
-elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
-elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
-elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
-fi
-
-# Determine whether the relevant software is installed successfully
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- echo "$error"
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- exit
-fi
-
-
-# Install the Node environment
-Install_Node
-
-# Install MCSManager
-Install_MCSManager
-
-# Create MCSManager background service
-Create_Service
-
diff --git a/setup.sh b/setup.sh
index 9c4e4d3..341fc97 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,377 +1,245 @@
#!/bin/bash
-#### MCSManager Command Line Interface
-#### Made by nuomiaa, CreeperKong, unitwk
-
-#### Copyright © 2023 MCSManager All rights reserved.
-
printf "\033c"
-error=""
-node="v14.19.1"
-arch=$(uname -m)
-mcsmanager_install_path="/opt/mcsmanager"
-zh=$(
- [[ $(locale -a) =~ "zh" ]] && echo 1
- export LANG=zh_CN.UTF-8 || echo 0
-)
-
-Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
+# print func
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
}
-
echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
+ printf '\033[1;31m%b\033[0m\n' "$@"
}
echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
-
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
+ printf '\033[1;32m%b\033[0m\n' "$@"
}
echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
+ printf '\033[1;36m%b\033[0m' "$@"
}
echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
+ printf '\033[1;33m%b\033[0m\n' "$@"
}
+# script info
+echo_cyan "+----------------------------------------------------------------------
+| MCSManager Installer
++----------------------------------------------------------------------
+| Copyright © 2023 MCSManager.
++----------------------------------------------------------------------
+| Contributors: Nuomiaa, CreeperKong, Unitwk, FunnyShadow
++----------------------------------------------------------------------
+"
+
+# Config
+mcsmanager_install_path="/opt/mcsmanager"
+mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+node="v14.19.1"
+
+error=""
+arch=$(uname -m)
+
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
+
+
Install_Node() {
- if [ "$zh" == 1 ]; then
- echo_cyan_n "[+] 安装 Node 环境... "
- else
- echo_cyan_n "[+] Install Node environment... "
- fi
-
- rm -irf "$node_install_path"
-
- cd /opt || exit
-
- wget -o /dev/null https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
-
- tar -zxf node-"$node"-linux-"$arch".tar.gz
-
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- if [ ! -L /usr/bin/node ] && [ ! -f /usr/bin/node ]; then
- ln -s "$node_install_path"/bin/node /usr/bin/node
- fi
- if [ ! -L /usr/bin/npm ] && [ ! -f /usr/bin/npm ]; then
- ln -s "$node_install_path"/bin/npm /usr/bin/npm
- fi
-
- chmod +x "$node_install_path"/bin/node
- chmod +x "$node_install_path"/bin/npm
-
- if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]; then
- if [ "$zh" == 1 ]; then
- echo_green "成功"
- else
- echo_green "Success"
- fi
- else
- if [ "$zh" == 1 ]; then
- echo_red "失败"
- Red_Error "[x] Node 安装失败!"
- else
- echo_red "Failed"
- Red_Error "[x] Node installation failed!"
- fi
- fi
-
- echo
- echo_yellow "=============== Node Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node Version ==============="
- echo
-
- sleep 3
+ echo_cyan_n "[+] Install Node.JS environment... "
+
+ rm -irf "$node_install_path"
+
+ cd /opt || exit
+
+ wget -o /dev/null https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
+
+ tar -zxf node-"$node"-linux-"$arch".tar.gz
+
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
+ if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ Red_Error "[x] Node installation failed!"
+ fi
+
+ echo
+ echo_yellow "=============== Node.JS Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node.JS Version ==============="
+ echo
+
+ sleep 3
}
+
Install_MCSManager() {
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 安装 MCSManager..."
- else
- echo_cyan "[+] Install MCSManager..."
- fi
-
- # 删除服务
- rm -f /etc/systemd/system/mcsm-daemon.service
- rm -f /etc/systemd/system/mcsm-web.service
-
- # 重载
- systemctl daemon-reload
-
- # echo "[x] Delete the original MCSManager"
- rm -irf ${mcsmanager_install_path}
-
- # echo "[+] mkdir -p ${mcsmanager_install_path}"
- mkdir -p ${mcsmanager_install_path} || exit
-
- # echo "[→] cd ${mcsmanager_install_path}"
- cd ${mcsmanager_install_path} || exit
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[↓] Git 克隆 MCSManager-Daemon..."
- else
- echo_cyan "[↓] Git clone MCSManager-Daemon..."
- fi
- git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git daemon
-
- # echo "[→] cd daemon"
- cd daemon || exit
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 安装 MCSManager-Daemon 依赖库..."
- else
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- fi
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
-
- # echo "[←] cd .."
- cd ..
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[↓] Git 克隆 MCSManager-Web..."
- else
- echo_cyan "[↓] Git clone MCSManager-Web..."
- fi
- git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Web-Production.git web
-
- # echo "[→] cd web"
- cd web || exit
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 安装 MCSManager-Web 依赖库..."
- else
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- fi
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
-
- echo
- echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
- echo
- if [ "$zh" == 1 ]; then
- echo_green "[+] MCSManager 安装成功!"
- else
- echo_green "[+] MCSManager installation success!"
- fi
-
- sleep 3
+ echo_cyan "[+] Install MCSManager..."
+
+ # stop service
+ systemctl stop mcsm-{web,daemon}
+
+ # delete service
+ rm -rf /etc/systemd/system/mcsm-daemon.service
+ rm -rf /etc/systemd/system/mcsm-web.service
+ systemctl daemon-reload
+
+ mkdir -p ${mcsmanager_install_path} || exit
+
+ # cd /opt/mcsmanager
+ cd ${mcsmanager_install_path} || exit
+
+
+ # donwload MCSManager release
+ wget ${mcsmanager_donwload_addr}
+ tar -zxf mcsmanager_linux_release.tar.gz -o
+ rm -rf "${mcsmanager_install_path}/mcsmanager_linux_release.tar.gz"
+
+ # echo "[→] cd daemon"
+ cd daemon || exit
+
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
+
+ # echo "[←] cd .."
+ cd ../web || exit
+
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
+
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green " Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ echo_green "[+] MCSManager installation success!"
+
+ sleep 3
}
Create_Service() {
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 创建 MCSManager 服务..."
- else
- echo_cyan "[+] Create MCSManager service..."
- fi
+ echo_cyan "[+] Create MCSManager service..."
- echo "
+ echo "
[Unit]
Description=MCSManager Daemon
[Service]
WorkingDirectory=/opt/mcsmanager/daemon
ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
+ExecReload=/bin/kill -s QUIT $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-daemon.service
+" > /etc/systemd/system/mcsm-daemon.service
- echo "
+ echo "
[Unit]
Description=MCSManager Web
[Service]
WorkingDirectory=/opt/mcsmanager/web
ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
+ExecReload=/bin/kill -s QUIT $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-web.service
-
- # 重载
- systemctl daemon-reload
-
- # 创建 Daemon 服务
- systemctl enable mcsm-daemon.service --now
-
- # 创建 Web 服务
- systemctl enable mcsm-web.service --now
-
- sleep 3
-
- printf "\033c"
- echo_yellow "=================================================================="
- if [ "$zh" == 1 ]; then
- echo_green "欢迎使用 MCSManager,您可以通过以下方式访问:"
- echo_yellow "=================================================================="
- echo_cyan_n "控制面板地址: "
- echo_yellow "http://localhost:23333"
- echo_red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。"
- echo_yellow "=================================================================="
- echo_cyan "重启 systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "禁用 systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "启用 systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "启动 systemctl start mcsm-{daemon,web}.service"
- echo_cyan "停止 systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "更多使用说明,请参考:https://docs.mcsmanager.com/"
- else
- echo_green "Welcome to MCSManager, you can access it by the following ways:"
- echo_yellow "=================================================================="
- echo_cyan_n "Web Service Address: "
- echo_yellow "http://localhost:23333"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow "=================================================================="
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "More info: https://docs.mcsmanager.com/"
- fi
- echo_yellow "=================================================================="
-
+" > /etc/systemd/system/mcsm-web.service
+
+ systemctl daemon-reload
+ systemctl enable mcsm-daemon.service --now
+ systemctl enable mcsm-web.service --now
+
+ sleep 3
+
+ printf "\n\n"
+
+ echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager panel !!!"
+ echo_yellow " "
+ echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
+ echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "systemctl disable mcsm-{daemon,web}.service"
+ echo_cyan "systemctl enable mcsm-{daemon,web}.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
}
-# ----------------- 程序启动 -----------------
-# 删除 Shell 脚本自身
-rm -f "$0"
-
-# 检查执行用户权限
-if [ "$(whoami)" != "root" ]; then
- if [ "$zh" == 1 ]; then
- Red_Error "[x] 请使用 root 权限执行 MCSManager 安装命令!"
- else
- Red_Error "[x] Please execute the MCSManager installation command with root permission!"
- fi
-fi
-echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-+----------------------------------------------------------------------
-"
-
-# 环境检查
+# Environmental inspection
if [ "$arch" == x86_64 ]; then
- arch=x64
- #echo "[-] x64 architecture detected"
+ arch=x64
+ #echo "[-] x64 architecture detected"
elif [ $arch == aarch64 ]; then
- arch=arm64
- #echo "[-] 64-bit ARM architecture detected"
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
elif [ $arch == arm ]; then
- arch=armv7l
- #echo "[-] 32-bit ARM architecture detected"
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
elif [ $arch == ppc64le ]; then
- arch=ppc64le
- #echo "[-] IBM POWER architecture detected"
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
elif [ $arch == s390x ]; then
- arch=s390x
- #echo "[-] IBM LinuxONE architecture detected"
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
else
- if [ "$zh" == 1 ]; then
- Red_Error "[x] 抱歉,暂不支持您的 体系架构($arch)!"
- else
- Red_Error "[x] Sorry, this architecture is not supported yet!"
- fi
- exit
+ Red_Error "[x] Sorry, this architecture is not supported yet!"
+ Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
+ exit
fi
-# 定义变量 Node 安装目录
+# Define the variable Node installation directory
node_install_path="/opt/node-$node-linux-$arch"
-# 检查网络连接
-if [ "$zh" == 1 ]; then
- echo_cyan "[-] 体系架构:$arch"
-else
- echo_cyan "[-] Architecture: $arch"
-fi
-
-# MCSManager 已安装
-if [ -d "$mcsmanager_install_path" ]; then
- printf "\033c"
- if [ "$zh" == 1 ]; then
- echo_red "----------------------------------------------------
-检查到已有 MCSManager 安装在 \"$mcsmanager_install_path\"
-继续安装会删除原有 MCSManager 面版的所有数据!
-----------------------------------------------------
-将在 10 秒后继续安装,取消请按 Ctrl + Z/C 键!"
- else
- echo_red "----------------------------------------------------
-MCSManager is installed at \"$mcsmanager_install_path\"
-Continuing the installation will delete the original MCSManager!
-----------------------------------------------------
-Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
- fi
- sleep 10
-fi
+# Check network connection
+echo_cyan "[-] Architecture: $arch"
-# 安装相关软件
-if [ "$zh" == 1 ]; then
- echo_cyan_n "[-] 安装相关软件(git,tar)... "
-else
- echo_cyan_n "[+] Installing dependent software(git,tar)... "
-fi
-if [ -x "$(command -v yum)" ]; then
- yum install -y git tar >error
-elif [ -x "$(command -v apt-get)" ]; then
- apt-get install -y git tar >error
-elif [ -x "$(command -v pacman)" ]; then
- pacman -Syu --noconfirm git tar >error
-elif [ -x "$(command -v zypper)" ]; then
- zypper --non-interactive install git tar >error
+# Install related software
+echo_cyan_n "[+] Installing dependent software(git,tar)... "
+if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
+elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
+elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
+elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
fi
-# 判断相关软件是否安装成功
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
- if [ "$zh" == 1 ]; then
- echo_green "成功"
- else
- echo_green "Success"
- fi
-else
- if [ "$zh" == 1 ]; then
- echo_red "失败"
- else
- echo_red "Failed"
- fi
+# Determine whether the relevant software is installed successfully
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
echo "$error"
- if [ "$zh" == 1 ]; then
- Red_Error "[x] 相关软件安装失败,请手动安装 git 和 tar 软件包!"
- else
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- fi
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
exit
fi
-# 安装 Node 环境
+
+# Install the Node environment
Install_Node
-# 安装 MCSManager
+# Install MCSManager
Install_MCSManager
-# 创建 MCSManager 后台服务
+# Create MCSManager background service
Create_Service
+
diff --git a/setup_cn.sh b/setup_cn.sh
index 9c4e4d3..99d7fa7 100644
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -1,377 +1,266 @@
#!/bin/bash
-#### MCSManager Command Line Interface
-#### Made by nuomiaa, CreeperKong, unitwk
+printf "\033c"
-#### Copyright © 2023 MCSManager All rights reserved.
+# print func
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
-printf "\033c"
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
-error=""
-node="v14.19.1"
-arch=$(uname -m)
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
+
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
+}
+
+# script info
+echo_cyan "+----------------------------------------------------------------------
+| MCSManager Installer (Chinese Version)
++----------------------------------------------------------------------
+| Copyright © 2023 MCSManager.
++----------------------------------------------------------------------
+| Contributors: Nuomiaa, CreeperKong, Unitwk, FunnyShadow
++----------------------------------------------------------------------
+
+We will use servers in the China to speed up your installation!
+我们将使用中国地区的服务器来加速您的安装速度!
+"
+
+# Config
mcsmanager_install_path="/opt/mcsmanager"
+mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+node="v14.19.1"
zh=$(
[[ $(locale -a) =~ "zh" ]] && echo 1
export LANG=zh_CN.UTF-8 || echo 0
)
+error=""
+arch=$(uname -m)
+
Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
}
-echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
-}
-echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
+Install_Node() {
+ echo_cyan_n "[+] Install Node.JS environment... "
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
+ rm -irf "$node_install_path"
-echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
-}
+ cd /opt || exit
-echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
-}
+ wget https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
-Install_Node() {
- if [ "$zh" == 1 ]; then
- echo_cyan_n "[+] 安装 Node 环境... "
- else
- echo_cyan_n "[+] Install Node environment... "
- fi
-
- rm -irf "$node_install_path"
-
- cd /opt || exit
-
- wget -o /dev/null https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
-
- tar -zxf node-"$node"-linux-"$arch".tar.gz
-
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- if [ ! -L /usr/bin/node ] && [ ! -f /usr/bin/node ]; then
- ln -s "$node_install_path"/bin/node /usr/bin/node
- fi
- if [ ! -L /usr/bin/npm ] && [ ! -f /usr/bin/npm ]; then
- ln -s "$node_install_path"/bin/npm /usr/bin/npm
- fi
-
- chmod +x "$node_install_path"/bin/node
- chmod +x "$node_install_path"/bin/npm
-
- if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]; then
- if [ "$zh" == 1 ]; then
- echo_green "成功"
- else
- echo_green "Success"
- fi
- else
- if [ "$zh" == 1 ]; then
- echo_red "失败"
- Red_Error "[x] Node 安装失败!"
- else
- echo_red "Failed"
- Red_Error "[x] Node installation failed!"
- fi
- fi
-
- echo
- echo_yellow "=============== Node Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node Version ==============="
- echo
-
- sleep 3
+ tar -zxf node-"$node"-linux-"$arch".tar.gz
+
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
+ if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ Red_Error "[x] Node installation failed!"
+ fi
+
+ echo
+ echo_yellow "=============== Node.JS Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node.JS Version ==============="
+ echo
+
+ sleep 3
}
+
Install_MCSManager() {
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 安装 MCSManager..."
- else
- echo_cyan "[+] Install MCSManager..."
- fi
-
- # 删除服务
- rm -f /etc/systemd/system/mcsm-daemon.service
- rm -f /etc/systemd/system/mcsm-web.service
-
- # 重载
- systemctl daemon-reload
-
- # echo "[x] Delete the original MCSManager"
- rm -irf ${mcsmanager_install_path}
-
- # echo "[+] mkdir -p ${mcsmanager_install_path}"
- mkdir -p ${mcsmanager_install_path} || exit
-
- # echo "[→] cd ${mcsmanager_install_path}"
- cd ${mcsmanager_install_path} || exit
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[↓] Git 克隆 MCSManager-Daemon..."
- else
- echo_cyan "[↓] Git clone MCSManager-Daemon..."
- fi
- git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Daemon-Production.git daemon
-
- # echo "[→] cd daemon"
- cd daemon || exit
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 安装 MCSManager-Daemon 依赖库..."
- else
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- fi
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
-
- # echo "[←] cd .."
- cd ..
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[↓] Git 克隆 MCSManager-Web..."
- else
- echo_cyan "[↓] Git clone MCSManager-Web..."
- fi
- git clone --single-branch -b master --depth 1 https://gitee.com/mcsmanager/MCSManager-Web-Production.git web
-
- # echo "[→] cd web"
- cd web || exit
-
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 安装 MCSManager-Web 依赖库..."
- else
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- fi
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com >error
-
- echo
- echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
- echo
- if [ "$zh" == 1 ]; then
- echo_green "[+] MCSManager 安装成功!"
- else
- echo_green "[+] MCSManager installation success!"
- fi
-
- sleep 3
+ echo_cyan "[+] Install MCSManager..."
+
+ # stop service
+ systemctl stop mcsm-{web,daemon}
+
+ # delete service
+ rm -rf /etc/systemd/system/mcsm-daemon.service
+ rm -rf /etc/systemd/system/mcsm-web.service
+ systemctl daemon-reload
+
+ mkdir -p ${mcsmanager_install_path} || exit
+
+ # cd /opt/mcsmanager
+ cd ${mcsmanager_install_path} || exit
+
+
+ # donwload MCSManager release
+ wget ${mcsmanager_donwload_addr}
+ tar -zxf mcsmanager_linux_release.tar.gz -o
+ rm -rf "${mcsmanager_install_path}/mcsmanager_linux_release.tar.gz"
+
+ # echo "[→] cd daemon"
+ cd daemon || exit
+
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production > npm_install_log
+
+ # echo "[←] cd .."
+ cd ../web || exit
+
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production > npm_install_log
+
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green " Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ echo_green "[+] MCSManager installation success!"
+
+ sleep 3
}
Create_Service() {
- if [ "$zh" == 1 ]; then
- echo_cyan "[+] 创建 MCSManager 服务..."
- else
- echo_cyan "[+] Create MCSManager service..."
- fi
+ echo_cyan "[+] Create MCSManager service..."
- echo "
+ echo "
[Unit]
Description=MCSManager Daemon
[Service]
WorkingDirectory=/opt/mcsmanager/daemon
ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
+ExecReload=/bin/kill -s QUIT $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-daemon.service
+" > /etc/systemd/system/mcsm-daemon.service
- echo "
+ echo "
[Unit]
Description=MCSManager Web
[Service]
WorkingDirectory=/opt/mcsmanager/web
ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
+ExecReload=/bin/kill -s QUIT $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-web.service
-
- # 重载
- systemctl daemon-reload
-
- # 创建 Daemon 服务
- systemctl enable mcsm-daemon.service --now
-
- # 创建 Web 服务
- systemctl enable mcsm-web.service --now
-
- sleep 3
-
- printf "\033c"
+" > /etc/systemd/system/mcsm-web.service
+
+ systemctl daemon-reload
+ systemctl enable mcsm-daemon.service --now
+ systemctl enable mcsm-web.service --now
+
+ sleep 3
+
+ printf "\n\n"
+ echo_yellow "=================================================================="
+ if [ "$zh" == 1 ]; then
+ echo_green "安装已完成!欢迎使用 MCSManager 面板!"
+ echo_yellow " "
+ echo_cyan_n "控制面板地址: "
+ echo_yellow "http://你的公网IP:23333"
+ echo_red "你必须开放 23333(面板)和 24444(守护进程用)端口,控制面板需要这两个端口才能正常工作。"
+ echo_yellow " "
+ echo_cyan "下面是常用的几个命令:"
+ echo_cyan "启动面板 systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "停止面板 systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "重启面板 systemctl restart mcsm-{daemon,web}.service"
+ echo_yellow " "
+ echo_cyan "官方文档(必读):https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
- if [ "$zh" == 1 ]; then
- echo_green "欢迎使用 MCSManager,您可以通过以下方式访问:"
- echo_yellow "=================================================================="
- echo_cyan_n "控制面板地址: "
- echo_yellow "http://localhost:23333"
- echo_red "若无法访问面板,请检查防火墙/安全组是否有放行面板 23333 和 24444 端口,控制面板需要这两个端口才能正常工作。"
- echo_yellow "=================================================================="
- echo_cyan "重启 systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "禁用 systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "启用 systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "启动 systemctl start mcsm-{daemon,web}.service"
- echo_cyan "停止 systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "更多使用说明,请参考:https://docs.mcsmanager.com/"
- else
- echo_green "Welcome to MCSManager, you can access it by the following ways:"
- echo_yellow "=================================================================="
- echo_cyan_n "Web Service Address: "
- echo_yellow "http://localhost:23333"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow "=================================================================="
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "More info: https://docs.mcsmanager.com/"
- fi
+ else
echo_yellow "=================================================================="
-
+ echo_green "Installation is complete! Welcome to the MCSManager panel!"
+ echo_yellow " "
+ echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
+ echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+ fi
}
-# ----------------- 程序启动 -----------------
-
-# 删除 Shell 脚本自身
-rm -f "$0"
-
-# 检查执行用户权限
-if [ "$(whoami)" != "root" ]; then
- if [ "$zh" == 1 ]; then
- Red_Error "[x] 请使用 root 权限执行 MCSManager 安装命令!"
- else
- Red_Error "[x] Please execute the MCSManager installation command with root permission!"
- fi
-fi
-echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-+----------------------------------------------------------------------
-"
-# 环境检查
+# Environmental inspection
if [ "$arch" == x86_64 ]; then
- arch=x64
- #echo "[-] x64 architecture detected"
+ arch=x64
+ #echo "[-] x64 architecture detected"
elif [ $arch == aarch64 ]; then
- arch=arm64
- #echo "[-] 64-bit ARM architecture detected"
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
elif [ $arch == arm ]; then
- arch=armv7l
- #echo "[-] 32-bit ARM architecture detected"
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
elif [ $arch == ppc64le ]; then
- arch=ppc64le
- #echo "[-] IBM POWER architecture detected"
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
elif [ $arch == s390x ]; then
- arch=s390x
- #echo "[-] IBM LinuxONE architecture detected"
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
else
- if [ "$zh" == 1 ]; then
- Red_Error "[x] 抱歉,暂不支持您的 体系架构($arch)!"
- else
- Red_Error "[x] Sorry, this architecture is not supported yet!"
- fi
- exit
+ Red_Error "[x] Sorry, this architecture is not supported yet!"
+ Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
+ exit
fi
-# 定义变量 Node 安装目录
+# Define the variable Node installation directory
node_install_path="/opt/node-$node-linux-$arch"
-# 检查网络连接
-if [ "$zh" == 1 ]; then
- echo_cyan "[-] 体系架构:$arch"
-else
- echo_cyan "[-] Architecture: $arch"
-fi
-
-# MCSManager 已安装
-if [ -d "$mcsmanager_install_path" ]; then
- printf "\033c"
- if [ "$zh" == 1 ]; then
- echo_red "----------------------------------------------------
-检查到已有 MCSManager 安装在 \"$mcsmanager_install_path\"
-继续安装会删除原有 MCSManager 面版的所有数据!
-----------------------------------------------------
-将在 10 秒后继续安装,取消请按 Ctrl + Z/C 键!"
- else
- echo_red "----------------------------------------------------
-MCSManager is installed at \"$mcsmanager_install_path\"
-Continuing the installation will delete the original MCSManager!
-----------------------------------------------------
-Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
- fi
- sleep 10
-fi
+# Check network connection
+echo_cyan "[-] Architecture: $arch"
-# 安装相关软件
-if [ "$zh" == 1 ]; then
- echo_cyan_n "[-] 安装相关软件(git,tar)... "
-else
- echo_cyan_n "[+] Installing dependent software(git,tar)... "
-fi
-if [ -x "$(command -v yum)" ]; then
- yum install -y git tar >error
-elif [ -x "$(command -v apt-get)" ]; then
- apt-get install -y git tar >error
-elif [ -x "$(command -v pacman)" ]; then
- pacman -Syu --noconfirm git tar >error
-elif [ -x "$(command -v zypper)" ]; then
- zypper --non-interactive install git tar >error
+# Install related software
+echo_cyan_n "[+] Installing dependent software(git,tar)... "
+if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
+elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
+elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
+elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
fi
-# 判断相关软件是否安装成功
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
- if [ "$zh" == 1 ]; then
- echo_green "成功"
- else
- echo_green "Success"
- fi
-else
- if [ "$zh" == 1 ]; then
- echo_red "失败"
- else
- echo_red "Failed"
- fi
+# Determine whether the relevant software is installed successfully
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
echo "$error"
- if [ "$zh" == 1 ]; then
- Red_Error "[x] 相关软件安装失败,请手动安装 git 和 tar 软件包!"
- else
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- fi
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
exit
fi
-# 安装 Node 环境
+
+# Install the Node environment
Install_Node
-# 安装 MCSManager
+# Install MCSManager
Install_MCSManager
-# 创建 MCSManager 后台服务
+# Create MCSManager background service
Create_Service
+
diff --git a/setup_en.sh b/setup_en.sh
index 75f229f..341fc97 100644
--- a/setup_en.sh
+++ b/setup_en.sh
@@ -1,18 +1,11 @@
#!/bin/bash
-printf "\033c"
-error=""
-node="v14.19.1"
-arch=$(uname -m)
-mcsmanager_install_path="/opt/mcsmanager"
+printf "\033c"
-Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
+# print func
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
}
-
echo_red() {
printf '\033[1;31m%b\033[0m\n' "$@"
}
@@ -21,10 +14,6 @@ echo_green() {
printf '\033[1;32m%b\033[0m\n' "$@"
}
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
-
echo_cyan_n() {
printf '\033[1;36m%b\033[0m' "$@"
}
@@ -33,8 +22,34 @@ echo_yellow() {
printf '\033[1;33m%b\033[0m\n' "$@"
}
+# script info
+echo_cyan "+----------------------------------------------------------------------
+| MCSManager Installer
++----------------------------------------------------------------------
+| Copyright © 2023 MCSManager.
++----------------------------------------------------------------------
+| Contributors: Nuomiaa, CreeperKong, Unitwk, FunnyShadow
++----------------------------------------------------------------------
+"
+
+# Config
+mcsmanager_install_path="/opt/mcsmanager"
+mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+node="v14.19.1"
+
+error=""
+arch=$(uname -m)
+
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
+
+
Install_Node() {
- echo_cyan_n "[+] Install Node environment... "
+ echo_cyan_n "[+] Install Node.JS environment... "
rm -irf "$node_install_path"
@@ -55,54 +70,49 @@ Install_Node() {
fi
echo
- echo_yellow "=============== Node Version ==============="
+ echo_yellow "=============== Node.JS Version ==============="
echo_yellow " node: $("$node_install_path"/bin/node -v)"
echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node Version ==============="
+ echo_yellow "=============== Node.JS Version ==============="
echo
sleep 3
}
+
Install_MCSManager() {
echo_cyan "[+] Install MCSManager..."
- # delete service
- rm -f /etc/systemd/system/mcsm-daemon.service
- rm -f /etc/systemd/system/mcsm-web.service
+ # stop service
+ systemctl stop mcsm-{web,daemon}
- # reload
+ # delete service
+ rm -rf /etc/systemd/system/mcsm-daemon.service
+ rm -rf /etc/systemd/system/mcsm-web.service
systemctl daemon-reload
-
- # echo "[x] Delete the original MCSManager"
- rm -irf ${mcsmanager_install_path}
- # echo "[+] mkdir -p ${mcsmanager_install_path}"
mkdir -p ${mcsmanager_install_path} || exit
- # echo "[→] cd ${mcsmanager_install_path}"
+ # cd /opt/mcsmanager
cd ${mcsmanager_install_path} || exit
- echo_cyan "[↓] Git clone MCSManager-Daemon..."
- git clone --single-branch -b master --depth 1 https://github.com/MCSManager/MCSManager-Daemon-Production.git daemon
+ # donwload MCSManager release
+ wget ${mcsmanager_donwload_addr}
+ tar -zxf mcsmanager_linux_release.tar.gz -o
+ rm -rf "${mcsmanager_install_path}/mcsmanager_linux_release.tar.gz"
+
# echo "[→] cd daemon"
cd daemon || exit
echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
# echo "[←] cd .."
- cd ..
-
- echo_cyan "[↓] Git clone MCSManager-Web..."
- git clone --single-branch -b master --depth 1 https://github.com/MCSManager/MCSManager-Web-Production.git web
-
- # echo "[→] cd web"
- cd web || exit
+ cd ../web || exit
echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com > error
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
echo
echo_yellow "=============== MCSManager ==============="
@@ -125,7 +135,7 @@ Description=MCSManager Daemon
[Service]
WorkingDirectory=/opt/mcsmanager/daemon
ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
+ExecReload=/bin/kill -s QUIT $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Environment=\"PATH=${PATH}\"
@@ -140,7 +150,7 @@ Description=MCSManager Web
[Service]
WorkingDirectory=/opt/mcsmanager/web
ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s HUP $MAINPID
+ExecReload=/bin/kill -s QUIT $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Environment=\"PATH=${PATH}\"
@@ -154,46 +164,27 @@ WantedBy=multi-user.target
sleep 3
- printf "\033c"
+ printf "\n\n"
+
echo_yellow "=================================================================="
- echo_green "Welcome to MCSManager, you can access it by the following ways:"
- echo_yellow "=================================================================="
- echo_cyan_n "Daemon Service Address: "; echo_yellow "http://localhost:24444"
- echo_cyan_n "Web Service Address: "; echo_yellow "http://localhost:23333"
- echo_cyan_n "Username: "; echo_yellow "root"
- echo_cyan_n "Password: "; echo_yellow "123456"
+ echo_green "Installation is complete! Welcome to the MCSManager panel !!!"
+ echo_yellow " "
+ echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
+ echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow "=================================================================="
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
echo_cyan "systemctl restart mcsm-{daemon,web}.service"
echo_cyan "systemctl disable mcsm-{daemon,web}.service"
echo_cyan "systemctl enable mcsm-{daemon,web}.service"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "More info: https://docs.mcsmanager.com/"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
-
-
}
-# ----------------- Program Start -----------------
-
-# delete the shell script itself
-rm -f "$0"
-
-# Check execute user permissions
-if [ "$(whoami)" != "root" ]; then
- Red_Error "[x] Please execute the MCSManager installation command with root permission!"
-fi
-
-echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2022 MCSManager All rights reserved.
-+----------------------------------------------------------------------
-| Shell Install Script by Nuomiaa & CreeperKong
-+----------------------------------------------------------------------
-"
# Environmental inspection
if [ "$arch" == x86_64 ]; then
@@ -213,6 +204,7 @@ elif [ $arch == s390x ]; then
#echo "[-] IBM LinuxONE architecture detected"
else
Red_Error "[x] Sorry, this architecture is not supported yet!"
+ Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
exit
fi
@@ -222,17 +214,6 @@ node_install_path="/opt/node-$node-linux-$arch"
# Check network connection
echo_cyan "[-] Architecture: $arch"
-# MCSManager Installed
-if [ -d "$mcsmanager_install_path" ]; then
- printf "\033c"
- echo_red "----------------------------------------------------
-MCSManager is installed at \"$mcsmanager_install_path\"
-Continuing the installation will delete the original MCSManager!
-----------------------------------------------------
-Installation will continue in 10 seconds, press Ctrl + Z/C to cancel!"
- sleep 10
-fi
-
# Install related software
echo_cyan_n "[+] Installing dependent software(git,tar)... "
if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
From 3df05f28e510daeb99d838f34043ae09e21420b8 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 21:07:21 +0800
Subject: [PATCH 072/460] Sync code
---
setup_cn.sh | 26 +++++++++++++-------------
setup_en.sh | 26 ++++++++++++++------------
2 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index 99d7fa7..ebfdf72 100644
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -1,5 +1,17 @@
#!/bin/bash
+# Config
+mcsmanager_install_path="/opt/mcsmanager"
+mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+node="v14.19.1"
+zh=$(
+ [[ $(locale -a) =~ "zh" ]] && echo 1
+ export LANG=zh_CN.UTF-8 || echo 0
+)
+
+error=""
+arch=$(uname -m)
+
printf "\033c"
# print func
@@ -24,7 +36,7 @@ echo_yellow() {
# script info
echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer (Chinese Version)
+| MCSManager Installer
+----------------------------------------------------------------------
| Copyright © 2023 MCSManager.
+----------------------------------------------------------------------
@@ -35,18 +47,6 @@ We will use servers in the China to speed up your installation!
我们将使用中国地区的服务器来加速您的安装速度!
"
-# Config
-mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
-node="v14.19.1"
-zh=$(
- [[ $(locale -a) =~ "zh" ]] && echo 1
- export LANG=zh_CN.UTF-8 || echo 0
-)
-
-error=""
-arch=$(uname -m)
-
Red_Error() {
echo '================================================='
printf '\033[1;31;40m%b\033[0m\n' "$@"
diff --git a/setup_en.sh b/setup_en.sh
index 341fc97..d691c47 100644
--- a/setup_en.sh
+++ b/setup_en.sh
@@ -1,5 +1,17 @@
#!/bin/bash
+# Config
+mcsmanager_install_path="/opt/mcsmanager"
+mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+node="v14.19.1"
+zh=$(
+ [[ $(locale -a) =~ "zh" ]] && echo 1
+ export LANG=zh_CN.UTF-8 || echo 0
+)
+
+error=""
+arch=$(uname -m)
+
printf "\033c"
# print func
@@ -32,14 +44,6 @@ echo_cyan "+--------------------------------------------------------------------
+----------------------------------------------------------------------
"
-# Config
-mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
-node="v14.19.1"
-
-error=""
-arch=$(uname -m)
-
Red_Error() {
echo '================================================='
printf '\033[1;31;40m%b\033[0m\n' "$@"
@@ -55,7 +59,7 @@ Install_Node() {
cd /opt || exit
- wget -o /dev/null https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
+ wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
tar -zxf node-"$node"-linux-"$arch".tar.gz
@@ -177,11 +181,9 @@ WantedBy=multi-user.target
echo_cyan "systemctl start mcsm-{daemon,web}.service"
echo_cyan "systemctl stop mcsm-{daemon,web}.service"
echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "systemctl enable mcsm-{daemon,web}.service"
echo_yellow " "
echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ echo_yellow "=================================================================="
}
From dfad89277a782f51f9e2656040ed9cb4e30e2791 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 21:07:33 +0800
Subject: [PATCH 073/460] Sync code
---
setup.sh | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/setup.sh b/setup.sh
index 341fc97..d691c47 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,5 +1,17 @@
#!/bin/bash
+# Config
+mcsmanager_install_path="/opt/mcsmanager"
+mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+node="v14.19.1"
+zh=$(
+ [[ $(locale -a) =~ "zh" ]] && echo 1
+ export LANG=zh_CN.UTF-8 || echo 0
+)
+
+error=""
+arch=$(uname -m)
+
printf "\033c"
# print func
@@ -32,14 +44,6 @@ echo_cyan "+--------------------------------------------------------------------
+----------------------------------------------------------------------
"
-# Config
-mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
-node="v14.19.1"
-
-error=""
-arch=$(uname -m)
-
Red_Error() {
echo '================================================='
printf '\033[1;31;40m%b\033[0m\n' "$@"
@@ -55,7 +59,7 @@ Install_Node() {
cd /opt || exit
- wget -o /dev/null https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
+ wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
tar -zxf node-"$node"-linux-"$arch".tar.gz
@@ -177,11 +181,9 @@ WantedBy=multi-user.target
echo_cyan "systemctl start mcsm-{daemon,web}.service"
echo_cyan "systemctl stop mcsm-{daemon,web}.service"
echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_cyan "systemctl disable mcsm-{daemon,web}.service"
- echo_cyan "systemctl enable mcsm-{daemon,web}.service"
echo_yellow " "
echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ echo_yellow "=================================================================="
}
From dcae1969344f3d60cc4582d501bef20978a60f07 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 21:25:02 +0800
Subject: [PATCH 074/460] Feat: gitee -> github
---
setup.sh | 2 +-
setup_en.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup.sh b/setup.sh
index d691c47..b3b3675 100644
--- a/setup.sh
+++ b/setup.sh
@@ -2,7 +2,7 @@
# Config
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
node="v14.19.1"
zh=$(
[[ $(locale -a) =~ "zh" ]] && echo 1
diff --git a/setup_en.sh b/setup_en.sh
index d691c47..b3b3675 100644
--- a/setup_en.sh
+++ b/setup_en.sh
@@ -2,7 +2,7 @@
# Config
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
node="v14.19.1"
zh=$(
[[ $(locale -a) =~ "zh" ]] && echo 1
From 07bcfade8407b22a34e317d6d3fa121beabdedae Mon Sep 17 00:00:00 2001
From: unitwk
Date: Mon, 5 Jun 2023 21:48:39 +0800
Subject: [PATCH 075/460] Feat: add better download addr
---
setup.sh | 8 +++-----
setup_cn.sh | 4 +++-
setup_en.sh | 8 +++-----
3 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/setup.sh b/setup.sh
index b3b3675..cfe8539 100644
--- a/setup.sh
+++ b/setup.sh
@@ -2,12 +2,8 @@
# Config
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz"
node="v14.19.1"
-zh=$(
- [[ $(locale -a) =~ "zh" ]] && echo 1
- export LANG=zh_CN.UTF-8 || echo 0
-)
error=""
arch=$(uname -m)
@@ -59,6 +55,8 @@ Install_Node() {
cd /opt || exit
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
tar -zxf node-"$node"-linux-"$arch".tar.gz
diff --git a/setup_cn.sh b/setup_cn.sh
index ebfdf72..1ad0582 100644
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -2,7 +2,7 @@
# Config
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/release/mcsmanager_linux_release.tar.gz"
node="v14.19.1"
zh=$(
[[ $(locale -a) =~ "zh" ]] && echo 1
@@ -62,6 +62,8 @@ Install_Node() {
cd /opt || exit
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
wget https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
tar -zxf node-"$node"-linux-"$arch".tar.gz
diff --git a/setup_en.sh b/setup_en.sh
index b3b3675..cfe8539 100644
--- a/setup_en.sh
+++ b/setup_en.sh
@@ -2,12 +2,8 @@
# Config
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
+mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz"
node="v14.19.1"
-zh=$(
- [[ $(locale -a) =~ "zh" ]] && echo 1
- export LANG=zh_CN.UTF-8 || echo 0
-)
error=""
arch=$(uname -m)
@@ -59,6 +55,8 @@ Install_Node() {
cd /opt || exit
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
tar -zxf node-"$node"-linux-"$arch".tar.gz
From 57dd9ce811fc5de9cdf24dc4ab90ef06652efa9c Mon Sep 17 00:00:00 2001
From: jgc9527
Date: Wed, 28 Jun 2023 13:07:33 +0800
Subject: [PATCH 076/460] =?UTF-8?q?=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20?=
=?UTF-8?q?=20=20setup=5Fcn.sh?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
error | 13 +++++++++++++
setup_cn.sh | 8 +++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 error
mode change 100644 => 100755 setup_cn.sh
diff --git a/error b/error
new file mode 100644
index 0000000..a063f80
--- /dev/null
+++ b/error
@@ -0,0 +1,13 @@
+正在读取软件包列表...
+正在分析软件包的依赖关系树...
+正在读取状态信息...
+git 已经是最新版 (1:2.30.2-1+deb11u2)。
+tar 已经是最新版 (1.34+dfsg-1)。
+下列软件包是自动安装的并且现在不需要了:
+ bsdmainutils geoip-database libbind9-161 libdns1104 libdns1110 libgeoip1
+ libicu63 libisc1100 libisc1105 libisccc161 libisccfg163 liblwres161
+ libmpdec2 libperl5.28 libpython2-stdlib libpython3.7-minimal
+ libpython3.7-stdlib linux-image-4.19.0-6-amd64 ncal python2 python2-minimal
+ python3.7-minimal
+使用'apt autoremove'来卸载它(它们)。
+升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 8 个软件包未被升级。
diff --git a/setup_cn.sh b/setup_cn.sh
old mode 100644
new mode 100755
index 1ad0582..eaf60ef
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -1,5 +1,11 @@
#!/bin/bash
-
+# 检查当前用户是否为 root 用户
+if [ $(id -u) -ne 0 ]; then
+ echo -e "\033[31m需要 root 权限执行此脚本,请使用 sudo 或者切换到 root 用户。\033[0m"
+ exit 1
+fi
+# 如果当前用户是 root 用户,则执行脚本的主体部分
+echo -e "\033[33m当前用户是 root 用户,开始执行 MCSManager 安装脚本。\033[0m"
# Config
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/release/mcsmanager_linux_release.tar.gz"
From bfa8b3df875f3a349aacdf260dd67f29a0631c2a Mon Sep 17 00:00:00 2001
From: jgc9527
Date: Wed, 28 Jun 2023 13:10:51 +0800
Subject: [PATCH 077/460] =?UTF-8?q?=09=E5=88=A0=E9=99=A4=EF=BC=9A=20=20=20?=
=?UTF-8?q?=20=20error?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
error | 13 -------------
1 file changed, 13 deletions(-)
delete mode 100644 error
diff --git a/error b/error
deleted file mode 100644
index a063f80..0000000
--- a/error
+++ /dev/null
@@ -1,13 +0,0 @@
-正在读取软件包列表...
-正在分析软件包的依赖关系树...
-正在读取状态信息...
-git 已经是最新版 (1:2.30.2-1+deb11u2)。
-tar 已经是最新版 (1.34+dfsg-1)。
-下列软件包是自动安装的并且现在不需要了:
- bsdmainutils geoip-database libbind9-161 libdns1104 libdns1110 libgeoip1
- libicu63 libisc1100 libisc1105 libisccc161 libisccfg163 liblwres161
- libmpdec2 libperl5.28 libpython2-stdlib libpython3.7-minimal
- libpython3.7-stdlib linux-image-4.19.0-6-amd64 ncal python2 python2-minimal
- python3.7-minimal
-使用'apt autoremove'来卸载它(它们)。
-升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 8 个软件包未被升级。
From 33af138b1fb8efe8dd64c3917f695ac655cf01c5 Mon Sep 17 00:00:00 2001
From: Lily Chou
Date: Tue, 4 Jul 2023 16:13:54 +0800
Subject: [PATCH 078/460] fix: zypper needs sudo to run
---
setup.sh | 2 +-
setup_cn.sh | 2 +-
setup_en.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/setup.sh b/setup.sh
index cfe8539..e0d382c 100644
--- a/setup.sh
+++ b/setup.sh
@@ -219,7 +219,7 @@ echo_cyan_n "[+] Installing dependent software(git,tar)... "
if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
-elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
+elif [ -x "$(command -v zypper)" ]; then sudo zypper --non-interactive install git tar > error;
fi
# Determine whether the relevant software is installed successfully
diff --git a/setup_cn.sh b/setup_cn.sh
index eaf60ef..861c41f 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -248,7 +248,7 @@ echo_cyan_n "[+] Installing dependent software(git,tar)... "
if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
-elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
+elif [ -x "$(command -v zypper)" ]; then sudo zypper --non-interactive install git tar > error;
fi
# Determine whether the relevant software is installed successfully
diff --git a/setup_en.sh b/setup_en.sh
index cfe8539..e0d382c 100644
--- a/setup_en.sh
+++ b/setup_en.sh
@@ -219,7 +219,7 @@ echo_cyan_n "[+] Installing dependent software(git,tar)... "
if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
-elif [ -x "$(command -v zypper)" ]; then zypper --non-interactive install git tar > error;
+elif [ -x "$(command -v zypper)" ]; then sudo zypper --non-interactive install git tar > error;
fi
# Determine whether the relevant software is installed successfully
From 5a08432506b52541367672dcfd480dd6723b72b2 Mon Sep 17 00:00:00 2001
From: huangsijun17
Date: Mon, 16 Oct 2023 13:19:09 +0800
Subject: [PATCH 079/460] Modify the judgment statement to comply with
standards and be compatible with zsh.
---
setup.sh | 20 ++++++++++----------
setup_cn.sh | 24 ++++++++++++------------
setup_en.sh | 20 ++++++++++----------
3 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/setup.sh b/setup.sh
index e0d382c..f5e7ef2 100644
--- a/setup.sh
+++ b/setup.sh
@@ -63,7 +63,7 @@ Install_Node() {
rm -rf node-"$node"-linux-"$arch".tar.gz
- if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]
then
echo_green "Success"
else
@@ -187,19 +187,19 @@ WantedBy=multi-user.target
# Environmental inspection
-if [ "$arch" == x86_64 ]; then
+if [[ "$arch" == x86_64 ]]; then
arch=x64
#echo "[-] x64 architecture detected"
-elif [ $arch == aarch64 ]; then
+elif [[ $arch == aarch64 ]]; then
arch=arm64
#echo "[-] 64-bit ARM architecture detected"
-elif [ $arch == arm ]; then
+elif [[ $arch == arm ]]; then
arch=armv7l
#echo "[-] 32-bit ARM architecture detected"
-elif [ $arch == ppc64le ]; then
+elif [[ $arch == ppc64le ]]; then
arch=ppc64le
#echo "[-] IBM POWER architecture detected"
-elif [ $arch == s390x ]; then
+elif [[ $arch == s390x ]]; then
arch=s390x
#echo "[-] IBM LinuxONE architecture detected"
else
@@ -216,10 +216,10 @@ echo_cyan "[-] Architecture: $arch"
# Install related software
echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
-elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
-elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
-elif [ -x "$(command -v zypper)" ]; then sudo zypper --non-interactive install git tar > error;
+if [[ -x "$(command -v yum)" ]]; then yum install -y git tar > error;
+elif [[ -x "$(command -v apt-get)" ]]; then apt-get install -y git tar > error;
+elif [[ -x "$(command -v pacman)" ]]; then pacman -Syu --noconfirm git tar > error;
+elif [[ -x "$(command -v zypper)" ]]; then sudo zypper --non-interactive install git tar > error;
fi
# Determine whether the relevant software is installed successfully
diff --git a/setup_cn.sh b/setup_cn.sh
index 861c41f..24518f6 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# 检查当前用户是否为 root 用户
-if [ $(id -u) -ne 0 ]; then
+if [[ $(id -u) -ne 0 ]]; then
echo -e "\033[31m需要 root 权限执行此脚本,请使用 sudo 或者切换到 root 用户。\033[0m"
exit 1
fi
@@ -76,7 +76,7 @@ Install_Node() {
rm -rf node-"$node"-linux-"$arch".tar.gz
- if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]
then
echo_green "Success"
else
@@ -181,7 +181,7 @@ WantedBy=multi-user.target
printf "\n\n"
echo_yellow "=================================================================="
- if [ "$zh" == 1 ]; then
+ if [[ "$zh" == 1 ]]; then
echo_green "安装已完成!欢迎使用 MCSManager 面板!"
echo_yellow " "
echo_cyan_n "控制面板地址: "
@@ -216,19 +216,19 @@ WantedBy=multi-user.target
# Environmental inspection
-if [ "$arch" == x86_64 ]; then
+if [[ "$arch" == x86_64 ]]; then
arch=x64
#echo "[-] x64 architecture detected"
-elif [ $arch == aarch64 ]; then
+elif [[ $arch == aarch64 ]]; then
arch=arm64
#echo "[-] 64-bit ARM architecture detected"
-elif [ $arch == arm ]; then
+elif [[ $arch == arm ]]; then
arch=armv7l
#echo "[-] 32-bit ARM architecture detected"
-elif [ $arch == ppc64le ]; then
+elif [[ $arch == ppc64le ]]; then
arch=ppc64le
#echo "[-] IBM POWER architecture detected"
-elif [ $arch == s390x ]; then
+elif [[ $arch == s390x ]]; then
arch=s390x
#echo "[-] IBM LinuxONE architecture detected"
else
@@ -245,10 +245,10 @@ echo_cyan "[-] Architecture: $arch"
# Install related software
echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
-elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
-elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
-elif [ -x "$(command -v zypper)" ]; then sudo zypper --non-interactive install git tar > error;
+if [[ -x "$(command -v yum)" ]]; then yum install -y git tar > error;
+elif [[ -x "$(command -v apt-get)" ]]; then apt-get install -y git tar > error;
+elif [[ -x "$(command -v pacman)" ]]; then pacman -Syu --noconfirm git tar > error;
+elif [[ -x "$(command -v zypper)" ]]; then sudo zypper --non-interactive install git tar > error;
fi
# Determine whether the relevant software is installed successfully
diff --git a/setup_en.sh b/setup_en.sh
index e0d382c..f5e7ef2 100644
--- a/setup_en.sh
+++ b/setup_en.sh
@@ -63,7 +63,7 @@ Install_Node() {
rm -rf node-"$node"-linux-"$arch".tar.gz
- if [ -f "$node_install_path"/bin/node ] && [ "$("$node_install_path"/bin/node -v)" == "$node" ]
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]
then
echo_green "Success"
else
@@ -187,19 +187,19 @@ WantedBy=multi-user.target
# Environmental inspection
-if [ "$arch" == x86_64 ]; then
+if [[ "$arch" == x86_64 ]]; then
arch=x64
#echo "[-] x64 architecture detected"
-elif [ $arch == aarch64 ]; then
+elif [[ $arch == aarch64 ]]; then
arch=arm64
#echo "[-] 64-bit ARM architecture detected"
-elif [ $arch == arm ]; then
+elif [[ $arch == arm ]]; then
arch=armv7l
#echo "[-] 32-bit ARM architecture detected"
-elif [ $arch == ppc64le ]; then
+elif [[ $arch == ppc64le ]]; then
arch=ppc64le
#echo "[-] IBM POWER architecture detected"
-elif [ $arch == s390x ]; then
+elif [[ $arch == s390x ]]; then
arch=s390x
#echo "[-] IBM LinuxONE architecture detected"
else
@@ -216,10 +216,10 @@ echo_cyan "[-] Architecture: $arch"
# Install related software
echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [ -x "$(command -v yum)" ]; then yum install -y git tar > error;
-elif [ -x "$(command -v apt-get)" ]; then apt-get install -y git tar > error;
-elif [ -x "$(command -v pacman)" ]; then pacman -Syu --noconfirm git tar > error;
-elif [ -x "$(command -v zypper)" ]; then sudo zypper --non-interactive install git tar > error;
+if [[ -x "$(command -v yum)" ]]; then yum install -y git tar > error;
+elif [[ -x "$(command -v apt-get)" ]]; then apt-get install -y git tar > error;
+elif [[ -x "$(command -v pacman)" ]]; then pacman -Syu --noconfirm git tar > error;
+elif [[ -x "$(command -v zypper)" ]]; then sudo zypper --non-interactive install git tar > error;
fi
# Determine whether the relevant software is installed successfully
From 6c9f0c37f927b262aba5cc66e0d218444184e54f Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 17:57:30 +0800
Subject: [PATCH 080/460] Updating the Docker Installation Method
---
docker/README.md | 76 --------------
docker/README_cn.md | 77 --------------
docker/build/Dockerfile | 29 ++++++
docker/build/build.py | 83 +++++++++++++++
docker/build/entrypoint.sh | 23 +++++
docker/docs/README.md | 180 +++++++++++++++++++++++++++++++++
docker/docs/README_cn.md | 178 ++++++++++++++++++++++++++++++++
docker/examples/cn/daemon.yaml | 22 ++--
docker/examples/cn/full.yaml | 42 ++++----
docker/examples/cn/web.yaml | 22 ++--
10 files changed, 540 insertions(+), 192 deletions(-)
delete mode 100644 docker/README.md
delete mode 100644 docker/README_cn.md
create mode 100644 docker/build/Dockerfile
create mode 100755 docker/build/build.py
create mode 100644 docker/build/entrypoint.sh
create mode 100644 docker/docs/README.md
create mode 100644 docker/docs/README_cn.md
diff --git a/docker/README.md b/docker/README.md
deleted file mode 100644
index 8e0ccc3..0000000
--- a/docker/README.md
+++ /dev/null
@@ -1,76 +0,0 @@
-# Install MCSManager with Docker
-
-## Prerequisites
-
-You need to prepare the following before installation:
-
-- `docker` version `17.12.0+` has been installed
-- `docker-compose` has been installed
-
-## Start installation
-
-First, use the following command to create the basic directory of `docker-compose`
-
-```bash
-mkdir -p mcsmanager
-cd mcsmanager
-```
-
-Then, create an empty file named `docker-compose.yaml`
-
-```bash
-touch docker-compose.yaml
-```
-
-If you are a new user, please copy the configuration file below, modify the part marked with comments, and paste it into `docker-compose.yaml`
-
-If you cannot copy or paste this file, you can also click [here](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/full.yaml) to get the sample file
-
-```yaml
-version: "2.4"
-
-services:
- web:
- image: bluefunny/mcsm-web:latest
- volumes:
- # This is the MCSManager control panel log storage directory
- # The default is [/var/logs/mcsmanager/web]
- - /var/logs/mcsmanager/web:/logs
-
- # This is the MCSManager control panel log storage directory
- # The default is the data/web folder under the current directory
- - ./data/web:/data
- network_mode: host
- command: /start
-
- daemon:
- image: bluefunny/mcsm-daemon:latest
- volumes:
- # This is the MCSManager control panel log storage directory
- # The default is [/var/logs/mcsmanager/daemon]
- - /var/logs/mcsmanager/daemon:/logs
-
- # This is the MCSManager control panel log storage directory
- # The default is the data/daemon folder under the current directory
- - ./data/daemon:/data
- network_mode: host
- command: /start
-```
-
-If you are an old user and only plan to install a certain component of MCSManager (such as only installing the MCSManager daemon), please refer to the following two sample files and modify the part marked with comments
-
-- [MCSManager web](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/web.yaml)
-- [MCSManager daemon](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/daemon.yaml)
-
-After all the above operations are completed, please run the following command to start MCSManager
-
-```bash
-docker-compose -f docker-compose.yaml up -d
-```
-
-If everything runs normally, you can soon access `http://127.0.0.1:23333` to view the panel you just built!
-
-If you modify (or update) the `docker-compose.yaml` file later, please move it back to the directory and run the following command to make the modification take effect
-
-```bash
-docker-compose up -d
diff --git a/docker/README_cn.md b/docker/README_cn.md
deleted file mode 100644
index e78511a..0000000
--- a/docker/README_cn.md
+++ /dev/null
@@ -1,77 +0,0 @@
-# 通过 Docker 安装 MCSManager
-
-## 预先准备
-
-你需要提前做好以下几点准备
-
-- 已经安装了 `17.12.0+` 版本的 `docker`
-- 已经安装了 `docker-compose`
-
-## 开始安装
-
-首先, 请先使用以下命令创建 `docker-compose` 基本目录
-
-```bash
-mkdir -p mcsmanager
-cd mcsmanager
-```
-
-然后, 创建一个名为 `docker-compose.yaml` 的空文件
-
-```bash
-touch docker-compose.yaml
-```
-
-如果你是一个新用户, 请复制下面的配置文件, 修改其中注释标出的部分, 粘贴到 `docker-compose.yaml` 中即可
-
-如果你无法复制或粘贴此文件, 你也可以[点击此处](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/full.yaml)获取示例文件
-
-```yaml
-version: "2.4"
-
-services:
- web:
- image: bluefunny/mcsm-web:latest
- volumes:
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为 [/var/logs/mcsmanager/web]
- - /var/logs/mcsmanager/web:/logs
-
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为当前目录下的 data/web 文件夹
- - ./data/web:/data
- network_mode: host
- command: /start
-
- daemon:
- image: bluefunny/mcsm-daemon:latest
- volumes:
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为 [/var/logs/mcsmanager/daemon]
- - /var/logs/mcsmanager/daemon:/logs
-
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为当前目录下的 data/daemon 文件夹
- - ./data/daemon:/data
- network_mode: host
- command: /start
-```
-
-如果你是一个老用户, 并且只准备安装 MCSManager 的某个组件 (如仅安装 MCSManager 守护程序), 请查看下面这两个示例文件, 并修改其中注释标出的部分
-
-- [MCSManager 控制面板](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/web.yaml)
-- [MCSManager 守护程序](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/daemon.yaml)
-
-当上述操作全部完成后, 请运行以下命令以启动 MCSManager
-
-```bash
-docker-compose -f docker-compose.yaml up -d
-```
-
-如果一切都运行正常, 那么不久后你就可以访问 `http://127.0.0.1:23333` 来查看你刚刚搭建好的面板了 !
-
-如果你后期修改(或更新)了 `docker-compose.yaml` 文件, 请重新移动到该目录, 并运行以下命令以使修改生效
-
-```bash
-docker-compose up -d
-```
diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile
new file mode 100644
index 0000000..d2488e8
--- /dev/null
+++ b/docker/build/Dockerfile
@@ -0,0 +1,29 @@
+ARG TYPE
+ARG VERSION
+FROM debian:stable-slim AS base
+
+RUN sed -i.bak 's/deb.debian.org/mirrors.cernet.edu.cn/g' /etc/apt/sources.list.d/debian.sources \
+ && sed -i.bak 's|security.debian.org/debian-security|mirrors.cernet.edu.cn/debian-security|g' /etc/apt/sources.list.d/debian.sources \
+ && apt-get update -y \
+ && apt-get install -y curl ca-certificates openssl git tar sqlite3 fontconfig tzdata iproute2 gettext-base wget \
+ && apt-get clean
+
+RUN cd /tmp \
+ && wget https://nodejs.org/dist/latest-v20.x/node-v20.11.1-linux-x64.tar.gz -O node.tar.gz \
+ && wget https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz -O mcsmanager.tar.gz \
+ && tar -xzf node.tar.gz -C /opt/node --strip-components=1 \
+ && tar -xzf mcsmanager.tar.gz -C /tmp/mcsmanager \
+ && mv -f /tmp/mcsmanager/${TYPE} /opt/${TYPE} \
+ && rm -rf /tmp/mcsmanager \
+ && rm -rf node.tar.gz \
+ && rm -rf mcsmanager.tar.gz
+
+RUN cd /opt/${TYPE} \
+ && /opt/node/bin/npm install --production
+
+USER mcsmanager
+ENV USER=mcsmanager HOME=/home/mcsmanager
+
+WORKDIR /opt/${TYPE}
+COPY ./entrypoint.sh /
+CMD ["/bin/bash", "/entrypoint.sh"]
diff --git a/docker/build/build.py b/docker/build/build.py
new file mode 100755
index 0000000..6a4eb62
--- /dev/null
+++ b/docker/build/build.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python3
+import argparse
+import os
+import subprocess
+import sys
+from typing import Iterator, NamedTuple
+
+class Context(NamedTuple):
+ type: str
+ version: str
+ tag: str
+
+
+def iterate_all() -> Iterator[Context]:
+ for type in ['daemon', 'web']:
+ for version in [9]:
+ tag = f'bluefunny/mcsmanager:{type}-{version}'
+ yield Context(type, str(version) , tag)
+
+
+def cmd_build(args: argparse.Namespace):
+ for ctx in iterate_all():
+ print(f'======== MCSManager | Type: {ctx.type}, Version: {ctx.version}, Tag: {ctx.tag!r} ========')
+
+ cmd = [
+ 'docker', 'build', os.getcwd(),
+ '-t', ctx.tag,
+ '--build-arg', f'TYPE={ctx.type}',
+ '--build-arg', f'VERSION={ctx.version}',
+ ]
+
+ if args.http_proxy is not None:
+ cmd.extend([
+ '--build-arg', f'http_proxy={args.http_proxy}',
+ '--build-arg', f'https_proxy={args.http_proxy}',
+ ])
+ subprocess.check_call(cmd)
+
+ if args.push:
+ subprocess.check_call(['docker', 'push', ctx.tag])
+
+
+def cmd_push(args: argparse.Namespace):
+ for ctx in iterate_all():
+ subprocess.check_call(['docker', 'push', ctx.tag])
+
+
+def cmd_delete(args: argparse.Namespace):
+ for ctx in iterate_all():
+ subprocess.check_call(['docker', 'image', 'rm', ctx.tag])
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ subparsers = parser.add_subparsers(title='Command', help='Available commands', dest='command', required=True)
+
+ parser_build = subparsers.add_parser('build', help='Build all images')
+ parser_build.add_argument('-p', '--push', action='store_true', help='Push after build')
+ parser_build.add_argument('--http-proxy', help='Set the url of http proxy to be used in build')
+
+ subparsers.add_parser('push', help='Push all images')
+ subparsers.add_parser('delete', help='Delete all images')
+
+ args = parser.parse_args()
+
+ if args.command == 'build':
+ cmd_build(args)
+ elif args.command == 'push':
+ cmd_push(args)
+ elif args.command == 'delete':
+ cmd_delete(args)
+ else:
+ print('Unknown command {!r}'.format(args.command))
+ sys.exit(1)
+
+
+if __name__ == '__main__':
+ try:
+ main()
+ except subprocess.CalledProcessError as e:
+ print(type(e).__name__, e.returncode, file=sys.stderr)
+ except KeyboardInterrupt:
+ pass
diff --git a/docker/build/entrypoint.sh b/docker/build/entrypoint.sh
new file mode 100644
index 0000000..916481a
--- /dev/null
+++ b/docker/build/entrypoint.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+set -e
+
+echo "[-] Checking the operating environment..."
+
+if [ ! -f /opt/node/bin/node ]; then
+ echo "[x] The nodejs runtime environment could not be found, you may be using an incomplete version"
+ exit 1
+fi
+
+if [ -d /opt/daemon ]; then
+ type=daemon
+elif [ -d /opt/web ]; then
+ type=web
+else
+ echo "[x] The MCSManager file directory could not be found, you may be using an incomplete version"
+ exit 1
+fi
+
+echo "[-] The operating environment is normal, starting the MCSManager..."
+
+cd /opt/$type
+eval "/opt/node/bin/node /opt/$type/app.js"
\ No newline at end of file
diff --git a/docker/docs/README.md b/docker/docs/README.md
new file mode 100644
index 0000000..ee700a5
--- /dev/null
+++ b/docker/docs/README.md
@@ -0,0 +1,180 @@
+# Installing MCSManager via Docker
+
+[English](README.md) | [简体中文](./README_cn.md)
+
+## Prerequisites
+
+You need to have the following prerequisites ready beforehand:
+
+- You are using a `Linux` system.
+- `docker-ce` package is already installed.
+
+> Due to the unconventional implementation of Docker Desktop on Windows, we neither support nor recommend installing MCSManager via Docker on Windows systems.
+
+## Getting Started
+
+Firstly, please switch to the root user.
+
+```bash
+sudo su
+```
+
+Then, create some basic directories that will be used later.
+
+```bash
+mkdir -p /opt/mcsmanager # MCSManager container directory
+mkdir -p /opt/mcsmanager/data # MCSManager data directory
+cd /opt/mcsmanager
+```
+
+Next, create an empty file named `docker-compose.yaml`.
+
+```bash
+touch docker-compose.yaml
+```
+
+If you need to install both MCSManager Web and MCSManager Daemon simultaneously, please copy the configuration below and paste it into `docker-compose.yaml`.
+
+```yaml
+version: "3"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Web logs directory
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web data directory
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
+ network_mode: host
+ command: /entrypoint.sh
+
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Daemon logs directory
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon data directory
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
+ network_mode: host
+```
+
+> If you are unable to copy or paste this file, you can also [click here](../examples/en/full.yaml) to get the example file.
+
+If you only need to install MCSManager Web, please copy the configuration below and paste it into `docker-compose.yaml`.
+
+```yaml
+version: "3"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Web logs directory
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web data directory
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
+ network_mode: host
+```
+
+> If you are unable to copy or paste this file, you can also [click here](../examples/en/web.yaml) to get the example file.
+
+If you want to install only MCSManager Daemon, please copy the configuration below and paste it into `docker-compose.yaml`.
+
+```yaml
+version: "3"
+
+services:
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Daemon logs directory
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon data directory
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
+ network_mode: host
+```
+
+> If you are unable to copy or paste this file, you can also [click here](../examples/en/daemon.yaml) to get the example file.
+
+Once all the above operations are completed, modify the configuration file as needed, then run the following command to start MCSManager.
+
+```bash
+docker compose -f docker-compose.yaml up -d
+```
+
+Now, you just need to wait for the command to complete the installation.
+
+If everything runs smoothly, shortly after, you can access `http://127.0.0.1:23333` to view the panel you just set up!
+
+> If running on a server, replace `127.0.0.1` with your public IP.
+
+> If you installed only the standalone MCSManager Daemon program, replace `23333` with `24444`.
+
+## Uninstallation
+
+If you no longer need MCSManager later on, you can navigate to the folder where you placed `docker-compose.yml` and then enter the following command to uninstall.
+
+```bash
+docker compose down
+rm -rf data
+```
+
+---
+
+Congratulations! You have completed all the tasks, and now you can start using MCSManager!
+
+However, if you find the original MCSManager Web or MCSManager Daemon images insufficient, you can also compile them yourself.
+
+Below is a simple compilation tutorial.
+
+---
+
+## Self-Compilation
+
+> Please note that you need to install `docker-ce` and `python` packages beforehand, and you need to have some Docker usage experience.
+
+If you need to compile yourself, you can use the files in the `build` folder in this directory for compilation.
+
+- `Dockerfile-daemon` is the image construction file for MCSManager Daemon.
+- `Dockerfile-web` is the image construction file for MCSManager Web.
+- `entrypoint.sh` is the default entry script executed in the image, which will run when the image starts.
+- `build.py` is a Python script used to build images. Use `python build.py -h` to get detailed help.
+
+You can use the following commands to build the images.
+
+```bash
+python build.py build
+python build.py build --push # If you need to push the images to Docker Hub, note: this requires you to pre-configure Docker Registry yourself.
+```
+
+If you prefer not to use the `build.py` script, you can also use the following commands to build the images.
+
+```bash
+docker build . -f -t # For example: docker build . -f Dockerfile -t bluefunny/mcsm-daemon:9 --build-arg TYPE=daemon --build-arg VERSION=9
+docker push # If you need to push the images to Docker Hub, note: this requires you to pre-configure Docker Registry yourself.
+```
+
+After the build is complete, you just need to replace the `image` section in the configuration files mentioned above with the name of the image you built yourself.
+
+### This article was translated by ChatGPT, there may be some errors, if you find these errors, please submit an Issue to let us know
\ No newline at end of file
diff --git a/docker/docs/README_cn.md b/docker/docs/README_cn.md
new file mode 100644
index 0000000..cc67067
--- /dev/null
+++ b/docker/docs/README_cn.md
@@ -0,0 +1,178 @@
+# 通过 Docker 安装 MCSManager
+
+[English](README.md) | [简体中文](./README_cn.md)
+
+## 预先准备
+
+你需要提前做好以下两点准备
+
+- 你使用的是 `Linux` 系统
+- 已经安装了 `docker-ce` 软件包
+
+> 由于 Windows 上的 Docker Desktop 实现方式并非常规, 因此, 我们不支持也不建议您在 Windows 系统上以 Docker 的方式安装 MCSManager
+
+## 开始安装
+
+首先, 请先切换为 root 用户
+
+```bash
+sudo su
+```
+
+然后使用以下命令创建一些待会儿会用到的基本目录
+
+```bash
+mkdir -p /opt/mcsmanager # MCSManager 容器文件目录
+mkdir -p /opt/mcsmanager/data # MCSManager 数据文件目录
+cd /opt/mcsmanager
+```
+
+然后, 创建一个名为 `docker-compose.yaml` 的空文件
+
+```bash
+touch docker-compose.yaml
+```
+
+如果你需要同时安装 MCSManager Web 与 MCSManager Daemon, 请复制下面的配置文件, 并将其粘贴到 `docker-compose.yaml` 中
+
+```yaml
+version: "3"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Web 日志存储目录
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web 数据存储目录
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
+ network_mode: host
+ command: /entrypoint.sh
+
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Daemon 日志存储目录
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon 数据存储目录
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
+ network_mode: host
+```
+
+> 如果你无法复制或粘贴此文件, 你也可以[点击此处](../examples/cn/full.yaml)获取示例文件
+
+如果你只需要安装 MCSManager Web, 请复制下面的配置文件, 并将其粘贴到 `docker-compose.yaml` 中
+
+```yaml
+version: "3"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Web 日志存储目录
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web 数据存储目录
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
+ network_mode: host
+```
+
+> 如果你无法复制或粘贴此文件, 你也可以[点击此处](../examples/cn/web.yaml)获取示例文件
+
+如果你要同时安装 MCSManager Daemon, 请复制下面的配置文件, 并将其粘贴到 `docker-compose.yaml` 中
+
+```yaml
+version: "3"
+
+services:
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Daemon 日志存储目录
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon 数据存储目录
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
+ network_mode: host
+```
+
+> 如果你无法复制或粘贴此文件, 你也可以[点击此处](../examples/cn/daemon.yaml)获取示例文件
+
+当上述操作全部完成后, 请按需修改配置文件, 之后运行以下命令启动 MCSManager
+
+```bash
+docker compose -f docker-compose.yaml up -d
+```
+
+此时, 你只需要等待命令运行完毕即可完成安装
+
+如果一切运行正常, 那么不久后你就可以访问 `http://127.0.0.1:23333` 来查看你刚刚搭建好的面板了 !
+
+> 如果是在服务器上运行, 则请将 `127.0.0.1` 替换为你的公网 IP
+
+> 如果你安装的是单独的的 MCSManager Daemon 程序, 则请将 `23333` 替换为 `24444`
+
+## 卸载
+
+如果后期你不需要 MCSManager 了, 你可以进入你用于放置 `docker-compose.yml` 的文件夹, 然后输入以下命令以卸载
+
+```bash
+docker compose down
+rm -rf data
+```
+
+---
+
+至此, 你已完成了全部的任务, 现在你可以开始使用 MCSManager 了 !
+
+不过如果你认为原本的 MCSManager Web 或 MCSManager Daemon 的镜像不够好, 你也可以自行编译
+
+下面为一个简单的编译教程
+
+---
+
+## 自行编译
+
+> 请注意, 你需要提前安装好 `docker-ce` 与 `python` 软件包, 并且你需要有一定的 Docker 使用经验
+
+如果你需要自行编译, 你可以使用此目录中的 `build` 文件夹中的文件进行编译
+
+- `Dockerfile-daemon` 为 MCSManager Daemon 的镜像构建文件
+- `Dockerfile-web` 为 MCSManager Web 的镜像构建文件
+- `entrypoint.sh` 为镜像默认执行的入口脚本, 在镜像启动时会运行此脚本
+- `build.py` 为用于构建镜像的 Python 脚本, 使用 `python build.py -h` 以获取详细帮助
+
+你可以使用以下命令构建镜像
+
+```bash
+python build.py build
+python build.py build --push # 如果你需要将镜像推送到 Docker Hub, 注意: 这需要你自己预先配置好 Docker Registry
+```
+
+如果你不想使用 `build.py` 脚本, 你也可以使用以下命令构建镜像
+
+```bash
+docker build . -f <构建文件> -t <标签> # 例如: docker build . -f Dockerfile -t bluefunny/mcsm-daemon:9 --build-arg TYPE=daemon --build-arg VERSION=9
+docker push <标签> # 如果你需要将镜像推送到 Docker Hub, 注意: 这需要你自己预先配置好 Docker Registry
+```
+
+在构建完成后, 你只需要将上文中配置文件中的 `image` 部分替换为你自行构建的镜像名称即可
diff --git a/docker/examples/cn/daemon.yaml b/docker/examples/cn/daemon.yaml
index 903bce3..1e45a80 100644
--- a/docker/examples/cn/daemon.yaml
+++ b/docker/examples/cn/daemon.yaml
@@ -1,15 +1,17 @@
-version: "2.4"
+version: "3"
services:
daemon:
- image: bluefunny/mcsm-daemon:latest
+ image: bluefunny/mcsmanager-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # 此处为 MCSManager 守护程序日志存储目录
- # 默认为 [/var/logs/mcsmanager/daemon]
- - /var/logs/mcsmanager/daemon:/logs
-
- # 此处为 MCSManager 守护程序日志存储目录
- # 默认为当前目录下的 data/daemon 文件夹
- - ./data/daemon:/data
+ # MCSManager Daemon 日志存储目录
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon 数据存储目录
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
network_mode: host
- command: /start
+ command: /entrypoint.sh
\ No newline at end of file
diff --git a/docker/examples/cn/full.yaml b/docker/examples/cn/full.yaml
index 15ad729..bd4dd69 100644
--- a/docker/examples/cn/full.yaml
+++ b/docker/examples/cn/full.yaml
@@ -1,28 +1,32 @@
-version: "2.4"
+version: "3"
services:
web:
- image: bluefunny/mcsm-web:latest
+ image: bluefunny/mcsmanager-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为 [/var/logs/mcsmanager/web]
- - /var/logs/mcsmanager/web:/logs
-
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为当前目录下的 data/web 文件夹
- - ./data/web:/data
+ # MCSManager Web 日志存储目录
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web 数据存储目录
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
network_mode: host
- command: /start
+ command: /entrypoint.sh
daemon:
- image: bluefunny/mcsm-daemon:latest
+ image: bluefunny/mcsmanager-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # 此处为 MCSManager 守护程序日志存储目录
- # 默认为 [/var/logs/mcsmanager/daemon]
- - /var/logs/mcsmanager/daemon:/logs
-
- # 此处为 MCSManager 守护程序日志存储目录
- # 默认为当前目录下的 data/daemon 文件夹
- - ./data/daemon:/data
+ # MCSManager Daemon 日志存储目录
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon 数据存储目录
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
network_mode: host
- command: /start
+ command: /entrypoint.sh
\ No newline at end of file
diff --git a/docker/examples/cn/web.yaml b/docker/examples/cn/web.yaml
index 6f612b3..40ce1e7 100644
--- a/docker/examples/cn/web.yaml
+++ b/docker/examples/cn/web.yaml
@@ -1,15 +1,17 @@
-version: "2.4"
+version: "3"
services:
web:
- image: bluefunny/mcsm-web:latest
+ image: bluefunny/mcsmanager-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为 [/var/logs/mcsmanager/web]
- - /var/logs/mcsmanager/web:/logs
-
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为当前目录下的 data/web 文件夹
- - ./data/web:/data
+ # MCSManager Web 日志存储目录
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web 数据存储目录
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
network_mode: host
- command: /start
+ command: /entrypoint.sh
\ No newline at end of file
From dd328335ab4eb7ea7f678911f073847dd92b8feb Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 17:57:30 +0800
Subject: [PATCH 081/460] Updating the Docker Installation Method
---
docker/README.md | 76 --------------
docker/README_cn.md | 77 --------------
docker/build/Dockerfile | 29 ++++++
docker/build/build.py | 83 +++++++++++++++
docker/build/entrypoint.sh | 23 +++++
docker/docs/README.md | 180 +++++++++++++++++++++++++++++++++
docker/docs/README_cn.md | 178 ++++++++++++++++++++++++++++++++
docker/examples/cn/daemon.yaml | 22 ++--
docker/examples/cn/full.yaml | 42 ++++----
docker/examples/cn/web.yaml | 22 ++--
docker/examples/en/daemon.yaml | 22 ++--
docker/examples/en/full.yaml | 42 ++++----
docker/examples/en/web.yaml | 22 ++--
13 files changed, 587 insertions(+), 231 deletions(-)
delete mode 100644 docker/README.md
delete mode 100644 docker/README_cn.md
create mode 100644 docker/build/Dockerfile
create mode 100755 docker/build/build.py
create mode 100644 docker/build/entrypoint.sh
create mode 100644 docker/docs/README.md
create mode 100644 docker/docs/README_cn.md
diff --git a/docker/README.md b/docker/README.md
deleted file mode 100644
index 8e0ccc3..0000000
--- a/docker/README.md
+++ /dev/null
@@ -1,76 +0,0 @@
-# Install MCSManager with Docker
-
-## Prerequisites
-
-You need to prepare the following before installation:
-
-- `docker` version `17.12.0+` has been installed
-- `docker-compose` has been installed
-
-## Start installation
-
-First, use the following command to create the basic directory of `docker-compose`
-
-```bash
-mkdir -p mcsmanager
-cd mcsmanager
-```
-
-Then, create an empty file named `docker-compose.yaml`
-
-```bash
-touch docker-compose.yaml
-```
-
-If you are a new user, please copy the configuration file below, modify the part marked with comments, and paste it into `docker-compose.yaml`
-
-If you cannot copy or paste this file, you can also click [here](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/full.yaml) to get the sample file
-
-```yaml
-version: "2.4"
-
-services:
- web:
- image: bluefunny/mcsm-web:latest
- volumes:
- # This is the MCSManager control panel log storage directory
- # The default is [/var/logs/mcsmanager/web]
- - /var/logs/mcsmanager/web:/logs
-
- # This is the MCSManager control panel log storage directory
- # The default is the data/web folder under the current directory
- - ./data/web:/data
- network_mode: host
- command: /start
-
- daemon:
- image: bluefunny/mcsm-daemon:latest
- volumes:
- # This is the MCSManager control panel log storage directory
- # The default is [/var/logs/mcsmanager/daemon]
- - /var/logs/mcsmanager/daemon:/logs
-
- # This is the MCSManager control panel log storage directory
- # The default is the data/daemon folder under the current directory
- - ./data/daemon:/data
- network_mode: host
- command: /start
-```
-
-If you are an old user and only plan to install a certain component of MCSManager (such as only installing the MCSManager daemon), please refer to the following two sample files and modify the part marked with comments
-
-- [MCSManager web](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/web.yaml)
-- [MCSManager daemon](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/daemon.yaml)
-
-After all the above operations are completed, please run the following command to start MCSManager
-
-```bash
-docker-compose -f docker-compose.yaml up -d
-```
-
-If everything runs normally, you can soon access `http://127.0.0.1:23333` to view the panel you just built!
-
-If you modify (or update) the `docker-compose.yaml` file later, please move it back to the directory and run the following command to make the modification take effect
-
-```bash
-docker-compose up -d
diff --git a/docker/README_cn.md b/docker/README_cn.md
deleted file mode 100644
index e78511a..0000000
--- a/docker/README_cn.md
+++ /dev/null
@@ -1,77 +0,0 @@
-# 通过 Docker 安装 MCSManager
-
-## 预先准备
-
-你需要提前做好以下几点准备
-
-- 已经安装了 `17.12.0+` 版本的 `docker`
-- 已经安装了 `docker-compose`
-
-## 开始安装
-
-首先, 请先使用以下命令创建 `docker-compose` 基本目录
-
-```bash
-mkdir -p mcsmanager
-cd mcsmanager
-```
-
-然后, 创建一个名为 `docker-compose.yaml` 的空文件
-
-```bash
-touch docker-compose.yaml
-```
-
-如果你是一个新用户, 请复制下面的配置文件, 修改其中注释标出的部分, 粘贴到 `docker-compose.yaml` 中即可
-
-如果你无法复制或粘贴此文件, 你也可以[点击此处](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/full.yaml)获取示例文件
-
-```yaml
-version: "2.4"
-
-services:
- web:
- image: bluefunny/mcsm-web:latest
- volumes:
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为 [/var/logs/mcsmanager/web]
- - /var/logs/mcsmanager/web:/logs
-
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为当前目录下的 data/web 文件夹
- - ./data/web:/data
- network_mode: host
- command: /start
-
- daemon:
- image: bluefunny/mcsm-daemon:latest
- volumes:
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为 [/var/logs/mcsmanager/daemon]
- - /var/logs/mcsmanager/daemon:/logs
-
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为当前目录下的 data/daemon 文件夹
- - ./data/daemon:/data
- network_mode: host
- command: /start
-```
-
-如果你是一个老用户, 并且只准备安装 MCSManager 的某个组件 (如仅安装 MCSManager 守护程序), 请查看下面这两个示例文件, 并修改其中注释标出的部分
-
-- [MCSManager 控制面板](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/web.yaml)
-- [MCSManager 守护程序](https://github.com/MCSManager/Script/blob/master/docker/examples/cn/daemon.yaml)
-
-当上述操作全部完成后, 请运行以下命令以启动 MCSManager
-
-```bash
-docker-compose -f docker-compose.yaml up -d
-```
-
-如果一切都运行正常, 那么不久后你就可以访问 `http://127.0.0.1:23333` 来查看你刚刚搭建好的面板了 !
-
-如果你后期修改(或更新)了 `docker-compose.yaml` 文件, 请重新移动到该目录, 并运行以下命令以使修改生效
-
-```bash
-docker-compose up -d
-```
diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile
new file mode 100644
index 0000000..d2488e8
--- /dev/null
+++ b/docker/build/Dockerfile
@@ -0,0 +1,29 @@
+ARG TYPE
+ARG VERSION
+FROM debian:stable-slim AS base
+
+RUN sed -i.bak 's/deb.debian.org/mirrors.cernet.edu.cn/g' /etc/apt/sources.list.d/debian.sources \
+ && sed -i.bak 's|security.debian.org/debian-security|mirrors.cernet.edu.cn/debian-security|g' /etc/apt/sources.list.d/debian.sources \
+ && apt-get update -y \
+ && apt-get install -y curl ca-certificates openssl git tar sqlite3 fontconfig tzdata iproute2 gettext-base wget \
+ && apt-get clean
+
+RUN cd /tmp \
+ && wget https://nodejs.org/dist/latest-v20.x/node-v20.11.1-linux-x64.tar.gz -O node.tar.gz \
+ && wget https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz -O mcsmanager.tar.gz \
+ && tar -xzf node.tar.gz -C /opt/node --strip-components=1 \
+ && tar -xzf mcsmanager.tar.gz -C /tmp/mcsmanager \
+ && mv -f /tmp/mcsmanager/${TYPE} /opt/${TYPE} \
+ && rm -rf /tmp/mcsmanager \
+ && rm -rf node.tar.gz \
+ && rm -rf mcsmanager.tar.gz
+
+RUN cd /opt/${TYPE} \
+ && /opt/node/bin/npm install --production
+
+USER mcsmanager
+ENV USER=mcsmanager HOME=/home/mcsmanager
+
+WORKDIR /opt/${TYPE}
+COPY ./entrypoint.sh /
+CMD ["/bin/bash", "/entrypoint.sh"]
diff --git a/docker/build/build.py b/docker/build/build.py
new file mode 100755
index 0000000..6a4eb62
--- /dev/null
+++ b/docker/build/build.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python3
+import argparse
+import os
+import subprocess
+import sys
+from typing import Iterator, NamedTuple
+
+class Context(NamedTuple):
+ type: str
+ version: str
+ tag: str
+
+
+def iterate_all() -> Iterator[Context]:
+ for type in ['daemon', 'web']:
+ for version in [9]:
+ tag = f'bluefunny/mcsmanager:{type}-{version}'
+ yield Context(type, str(version) , tag)
+
+
+def cmd_build(args: argparse.Namespace):
+ for ctx in iterate_all():
+ print(f'======== MCSManager | Type: {ctx.type}, Version: {ctx.version}, Tag: {ctx.tag!r} ========')
+
+ cmd = [
+ 'docker', 'build', os.getcwd(),
+ '-t', ctx.tag,
+ '--build-arg', f'TYPE={ctx.type}',
+ '--build-arg', f'VERSION={ctx.version}',
+ ]
+
+ if args.http_proxy is not None:
+ cmd.extend([
+ '--build-arg', f'http_proxy={args.http_proxy}',
+ '--build-arg', f'https_proxy={args.http_proxy}',
+ ])
+ subprocess.check_call(cmd)
+
+ if args.push:
+ subprocess.check_call(['docker', 'push', ctx.tag])
+
+
+def cmd_push(args: argparse.Namespace):
+ for ctx in iterate_all():
+ subprocess.check_call(['docker', 'push', ctx.tag])
+
+
+def cmd_delete(args: argparse.Namespace):
+ for ctx in iterate_all():
+ subprocess.check_call(['docker', 'image', 'rm', ctx.tag])
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ subparsers = parser.add_subparsers(title='Command', help='Available commands', dest='command', required=True)
+
+ parser_build = subparsers.add_parser('build', help='Build all images')
+ parser_build.add_argument('-p', '--push', action='store_true', help='Push after build')
+ parser_build.add_argument('--http-proxy', help='Set the url of http proxy to be used in build')
+
+ subparsers.add_parser('push', help='Push all images')
+ subparsers.add_parser('delete', help='Delete all images')
+
+ args = parser.parse_args()
+
+ if args.command == 'build':
+ cmd_build(args)
+ elif args.command == 'push':
+ cmd_push(args)
+ elif args.command == 'delete':
+ cmd_delete(args)
+ else:
+ print('Unknown command {!r}'.format(args.command))
+ sys.exit(1)
+
+
+if __name__ == '__main__':
+ try:
+ main()
+ except subprocess.CalledProcessError as e:
+ print(type(e).__name__, e.returncode, file=sys.stderr)
+ except KeyboardInterrupt:
+ pass
diff --git a/docker/build/entrypoint.sh b/docker/build/entrypoint.sh
new file mode 100644
index 0000000..916481a
--- /dev/null
+++ b/docker/build/entrypoint.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+set -e
+
+echo "[-] Checking the operating environment..."
+
+if [ ! -f /opt/node/bin/node ]; then
+ echo "[x] The nodejs runtime environment could not be found, you may be using an incomplete version"
+ exit 1
+fi
+
+if [ -d /opt/daemon ]; then
+ type=daemon
+elif [ -d /opt/web ]; then
+ type=web
+else
+ echo "[x] The MCSManager file directory could not be found, you may be using an incomplete version"
+ exit 1
+fi
+
+echo "[-] The operating environment is normal, starting the MCSManager..."
+
+cd /opt/$type
+eval "/opt/node/bin/node /opt/$type/app.js"
\ No newline at end of file
diff --git a/docker/docs/README.md b/docker/docs/README.md
new file mode 100644
index 0000000..ee700a5
--- /dev/null
+++ b/docker/docs/README.md
@@ -0,0 +1,180 @@
+# Installing MCSManager via Docker
+
+[English](README.md) | [简体中文](./README_cn.md)
+
+## Prerequisites
+
+You need to have the following prerequisites ready beforehand:
+
+- You are using a `Linux` system.
+- `docker-ce` package is already installed.
+
+> Due to the unconventional implementation of Docker Desktop on Windows, we neither support nor recommend installing MCSManager via Docker on Windows systems.
+
+## Getting Started
+
+Firstly, please switch to the root user.
+
+```bash
+sudo su
+```
+
+Then, create some basic directories that will be used later.
+
+```bash
+mkdir -p /opt/mcsmanager # MCSManager container directory
+mkdir -p /opt/mcsmanager/data # MCSManager data directory
+cd /opt/mcsmanager
+```
+
+Next, create an empty file named `docker-compose.yaml`.
+
+```bash
+touch docker-compose.yaml
+```
+
+If you need to install both MCSManager Web and MCSManager Daemon simultaneously, please copy the configuration below and paste it into `docker-compose.yaml`.
+
+```yaml
+version: "3"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Web logs directory
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web data directory
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
+ network_mode: host
+ command: /entrypoint.sh
+
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Daemon logs directory
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon data directory
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
+ network_mode: host
+```
+
+> If you are unable to copy or paste this file, you can also [click here](../examples/en/full.yaml) to get the example file.
+
+If you only need to install MCSManager Web, please copy the configuration below and paste it into `docker-compose.yaml`.
+
+```yaml
+version: "3"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Web logs directory
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web data directory
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
+ network_mode: host
+```
+
+> If you are unable to copy or paste this file, you can also [click here](../examples/en/web.yaml) to get the example file.
+
+If you want to install only MCSManager Daemon, please copy the configuration below and paste it into `docker-compose.yaml`.
+
+```yaml
+version: "3"
+
+services:
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Daemon logs directory
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon data directory
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
+ network_mode: host
+```
+
+> If you are unable to copy or paste this file, you can also [click here](../examples/en/daemon.yaml) to get the example file.
+
+Once all the above operations are completed, modify the configuration file as needed, then run the following command to start MCSManager.
+
+```bash
+docker compose -f docker-compose.yaml up -d
+```
+
+Now, you just need to wait for the command to complete the installation.
+
+If everything runs smoothly, shortly after, you can access `http://127.0.0.1:23333` to view the panel you just set up!
+
+> If running on a server, replace `127.0.0.1` with your public IP.
+
+> If you installed only the standalone MCSManager Daemon program, replace `23333` with `24444`.
+
+## Uninstallation
+
+If you no longer need MCSManager later on, you can navigate to the folder where you placed `docker-compose.yml` and then enter the following command to uninstall.
+
+```bash
+docker compose down
+rm -rf data
+```
+
+---
+
+Congratulations! You have completed all the tasks, and now you can start using MCSManager!
+
+However, if you find the original MCSManager Web or MCSManager Daemon images insufficient, you can also compile them yourself.
+
+Below is a simple compilation tutorial.
+
+---
+
+## Self-Compilation
+
+> Please note that you need to install `docker-ce` and `python` packages beforehand, and you need to have some Docker usage experience.
+
+If you need to compile yourself, you can use the files in the `build` folder in this directory for compilation.
+
+- `Dockerfile-daemon` is the image construction file for MCSManager Daemon.
+- `Dockerfile-web` is the image construction file for MCSManager Web.
+- `entrypoint.sh` is the default entry script executed in the image, which will run when the image starts.
+- `build.py` is a Python script used to build images. Use `python build.py -h` to get detailed help.
+
+You can use the following commands to build the images.
+
+```bash
+python build.py build
+python build.py build --push # If you need to push the images to Docker Hub, note: this requires you to pre-configure Docker Registry yourself.
+```
+
+If you prefer not to use the `build.py` script, you can also use the following commands to build the images.
+
+```bash
+docker build . -f -t # For example: docker build . -f Dockerfile -t bluefunny/mcsm-daemon:9 --build-arg TYPE=daemon --build-arg VERSION=9
+docker push # If you need to push the images to Docker Hub, note: this requires you to pre-configure Docker Registry yourself.
+```
+
+After the build is complete, you just need to replace the `image` section in the configuration files mentioned above with the name of the image you built yourself.
+
+### This article was translated by ChatGPT, there may be some errors, if you find these errors, please submit an Issue to let us know
\ No newline at end of file
diff --git a/docker/docs/README_cn.md b/docker/docs/README_cn.md
new file mode 100644
index 0000000..cc67067
--- /dev/null
+++ b/docker/docs/README_cn.md
@@ -0,0 +1,178 @@
+# 通过 Docker 安装 MCSManager
+
+[English](README.md) | [简体中文](./README_cn.md)
+
+## 预先准备
+
+你需要提前做好以下两点准备
+
+- 你使用的是 `Linux` 系统
+- 已经安装了 `docker-ce` 软件包
+
+> 由于 Windows 上的 Docker Desktop 实现方式并非常规, 因此, 我们不支持也不建议您在 Windows 系统上以 Docker 的方式安装 MCSManager
+
+## 开始安装
+
+首先, 请先切换为 root 用户
+
+```bash
+sudo su
+```
+
+然后使用以下命令创建一些待会儿会用到的基本目录
+
+```bash
+mkdir -p /opt/mcsmanager # MCSManager 容器文件目录
+mkdir -p /opt/mcsmanager/data # MCSManager 数据文件目录
+cd /opt/mcsmanager
+```
+
+然后, 创建一个名为 `docker-compose.yaml` 的空文件
+
+```bash
+touch docker-compose.yaml
+```
+
+如果你需要同时安装 MCSManager Web 与 MCSManager Daemon, 请复制下面的配置文件, 并将其粘贴到 `docker-compose.yaml` 中
+
+```yaml
+version: "3"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Web 日志存储目录
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web 数据存储目录
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
+ network_mode: host
+ command: /entrypoint.sh
+
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Daemon 日志存储目录
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon 数据存储目录
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
+ network_mode: host
+```
+
+> 如果你无法复制或粘贴此文件, 你也可以[点击此处](../examples/cn/full.yaml)获取示例文件
+
+如果你只需要安装 MCSManager Web, 请复制下面的配置文件, 并将其粘贴到 `docker-compose.yaml` 中
+
+```yaml
+version: "3"
+
+services:
+ web:
+ image: bluefunny/mcsm-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Web 日志存储目录
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web 数据存储目录
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
+ network_mode: host
+```
+
+> 如果你无法复制或粘贴此文件, 你也可以[点击此处](../examples/cn/web.yaml)获取示例文件
+
+如果你要同时安装 MCSManager Daemon, 请复制下面的配置文件, 并将其粘贴到 `docker-compose.yaml` 中
+
+```yaml
+version: "3"
+
+services:
+ daemon:
+ image: bluefunny/mcsm-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
+ volumes:
+ # MCSManager Daemon 日志存储目录
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon 数据存储目录
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
+ network_mode: host
+```
+
+> 如果你无法复制或粘贴此文件, 你也可以[点击此处](../examples/cn/daemon.yaml)获取示例文件
+
+当上述操作全部完成后, 请按需修改配置文件, 之后运行以下命令启动 MCSManager
+
+```bash
+docker compose -f docker-compose.yaml up -d
+```
+
+此时, 你只需要等待命令运行完毕即可完成安装
+
+如果一切运行正常, 那么不久后你就可以访问 `http://127.0.0.1:23333` 来查看你刚刚搭建好的面板了 !
+
+> 如果是在服务器上运行, 则请将 `127.0.0.1` 替换为你的公网 IP
+
+> 如果你安装的是单独的的 MCSManager Daemon 程序, 则请将 `23333` 替换为 `24444`
+
+## 卸载
+
+如果后期你不需要 MCSManager 了, 你可以进入你用于放置 `docker-compose.yml` 的文件夹, 然后输入以下命令以卸载
+
+```bash
+docker compose down
+rm -rf data
+```
+
+---
+
+至此, 你已完成了全部的任务, 现在你可以开始使用 MCSManager 了 !
+
+不过如果你认为原本的 MCSManager Web 或 MCSManager Daemon 的镜像不够好, 你也可以自行编译
+
+下面为一个简单的编译教程
+
+---
+
+## 自行编译
+
+> 请注意, 你需要提前安装好 `docker-ce` 与 `python` 软件包, 并且你需要有一定的 Docker 使用经验
+
+如果你需要自行编译, 你可以使用此目录中的 `build` 文件夹中的文件进行编译
+
+- `Dockerfile-daemon` 为 MCSManager Daemon 的镜像构建文件
+- `Dockerfile-web` 为 MCSManager Web 的镜像构建文件
+- `entrypoint.sh` 为镜像默认执行的入口脚本, 在镜像启动时会运行此脚本
+- `build.py` 为用于构建镜像的 Python 脚本, 使用 `python build.py -h` 以获取详细帮助
+
+你可以使用以下命令构建镜像
+
+```bash
+python build.py build
+python build.py build --push # 如果你需要将镜像推送到 Docker Hub, 注意: 这需要你自己预先配置好 Docker Registry
+```
+
+如果你不想使用 `build.py` 脚本, 你也可以使用以下命令构建镜像
+
+```bash
+docker build . -f <构建文件> -t <标签> # 例如: docker build . -f Dockerfile -t bluefunny/mcsm-daemon:9 --build-arg TYPE=daemon --build-arg VERSION=9
+docker push <标签> # 如果你需要将镜像推送到 Docker Hub, 注意: 这需要你自己预先配置好 Docker Registry
+```
+
+在构建完成后, 你只需要将上文中配置文件中的 `image` 部分替换为你自行构建的镜像名称即可
diff --git a/docker/examples/cn/daemon.yaml b/docker/examples/cn/daemon.yaml
index 903bce3..1e45a80 100644
--- a/docker/examples/cn/daemon.yaml
+++ b/docker/examples/cn/daemon.yaml
@@ -1,15 +1,17 @@
-version: "2.4"
+version: "3"
services:
daemon:
- image: bluefunny/mcsm-daemon:latest
+ image: bluefunny/mcsmanager-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # 此处为 MCSManager 守护程序日志存储目录
- # 默认为 [/var/logs/mcsmanager/daemon]
- - /var/logs/mcsmanager/daemon:/logs
-
- # 此处为 MCSManager 守护程序日志存储目录
- # 默认为当前目录下的 data/daemon 文件夹
- - ./data/daemon:/data
+ # MCSManager Daemon 日志存储目录
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon 数据存储目录
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
network_mode: host
- command: /start
+ command: /entrypoint.sh
\ No newline at end of file
diff --git a/docker/examples/cn/full.yaml b/docker/examples/cn/full.yaml
index 15ad729..bd4dd69 100644
--- a/docker/examples/cn/full.yaml
+++ b/docker/examples/cn/full.yaml
@@ -1,28 +1,32 @@
-version: "2.4"
+version: "3"
services:
web:
- image: bluefunny/mcsm-web:latest
+ image: bluefunny/mcsmanager-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为 [/var/logs/mcsmanager/web]
- - /var/logs/mcsmanager/web:/logs
-
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为当前目录下的 data/web 文件夹
- - ./data/web:/data
+ # MCSManager Web 日志存储目录
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web 数据存储目录
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
network_mode: host
- command: /start
+ command: /entrypoint.sh
daemon:
- image: bluefunny/mcsm-daemon:latest
+ image: bluefunny/mcsmanager-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # 此处为 MCSManager 守护程序日志存储目录
- # 默认为 [/var/logs/mcsmanager/daemon]
- - /var/logs/mcsmanager/daemon:/logs
-
- # 此处为 MCSManager 守护程序日志存储目录
- # 默认为当前目录下的 data/daemon 文件夹
- - ./data/daemon:/data
+ # MCSManager Daemon 日志存储目录
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon 数据存储目录
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
network_mode: host
- command: /start
+ command: /entrypoint.sh
\ No newline at end of file
diff --git a/docker/examples/cn/web.yaml b/docker/examples/cn/web.yaml
index 6f612b3..40ce1e7 100644
--- a/docker/examples/cn/web.yaml
+++ b/docker/examples/cn/web.yaml
@@ -1,15 +1,17 @@
-version: "2.4"
+version: "3"
services:
web:
- image: bluefunny/mcsm-web:latest
+ image: bluefunny/mcsmanager-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为 [/var/logs/mcsmanager/web]
- - /var/logs/mcsmanager/web:/logs
-
- # 此处为 MCSManager 控制面板日志存储目录
- # 默认为当前目录下的 data/web 文件夹
- - ./data/web:/data
+ # MCSManager Web 日志存储目录
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web 数据存储目录
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
network_mode: host
- command: /start
+ command: /entrypoint.sh
\ No newline at end of file
diff --git a/docker/examples/en/daemon.yaml b/docker/examples/en/daemon.yaml
index 4ae4580..8799621 100644
--- a/docker/examples/en/daemon.yaml
+++ b/docker/examples/en/daemon.yaml
@@ -1,15 +1,17 @@
-version: "2.4"
+version: "3"
services:
daemon:
- image: bluefunny/mcsm-daemon:latest
+ image: bluefunny/mcsmanager-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # This is the MCSManager web panel log storage directory
- # Default is [/var/logs/mcsmanager/daemon]
- - /var/logs/mcsmanager/daemon:/logs
-
- # This is the MCSManager daemon data storage directory
- # Default is the data/daemon folder in the current directory
- - ./data/daemon:/data
+ # MCSManager Daemon log storage directory
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon data storage directory
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
network_mode: host
- command: /start
+ command: /entrypoint.sh
\ No newline at end of file
diff --git a/docker/examples/en/full.yaml b/docker/examples/en/full.yaml
index f8d00ce..55af55d 100644
--- a/docker/examples/en/full.yaml
+++ b/docker/examples/en/full.yaml
@@ -1,28 +1,32 @@
-version: "2.4"
+version: "3"
services:
web:
- image: bluefunny/mcsm-web:latest
+ image: bluefunny/mcsmanager-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # This is the MCSManager web panel log storage directory
- # The default is [/var/logs/mcsmanager/web]
- - /var/logs/mcsmanager/web:/logs
-
- # This is the MCSManager web panel data storage directory
- # The default is the data/web folder in the current directory
- - ./data/web:/data
+ # MCSManager Web log storage directory
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web data storage directory
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
network_mode: host
- command: /start
+ command: /entrypoint.sh
daemon:
- image: bluefunny/mcsm-daemon:latest
+ image: bluefunny/mcsmanager-daemon:latest
+ name: mcsmanager-daemon
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # This is the MCSManager daemon log storage directory
- # The default is [/var/logs/mcsmanager/daemon]
- - /var/logs/mcsmanager/daemon:/logs
-
- # This is the MCSManager daemon data storage directory
- # The default is the data/daemon folder in the current directory
- - ./data/daemon:/data
+ # MCSManager Daemon log storage directory
+ - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ # MCSManager Daemon data storage directory
+ - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ # port:
+ # - 24444:24444
network_mode: host
- command: /start
+ command: /entrypoint.sh
\ No newline at end of file
diff --git a/docker/examples/en/web.yaml b/docker/examples/en/web.yaml
index cb5ae2b..c4c6d5f 100644
--- a/docker/examples/en/web.yaml
+++ b/docker/examples/en/web.yaml
@@ -1,15 +1,17 @@
-version: "2.4"
+version: "3"
services:
web:
- image: bluefunny/mcsm-web:latest
+ image: bluefunny/mcsmanager-web:latest
+ name: mcsmanager-web
+ environment:
+ - TZ=Asia/Shanghai
volumes:
- # This is the MCSManager daemon log storage directory
- # The default is [/var/logs/mcsmanager/web]
- - /var/logs/mcsmanager/web:/logs
-
- # This is the MCSManager daemon data storage directory
- # The default is the data/web folder in the current directory
- - ./data/web:/data
+ # MCSManager Web log storage directory
+ - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ # MCSManager Web data storage directory
+ - /opt/mcsmanager/data/data/web:/opt/web/data
+ # port:
+ # - 23333:23333
network_mode: host
- command: /start
+ command: /entrypoint.sh
\ No newline at end of file
From f6057349cf0b8326dc9b00b2271cfecb1923b996 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 18:34:06 +0800
Subject: [PATCH 082/460] Fix a little problem
---
docker/build/Dockerfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile
index d2488e8..0cecd8e 100644
--- a/docker/build/Dockerfile
+++ b/docker/build/Dockerfile
@@ -11,6 +11,7 @@ RUN sed -i.bak 's/deb.debian.org/mirrors.cernet.edu.cn/g' /etc/apt/sources.list.
RUN cd /tmp \
&& wget https://nodejs.org/dist/latest-v20.x/node-v20.11.1-linux-x64.tar.gz -O node.tar.gz \
&& wget https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz -O mcsmanager.tar.gz \
+ && mkdir -p /opt/node \
&& tar -xzf node.tar.gz -C /opt/node --strip-components=1 \
&& tar -xzf mcsmanager.tar.gz -C /tmp/mcsmanager \
&& mv -f /tmp/mcsmanager/${TYPE} /opt/${TYPE} \
From d7569818edc5fdc2e7da5a2e680814661837df47 Mon Sep 17 00:00:00 2001
From: BlueFunny <53890138+FunnyShadow@users.noreply.github.com>
Date: Wed, 21 Feb 2024 18:53:27 +0800
Subject: [PATCH 083/460] Update Dockerfile
---
docker/build/Dockerfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile
index 0cecd8e..6bf97a9 100644
--- a/docker/build/Dockerfile
+++ b/docker/build/Dockerfile
@@ -12,6 +12,7 @@ RUN cd /tmp \
&& wget https://nodejs.org/dist/latest-v20.x/node-v20.11.1-linux-x64.tar.gz -O node.tar.gz \
&& wget https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz -O mcsmanager.tar.gz \
&& mkdir -p /opt/node \
+ && mkdir -p /tmp/mcsmanager \
&& tar -xzf node.tar.gz -C /opt/node --strip-components=1 \
&& tar -xzf mcsmanager.tar.gz -C /tmp/mcsmanager \
&& mv -f /tmp/mcsmanager/${TYPE} /opt/${TYPE} \
From d835336a6d09cc3cc597777e99841840766fbd0f Mon Sep 17 00:00:00 2001
From: BlueFunny <53890138+FunnyShadow@users.noreply.github.com>
Date: Wed, 21 Feb 2024 18:56:17 +0800
Subject: [PATCH 084/460] Update Dockerfile
---
docker/build/Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile
index 6bf97a9..204d6e7 100644
--- a/docker/build/Dockerfile
+++ b/docker/build/Dockerfile
@@ -21,7 +21,7 @@ RUN cd /tmp \
&& rm -rf mcsmanager.tar.gz
RUN cd /opt/${TYPE} \
- && /opt/node/bin/npm install --production
+ && /opt/node/bin/node /opt/node/bin/npm install --production
USER mcsmanager
ENV USER=mcsmanager HOME=/home/mcsmanager
From dccd108b262a4d5834aca33274cf2bec4b9e621b Mon Sep 17 00:00:00 2001
From: BlueFunny <53890138+FunnyShadow@users.noreply.github.com>
Date: Wed, 21 Feb 2024 19:00:59 +0800
Subject: [PATCH 085/460] Update Dockerfile
---
docker/build/Dockerfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile
index 204d6e7..6fda7aa 100644
--- a/docker/build/Dockerfile
+++ b/docker/build/Dockerfile
@@ -1,5 +1,5 @@
-ARG TYPE
-ARG VERSION
+ARG TYPE=daemon
+ARG VERSION=9
FROM debian:stable-slim AS base
RUN sed -i.bak 's/deb.debian.org/mirrors.cernet.edu.cn/g' /etc/apt/sources.list.d/debian.sources \
From 413e8f2190c3779dafeb5487f03c075f7d97f5cd Mon Sep 17 00:00:00 2001
From: BlueFunny <53890138+FunnyShadow@users.noreply.github.com>
Date: Wed, 21 Feb 2024 19:01:59 +0800
Subject: [PATCH 086/460] Update Dockerfile
---
docker/build/Dockerfile | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile
index 6fda7aa..085c2ba 100644
--- a/docker/build/Dockerfile
+++ b/docker/build/Dockerfile
@@ -1,5 +1,3 @@
-ARG TYPE=daemon
-ARG VERSION=9
FROM debian:stable-slim AS base
RUN sed -i.bak 's/deb.debian.org/mirrors.cernet.edu.cn/g' /etc/apt/sources.list.d/debian.sources \
@@ -15,17 +13,17 @@ RUN cd /tmp \
&& mkdir -p /tmp/mcsmanager \
&& tar -xzf node.tar.gz -C /opt/node --strip-components=1 \
&& tar -xzf mcsmanager.tar.gz -C /tmp/mcsmanager \
- && mv -f /tmp/mcsmanager/${TYPE} /opt/${TYPE} \
+ && mv -f /tmp/mcsmanager/${TYPE} /opt/daemon \
&& rm -rf /tmp/mcsmanager \
&& rm -rf node.tar.gz \
&& rm -rf mcsmanager.tar.gz
-RUN cd /opt/${TYPE} \
+RUN cd /opt/daemon \
&& /opt/node/bin/node /opt/node/bin/npm install --production
USER mcsmanager
ENV USER=mcsmanager HOME=/home/mcsmanager
-WORKDIR /opt/${TYPE}
+WORKDIR /opt/daemon
COPY ./entrypoint.sh /
CMD ["/bin/bash", "/entrypoint.sh"]
From c5af1fb6105604245e833b9cc61286871341b4e4 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:08:20 +0800
Subject: [PATCH 087/460] Splitting the Daemon and Web build files into two
---
.../build/{Dockerfile => Dockerfile-daemon} | 2 +-
docker/build/Dockerfile-web | 29 +++++++++++++++++++
docker/build/build.py | 3 +-
3 files changed, 31 insertions(+), 3 deletions(-)
rename docker/build/{Dockerfile => Dockerfile-daemon} (95%)
create mode 100644 docker/build/Dockerfile-web
diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile-daemon
similarity index 95%
rename from docker/build/Dockerfile
rename to docker/build/Dockerfile-daemon
index 085c2ba..8d67aa3 100644
--- a/docker/build/Dockerfile
+++ b/docker/build/Dockerfile-daemon
@@ -13,7 +13,7 @@ RUN cd /tmp \
&& mkdir -p /tmp/mcsmanager \
&& tar -xzf node.tar.gz -C /opt/node --strip-components=1 \
&& tar -xzf mcsmanager.tar.gz -C /tmp/mcsmanager \
- && mv -f /tmp/mcsmanager/${TYPE} /opt/daemon \
+ && mv -f /tmp/mcsmanager/daemon /opt/daemon \
&& rm -rf /tmp/mcsmanager \
&& rm -rf node.tar.gz \
&& rm -rf mcsmanager.tar.gz
diff --git a/docker/build/Dockerfile-web b/docker/build/Dockerfile-web
new file mode 100644
index 0000000..f3209e3
--- /dev/null
+++ b/docker/build/Dockerfile-web
@@ -0,0 +1,29 @@
+FROM debian:stable-slim AS base
+
+RUN sed -i.bak 's/deb.debian.org/mirrors.cernet.edu.cn/g' /etc/apt/sources.list.d/debian.sources \
+ && sed -i.bak 's|security.debian.org/debian-security|mirrors.cernet.edu.cn/debian-security|g' /etc/apt/sources.list.d/debian.sources \
+ && apt-get update -y \
+ && apt-get install -y curl ca-certificates openssl git tar sqlite3 fontconfig tzdata iproute2 gettext-base wget \
+ && apt-get clean
+
+RUN cd /tmp \
+ && wget https://nodejs.org/dist/latest-v20.x/node-v20.11.1-linux-x64.tar.gz -O node.tar.gz \
+ && wget https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz -O mcsmanager.tar.gz \
+ && mkdir -p /opt/node \
+ && mkdir -p /tmp/mcsmanager \
+ && tar -xzf node.tar.gz -C /opt/node --strip-components=1 \
+ && tar -xzf mcsmanager.tar.gz -C /tmp/mcsmanager \
+ && mv -f /tmp/mcsmanager/web /opt/daemon \
+ && rm -rf /tmp/mcsmanager \
+ && rm -rf node.tar.gz \
+ && rm -rf mcsmanager.tar.gz
+
+RUN cd /opt/web \
+ && /opt/node/bin/node /opt/node/bin/npm install --production
+
+USER mcsmanager
+ENV USER=mcsmanager HOME=/home/mcsmanager
+
+WORKDIR /opt/web
+COPY ./entrypoint.sh /
+CMD ["/bin/bash", "/entrypoint.sh"]
diff --git a/docker/build/build.py b/docker/build/build.py
index 6a4eb62..1e67960 100755
--- a/docker/build/build.py
+++ b/docker/build/build.py
@@ -24,9 +24,8 @@ def cmd_build(args: argparse.Namespace):
cmd = [
'docker', 'build', os.getcwd(),
+ '-f', f'Dockerfile-{ctx.type}',
'-t', ctx.tag,
- '--build-arg', f'TYPE={ctx.type}',
- '--build-arg', f'VERSION={ctx.version}',
]
if args.http_proxy is not None:
From 6300e8bdad6b442dfdc5e227efb0527a83de8dea Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:13:01 +0800
Subject: [PATCH 088/460] Updating the tutorial file
---
docker/docs/README.md | 10 +++++-----
docker/docs/README_cn.md | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/docker/docs/README.md b/docker/docs/README.md
index e7c5c40..3f7b173 100644
--- a/docker/docs/README.md
+++ b/docker/docs/README.md
@@ -40,7 +40,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsm-web:latest
+ image: bluefunny/mcsmanager-web:latest
name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
@@ -55,7 +55,7 @@ services:
command: /entrypoint.sh
daemon:
- image: bluefunny/mcsm-daemon:latest
+ image: bluefunny/mcsmanager-daemon:latest
name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
@@ -78,7 +78,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsm-web:latest
+ image: bluefunny/mcsmanager-web:latest
name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
@@ -101,7 +101,7 @@ version: "3"
services:
daemon:
- image: bluefunny/mcsm-daemon:latest
+ image: bluefunny/mcsmanager-daemon:latest
name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
@@ -171,7 +171,7 @@ python build.py build --push # If you need to push the images to Docker Hub, not
If you prefer not to use the `build.py` script, you can also use the following commands to build the images.
```bash
-docker build . -f -t # For example: docker build . -f Dockerfile -t bluefunny/mcsm-daemon:9 --build-arg TYPE=daemon --build-arg VERSION=9
+docker build . -f -t # For example: docker build . -f Dockerfile -t bluefunny/mcsmanager-daemon:9 --build-arg TYPE=daemon --build-arg VERSION=9
docker push # If you need to push the images to Docker Hub, note: this requires you to pre-configure Docker Registry yourself.
```
diff --git a/docker/docs/README_cn.md b/docker/docs/README_cn.md
index 7ffa2ca..4045329 100644
--- a/docker/docs/README_cn.md
+++ b/docker/docs/README_cn.md
@@ -40,7 +40,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsm-web:latest
+ image: bluefunny/mcsmanager-web:latest
name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
@@ -55,7 +55,7 @@ services:
command: /entrypoint.sh
daemon:
- image: bluefunny/mcsm-daemon:latest
+ image: bluefunny/mcsmanager-daemon:latest
name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
@@ -78,7 +78,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsm-web:latest
+ image: bluefunny/mcsmanager-web:latest
name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
@@ -101,7 +101,7 @@ version: "3"
services:
daemon:
- image: bluefunny/mcsm-daemon:latest
+ image: bluefunny/mcsmanager-daemon:latest
name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
@@ -171,7 +171,7 @@ python build.py build --push # 如果你需要将镜像推送到 Docker Hub, 注
如果你不想使用 `build.py` 脚本, 你也可以使用以下命令构建镜像
```bash
-docker build . -f <构建文件> -t <标签> # 例如: docker build . -f Dockerfile -t bluefunny/mcsm-daemon:9 --build-arg TYPE=daemon --build-arg VERSION=9
+docker build . -f <构建文件> -t <标签> # 例如: docker build . -f Dockerfile -t bluefunny/mcsmanager-daemon:9 --build-arg TYPE=daemon --build-arg VERSION=9
docker push <标签> # 如果你需要将镜像推送到 Docker Hub, 注意: 这需要你自己预先配置好 Docker Registry
```
From 1d9182d4152b2295e3a8a8cb0f5662befe3fb282 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:15:14 +0800
Subject: [PATCH 089/460] Fixing a really stupid problem
---
docker/build/Dockerfile-web | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker/build/Dockerfile-web b/docker/build/Dockerfile-web
index f3209e3..5636ea1 100644
--- a/docker/build/Dockerfile-web
+++ b/docker/build/Dockerfile-web
@@ -13,7 +13,7 @@ RUN cd /tmp \
&& mkdir -p /tmp/mcsmanager \
&& tar -xzf node.tar.gz -C /opt/node --strip-components=1 \
&& tar -xzf mcsmanager.tar.gz -C /tmp/mcsmanager \
- && mv -f /tmp/mcsmanager/web /opt/daemon \
+ && mv -f /tmp/mcsmanager/web /opt/web \
&& rm -rf /tmp/mcsmanager \
&& rm -rf node.tar.gz \
&& rm -rf mcsmanager.tar.gz
From 8354b6451b9d77df1fba36e0f212626068607630 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:22:51 +0800
Subject: [PATCH 090/460] Replace field name (misremembered...)
---
docker/examples/cn/daemon.yaml | 2 +-
docker/examples/cn/full.yaml | 4 ++--
docker/examples/cn/web.yaml | 2 +-
docker/examples/en/daemon.yaml | 2 +-
docker/examples/en/full.yaml | 4 ++--
docker/examples/en/web.yaml | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/docker/examples/cn/daemon.yaml b/docker/examples/cn/daemon.yaml
index 1e45a80..5d61edc 100644
--- a/docker/examples/cn/daemon.yaml
+++ b/docker/examples/cn/daemon.yaml
@@ -3,7 +3,7 @@ version: "3"
services:
daemon:
image: bluefunny/mcsmanager-daemon:latest
- name: mcsmanager-daemon
+ container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
volumes:
diff --git a/docker/examples/cn/full.yaml b/docker/examples/cn/full.yaml
index bd4dd69..4928ef9 100644
--- a/docker/examples/cn/full.yaml
+++ b/docker/examples/cn/full.yaml
@@ -3,7 +3,7 @@ version: "3"
services:
web:
image: bluefunny/mcsmanager-web:latest
- name: mcsmanager-web
+ container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
volumes:
@@ -18,7 +18,7 @@ services:
daemon:
image: bluefunny/mcsmanager-daemon:latest
- name: mcsmanager-daemon
+ container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
volumes:
diff --git a/docker/examples/cn/web.yaml b/docker/examples/cn/web.yaml
index 40ce1e7..0d70fe0 100644
--- a/docker/examples/cn/web.yaml
+++ b/docker/examples/cn/web.yaml
@@ -3,7 +3,7 @@ version: "3"
services:
web:
image: bluefunny/mcsmanager-web:latest
- name: mcsmanager-web
+ container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
volumes:
diff --git a/docker/examples/en/daemon.yaml b/docker/examples/en/daemon.yaml
index 8799621..1260089 100644
--- a/docker/examples/en/daemon.yaml
+++ b/docker/examples/en/daemon.yaml
@@ -3,7 +3,7 @@ version: "3"
services:
daemon:
image: bluefunny/mcsmanager-daemon:latest
- name: mcsmanager-daemon
+ container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
volumes:
diff --git a/docker/examples/en/full.yaml b/docker/examples/en/full.yaml
index 55af55d..06dd5eb 100644
--- a/docker/examples/en/full.yaml
+++ b/docker/examples/en/full.yaml
@@ -3,7 +3,7 @@ version: "3"
services:
web:
image: bluefunny/mcsmanager-web:latest
- name: mcsmanager-web
+ container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
volumes:
@@ -18,7 +18,7 @@ services:
daemon:
image: bluefunny/mcsmanager-daemon:latest
- name: mcsmanager-daemon
+ container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
volumes:
diff --git a/docker/examples/en/web.yaml b/docker/examples/en/web.yaml
index c4c6d5f..bbd9f70 100644
--- a/docker/examples/en/web.yaml
+++ b/docker/examples/en/web.yaml
@@ -3,7 +3,7 @@ version: "3"
services:
web:
image: bluefunny/mcsmanager-web:latest
- name: mcsmanager-web
+ container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
volumes:
From 01fcb2bfcb2970ee05d6207b53e8d985da8ad46a Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:23:44 +0800
Subject: [PATCH 091/460] Change the default path to the current directory
---
docker/examples/cn/daemon.yaml | 4 ++--
docker/examples/cn/full.yaml | 8 ++++----
docker/examples/cn/web.yaml | 4 ++--
docker/examples/en/daemon.yaml | 4 ++--
docker/examples/en/full.yaml | 8 ++++----
docker/examples/en/web.yaml | 4 ++--
6 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/docker/examples/cn/daemon.yaml b/docker/examples/cn/daemon.yaml
index 5d61edc..acf3af2 100644
--- a/docker/examples/cn/daemon.yaml
+++ b/docker/examples/cn/daemon.yaml
@@ -8,9 +8,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Daemon 日志存储目录
- - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ - ./data/logs/daemon:/opt/daemon/logs
# MCSManager Daemon 数据存储目录
- - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ - ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
network_mode: host
diff --git a/docker/examples/cn/full.yaml b/docker/examples/cn/full.yaml
index 4928ef9..154b75e 100644
--- a/docker/examples/cn/full.yaml
+++ b/docker/examples/cn/full.yaml
@@ -8,9 +8,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Web 日志存储目录
- - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ - ./data/logs/web:/opt/web/logs
# MCSManager Web 数据存储目录
- - /opt/mcsmanager/data/data/web:/opt/web/data
+ - ./data/data/web:/opt/web/data
# port:
# - 23333:23333
network_mode: host
@@ -23,9 +23,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Daemon 日志存储目录
- - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ - ./data/logs/daemon:/opt/daemon/logs
# MCSManager Daemon 数据存储目录
- - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ - ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
network_mode: host
diff --git a/docker/examples/cn/web.yaml b/docker/examples/cn/web.yaml
index 0d70fe0..6cce805 100644
--- a/docker/examples/cn/web.yaml
+++ b/docker/examples/cn/web.yaml
@@ -8,9 +8,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Web 日志存储目录
- - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ - ./data/logs/web:/opt/web/logs
# MCSManager Web 数据存储目录
- - /opt/mcsmanager/data/data/web:/opt/web/data
+ - ./data/data/web:/opt/web/data
# port:
# - 23333:23333
network_mode: host
diff --git a/docker/examples/en/daemon.yaml b/docker/examples/en/daemon.yaml
index 1260089..47c51e4 100644
--- a/docker/examples/en/daemon.yaml
+++ b/docker/examples/en/daemon.yaml
@@ -8,9 +8,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Daemon log storage directory
- - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ - ./data/logs/daemon:/opt/daemon/logs
# MCSManager Daemon data storage directory
- - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ - ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
network_mode: host
diff --git a/docker/examples/en/full.yaml b/docker/examples/en/full.yaml
index 06dd5eb..fe39576 100644
--- a/docker/examples/en/full.yaml
+++ b/docker/examples/en/full.yaml
@@ -8,9 +8,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Web log storage directory
- - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ - ./data/logs/web:/opt/web/logs
# MCSManager Web data storage directory
- - /opt/mcsmanager/data/data/web:/opt/web/data
+ - ./data/data/web:/opt/web/data
# port:
# - 23333:23333
network_mode: host
@@ -23,9 +23,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Daemon log storage directory
- - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ - ./data/logs/daemon:/opt/daemon/logs
# MCSManager Daemon data storage directory
- - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ - ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
network_mode: host
diff --git a/docker/examples/en/web.yaml b/docker/examples/en/web.yaml
index bbd9f70..8d9caf4 100644
--- a/docker/examples/en/web.yaml
+++ b/docker/examples/en/web.yaml
@@ -8,9 +8,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Web log storage directory
- - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ - ./data/logs/web:/opt/web/logs
# MCSManager Web data storage directory
- - /opt/mcsmanager/data/data/web:/opt/web/data
+ - ./data/data/web:/opt/web/data
# port:
# - 23333:23333
network_mode: host
From bc6cdb83bf13b0660b79278e2a759e4be18ffe3d Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:25:16 +0800
Subject: [PATCH 092/460] Update directory paths and permissions in Docker
configuration
---
docker/docs/README.md | 21 +++++++++++----------
docker/docs/README_cn.md | 21 +++++++++++----------
2 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/docker/docs/README.md b/docker/docs/README.md
index 3f7b173..8e89b67 100644
--- a/docker/docs/README.md
+++ b/docker/docs/README.md
@@ -22,8 +22,9 @@ sudo su
Then, create some basic directories that will be used later.
```bash
-mkdir -p /opt/mcsmanager # MCSManager container directory
-mkdir -p /opt/mcsmanager/data # MCSManager data directory
+mkdir -p /opt/mcsmanager # MCSManager container directory
+mkdir -p /opt/mcsmanager/data # MCSManager data directory
+chown -R 1000:1000 /opt/mcsmanager # Modify directory permissions
cd /opt/mcsmanager
```
@@ -46,9 +47,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Web logs directory
- - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ - ./data/logs/web:/opt/web/logs
# MCSManager Web data directory
- - /opt/mcsmanager/data/data/web:/opt/web/data
+ - ./data/data/web:/opt/web/data
# port:
# - 23333:23333
network_mode: host
@@ -61,9 +62,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Daemon logs directory
- - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ - ./data/logs/daemon:/opt/daemon/logs
# MCSManager Daemon data directory
- - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ - ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
network_mode: host
@@ -84,9 +85,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Web logs directory
- - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ - ./data/logs/web:/opt/web/logs
# MCSManager Web data directory
- - /opt/mcsmanager/data/data/web:/opt/web/data
+ - ./data/data/web:/opt/web/data
# port:
# - 23333:23333
network_mode: host
@@ -107,9 +108,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Daemon logs directory
- - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ - ./data/logs/daemon:/opt/daemon/logs
# MCSManager Daemon data directory
- - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ - ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
network_mode: host
diff --git a/docker/docs/README_cn.md b/docker/docs/README_cn.md
index 4045329..ba89b01 100644
--- a/docker/docs/README_cn.md
+++ b/docker/docs/README_cn.md
@@ -22,8 +22,9 @@ sudo su
然后使用以下命令创建一些待会儿会用到的基本目录
```bash
-mkdir -p /opt/mcsmanager # MCSManager 容器文件目录
-mkdir -p /opt/mcsmanager/data # MCSManager 数据文件目录
+mkdir -p /opt/mcsmanager # MCSManager 容器文件目录
+mkdir -p /opt/mcsmanager/data # MCSManager 数据文件目录
+chown -R 1000:1000 /opt/mcsmanager # 修改目录权限
cd /opt/mcsmanager
```
@@ -46,9 +47,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Web 日志存储目录
- - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ - ./data/logs/web:/opt/web/logs
# MCSManager Web 数据存储目录
- - /opt/mcsmanager/data/data/web:/opt/web/data
+ - ./data/data/web:/opt/web/data
# port:
# - 23333:23333
network_mode: host
@@ -61,9 +62,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Daemon 日志存储目录
- - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ - ./data/logs/daemon:/opt/daemon/logs
# MCSManager Daemon 数据存储目录
- - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ - ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
network_mode: host
@@ -84,9 +85,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Web 日志存储目录
- - /opt/mcsmanager/data/logs/web:/opt/web/logs
+ - ./data/logs/web:/opt/web/logs
# MCSManager Web 数据存储目录
- - /opt/mcsmanager/data/data/web:/opt/web/data
+ - ./data/data/web:/opt/web/data
# port:
# - 23333:23333
network_mode: host
@@ -107,9 +108,9 @@ services:
- TZ=Asia/Shanghai
volumes:
# MCSManager Daemon 日志存储目录
- - /opt/mcsmanager/data/logs/daemon:/opt/daemon/logs
+ - ./data/logs/daemon:/opt/daemon/logs
# MCSManager Daemon 数据存储目录
- - /opt/mcsmanager/data/data/daemon:/opt/daemon/data
+ - ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
network_mode: host
From 877c0b13ed8667cb33ef047eebdd87f23f12181a Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:29:22 +0800
Subject: [PATCH 093/460] Fix a naming error
---
docker/docs/README.md | 8 ++++----
docker/docs/README_cn.md | 8 ++++----
docker/examples/cn/daemon.yaml | 2 +-
docker/examples/cn/full.yaml | 4 ++--
docker/examples/cn/web.yaml | 2 +-
docker/examples/en/daemon.yaml | 2 +-
docker/examples/en/full.yaml | 4 ++--
docker/examples/en/web.yaml | 2 +-
8 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/docker/docs/README.md b/docker/docs/README.md
index 8e89b67..2389403 100644
--- a/docker/docs/README.md
+++ b/docker/docs/README.md
@@ -41,7 +41,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsmanager-web:latest
+ image: bluefunny/mcsmanager:web-9
name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
@@ -56,7 +56,7 @@ services:
command: /entrypoint.sh
daemon:
- image: bluefunny/mcsmanager-daemon:latest
+ image: bluefunny/mcsmanager:daemon-9
name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
@@ -79,7 +79,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsmanager-web:latest
+ image: bluefunny/mcsmanager:web-9
name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
@@ -102,7 +102,7 @@ version: "3"
services:
daemon:
- image: bluefunny/mcsmanager-daemon:latest
+ image: bluefunny/mcsmanager:daemon-9
name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
diff --git a/docker/docs/README_cn.md b/docker/docs/README_cn.md
index ba89b01..79b4826 100644
--- a/docker/docs/README_cn.md
+++ b/docker/docs/README_cn.md
@@ -41,7 +41,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsmanager-web:latest
+ image: bluefunny/mcsmanager:web-9
name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
@@ -56,7 +56,7 @@ services:
command: /entrypoint.sh
daemon:
- image: bluefunny/mcsmanager-daemon:latest
+ image: bluefunny/mcsmanager:daemon-9
name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
@@ -79,7 +79,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsmanager-web:latest
+ image: bluefunny/mcsmanager:web-9
name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
@@ -102,7 +102,7 @@ version: "3"
services:
daemon:
- image: bluefunny/mcsmanager-daemon:latest
+ image: bluefunny/mcsmanager:daemon-9
name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
diff --git a/docker/examples/cn/daemon.yaml b/docker/examples/cn/daemon.yaml
index acf3af2..0b1654a 100644
--- a/docker/examples/cn/daemon.yaml
+++ b/docker/examples/cn/daemon.yaml
@@ -2,7 +2,7 @@ version: "3"
services:
daemon:
- image: bluefunny/mcsmanager-daemon:latest
+ image: bluefunny/mcsmanager:daemon-9
container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
diff --git a/docker/examples/cn/full.yaml b/docker/examples/cn/full.yaml
index 154b75e..1701aba 100644
--- a/docker/examples/cn/full.yaml
+++ b/docker/examples/cn/full.yaml
@@ -2,7 +2,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsmanager-web:latest
+ image: bluefunny/mcsmanager:web-9
container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
@@ -17,7 +17,7 @@ services:
command: /entrypoint.sh
daemon:
- image: bluefunny/mcsmanager-daemon:latest
+ image: bluefunny/mcsmanager:daemon-9
container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
diff --git a/docker/examples/cn/web.yaml b/docker/examples/cn/web.yaml
index 6cce805..c45653a 100644
--- a/docker/examples/cn/web.yaml
+++ b/docker/examples/cn/web.yaml
@@ -2,7 +2,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsmanager-web:latest
+ image: bluefunny/mcsmanager:web-9
container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
diff --git a/docker/examples/en/daemon.yaml b/docker/examples/en/daemon.yaml
index 47c51e4..10958d1 100644
--- a/docker/examples/en/daemon.yaml
+++ b/docker/examples/en/daemon.yaml
@@ -2,7 +2,7 @@ version: "3"
services:
daemon:
- image: bluefunny/mcsmanager-daemon:latest
+ image: bluefunny/mcsmanager:daemon-9
container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
diff --git a/docker/examples/en/full.yaml b/docker/examples/en/full.yaml
index fe39576..99ae52b 100644
--- a/docker/examples/en/full.yaml
+++ b/docker/examples/en/full.yaml
@@ -2,7 +2,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsmanager-web:latest
+ image: bluefunny/mcsmanager:web-9
container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
@@ -17,7 +17,7 @@ services:
command: /entrypoint.sh
daemon:
- image: bluefunny/mcsmanager-daemon:latest
+ image: bluefunny/mcsmanager:daemon-9
container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
diff --git a/docker/examples/en/web.yaml b/docker/examples/en/web.yaml
index 8d9caf4..cbe3047 100644
--- a/docker/examples/en/web.yaml
+++ b/docker/examples/en/web.yaml
@@ -2,7 +2,7 @@ version: "3"
services:
web:
- image: bluefunny/mcsmanager-web:latest
+ image: bluefunny/mcsmanager:web-9
container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
From 1839d8d06af2d566a4f6ace72991ada50d51b350 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:32:49 +0800
Subject: [PATCH 094/460] Fix a user permissions issue
---
docker/build/Dockerfile-daemon | 4 ++--
docker/build/Dockerfile-web | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/docker/build/Dockerfile-daemon b/docker/build/Dockerfile-daemon
index 8d67aa3..6ab9703 100644
--- a/docker/build/Dockerfile-daemon
+++ b/docker/build/Dockerfile-daemon
@@ -21,8 +21,8 @@ RUN cd /tmp \
RUN cd /opt/daemon \
&& /opt/node/bin/node /opt/node/bin/npm install --production
-USER mcsmanager
-ENV USER=mcsmanager HOME=/home/mcsmanager
+USER container
+ENV USER=container HOME=/home/container
WORKDIR /opt/daemon
COPY ./entrypoint.sh /
diff --git a/docker/build/Dockerfile-web b/docker/build/Dockerfile-web
index 5636ea1..db3e814 100644
--- a/docker/build/Dockerfile-web
+++ b/docker/build/Dockerfile-web
@@ -21,8 +21,8 @@ RUN cd /tmp \
RUN cd /opt/web \
&& /opt/node/bin/node /opt/node/bin/npm install --production
-USER mcsmanager
-ENV USER=mcsmanager HOME=/home/mcsmanager
+USER container
+ENV USER=container HOME=/home/container
WORKDIR /opt/web
COPY ./entrypoint.sh /
From ecb4ab8d6a6302103a538d77d53c0379931fec61 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:40:13 +0800
Subject: [PATCH 095/460] fix
---
docker/build/Dockerfile-daemon | 3 ---
docker/build/Dockerfile-web | 3 ---
docker/docs/README.md | 2 +-
docker/docs/README_cn.md | 2 +-
4 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/docker/build/Dockerfile-daemon b/docker/build/Dockerfile-daemon
index 6ab9703..f135f19 100644
--- a/docker/build/Dockerfile-daemon
+++ b/docker/build/Dockerfile-daemon
@@ -21,9 +21,6 @@ RUN cd /tmp \
RUN cd /opt/daemon \
&& /opt/node/bin/node /opt/node/bin/npm install --production
-USER container
-ENV USER=container HOME=/home/container
-
WORKDIR /opt/daemon
COPY ./entrypoint.sh /
CMD ["/bin/bash", "/entrypoint.sh"]
diff --git a/docker/build/Dockerfile-web b/docker/build/Dockerfile-web
index db3e814..9b0c87f 100644
--- a/docker/build/Dockerfile-web
+++ b/docker/build/Dockerfile-web
@@ -21,9 +21,6 @@ RUN cd /tmp \
RUN cd /opt/web \
&& /opt/node/bin/node /opt/node/bin/npm install --production
-USER container
-ENV USER=container HOME=/home/container
-
WORKDIR /opt/web
COPY ./entrypoint.sh /
CMD ["/bin/bash", "/entrypoint.sh"]
diff --git a/docker/docs/README.md b/docker/docs/README.md
index 2389403..848a02f 100644
--- a/docker/docs/README.md
+++ b/docker/docs/README.md
@@ -137,7 +137,7 @@ If everything runs smoothly, shortly after, you can access `http://127.0.0.1:233
If you no longer need MCSManager later on, you can navigate to the folder where you placed `docker-compose.yml` and then enter the following command to uninstall.
```bash
-docker compose down
+docker compose -f docker-compose.yaml down
rm -rf data
```
diff --git a/docker/docs/README_cn.md b/docker/docs/README_cn.md
index 79b4826..04a377d 100644
--- a/docker/docs/README_cn.md
+++ b/docker/docs/README_cn.md
@@ -137,7 +137,7 @@ docker compose -f docker-compose.yaml up -d
如果后期你不需要 MCSManager 了, 你可以进入你用于放置 `docker-compose.yml` 的文件夹, 然后输入以下命令以卸载
```bash
-docker compose down
+docker compose -f docker-compose.yaml down
rm -rf data
```
From 9a0c37bb2d67bc2c52160a324cd35a6691d06916 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:40:13 +0800
Subject: [PATCH 096/460] Add executable permission to entrypoint.sh
---
docker/build/Dockerfile-daemon | 4 +---
docker/build/Dockerfile-web | 4 +---
docker/docs/README.md | 2 +-
docker/docs/README_cn.md | 2 +-
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/docker/build/Dockerfile-daemon b/docker/build/Dockerfile-daemon
index 6ab9703..4361d12 100644
--- a/docker/build/Dockerfile-daemon
+++ b/docker/build/Dockerfile-daemon
@@ -21,9 +21,7 @@ RUN cd /tmp \
RUN cd /opt/daemon \
&& /opt/node/bin/node /opt/node/bin/npm install --production
-USER container
-ENV USER=container HOME=/home/container
-
WORKDIR /opt/daemon
COPY ./entrypoint.sh /
+RUN chmod +x /entrypoint.sh
CMD ["/bin/bash", "/entrypoint.sh"]
diff --git a/docker/build/Dockerfile-web b/docker/build/Dockerfile-web
index db3e814..e89fc78 100644
--- a/docker/build/Dockerfile-web
+++ b/docker/build/Dockerfile-web
@@ -21,9 +21,7 @@ RUN cd /tmp \
RUN cd /opt/web \
&& /opt/node/bin/node /opt/node/bin/npm install --production
-USER container
-ENV USER=container HOME=/home/container
-
WORKDIR /opt/web
COPY ./entrypoint.sh /
+RUN chmod +x /entrypoint.sh
CMD ["/bin/bash", "/entrypoint.sh"]
diff --git a/docker/docs/README.md b/docker/docs/README.md
index 2389403..848a02f 100644
--- a/docker/docs/README.md
+++ b/docker/docs/README.md
@@ -137,7 +137,7 @@ If everything runs smoothly, shortly after, you can access `http://127.0.0.1:233
If you no longer need MCSManager later on, you can navigate to the folder where you placed `docker-compose.yml` and then enter the following command to uninstall.
```bash
-docker compose down
+docker compose -f docker-compose.yaml down
rm -rf data
```
diff --git a/docker/docs/README_cn.md b/docker/docs/README_cn.md
index 79b4826..04a377d 100644
--- a/docker/docs/README_cn.md
+++ b/docker/docs/README_cn.md
@@ -137,7 +137,7 @@ docker compose -f docker-compose.yaml up -d
如果后期你不需要 MCSManager 了, 你可以进入你用于放置 `docker-compose.yml` 的文件夹, 然后输入以下命令以卸载
```bash
-docker compose down
+docker compose -f docker-compose.yaml down
rm -rf data
```
From 0beffa8f21be0565db4c68feb348b9ae89531b67 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:43:52 +0800
Subject: [PATCH 097/460] Update network_mode in Docker Compose files
---
docker/examples/cn/daemon.yaml | 3 +--
docker/examples/cn/full.yaml | 4 +---
docker/examples/cn/web.yaml | 3 +--
docker/examples/en/daemon.yaml | 3 +--
docker/examples/en/full.yaml | 4 +---
docker/examples/en/web.yaml | 3 +--
6 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/docker/examples/cn/daemon.yaml b/docker/examples/cn/daemon.yaml
index 0b1654a..408edc9 100644
--- a/docker/examples/cn/daemon.yaml
+++ b/docker/examples/cn/daemon.yaml
@@ -13,5 +13,4 @@ services:
- ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
- network_mode: host
- command: /entrypoint.sh
\ No newline at end of file
+ network_mode: host
\ No newline at end of file
diff --git a/docker/examples/cn/full.yaml b/docker/examples/cn/full.yaml
index 1701aba..705be75 100644
--- a/docker/examples/cn/full.yaml
+++ b/docker/examples/cn/full.yaml
@@ -14,7 +14,6 @@ services:
# port:
# - 23333:23333
network_mode: host
- command: /entrypoint.sh
daemon:
image: bluefunny/mcsmanager:daemon-9
@@ -28,5 +27,4 @@ services:
- ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
- network_mode: host
- command: /entrypoint.sh
\ No newline at end of file
+ network_mode: host
\ No newline at end of file
diff --git a/docker/examples/cn/web.yaml b/docker/examples/cn/web.yaml
index c45653a..62eeffe 100644
--- a/docker/examples/cn/web.yaml
+++ b/docker/examples/cn/web.yaml
@@ -13,5 +13,4 @@ services:
- ./data/data/web:/opt/web/data
# port:
# - 23333:23333
- network_mode: host
- command: /entrypoint.sh
\ No newline at end of file
+ network_mode: host
\ No newline at end of file
diff --git a/docker/examples/en/daemon.yaml b/docker/examples/en/daemon.yaml
index 10958d1..326e043 100644
--- a/docker/examples/en/daemon.yaml
+++ b/docker/examples/en/daemon.yaml
@@ -13,5 +13,4 @@ services:
- ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
- network_mode: host
- command: /entrypoint.sh
\ No newline at end of file
+ network_mode: host
\ No newline at end of file
diff --git a/docker/examples/en/full.yaml b/docker/examples/en/full.yaml
index 99ae52b..1c535cd 100644
--- a/docker/examples/en/full.yaml
+++ b/docker/examples/en/full.yaml
@@ -14,7 +14,6 @@ services:
# port:
# - 23333:23333
network_mode: host
- command: /entrypoint.sh
daemon:
image: bluefunny/mcsmanager:daemon-9
@@ -28,5 +27,4 @@ services:
- ./data/data/daemon:/opt/daemon/data
# port:
# - 24444:24444
- network_mode: host
- command: /entrypoint.sh
\ No newline at end of file
+ network_mode: host
\ No newline at end of file
diff --git a/docker/examples/en/web.yaml b/docker/examples/en/web.yaml
index cbe3047..7640f91 100644
--- a/docker/examples/en/web.yaml
+++ b/docker/examples/en/web.yaml
@@ -13,5 +13,4 @@ services:
- ./data/data/web:/opt/web/data
# port:
# - 23333:23333
- network_mode: host
- command: /entrypoint.sh
\ No newline at end of file
+ network_mode: host
\ No newline at end of file
From 73e1c84703f9d61f0d88d2be55aee2b2ae0a7e97 Mon Sep 17 00:00:00 2001
From: FunnyShadow
Date: Wed, 21 Feb 2024 19:51:05 +0800
Subject: [PATCH 098/460] Update field names (within the document)
---
docker/docs/README.md | 8 ++++----
docker/docs/README_cn.md | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/docker/docs/README.md b/docker/docs/README.md
index 848a02f..4bf6e47 100644
--- a/docker/docs/README.md
+++ b/docker/docs/README.md
@@ -42,7 +42,7 @@ version: "3"
services:
web:
image: bluefunny/mcsmanager:web-9
- name: mcsmanager-web
+ container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
volumes:
@@ -57,7 +57,7 @@ services:
daemon:
image: bluefunny/mcsmanager:daemon-9
- name: mcsmanager-daemon
+ container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
volumes:
@@ -80,7 +80,7 @@ version: "3"
services:
web:
image: bluefunny/mcsmanager:web-9
- name: mcsmanager-web
+ container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
volumes:
@@ -103,7 +103,7 @@ version: "3"
services:
daemon:
image: bluefunny/mcsmanager:daemon-9
- name: mcsmanager-daemon
+ container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
volumes:
diff --git a/docker/docs/README_cn.md b/docker/docs/README_cn.md
index 04a377d..e6d2a9b 100644
--- a/docker/docs/README_cn.md
+++ b/docker/docs/README_cn.md
@@ -42,7 +42,7 @@ version: "3"
services:
web:
image: bluefunny/mcsmanager:web-9
- name: mcsmanager-web
+ container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
volumes:
@@ -57,7 +57,7 @@ services:
daemon:
image: bluefunny/mcsmanager:daemon-9
- name: mcsmanager-daemon
+ container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
volumes:
@@ -80,7 +80,7 @@ version: "3"
services:
web:
image: bluefunny/mcsmanager:web-9
- name: mcsmanager-web
+ container_name: mcsmanager-web
environment:
- TZ=Asia/Shanghai
volumes:
@@ -103,7 +103,7 @@ version: "3"
services:
daemon:
image: bluefunny/mcsmanager:daemon-9
- name: mcsmanager-daemon
+ container_name: mcsmanager-daemon
environment:
- TZ=Asia/Shanghai
volumes:
From c2eb58c9b70bb336729641d7a76c35c1bbd17f7a Mon Sep 17 00:00:00 2001
From: unitwk
Date: Thu, 7 Mar 2024 17:04:08 +0800
Subject: [PATCH 099/460] Update setup_cn.sh
---
setup_cn.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index 24518f6..fe93d45 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -8,7 +8,7 @@ fi
echo -e "\033[33m当前用户是 root 用户,开始执行 MCSManager 安装脚本。\033[0m"
# Config
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/release/mcsmanager_linux_release.tar.gz"
+mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
node="v14.19.1"
zh=$(
[[ $(locale -a) =~ "zh" ]] && echo 1
From 5dd620cd5b0afbd1ff1b5ec9e235349d93630026 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Tue, 19 Mar 2024 11:16:51 +0800
Subject: [PATCH 100/460] Feat: test install script
---
install.sh | 240 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 240 insertions(+)
create mode 100644 install.sh
diff --git a/install.sh b/install.sh
new file mode 100644
index 0000000..103d9a1
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,240 @@
+#!/bin/bash
+
+mcsmanager_install_path="/opt/mcsmanager"
+mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/mcsmanager_v10_linux_beta.tar.gz"
+package_name="mcsmanager-v10.tar.gz"
+node="v20.11.1"
+
+error=""
+arch=$(uname -m)
+
+printf "\033c"
+
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
+
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
+
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
+
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
+}
+
+# script info
+echo_cyan "+----------------------------------------------------------------------
+| MCSManager Installer
++----------------------------------------------------------------------
+"
+
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
+
+
+Install_Node() {
+ echo_cyan_n "[+] Install Node.JS environment... "
+
+ rm -irf "$node_install_path"
+
+ cd /opt || exit
+
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
+ wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
+
+ tar -zxf node-"$node"-linux-"$arch".tar.gz
+
+ rm -rf node-"$node"-linux-"$arch".tar.gz
+
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ Red_Error "[x] Node installation failed!"
+ fi
+
+ echo
+ echo_yellow "=============== Node.JS Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node.JS Version ==============="
+ echo
+
+ sleep 3
+}
+
+
+Install_MCSManager() {
+ echo_cyan "[+] Install MCSManager..."
+
+ # stop service
+ systemctl stop mcsm-{web,daemon}
+
+ # delete service
+ rm -rf /etc/systemd/system/mcsm-daemon.service
+ rm -rf /etc/systemd/system/mcsm-web.service
+ systemctl daemon-reload
+
+ mkdir -p ${mcsmanager_install_path} || exit
+
+ # cd /opt/mcsmanager
+ cd ${mcsmanager_install_path} || exit
+
+
+ # donwload MCSManager release
+ wget ${mcsmanager_donwload_addr}
+ tar -zxf ${package_name} -o
+ rm -rf "${mcsmanager_install_path}/${package_name}"
+
+ # echo "[→] cd daemon"
+ cd daemon || exit
+
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
+
+ # echo "[←] cd .."
+ cd ../web || exit
+
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
+
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green " Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ echo_green "[+] MCSManager installation success!"
+
+ sleep 3
+}
+
+Create_Service() {
+ echo_cyan "[+] Create MCSManager service..."
+
+ echo "
+[Unit]
+Description=MCSManager Daemon
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/daemon
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s QUIT $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" > /etc/systemd/system/mcsm-daemon.service
+
+ echo "
+[Unit]
+Description=MCSManager Web
+
+[Service]
+WorkingDirectory=/opt/mcsmanager/web
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s QUIT $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" > /etc/systemd/system/mcsm-web.service
+
+ systemctl daemon-reload
+ systemctl enable mcsm-daemon.service --now
+ systemctl enable mcsm-web.service --now
+
+ sleep 3
+
+ printf "\n\n\n\n"
+
+ echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_yellow " "
+ echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333 (Browser)"
+ echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444 (Cluster)"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+}
+
+
+
+# Environmental inspection
+if [[ "$arch" == x86_64 ]]; then
+ arch=x64
+ #echo "[-] x64 architecture detected"
+elif [[ $arch == aarch64 ]]; then
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
+elif [[ $arch == arm ]]; then
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
+elif [[ $arch == ppc64le ]]; then
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
+elif [[ $arch == s390x ]]; then
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
+else
+ Red_Error "[x] Sorry, this architecture is not supported yet!"
+ Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
+ exit
+fi
+
+# Define the variable Node installation directory
+node_install_path="/opt/node-$node-linux-$arch"
+
+# Check network connection
+echo_cyan "[-] Architecture: $arch"
+
+# Install related software
+echo_cyan_n "[+] Installing dependent software(git,tar)... "
+if [[ -x "$(command -v yum)" ]]; then yum install -y git tar > error;
+elif [[ -x "$(command -v apt-get)" ]]; then apt-get install -y git tar > error;
+elif [[ -x "$(command -v pacman)" ]]; then pacman -Syu --noconfirm git tar > error;
+elif [[ -x "$(command -v zypper)" ]]; then sudo zypper --non-interactive install git tar > error;
+fi
+
+# Determine whether the relevant software is installed successfully
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
+ then
+ echo_green "Success"
+ else
+ echo_red "Failed"
+ echo "$error"
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
+ exit
+fi
+
+
+# Install the Node environment
+Install_Node
+
+# Install MCSManager
+Install_MCSManager
+
+# Create MCSManager background service
+Create_Service
+
From ce8e3cc71a925e263e0aa0a5084c89ba84aadabb Mon Sep 17 00:00:00 2001
From: unitwk
Date: Tue, 19 Mar 2024 11:30:01 +0800
Subject: [PATCH 101/460] Feat: test install script
---
install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install.sh b/install.sh
index 103d9a1..8842434 100644
--- a/install.sh
+++ b/install.sh
@@ -3,7 +3,7 @@
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/mcsmanager_v10_linux_beta.tar.gz"
package_name="mcsmanager-v10.tar.gz"
-node="v20.11.1"
+node="v16.20.2"
error=""
arch=$(uname -m)
From 8cbfd154a2e68c1fd8f3f98400c66f780a98335c Mon Sep 17 00:00:00 2001
From: unitwk
Date: Tue, 19 Mar 2024 11:31:52 +0800
Subject: [PATCH 102/460] Feat: test install script
---
install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install.sh b/install.sh
index 8842434..fa55877 100644
--- a/install.sh
+++ b/install.sh
@@ -1,7 +1,7 @@
#!/bin/bash
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/mcsmanager_v10_linux_beta.tar.gz"
+mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/mcsmanager-v10.tar.gz"
package_name="mcsmanager-v10.tar.gz"
node="v16.20.2"
From 5fdbf38a29e2c00cd464cbbed8739f9792c9d147 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Tue, 19 Mar 2024 15:50:34 +0800
Subject: [PATCH 103/460] Feat: test install script
---
install.sh | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/install.sh b/install.sh
index fa55877..d9c7466 100644
--- a/install.sh
+++ b/install.sh
@@ -44,7 +44,7 @@ Red_Error() {
Install_Node() {
- echo_cyan_n "[+] Install Node.JS environment... "
+ echo_cyan_n "[+] Install Node.JS environment...\n"
rm -irf "$node_install_path"
@@ -96,7 +96,7 @@ Install_MCSManager() {
# donwload MCSManager release
wget ${mcsmanager_donwload_addr}
- tar -zxf ${package_name} -o
+ tar -zxf ${package_name} -o || exit
rm -rf "${mcsmanager_install_path}/${package_name}"
# echo "[→] cd daemon"
@@ -124,10 +124,11 @@ Install_MCSManager() {
Create_Service() {
echo_cyan "[+] Create MCSManager service..."
+ echo_cyan "[!] Try to register to the "systemctl", This comomand require \"root\" permission."
- echo "
-[Unit]
-Description=MCSManager Daemon
+ sudo su
+ echo "[Unit]
+Description=MCSManager-Daemon
[Service]
WorkingDirectory=/opt/mcsmanager/daemon
@@ -140,9 +141,8 @@ Environment=\"PATH=${PATH}\"
WantedBy=multi-user.target
" > /etc/systemd/system/mcsm-daemon.service
- echo "
-[Unit]
-Description=MCSManager Web
+ echo "[Unit]
+Description=MCSManager-Web
[Service]
WorkingDirectory=/opt/mcsmanager/web
@@ -155,11 +155,21 @@ Environment=\"PATH=${PATH}\"
WantedBy=multi-user.target
" > /etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
- sleep 3
+ if [ -e "/etc/systemd/system/mcsm-web.service" ]; then
+ systemctl daemon-reload
+ systemctl enable mcsm-daemon.service --now
+ systemctl enable mcsm-web.service --now
+ exit
+ echo_green "Registered!"
+ else
+ echo_red "Failed to register the system service. Please use the "ROOT" account to re-run the script and ensure that the "sudo" command is available."
+ exit
+ exit
+ fi
+
+
+ sleep 2
printf "\n\n\n\n"
From 96ad890521cabc261934adf519ae9a24319d7fc5 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Tue, 19 Mar 2024 16:06:00 +0800
Subject: [PATCH 104/460] Feat: test install script
---
install.sh | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/install.sh b/install.sh
index d9c7466..da70346 100644
--- a/install.sh
+++ b/install.sh
@@ -46,7 +46,7 @@ Red_Error() {
Install_Node() {
echo_cyan_n "[+] Install Node.JS environment...\n"
- rm -irf "$node_install_path"
+ sudo rm -irf "$node_install_path"
cd /opt || exit
@@ -81,12 +81,13 @@ Install_MCSManager() {
echo_cyan "[+] Install MCSManager..."
# stop service
- systemctl stop mcsm-{web,daemon}
+ sudo systemctl stop mcsm-{web,daemon}
+ sudo systemctl disable mcsm-{web,daemon}
# delete service
- rm -rf /etc/systemd/system/mcsm-daemon.service
- rm -rf /etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
+ sudo rm -rf /etc/systemd/system/mcsm-daemon.service
+ sudo rm -rf /etc/systemd/system/mcsm-web.service
+ sudo systemctl daemon-reload
mkdir -p ${mcsmanager_install_path} || exit
@@ -126,8 +127,8 @@ Create_Service() {
echo_cyan "[+] Create MCSManager service..."
echo_cyan "[!] Try to register to the "systemctl", This comomand require \"root\" permission."
- sudo su
- echo "[Unit]
+
+ sudo echo "[Unit]
Description=MCSManager-Daemon
[Service]
@@ -141,7 +142,7 @@ Environment=\"PATH=${PATH}\"
WantedBy=multi-user.target
" > /etc/systemd/system/mcsm-daemon.service
- echo "[Unit]
+ sudo echo "[Unit]
Description=MCSManager-Web
[Service]
@@ -157,15 +158,12 @@ WantedBy=multi-user.target
if [ -e "/etc/systemd/system/mcsm-web.service" ]; then
- systemctl daemon-reload
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
- exit
+ sudo systemctl daemon-reload
+ sudo systemctl enable mcsm-daemon.service --now
+ sudo systemctl enable mcsm-web.service --now
echo_green "Registered!"
else
echo_red "Failed to register the system service. Please use the "ROOT" account to re-run the script and ensure that the "sudo" command is available."
- exit
- exit
fi
From 49aefcfa4266fed2a9329634e03f01786c47ddf8 Mon Sep 17 00:00:00 2001
From: unitwk
Date: Tue, 19 Mar 2024 16:26:05 +0800
Subject: [PATCH 105/460] Feat: test install script
---
install.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/install.sh b/install.sh
index da70346..105275b 100644
--- a/install.sh
+++ b/install.sh
@@ -127,7 +127,6 @@ Create_Service() {
echo_cyan "[+] Create MCSManager service..."
echo_cyan "[!] Try to register to the "systemctl", This comomand require \"root\" permission."
-
sudo echo "[Unit]
Description=MCSManager-Daemon
@@ -156,17 +155,18 @@ Environment=\"PATH=${PATH}\"
WantedBy=multi-user.target
" > /etc/systemd/system/mcsm-web.service
-
if [ -e "/etc/systemd/system/mcsm-web.service" ]; then
sudo systemctl daemon-reload
sudo systemctl enable mcsm-daemon.service --now
sudo systemctl enable mcsm-web.service --now
echo_green "Registered!"
else
- echo_red "Failed to register the system service. Please use the "ROOT" account to re-run the script and ensure that the "sudo" command is available."
+ printf "\n\n"
+ echo_red "The MCSManager was successfully installed to \"/opt/mcsmanager\"."
+ echo_red "But register to the \"systemctl\" failed!\nPlease use the \"root\" account to re-run the script!"
+ exit
fi
-
sleep 2
printf "\n\n\n\n"
@@ -219,9 +219,9 @@ echo_cyan "[-] Architecture: $arch"
# Install related software
echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [[ -x "$(command -v yum)" ]]; then yum install -y git tar > error;
-elif [[ -x "$(command -v apt-get)" ]]; then apt-get install -y git tar > error;
-elif [[ -x "$(command -v pacman)" ]]; then pacman -Syu --noconfirm git tar > error;
+if [[ -x "$(command -v yum)" ]]; then sudo yum install -y git tar > error;
+elif [[ -x "$(command -v apt-get)" ]]; then sudo apt-get install -y git tar > error;
+elif [[ -x "$(command -v pacman)" ]]; then sudo pacman -Syu --noconfirm git tar > error;
elif [[ -x "$(command -v zypper)" ]]; then sudo zypper --non-interactive install git tar > error;
fi
From c1030c814b922d4b7fbd97d80d67a3aaf9bbfd2d Mon Sep 17 00:00:00 2001
From: Umou
Date: Sun, 31 Mar 2024 09:44:51 +0800
Subject: [PATCH 106/460] Update install.sh
---
install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install.sh b/install.sh
index 105275b..5355807 100644
--- a/install.sh
+++ b/install.sh
@@ -2,7 +2,7 @@
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/mcsmanager-v10.tar.gz"
-package_name="mcsmanager-v10.tar.gz"
+package_name="MCSManager-v10-linux.tar.gz"
node="v16.20.2"
error=""
From 94862d849f0054e5285adc9a576ac39b0d7718a4 Mon Sep 17 00:00:00 2001
From: Umou
Date: Sun, 31 Mar 2024 09:45:07 +0800
Subject: [PATCH 107/460] Update install.sh
---
install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install.sh b/install.sh
index 5355807..46d38a5 100644
--- a/install.sh
+++ b/install.sh
@@ -1,7 +1,7 @@
#!/bin/bash
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/mcsmanager-v10.tar.gz"
+mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/MCSManager-v10-linux.tar.gz"
package_name="MCSManager-v10-linux.tar.gz"
node="v16.20.2"
From be51fd905a256e6219ac69c430c99b4250505872 Mon Sep 17 00:00:00 2001
From: Umou
Date: Mon, 1 Apr 2024 22:50:53 +0800
Subject: [PATCH 108/460] Update README.md
---
README.md | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/README.md b/README.md
index 4b77c7f..8e861f7 100644
--- a/README.md
+++ b/README.md
@@ -2,28 +2,14 @@
-[Official Website](http://mcsmanager.com/) | [中文文档](https://github.com/MCSManager/Script/blob/master/README_cn.md) | [Gitee](https://gitee.com/mcsmanager/script)
+[Official Website](http://mcsmanager.com/)
## What is this?
-The files here are all platform-wide install, delete, update scripts, etc. for MCSManager 9.
+The files here are all platform-wide install, delete, update scripts, etc. for MCSManager.
The default installation script on the official website is the `setup.sh` file of gitee repository, it contains multiple languages.
You can also use the following one-click command to perform a quick installation
-
-## Installation method
-
-### One-click installation command
-
-```bash
-wget https://raw.githubusercontent.com/MCSManager/Script/master/setup.sh -O setup.sh && bash setup.sh
-```
-
-### Docker (Beta)
-
-Please check this [tutorial](https://github.com/MCSManager/Script/blob/master/docker/README.md)
-
-
From c3e0d074705b96c2d5275247212a71ff8cf74d01 Mon Sep 17 00:00:00 2001
From: Umou
Date: Mon, 1 Apr 2024 22:53:28 +0800
Subject: [PATCH 109/460] Update install.sh
---
install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install.sh b/install.sh
index 46d38a5..0a4de74 100644
--- a/install.sh
+++ b/install.sh
@@ -1,7 +1,7 @@
#!/bin/bash
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/MCSManager-v10-linux.tar.gz"
+mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
package_name="MCSManager-v10-linux.tar.gz"
node="v16.20.2"
From c163a027cad9b7b33c85ab241f048fa8a1601888 Mon Sep 17 00:00:00 2001
From: Umou
Date: Tue, 2 Apr 2024 15:10:59 +0800
Subject: [PATCH 110/460] Update install.sh
---
install.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/install.sh b/install.sh
index 0a4de74..9613e3f 100644
--- a/install.sh
+++ b/install.sh
@@ -119,7 +119,9 @@ Install_MCSManager() {
echo_yellow "=============== MCSManager ==============="
echo
echo_green "[+] MCSManager installation success!"
-
+
+ sudo chmod -R 755 /opt/mcsmanager/
+
sleep 3
}
From 8aedc984e02e5ce6a3e5541ab08e3fe5a5bba31b Mon Sep 17 00:00:00 2001
From: Umou
Date: Wed, 3 Apr 2024 14:09:48 +0800
Subject: [PATCH 111/460] Update install.sh
---
install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/install.sh b/install.sh
index 9613e3f..42a35b7 100644
--- a/install.sh
+++ b/install.sh
@@ -104,13 +104,13 @@ Install_MCSManager() {
cd daemon || exit
echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit > npm_install_log
# echo "[←] cd .."
cd ../web || exit
echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit > npm_install_log
echo
echo_yellow "=============== MCSManager ==============="
From d42d5004f2857cfe0f4266a27bbe02c9f23e9156 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E7=90=A8?=
Date: Wed, 3 Apr 2024 15:36:32 +0800
Subject: [PATCH 112/460] Feat: upgrade to v10
---
install.sh | 250 ----------------------------------------------
package-lock.json | 6 ++
setup.sh | 136 ++++++++++++-------------
setup_cn.sh | 179 ++++++++++++++-------------------
setup_en.sh | 136 ++++++++++++-------------
5 files changed, 221 insertions(+), 486 deletions(-)
delete mode 100644 install.sh
create mode 100644 package-lock.json
diff --git a/install.sh b/install.sh
deleted file mode 100644
index 42a35b7..0000000
--- a/install.sh
+++ /dev/null
@@ -1,250 +0,0 @@
-#!/bin/bash
-
-mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
-package_name="MCSManager-v10-linux.tar.gz"
-node="v16.20.2"
-
-error=""
-arch=$(uname -m)
-
-printf "\033c"
-
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
-echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
-}
-
-echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
-
-echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
-}
-
-echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
-}
-
-# script info
-echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-"
-
-Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
-}
-
-
-Install_Node() {
- echo_cyan_n "[+] Install Node.JS environment...\n"
-
- sudo rm -irf "$node_install_path"
-
- cd /opt || exit
-
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
-
- tar -zxf node-"$node"-linux-"$arch".tar.gz
-
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- Red_Error "[x] Node installation failed!"
- fi
-
- echo
- echo_yellow "=============== Node.JS Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node.JS Version ==============="
- echo
-
- sleep 3
-}
-
-
-Install_MCSManager() {
- echo_cyan "[+] Install MCSManager..."
-
- # stop service
- sudo systemctl stop mcsm-{web,daemon}
- sudo systemctl disable mcsm-{web,daemon}
-
- # delete service
- sudo rm -rf /etc/systemd/system/mcsm-daemon.service
- sudo rm -rf /etc/systemd/system/mcsm-web.service
- sudo systemctl daemon-reload
-
- mkdir -p ${mcsmanager_install_path} || exit
-
- # cd /opt/mcsmanager
- cd ${mcsmanager_install_path} || exit
-
-
- # donwload MCSManager release
- wget ${mcsmanager_donwload_addr}
- tar -zxf ${package_name} -o || exit
- rm -rf "${mcsmanager_install_path}/${package_name}"
-
- # echo "[→] cd daemon"
- cd daemon || exit
-
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit > npm_install_log
-
- # echo "[←] cd .."
- cd ../web || exit
-
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit > npm_install_log
-
- echo
- echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
- echo
- echo_green "[+] MCSManager installation success!"
-
- sudo chmod -R 755 /opt/mcsmanager/
-
- sleep 3
-}
-
-Create_Service() {
- echo_cyan "[+] Create MCSManager service..."
- echo_cyan "[!] Try to register to the "systemctl", This comomand require \"root\" permission."
-
- sudo echo "[Unit]
-Description=MCSManager-Daemon
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-daemon.service
-
- sudo echo "[Unit]
-Description=MCSManager-Web
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/web
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-web.service
-
- if [ -e "/etc/systemd/system/mcsm-web.service" ]; then
- sudo systemctl daemon-reload
- sudo systemctl enable mcsm-daemon.service --now
- sudo systemctl enable mcsm-web.service --now
- echo_green "Registered!"
- else
- printf "\n\n"
- echo_red "The MCSManager was successfully installed to \"/opt/mcsmanager\"."
- echo_red "But register to the \"systemctl\" failed!\nPlease use the \"root\" account to re-run the script!"
- exit
- fi
-
- sleep 2
-
- printf "\n\n\n\n"
-
- echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager!!!"
- echo_yellow " "
- echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333 (Browser)"
- echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444 (Cluster)"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
-}
-
-
-
-# Environmental inspection
-if [[ "$arch" == x86_64 ]]; then
- arch=x64
- #echo "[-] x64 architecture detected"
-elif [[ $arch == aarch64 ]]; then
- arch=arm64
- #echo "[-] 64-bit ARM architecture detected"
-elif [[ $arch == arm ]]; then
- arch=armv7l
- #echo "[-] 32-bit ARM architecture detected"
-elif [[ $arch == ppc64le ]]; then
- arch=ppc64le
- #echo "[-] IBM POWER architecture detected"
-elif [[ $arch == s390x ]]; then
- arch=s390x
- #echo "[-] IBM LinuxONE architecture detected"
-else
- Red_Error "[x] Sorry, this architecture is not supported yet!"
- Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
- exit
-fi
-
-# Define the variable Node installation directory
-node_install_path="/opt/node-$node-linux-$arch"
-
-# Check network connection
-echo_cyan "[-] Architecture: $arch"
-
-# Install related software
-echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [[ -x "$(command -v yum)" ]]; then sudo yum install -y git tar > error;
-elif [[ -x "$(command -v apt-get)" ]]; then sudo apt-get install -y git tar > error;
-elif [[ -x "$(command -v pacman)" ]]; then sudo pacman -Syu --noconfirm git tar > error;
-elif [[ -x "$(command -v zypper)" ]]; then sudo zypper --non-interactive install git tar > error;
-fi
-
-# Determine whether the relevant software is installed successfully
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- echo "$error"
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- exit
-fi
-
-
-# Install the Node environment
-Install_Node
-
-# Install MCSManager
-Install_MCSManager
-
-# Create MCSManager background service
-Create_Service
-
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..6f84430
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,6 @@
+{
+ "name": "Script",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {}
+}
diff --git a/setup.sh b/setup.sh
index f5e7ef2..4e5220a 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,16 +1,15 @@
#!/bin/bash
-# Config
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz"
-node="v14.19.1"
+mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+package_name="MCSManager-v10-linux.tar.gz"
+node="v16.20.2"
error=""
arch=$(uname -m)
printf "\033c"
-# print func
echo_cyan() {
printf '\033[1;36m%b\033[0m\n' "$@"
}
@@ -34,10 +33,6 @@ echo_yellow() {
echo_cyan "+----------------------------------------------------------------------
| MCSManager Installer
+----------------------------------------------------------------------
-| Copyright © 2023 MCSManager.
-+----------------------------------------------------------------------
-| Contributors: Nuomiaa, CreeperKong, Unitwk, FunnyShadow
-+----------------------------------------------------------------------
"
Red_Error() {
@@ -47,15 +42,14 @@ Red_Error() {
exit 1
}
-
Install_Node() {
- echo_cyan_n "[+] Install Node.JS environment... "
+ echo_cyan_n "[+] Install Node.JS environment...\n"
- rm -irf "$node_install_path"
+ sudo rm -irf "$node_install_path"
cd /opt || exit
- rm -rf node-"$node"-linux-"$arch".tar.gz
+ rm -rf node-"$node"-linux-"$arch".tar.gz
wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
@@ -63,8 +57,7 @@ Install_Node() {
rm -rf node-"$node"-linux-"$arch".tar.gz
- if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]
- then
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
echo_green "Success"
else
echo_red "Failed"
@@ -81,40 +74,39 @@ Install_Node() {
sleep 3
}
-
Install_MCSManager() {
echo_cyan "[+] Install MCSManager..."
# stop service
- systemctl stop mcsm-{web,daemon}
+ sudo systemctl stop mcsm-{web,daemon}
+ sudo systemctl disable mcsm-{web,daemon}
# delete service
- rm -rf /etc/systemd/system/mcsm-daemon.service
- rm -rf /etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
+ sudo rm -rf /etc/systemd/system/mcsm-daemon.service
+ sudo rm -rf /etc/systemd/system/mcsm-web.service
+ sudo systemctl daemon-reload
mkdir -p ${mcsmanager_install_path} || exit
# cd /opt/mcsmanager
cd ${mcsmanager_install_path} || exit
-
# donwload MCSManager release
wget ${mcsmanager_donwload_addr}
- tar -zxf mcsmanager_linux_release.tar.gz -o
- rm -rf "${mcsmanager_install_path}/mcsmanager_linux_release.tar.gz"
-
+ tar -zxf ${package_name} -o || exit
+ rm -rf "${mcsmanager_install_path}/${package_name}"
+
# echo "[→] cd daemon"
cd daemon || exit
echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
# echo "[←] cd .."
cd ../web || exit
echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
echo
echo_yellow "=============== MCSManager ==============="
@@ -124,15 +116,17 @@ Install_MCSManager() {
echo
echo_green "[+] MCSManager installation success!"
+ sudo chmod -R 755 /opt/mcsmanager/
+
sleep 3
}
Create_Service() {
echo_cyan "[+] Create MCSManager service..."
+ echo_cyan "[!] Try to register to the "systemctl", This comomand require \"root\" permission."
- echo "
-[Unit]
-Description=MCSManager Daemon
+ sudo echo "[Unit]
+Description=MCSManager-Daemon
[Service]
WorkingDirectory=/opt/mcsmanager/daemon
@@ -143,11 +137,10 @@ Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-daemon.service
+" >/etc/systemd/system/mcsm-daemon.service
- echo "
-[Unit]
-Description=MCSManager Web
+ sudo echo "[Unit]
+Description=MCSManager-Web
[Service]
WorkingDirectory=/opt/mcsmanager/web
@@ -158,34 +151,42 @@ Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-web.service
+" >/etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
+ if [ -e "/etc/systemd/system/mcsm-web.service" ]; then
+ sudo systemctl daemon-reload
+ sudo systemctl enable mcsm-daemon.service --now
+ sudo systemctl enable mcsm-web.service --now
+ echo_green "Registered!"
+ else
+ printf "\n\n"
+ echo_red "The MCSManager was successfully installed to \"/opt/mcsmanager\"."
+ echo_red "But register to the \"systemctl\" failed!\nPlease use the \"root\" account to re-run the script!"
+ exit
+ fi
- sleep 3
+ sleep 2
- printf "\n\n"
+ printf "\n\n\n\n"
echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager panel !!!"
- echo_yellow " "
- echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
- echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_yellow " "
+ echo_cyan_n "HTTP Web Service: "
+ echo_yellow "http://:23333 (Browser)"
+ echo_cyan_n "Daemon Address: "
+ echo_yellow "ws://:24444 (Cluster)"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
}
-
-
# Environmental inspection
if [[ "$arch" == x86_64 ]]; then
arch=x64
@@ -216,24 +217,26 @@ echo_cyan "[-] Architecture: $arch"
# Install related software
echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [[ -x "$(command -v yum)" ]]; then yum install -y git tar > error;
-elif [[ -x "$(command -v apt-get)" ]]; then apt-get install -y git tar > error;
-elif [[ -x "$(command -v pacman)" ]]; then pacman -Syu --noconfirm git tar > error;
-elif [[ -x "$(command -v zypper)" ]]; then sudo zypper --non-interactive install git tar > error;
+if [[ -x "$(command -v yum)" ]]; then
+ sudo yum install -y git tar >error
+elif [[ -x "$(command -v apt-get)" ]]; then
+ sudo apt-get install -y git tar >error
+elif [[ -x "$(command -v pacman)" ]]; then
+ sudo pacman -Syu --noconfirm git tar >error
+elif [[ -x "$(command -v zypper)" ]]; then
+ sudo zypper --non-interactive install git tar >error
fi
# Determine whether the relevant software is installed successfully
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- echo "$error"
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- exit
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
+ echo_green "Success"
+else
+ echo_red "Failed"
+ echo "$error"
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
+ exit
fi
-
# Install the Node environment
Install_Node
@@ -242,4 +245,3 @@ Install_MCSManager
# Create MCSManager background service
Create_Service
-
diff --git a/setup_cn.sh b/setup_cn.sh
index fe93d45..613fa13 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -1,26 +1,15 @@
#!/bin/bash
-# 检查当前用户是否为 root 用户
-if [[ $(id -u) -ne 0 ]]; then
- echo -e "\033[31m需要 root 权限执行此脚本,请使用 sudo 或者切换到 root 用户。\033[0m"
- exit 1
-fi
-# 如果当前用户是 root 用户,则执行脚本的主体部分
-echo -e "\033[33m当前用户是 root 用户,开始执行 MCSManager 安装脚本。\033[0m"
-# Config
+
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://gitee.com/mcsmanager/MCSManager/releases/download/v9.9.0/mcsmanager_linux_release.tar.gz"
-node="v14.19.1"
-zh=$(
- [[ $(locale -a) =~ "zh" ]] && echo 1
- export LANG=zh_CN.UTF-8 || echo 0
-)
+mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+package_name="MCSManager-v10-linux.tar.gz"
+node="v16.20.2"
error=""
arch=$(uname -m)
printf "\033c"
-# print func
echo_cyan() {
printf '\033[1;36m%b\033[0m\n' "$@"
}
@@ -40,17 +29,12 @@ echo_yellow() {
printf '\033[1;33m%b\033[0m\n' "$@"
}
-# script info
echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-| Copyright © 2023 MCSManager.
-+----------------------------------------------------------------------
-| Contributors: Nuomiaa, CreeperKong, Unitwk, FunnyShadow
+| MCSManager 安装脚本
+----------------------------------------------------------------------
-We will use servers in the China to speed up your installation!
-我们将使用中国地区的服务器来加速您的安装速度!
+MCSManager 安装脚本不会破坏您系统上原有的任何服务以及环境变量,安装脚本所有的一切均为无污染的安全行为!
+我们只会在 /opt 目录下创建两个文件夹,一个用于存放 NodeJS 运行时,一个用于存放 MCSManager 代码文件,并且尝试添加 MCSM 到系统服务!
"
Red_Error() {
@@ -60,24 +44,22 @@ Red_Error() {
exit 1
}
-
Install_Node() {
- echo_cyan_n "[+] Install Node.JS environment... "
+ echo_cyan_n "[+] 正在安装 NodeJS 运行时环境...\n"
- rm -irf "$node_install_path"
+ sudo rm -irf "$node_install_path"
cd /opt || exit
- rm -rf node-"$node"-linux-"$arch".tar.gz
+ rm -rf node-"$node"-linux-"$arch".tar.gz
- wget https://npmmirror.com/mirrors/node/"$node"/node-"$node"-linux-"$arch".tar.gz
+ wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
tar -zxf node-"$node"-linux-"$arch".tar.gz
rm -rf node-"$node"-linux-"$arch".tar.gz
- if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]
- then
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
echo_green "Success"
else
echo_red "Failed"
@@ -94,40 +76,39 @@ Install_Node() {
sleep 3
}
-
Install_MCSManager() {
- echo_cyan "[+] Install MCSManager..."
+ echo_cyan "[+] 正在安装面板..."
# stop service
- systemctl stop mcsm-{web,daemon}
+ sudo systemctl stop mcsm-{web,daemon}
+ sudo systemctl disable mcsm-{web,daemon}
# delete service
- rm -rf /etc/systemd/system/mcsm-daemon.service
- rm -rf /etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
+ sudo rm -rf /etc/systemd/system/mcsm-daemon.service
+ sudo rm -rf /etc/systemd/system/mcsm-web.service
+ sudo systemctl daemon-reload
mkdir -p ${mcsmanager_install_path} || exit
# cd /opt/mcsmanager
cd ${mcsmanager_install_path} || exit
-
# donwload MCSManager release
wget ${mcsmanager_donwload_addr}
- tar -zxf mcsmanager_linux_release.tar.gz -o
- rm -rf "${mcsmanager_install_path}/mcsmanager_linux_release.tar.gz"
-
+ tar -zxf ${package_name} -o || exit
+ rm -rf "${mcsmanager_install_path}/${package_name}"
+
# echo "[→] cd daemon"
cd daemon || exit
echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production > npm_install_log
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
# echo "[←] cd .."
cd ../web || exit
echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production > npm_install_log
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
echo
echo_yellow "=============== MCSManager ==============="
@@ -137,15 +118,17 @@ Install_MCSManager() {
echo
echo_green "[+] MCSManager installation success!"
+ sudo chmod -R 755 /opt/mcsmanager/
+
sleep 3
}
Create_Service() {
- echo_cyan "[+] Create MCSManager service..."
+ echo_cyan "[+] 注册系统服务中..."
+ echo_cyan "[!] Try to register to the "systemctl", This comomand require \"root\" permission."
- echo "
-[Unit]
-Description=MCSManager Daemon
+ sudo echo "[Unit]
+Description=MCSManager-Daemon
[Service]
WorkingDirectory=/opt/mcsmanager/daemon
@@ -156,11 +139,10 @@ Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-daemon.service
+" >/etc/systemd/system/mcsm-daemon.service
- echo "
-[Unit]
-Description=MCSManager Web
+ sudo echo "[Unit]
+Description=MCSManager-Web
[Service]
WorkingDirectory=/opt/mcsmanager/web
@@ -171,49 +153,41 @@ Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-web.service
-
- systemctl daemon-reload
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
+" >/etc/systemd/system/mcsm-web.service
- sleep 3
-
- printf "\n\n"
- echo_yellow "=================================================================="
- if [[ "$zh" == 1 ]]; then
- echo_green "安装已完成!欢迎使用 MCSManager 面板!"
- echo_yellow " "
- echo_cyan_n "控制面板地址: "
- echo_yellow "http://你的公网IP:23333"
- echo_red "你必须开放 23333(面板)和 24444(守护进程用)端口,控制面板需要这两个端口才能正常工作。"
- echo_yellow " "
- echo_cyan "下面是常用的几个命令:"
- echo_cyan "启动面板 systemctl start mcsm-{daemon,web}.service"
- echo_cyan "停止面板 systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "重启面板 systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_cyan "官方文档(必读):https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ if [ -e "/etc/systemd/system/mcsm-web.service" ]; then
+ sudo systemctl daemon-reload
+ sudo systemctl enable mcsm-daemon.service --now
+ sudo systemctl enable mcsm-web.service --now
+ echo_green "Registered!"
else
- echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager panel!"
- echo_yellow " "
- echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
- echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ printf "\n\n"
+ echo_red "面板已成功安装到目录: \"/opt/mcsmanager\"."
+ echo_red "但是由于权限不足,无法注册到系统服务中,你可以手动启动面板(参考 Github Readme.md)或重新使用 root 权限安装!"
+ exit
fi
-}
+ sleep 2
+ printf "\n\n\n\n"
+
+ echo_yellow "=================================================================="
+ echo_green "MCSManager 面板已安装完成!接下来您只需在浏览器访问即可愉快的使用它!"
+ echo_yellow " "
+ echo_cyan_n "请使用浏览器访问此地址: "
+ echo_yellow "http://<公网IP>:23333"
+ echo_cyan_n "守护进程地址(集群用): "
+ echo_yellow "ws://<公网IP>:24444"
+ echo_red "注意:您必须开放 23333 和 24444 两个端口才能保证服务正常访问!"
+ echo_yellow " "
+ echo_cyan "面板常用命令:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service # 开启面板"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service # 关闭面板"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service # 重启面板"
+ echo_yellow " "
+ echo_green "官方文档: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+}
# Environmental inspection
if [[ "$arch" == x86_64 ]]; then
@@ -245,24 +219,26 @@ echo_cyan "[-] Architecture: $arch"
# Install related software
echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [[ -x "$(command -v yum)" ]]; then yum install -y git tar > error;
-elif [[ -x "$(command -v apt-get)" ]]; then apt-get install -y git tar > error;
-elif [[ -x "$(command -v pacman)" ]]; then pacman -Syu --noconfirm git tar > error;
-elif [[ -x "$(command -v zypper)" ]]; then sudo zypper --non-interactive install git tar > error;
+if [[ -x "$(command -v yum)" ]]; then
+ sudo yum install -y git tar >error
+elif [[ -x "$(command -v apt-get)" ]]; then
+ sudo apt-get install -y git tar >error
+elif [[ -x "$(command -v pacman)" ]]; then
+ sudo pacman -Syu --noconfirm git tar >error
+elif [[ -x "$(command -v zypper)" ]]; then
+ sudo zypper --non-interactive install git tar >error
fi
# Determine whether the relevant software is installed successfully
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- echo "$error"
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- exit
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
+ echo_green "Success"
+else
+ echo_red "Failed"
+ echo "$error"
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
+ exit
fi
-
# Install the Node environment
Install_Node
@@ -271,4 +247,3 @@ Install_MCSManager
# Create MCSManager background service
Create_Service
-
diff --git a/setup_en.sh b/setup_en.sh
index f5e7ef2..4e5220a 100644
--- a/setup_en.sh
+++ b/setup_en.sh
@@ -1,16 +1,15 @@
#!/bin/bash
-# Config
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz"
-node="v14.19.1"
+mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+package_name="MCSManager-v10-linux.tar.gz"
+node="v16.20.2"
error=""
arch=$(uname -m)
printf "\033c"
-# print func
echo_cyan() {
printf '\033[1;36m%b\033[0m\n' "$@"
}
@@ -34,10 +33,6 @@ echo_yellow() {
echo_cyan "+----------------------------------------------------------------------
| MCSManager Installer
+----------------------------------------------------------------------
-| Copyright © 2023 MCSManager.
-+----------------------------------------------------------------------
-| Contributors: Nuomiaa, CreeperKong, Unitwk, FunnyShadow
-+----------------------------------------------------------------------
"
Red_Error() {
@@ -47,15 +42,14 @@ Red_Error() {
exit 1
}
-
Install_Node() {
- echo_cyan_n "[+] Install Node.JS environment... "
+ echo_cyan_n "[+] Install Node.JS environment...\n"
- rm -irf "$node_install_path"
+ sudo rm -irf "$node_install_path"
cd /opt || exit
- rm -rf node-"$node"-linux-"$arch".tar.gz
+ rm -rf node-"$node"-linux-"$arch".tar.gz
wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
@@ -63,8 +57,7 @@ Install_Node() {
rm -rf node-"$node"-linux-"$arch".tar.gz
- if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]
- then
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
echo_green "Success"
else
echo_red "Failed"
@@ -81,40 +74,39 @@ Install_Node() {
sleep 3
}
-
Install_MCSManager() {
echo_cyan "[+] Install MCSManager..."
# stop service
- systemctl stop mcsm-{web,daemon}
+ sudo systemctl stop mcsm-{web,daemon}
+ sudo systemctl disable mcsm-{web,daemon}
# delete service
- rm -rf /etc/systemd/system/mcsm-daemon.service
- rm -rf /etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
+ sudo rm -rf /etc/systemd/system/mcsm-daemon.service
+ sudo rm -rf /etc/systemd/system/mcsm-web.service
+ sudo systemctl daemon-reload
mkdir -p ${mcsmanager_install_path} || exit
# cd /opt/mcsmanager
cd ${mcsmanager_install_path} || exit
-
# donwload MCSManager release
wget ${mcsmanager_donwload_addr}
- tar -zxf mcsmanager_linux_release.tar.gz -o
- rm -rf "${mcsmanager_install_path}/mcsmanager_linux_release.tar.gz"
-
+ tar -zxf ${package_name} -o || exit
+ rm -rf "${mcsmanager_install_path}/${package_name}"
+
# echo "[→] cd daemon"
cd daemon || exit
echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
# echo "[←] cd .."
cd ../web || exit
echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production > npm_install_log
+ /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
echo
echo_yellow "=============== MCSManager ==============="
@@ -124,15 +116,17 @@ Install_MCSManager() {
echo
echo_green "[+] MCSManager installation success!"
+ sudo chmod -R 755 /opt/mcsmanager/
+
sleep 3
}
Create_Service() {
echo_cyan "[+] Create MCSManager service..."
+ echo_cyan "[!] Try to register to the "systemctl", This comomand require \"root\" permission."
- echo "
-[Unit]
-Description=MCSManager Daemon
+ sudo echo "[Unit]
+Description=MCSManager-Daemon
[Service]
WorkingDirectory=/opt/mcsmanager/daemon
@@ -143,11 +137,10 @@ Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-daemon.service
+" >/etc/systemd/system/mcsm-daemon.service
- echo "
-[Unit]
-Description=MCSManager Web
+ sudo echo "[Unit]
+Description=MCSManager-Web
[Service]
WorkingDirectory=/opt/mcsmanager/web
@@ -158,34 +151,42 @@ Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-web.service
+" >/etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
+ if [ -e "/etc/systemd/system/mcsm-web.service" ]; then
+ sudo systemctl daemon-reload
+ sudo systemctl enable mcsm-daemon.service --now
+ sudo systemctl enable mcsm-web.service --now
+ echo_green "Registered!"
+ else
+ printf "\n\n"
+ echo_red "The MCSManager was successfully installed to \"/opt/mcsmanager\"."
+ echo_red "But register to the \"systemctl\" failed!\nPlease use the \"root\" account to re-run the script!"
+ exit
+ fi
- sleep 3
+ sleep 2
- printf "\n\n"
+ printf "\n\n\n\n"
echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager panel !!!"
- echo_yellow " "
- echo_cyan_n "HTTP Web Service: "; echo_yellow "http://:23333"
- echo_cyan_n "Daemon Address: "; echo_yellow "ws://:24444"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_yellow " "
+ echo_cyan_n "HTTP Web Service: "
+ echo_yellow "http://:23333 (Browser)"
+ echo_cyan_n "Daemon Address: "
+ echo_yellow "ws://:24444 (Cluster)"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
}
-
-
# Environmental inspection
if [[ "$arch" == x86_64 ]]; then
arch=x64
@@ -216,24 +217,26 @@ echo_cyan "[-] Architecture: $arch"
# Install related software
echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [[ -x "$(command -v yum)" ]]; then yum install -y git tar > error;
-elif [[ -x "$(command -v apt-get)" ]]; then apt-get install -y git tar > error;
-elif [[ -x "$(command -v pacman)" ]]; then pacman -Syu --noconfirm git tar > error;
-elif [[ -x "$(command -v zypper)" ]]; then sudo zypper --non-interactive install git tar > error;
+if [[ -x "$(command -v yum)" ]]; then
+ sudo yum install -y git tar >error
+elif [[ -x "$(command -v apt-get)" ]]; then
+ sudo apt-get install -y git tar >error
+elif [[ -x "$(command -v pacman)" ]]; then
+ sudo pacman -Syu --noconfirm git tar >error
+elif [[ -x "$(command -v zypper)" ]]; then
+ sudo zypper --non-interactive install git tar >error
fi
# Determine whether the relevant software is installed successfully
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]
- then
- echo_green "Success"
- else
- echo_red "Failed"
- echo "$error"
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- exit
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
+ echo_green "Success"
+else
+ echo_red "Failed"
+ echo "$error"
+ Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
+ exit
fi
-
# Install the Node environment
Install_Node
@@ -242,4 +245,3 @@ Install_MCSManager
# Create MCSManager background service
Create_Service
-
From 71592112ac3fb88198e67b62362d2390ad921390 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E7=90=A8?=
Date: Wed, 3 Apr 2024 15:36:48 +0800
Subject: [PATCH 113/460] Feat: upgrade to v10
---
setup_en.sh | 247 ----------------------------------------------------
1 file changed, 247 deletions(-)
delete mode 100644 setup_en.sh
diff --git a/setup_en.sh b/setup_en.sh
deleted file mode 100644
index 4e5220a..0000000
--- a/setup_en.sh
+++ /dev/null
@@ -1,247 +0,0 @@
-#!/bin/bash
-
-mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
-package_name="MCSManager-v10-linux.tar.gz"
-node="v16.20.2"
-
-error=""
-arch=$(uname -m)
-
-printf "\033c"
-
-echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
-echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
-}
-
-echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
-
-echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
-}
-
-echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
-}
-
-# script info
-echo_cyan "+----------------------------------------------------------------------
-| MCSManager Installer
-+----------------------------------------------------------------------
-"
-
-Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
-}
-
-Install_Node() {
- echo_cyan_n "[+] Install Node.JS environment...\n"
-
- sudo rm -irf "$node_install_path"
-
- cd /opt || exit
-
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
-
- tar -zxf node-"$node"-linux-"$arch".tar.gz
-
- rm -rf node-"$node"-linux-"$arch".tar.gz
-
- if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
- echo_green "Success"
- else
- echo_red "Failed"
- Red_Error "[x] Node installation failed!"
- fi
-
- echo
- echo_yellow "=============== Node.JS Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node.JS Version ==============="
- echo
-
- sleep 3
-}
-
-Install_MCSManager() {
- echo_cyan "[+] Install MCSManager..."
-
- # stop service
- sudo systemctl stop mcsm-{web,daemon}
- sudo systemctl disable mcsm-{web,daemon}
-
- # delete service
- sudo rm -rf /etc/systemd/system/mcsm-daemon.service
- sudo rm -rf /etc/systemd/system/mcsm-web.service
- sudo systemctl daemon-reload
-
- mkdir -p ${mcsmanager_install_path} || exit
-
- # cd /opt/mcsmanager
- cd ${mcsmanager_install_path} || exit
-
- # donwload MCSManager release
- wget ${mcsmanager_donwload_addr}
- tar -zxf ${package_name} -o || exit
- rm -rf "${mcsmanager_install_path}/${package_name}"
-
- # echo "[→] cd daemon"
- cd daemon || exit
-
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
-
- # echo "[←] cd .."
- cd ../web || exit
-
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
-
- echo
- echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
- echo
- echo_green "[+] MCSManager installation success!"
-
- sudo chmod -R 755 /opt/mcsmanager/
-
- sleep 3
-}
-
-Create_Service() {
- echo_cyan "[+] Create MCSManager service..."
- echo_cyan "[!] Try to register to the "systemctl", This comomand require \"root\" permission."
-
- sudo echo "[Unit]
-Description=MCSManager-Daemon
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-daemon.service
-
- sudo echo "[Unit]
-Description=MCSManager-Web
-
-[Service]
-WorkingDirectory=/opt/mcsmanager/web
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-web.service
-
- if [ -e "/etc/systemd/system/mcsm-web.service" ]; then
- sudo systemctl daemon-reload
- sudo systemctl enable mcsm-daemon.service --now
- sudo systemctl enable mcsm-web.service --now
- echo_green "Registered!"
- else
- printf "\n\n"
- echo_red "The MCSManager was successfully installed to \"/opt/mcsmanager\"."
- echo_red "But register to the \"systemctl\" failed!\nPlease use the \"root\" account to re-run the script!"
- exit
- fi
-
- sleep 2
-
- printf "\n\n\n\n"
-
- echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager!!!"
- echo_yellow " "
- echo_cyan_n "HTTP Web Service: "
- echo_yellow "http://:23333 (Browser)"
- echo_cyan_n "Daemon Address: "
- echo_yellow "ws://:24444 (Cluster)"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
-}
-
-# Environmental inspection
-if [[ "$arch" == x86_64 ]]; then
- arch=x64
- #echo "[-] x64 architecture detected"
-elif [[ $arch == aarch64 ]]; then
- arch=arm64
- #echo "[-] 64-bit ARM architecture detected"
-elif [[ $arch == arm ]]; then
- arch=armv7l
- #echo "[-] 32-bit ARM architecture detected"
-elif [[ $arch == ppc64le ]]; then
- arch=ppc64le
- #echo "[-] IBM POWER architecture detected"
-elif [[ $arch == s390x ]]; then
- arch=s390x
- #echo "[-] IBM LinuxONE architecture detected"
-else
- Red_Error "[x] Sorry, this architecture is not supported yet!"
- Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
- exit
-fi
-
-# Define the variable Node installation directory
-node_install_path="/opt/node-$node-linux-$arch"
-
-# Check network connection
-echo_cyan "[-] Architecture: $arch"
-
-# Install related software
-echo_cyan_n "[+] Installing dependent software(git,tar)... "
-if [[ -x "$(command -v yum)" ]]; then
- sudo yum install -y git tar >error
-elif [[ -x "$(command -v apt-get)" ]]; then
- sudo apt-get install -y git tar >error
-elif [[ -x "$(command -v pacman)" ]]; then
- sudo pacman -Syu --noconfirm git tar >error
-elif [[ -x "$(command -v zypper)" ]]; then
- sudo zypper --non-interactive install git tar >error
-fi
-
-# Determine whether the relevant software is installed successfully
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
- echo_green "Success"
-else
- echo_red "Failed"
- echo "$error"
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- exit
-fi
-
-# Install the Node environment
-Install_Node
-
-# Install MCSManager
-Install_MCSManager
-
-# Create MCSManager background service
-Create_Service
From cc9f80d8f2d86620cf81599e118ed3dac798576b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E7=90=A8?=
Date: Wed, 3 Apr 2024 15:37:11 +0800
Subject: [PATCH 114/460] Feat: upgrade to v10
---
README_cn.md | 35 -------
docker/build/Dockerfile-daemon | 27 -----
docker/build/Dockerfile-web | 27 -----
docker/build/build.py | 82 ---------------
docker/build/entrypoint.sh | 23 ----
docker/docs/README.md | 185 ---------------------------------
docker/docs/README_cn.md | 183 --------------------------------
docker/examples/cn/daemon.yaml | 16 ---
docker/examples/cn/full.yaml | 30 ------
docker/examples/cn/web.yaml | 16 ---
docker/examples/en/daemon.yaml | 16 ---
docker/examples/en/full.yaml | 30 ------
docker/examples/en/web.yaml | 16 ---
package-lock.json | 6 --
14 files changed, 692 deletions(-)
delete mode 100644 README_cn.md
delete mode 100644 docker/build/Dockerfile-daemon
delete mode 100644 docker/build/Dockerfile-web
delete mode 100755 docker/build/build.py
delete mode 100644 docker/build/entrypoint.sh
delete mode 100644 docker/docs/README.md
delete mode 100644 docker/docs/README_cn.md
delete mode 100644 docker/examples/cn/daemon.yaml
delete mode 100644 docker/examples/cn/full.yaml
delete mode 100644 docker/examples/cn/web.yaml
delete mode 100644 docker/examples/en/daemon.yaml
delete mode 100644 docker/examples/en/full.yaml
delete mode 100644 docker/examples/en/web.yaml
delete mode 100644 package-lock.json
diff --git a/README_cn.md b/README_cn.md
deleted file mode 100644
index 824d0ca..0000000
--- a/README_cn.md
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-[MCSManager 9 官方网站](http://mcsmanager.com/) | [English](https://github.com/MCSManager/Script/blob/master/README.md) | [Gitee 仓库](https://gitee.com/mcsmanager/script)
-
-
-
-## 这是什么?
-
-这里是 Ubuntu / Debian / CentOS 等 Linux 系系统的 MCSManager 9 安装, 卸载, 升级脚本等的集中存储库
-
-官网上默认的安装脚本为 Gitee 仓库中的 `setup.sh` , 它包含多种语言支持
-
-你也可以使用下列一键命令安装 MCSManager 9
-
-## 安装方法
-
-### 一键命令安装
-
-```bash
-wget https://raw.githubusercontent.com/MCSManager/Script/master/setup.sh -O setup.sh && bash setup.sh
-```
-
-_当然, 一般国内用户因为众所周知的原因都连不上 Github, 下方为 Gitee 国内镜像源链接_
-
-```bash
-wget https://gitee.com/mcsmanager/script/raw/master/setup.sh -O setup.sh && bash setup.sh
-```
-
-### Docker (Beta)
-
-请查看此[教程](https://github.com/MCSManager/Script/blob/master/docker/README_cn.md)
-
-
diff --git a/docker/build/Dockerfile-daemon b/docker/build/Dockerfile-daemon
deleted file mode 100644
index 4361d12..0000000
--- a/docker/build/Dockerfile-daemon
+++ /dev/null
@@ -1,27 +0,0 @@
-FROM debian:stable-slim AS base
-
-RUN sed -i.bak 's/deb.debian.org/mirrors.cernet.edu.cn/g' /etc/apt/sources.list.d/debian.sources \
- && sed -i.bak 's|security.debian.org/debian-security|mirrors.cernet.edu.cn/debian-security|g' /etc/apt/sources.list.d/debian.sources \
- && apt-get update -y \
- && apt-get install -y curl ca-certificates openssl git tar sqlite3 fontconfig tzdata iproute2 gettext-base wget \
- && apt-get clean
-
-RUN cd /tmp \
- && wget https://nodejs.org/dist/latest-v20.x/node-v20.11.1-linux-x64.tar.gz -O node.tar.gz \
- && wget https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz -O mcsmanager.tar.gz \
- && mkdir -p /opt/node \
- && mkdir -p /tmp/mcsmanager \
- && tar -xzf node.tar.gz -C /opt/node --strip-components=1 \
- && tar -xzf mcsmanager.tar.gz -C /tmp/mcsmanager \
- && mv -f /tmp/mcsmanager/daemon /opt/daemon \
- && rm -rf /tmp/mcsmanager \
- && rm -rf node.tar.gz \
- && rm -rf mcsmanager.tar.gz
-
-RUN cd /opt/daemon \
- && /opt/node/bin/node /opt/node/bin/npm install --production
-
-WORKDIR /opt/daemon
-COPY ./entrypoint.sh /
-RUN chmod +x /entrypoint.sh
-CMD ["/bin/bash", "/entrypoint.sh"]
diff --git a/docker/build/Dockerfile-web b/docker/build/Dockerfile-web
deleted file mode 100644
index e89fc78..0000000
--- a/docker/build/Dockerfile-web
+++ /dev/null
@@ -1,27 +0,0 @@
-FROM debian:stable-slim AS base
-
-RUN sed -i.bak 's/deb.debian.org/mirrors.cernet.edu.cn/g' /etc/apt/sources.list.d/debian.sources \
- && sed -i.bak 's|security.debian.org/debian-security|mirrors.cernet.edu.cn/debian-security|g' /etc/apt/sources.list.d/debian.sources \
- && apt-get update -y \
- && apt-get install -y curl ca-certificates openssl git tar sqlite3 fontconfig tzdata iproute2 gettext-base wget \
- && apt-get clean
-
-RUN cd /tmp \
- && wget https://nodejs.org/dist/latest-v20.x/node-v20.11.1-linux-x64.tar.gz -O node.tar.gz \
- && wget https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz -O mcsmanager.tar.gz \
- && mkdir -p /opt/node \
- && mkdir -p /tmp/mcsmanager \
- && tar -xzf node.tar.gz -C /opt/node --strip-components=1 \
- && tar -xzf mcsmanager.tar.gz -C /tmp/mcsmanager \
- && mv -f /tmp/mcsmanager/web /opt/web \
- && rm -rf /tmp/mcsmanager \
- && rm -rf node.tar.gz \
- && rm -rf mcsmanager.tar.gz
-
-RUN cd /opt/web \
- && /opt/node/bin/node /opt/node/bin/npm install --production
-
-WORKDIR /opt/web
-COPY ./entrypoint.sh /
-RUN chmod +x /entrypoint.sh
-CMD ["/bin/bash", "/entrypoint.sh"]
diff --git a/docker/build/build.py b/docker/build/build.py
deleted file mode 100755
index 1e67960..0000000
--- a/docker/build/build.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env python3
-import argparse
-import os
-import subprocess
-import sys
-from typing import Iterator, NamedTuple
-
-class Context(NamedTuple):
- type: str
- version: str
- tag: str
-
-
-def iterate_all() -> Iterator[Context]:
- for type in ['daemon', 'web']:
- for version in [9]:
- tag = f'bluefunny/mcsmanager:{type}-{version}'
- yield Context(type, str(version) , tag)
-
-
-def cmd_build(args: argparse.Namespace):
- for ctx in iterate_all():
- print(f'======== MCSManager | Type: {ctx.type}, Version: {ctx.version}, Tag: {ctx.tag!r} ========')
-
- cmd = [
- 'docker', 'build', os.getcwd(),
- '-f', f'Dockerfile-{ctx.type}',
- '-t', ctx.tag,
- ]
-
- if args.http_proxy is not None:
- cmd.extend([
- '--build-arg', f'http_proxy={args.http_proxy}',
- '--build-arg', f'https_proxy={args.http_proxy}',
- ])
- subprocess.check_call(cmd)
-
- if args.push:
- subprocess.check_call(['docker', 'push', ctx.tag])
-
-
-def cmd_push(args: argparse.Namespace):
- for ctx in iterate_all():
- subprocess.check_call(['docker', 'push', ctx.tag])
-
-
-def cmd_delete(args: argparse.Namespace):
- for ctx in iterate_all():
- subprocess.check_call(['docker', 'image', 'rm', ctx.tag])
-
-
-def main():
- parser = argparse.ArgumentParser()
- subparsers = parser.add_subparsers(title='Command', help='Available commands', dest='command', required=True)
-
- parser_build = subparsers.add_parser('build', help='Build all images')
- parser_build.add_argument('-p', '--push', action='store_true', help='Push after build')
- parser_build.add_argument('--http-proxy', help='Set the url of http proxy to be used in build')
-
- subparsers.add_parser('push', help='Push all images')
- subparsers.add_parser('delete', help='Delete all images')
-
- args = parser.parse_args()
-
- if args.command == 'build':
- cmd_build(args)
- elif args.command == 'push':
- cmd_push(args)
- elif args.command == 'delete':
- cmd_delete(args)
- else:
- print('Unknown command {!r}'.format(args.command))
- sys.exit(1)
-
-
-if __name__ == '__main__':
- try:
- main()
- except subprocess.CalledProcessError as e:
- print(type(e).__name__, e.returncode, file=sys.stderr)
- except KeyboardInterrupt:
- pass
diff --git a/docker/build/entrypoint.sh b/docker/build/entrypoint.sh
deleted file mode 100644
index 916481a..0000000
--- a/docker/build/entrypoint.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-set -e
-
-echo "[-] Checking the operating environment..."
-
-if [ ! -f /opt/node/bin/node ]; then
- echo "[x] The nodejs runtime environment could not be found, you may be using an incomplete version"
- exit 1
-fi
-
-if [ -d /opt/daemon ]; then
- type=daemon
-elif [ -d /opt/web ]; then
- type=web
-else
- echo "[x] The MCSManager file directory could not be found, you may be using an incomplete version"
- exit 1
-fi
-
-echo "[-] The operating environment is normal, starting the MCSManager..."
-
-cd /opt/$type
-eval "/opt/node/bin/node /opt/$type/app.js"
\ No newline at end of file
diff --git a/docker/docs/README.md b/docker/docs/README.md
deleted file mode 100644
index 4bf6e47..0000000
--- a/docker/docs/README.md
+++ /dev/null
@@ -1,185 +0,0 @@
-# Installing MCSManager via Docker
-
-[English](README.md) | [简体中文](./README_cn.md)
-
-## Prerequisites
-
-You need to have the following prerequisites ready beforehand:
-
-- You are using a `Linux` system.
-- `docker-ce` package is already installed.
-
-> Due to the unconventional implementation of Docker Desktop on Windows, we neither support nor recommend installing MCSManager via Docker on Windows systems.
-
-## Getting Started
-
-Firstly, please switch to the root user.
-
-```bash
-sudo su
-```
-
-Then, create some basic directories that will be used later.
-
-```bash
-mkdir -p /opt/mcsmanager # MCSManager container directory
-mkdir -p /opt/mcsmanager/data # MCSManager data directory
-chown -R 1000:1000 /opt/mcsmanager # Modify directory permissions
-cd /opt/mcsmanager
-```
-
-Next, create an empty file named `docker-compose.yaml`.
-
-```bash
-touch docker-compose.yaml
-```
-
-If you need to install both MCSManager Web and MCSManager Daemon simultaneously, please copy the configuration below and paste it into `docker-compose.yaml`.
-
-```yaml
-version: "3"
-
-services:
- web:
- image: bluefunny/mcsmanager:web-9
- container_name: mcsmanager-web
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Web logs directory
- - ./data/logs/web:/opt/web/logs
- # MCSManager Web data directory
- - ./data/data/web:/opt/web/data
- # port:
- # - 23333:23333
- network_mode: host
- command: /entrypoint.sh
-
- daemon:
- image: bluefunny/mcsmanager:daemon-9
- container_name: mcsmanager-daemon
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Daemon logs directory
- - ./data/logs/daemon:/opt/daemon/logs
- # MCSManager Daemon data directory
- - ./data/data/daemon:/opt/daemon/data
- # port:
- # - 24444:24444
- network_mode: host
-```
-
-> If you are unable to copy or paste this file, you can also [click here](../examples/en/full.yaml) to get the example file.
-
-If you only need to install MCSManager Web, please copy the configuration below and paste it into `docker-compose.yaml`.
-
-```yaml
-version: "3"
-
-services:
- web:
- image: bluefunny/mcsmanager:web-9
- container_name: mcsmanager-web
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Web logs directory
- - ./data/logs/web:/opt/web/logs
- # MCSManager Web data directory
- - ./data/data/web:/opt/web/data
- # port:
- # - 23333:23333
- network_mode: host
-```
-
-> If you are unable to copy or paste this file, you can also [click here](../examples/en/web.yaml) to get the example file.
-
-If you want to install only MCSManager Daemon, please copy the configuration below and paste it into `docker-compose.yaml`.
-
-```yaml
-version: "3"
-
-services:
- daemon:
- image: bluefunny/mcsmanager:daemon-9
- container_name: mcsmanager-daemon
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Daemon logs directory
- - ./data/logs/daemon:/opt/daemon/logs
- # MCSManager Daemon data directory
- - ./data/data/daemon:/opt/daemon/data
- # port:
- # - 24444:24444
- network_mode: host
-```
-
-> If you are unable to copy or paste this file, you can also [click here](../examples/en/daemon.yaml) to get the example file.
-
-Once all the above operations are completed, modify the configuration file as needed, then run the following command to start MCSManager.
-
-```bash
-docker compose -f docker-compose.yaml up -d
-```
-
-Now, you just need to wait for the command to complete the installation.
-
-If everything runs smoothly, shortly after, you can access `http://127.0.0.1:23333` to view the panel you just set up!
-
-> If running on a server, replace `127.0.0.1` with your public IP.
-
-> If you installed only the standalone MCSManager Daemon program, replace `23333` with `24444`.
-
-## Uninstallation
-
-If you no longer need MCSManager later on, you can navigate to the folder where you placed `docker-compose.yml` and then enter the following command to uninstall.
-
-```bash
-docker compose -f docker-compose.yaml down
-rm -rf data
-```
-
----
-
-Congratulations! You have completed all the tasks, and now you can start using MCSManager!
-
-However, if you find the original MCSManager Web or MCSManager Daemon images insufficient, you can also compile them yourself.
-
-Below is a simple compilation tutorial.
-
----
-
-## Self-Compilation
-
-> Please note that you need to install `docker-ce` and `python` packages beforehand, and you need to have some Docker usage experience.
-
-If you need to compile yourself, you can use the files in the `build` folder in this directory for compilation.
-
-- `Dockerfile-daemon` is the image construction file for MCSManager Daemon.
-- `Dockerfile-web` is the image construction file for MCSManager Web.
-- `entrypoint.sh` is the default entry script executed in the image, which will run when the image starts.
-- `build.py` is a Python script used to build images. Use `python build.py -h` to get detailed help.
-
-You can use the following commands to build the images.
-
-```bash
-python build.py build
-python build.py build --push # If you need to push the images to Docker Hub, note: this requires you to pre-configure Docker Registry yourself.
-```
-
-If you prefer not to use the `build.py` script, you can also use the following commands to build the images.
-
-```bash
-docker build . -f -t # For example: docker build . -f Dockerfile -t bluefunny/mcsmanager-daemon:9 --build-arg TYPE=daemon --build-arg VERSION=9
-docker push # If you need to push the images to Docker Hub, note: this requires you to pre-configure Docker Registry yourself.
-```
-
-After the build is complete, you just need to replace the `image` section in the configuration files mentioned above with the name of the image you built yourself.
-
-## Acknowledgements
-
-The script was adapted from the personal repository of Fallen_breath: https://github.com/Fallen-Breath/pterodactyl-eggs
-
-### This article was translated by ChatGPT, there may be some errors, if you find these errors, please submit an Issue to let us know
\ No newline at end of file
diff --git a/docker/docs/README_cn.md b/docker/docs/README_cn.md
deleted file mode 100644
index e6d2a9b..0000000
--- a/docker/docs/README_cn.md
+++ /dev/null
@@ -1,183 +0,0 @@
-# 通过 Docker 安装 MCSManager
-
-[English](README.md) | [简体中文](./README_cn.md)
-
-## 预先准备
-
-你需要提前做好以下两点准备
-
-- 你使用的是 `Linux` 系统
-- 已经安装了 `docker-ce` 软件包
-
-> 由于 Windows 上的 Docker Desktop 实现方式并非常规, 因此, 我们不支持也不建议您在 Windows 系统上以 Docker 的方式安装 MCSManager
-
-## 开始安装
-
-首先, 请先切换为 root 用户
-
-```bash
-sudo su
-```
-
-然后使用以下命令创建一些待会儿会用到的基本目录
-
-```bash
-mkdir -p /opt/mcsmanager # MCSManager 容器文件目录
-mkdir -p /opt/mcsmanager/data # MCSManager 数据文件目录
-chown -R 1000:1000 /opt/mcsmanager # 修改目录权限
-cd /opt/mcsmanager
-```
-
-然后, 创建一个名为 `docker-compose.yaml` 的空文件
-
-```bash
-touch docker-compose.yaml
-```
-
-如果你需要同时安装 MCSManager Web 与 MCSManager Daemon, 请复制下面的配置文件, 并将其粘贴到 `docker-compose.yaml` 中
-
-```yaml
-version: "3"
-
-services:
- web:
- image: bluefunny/mcsmanager:web-9
- container_name: mcsmanager-web
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Web 日志存储目录
- - ./data/logs/web:/opt/web/logs
- # MCSManager Web 数据存储目录
- - ./data/data/web:/opt/web/data
- # port:
- # - 23333:23333
- network_mode: host
- command: /entrypoint.sh
-
- daemon:
- image: bluefunny/mcsmanager:daemon-9
- container_name: mcsmanager-daemon
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Daemon 日志存储目录
- - ./data/logs/daemon:/opt/daemon/logs
- # MCSManager Daemon 数据存储目录
- - ./data/data/daemon:/opt/daemon/data
- # port:
- # - 24444:24444
- network_mode: host
-```
-
-> 如果你无法复制或粘贴此文件, 你也可以[点击此处](../examples/cn/full.yaml)获取示例文件
-
-如果你只需要安装 MCSManager Web, 请复制下面的配置文件, 并将其粘贴到 `docker-compose.yaml` 中
-
-```yaml
-version: "3"
-
-services:
- web:
- image: bluefunny/mcsmanager:web-9
- container_name: mcsmanager-web
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Web 日志存储目录
- - ./data/logs/web:/opt/web/logs
- # MCSManager Web 数据存储目录
- - ./data/data/web:/opt/web/data
- # port:
- # - 23333:23333
- network_mode: host
-```
-
-> 如果你无法复制或粘贴此文件, 你也可以[点击此处](../examples/cn/web.yaml)获取示例文件
-
-如果你要同时安装 MCSManager Daemon, 请复制下面的配置文件, 并将其粘贴到 `docker-compose.yaml` 中
-
-```yaml
-version: "3"
-
-services:
- daemon:
- image: bluefunny/mcsmanager:daemon-9
- container_name: mcsmanager-daemon
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Daemon 日志存储目录
- - ./data/logs/daemon:/opt/daemon/logs
- # MCSManager Daemon 数据存储目录
- - ./data/data/daemon:/opt/daemon/data
- # port:
- # - 24444:24444
- network_mode: host
-```
-
-> 如果你无法复制或粘贴此文件, 你也可以[点击此处](../examples/cn/daemon.yaml)获取示例文件
-
-当上述操作全部完成后, 请按需修改配置文件, 之后运行以下命令启动 MCSManager
-
-```bash
-docker compose -f docker-compose.yaml up -d
-```
-
-此时, 你只需要等待命令运行完毕即可完成安装
-
-如果一切运行正常, 那么不久后你就可以访问 `http://127.0.0.1:23333` 来查看你刚刚搭建好的面板了 !
-
-> 如果是在服务器上运行, 则请将 `127.0.0.1` 替换为你的公网 IP
-
-> 如果你安装的是单独的的 MCSManager Daemon 程序, 则请将 `23333` 替换为 `24444`
-
-## 卸载
-
-如果后期你不需要 MCSManager 了, 你可以进入你用于放置 `docker-compose.yml` 的文件夹, 然后输入以下命令以卸载
-
-```bash
-docker compose -f docker-compose.yaml down
-rm -rf data
-```
-
----
-
-至此, 你已完成了全部的任务, 现在你可以开始使用 MCSManager 了 !
-
-不过如果你认为原本的 MCSManager Web 或 MCSManager Daemon 的镜像不够好, 你也可以自行编译
-
-下面为一个简单的编译教程
-
----
-
-## 自行编译
-
-> 请注意, 你需要提前安装好 `docker-ce` 与 `python` 软件包, 并且你需要有一定的 Docker 使用经验
-
-如果你需要自行编译, 你可以使用此目录中的 `build` 文件夹中的文件进行编译
-
-- `Dockerfile-daemon` 为 MCSManager Daemon 的镜像构建文件
-- `Dockerfile-web` 为 MCSManager Web 的镜像构建文件
-- `entrypoint.sh` 为镜像默认执行的入口脚本, 在镜像启动时会运行此脚本
-- `build.py` 为用于构建镜像的 Python 脚本, 使用 `python build.py -h` 以获取详细帮助
-
-你可以使用以下命令构建镜像
-
-```bash
-python build.py build
-python build.py build --push # 如果你需要将镜像推送到 Docker Hub, 注意: 这需要你自己预先配置好 Docker Registry
-```
-
-如果你不想使用 `build.py` 脚本, 你也可以使用以下命令构建镜像
-
-```bash
-docker build . -f <构建文件> -t <标签> # 例如: docker build . -f Dockerfile -t bluefunny/mcsmanager-daemon:9 --build-arg TYPE=daemon --build-arg VERSION=9
-docker push <标签> # 如果你需要将镜像推送到 Docker Hub, 注意: 这需要你自己预先配置好 Docker Registry
-```
-
-在构建完成后, 你只需要将上文中配置文件中的 `image` 部分替换为你自行构建的镜像名称即可
-
-## 致谢
-
-构建脚本来源于 Fallen_breath 的个人仓库: https://github.com/Fallen-Breath/pterodactyl-eggs
\ No newline at end of file
diff --git a/docker/examples/cn/daemon.yaml b/docker/examples/cn/daemon.yaml
deleted file mode 100644
index 408edc9..0000000
--- a/docker/examples/cn/daemon.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-version: "3"
-
-services:
- daemon:
- image: bluefunny/mcsmanager:daemon-9
- container_name: mcsmanager-daemon
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Daemon 日志存储目录
- - ./data/logs/daemon:/opt/daemon/logs
- # MCSManager Daemon 数据存储目录
- - ./data/data/daemon:/opt/daemon/data
- # port:
- # - 24444:24444
- network_mode: host
\ No newline at end of file
diff --git a/docker/examples/cn/full.yaml b/docker/examples/cn/full.yaml
deleted file mode 100644
index 705be75..0000000
--- a/docker/examples/cn/full.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-version: "3"
-
-services:
- web:
- image: bluefunny/mcsmanager:web-9
- container_name: mcsmanager-web
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Web 日志存储目录
- - ./data/logs/web:/opt/web/logs
- # MCSManager Web 数据存储目录
- - ./data/data/web:/opt/web/data
- # port:
- # - 23333:23333
- network_mode: host
-
- daemon:
- image: bluefunny/mcsmanager:daemon-9
- container_name: mcsmanager-daemon
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Daemon 日志存储目录
- - ./data/logs/daemon:/opt/daemon/logs
- # MCSManager Daemon 数据存储目录
- - ./data/data/daemon:/opt/daemon/data
- # port:
- # - 24444:24444
- network_mode: host
\ No newline at end of file
diff --git a/docker/examples/cn/web.yaml b/docker/examples/cn/web.yaml
deleted file mode 100644
index 62eeffe..0000000
--- a/docker/examples/cn/web.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-version: "3"
-
-services:
- web:
- image: bluefunny/mcsmanager:web-9
- container_name: mcsmanager-web
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Web 日志存储目录
- - ./data/logs/web:/opt/web/logs
- # MCSManager Web 数据存储目录
- - ./data/data/web:/opt/web/data
- # port:
- # - 23333:23333
- network_mode: host
\ No newline at end of file
diff --git a/docker/examples/en/daemon.yaml b/docker/examples/en/daemon.yaml
deleted file mode 100644
index 326e043..0000000
--- a/docker/examples/en/daemon.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-version: "3"
-
-services:
- daemon:
- image: bluefunny/mcsmanager:daemon-9
- container_name: mcsmanager-daemon
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Daemon log storage directory
- - ./data/logs/daemon:/opt/daemon/logs
- # MCSManager Daemon data storage directory
- - ./data/data/daemon:/opt/daemon/data
- # port:
- # - 24444:24444
- network_mode: host
\ No newline at end of file
diff --git a/docker/examples/en/full.yaml b/docker/examples/en/full.yaml
deleted file mode 100644
index 1c535cd..0000000
--- a/docker/examples/en/full.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-version: "3"
-
-services:
- web:
- image: bluefunny/mcsmanager:web-9
- container_name: mcsmanager-web
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Web log storage directory
- - ./data/logs/web:/opt/web/logs
- # MCSManager Web data storage directory
- - ./data/data/web:/opt/web/data
- # port:
- # - 23333:23333
- network_mode: host
-
- daemon:
- image: bluefunny/mcsmanager:daemon-9
- container_name: mcsmanager-daemon
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Daemon log storage directory
- - ./data/logs/daemon:/opt/daemon/logs
- # MCSManager Daemon data storage directory
- - ./data/data/daemon:/opt/daemon/data
- # port:
- # - 24444:24444
- network_mode: host
\ No newline at end of file
diff --git a/docker/examples/en/web.yaml b/docker/examples/en/web.yaml
deleted file mode 100644
index 7640f91..0000000
--- a/docker/examples/en/web.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-version: "3"
-
-services:
- web:
- image: bluefunny/mcsmanager:web-9
- container_name: mcsmanager-web
- environment:
- - TZ=Asia/Shanghai
- volumes:
- # MCSManager Web log storage directory
- - ./data/logs/web:/opt/web/logs
- # MCSManager Web data storage directory
- - ./data/data/web:/opt/web/data
- # port:
- # - 23333:23333
- network_mode: host
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
deleted file mode 100644
index 6f84430..0000000
--- a/package-lock.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "Script",
- "lockfileVersion": 2,
- "requires": true,
- "packages": {}
-}
From ea9fea4731316d10b1d18756c9caa4004c0f677f Mon Sep 17 00:00:00 2001
From: unitwk
Date: Sat, 13 Apr 2024 12:16:16 +0800
Subject: [PATCH 115/460] Feat: add build script
---
index.html | 12 ++++++++++++
package-lock.json | 6 ++++++
package.json | 8 ++++++++
3 files changed, 26 insertions(+)
create mode 100644 index.html
create mode 100644 package-lock.json
create mode 100644 package.json
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..320d457
--- /dev/null
+++ b/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+ 404 Not Found
+
+
+ 404 Not Found
+
+
+
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..6946f74
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,6 @@
+{
+ "name": "MCSManager-Script",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {}
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..d7e12cf
--- /dev/null
+++ b/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "mcsmanager-script",
+ "version": "1.0.0",
+ "scripts": {
+ "build": "echo 1"
+ },
+ "license": "MIT"
+}
From d4b486260720c139c15fcf8cb6bf89981d27d4ab Mon Sep 17 00:00:00 2001
From: swwind
Date: Fri, 26 Apr 2024 13:30:00 +0800
Subject: [PATCH 116/460] exit when not sudo
---
setup.sh | 129 ++++++++++++++++++++++++++++---------------------------
1 file changed, 65 insertions(+), 64 deletions(-)
diff --git a/setup.sh b/setup.sh
index 4e5220a..d9cdb4e 100644
--- a/setup.sh
+++ b/setup.sh
@@ -2,12 +2,16 @@
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+mcsmanager_user="mcsm"
package_name="MCSManager-v10-linux.tar.gz"
node="v16.20.2"
-
-error=""
arch=$(uname -m)
+if [ "$(id -u)" -ne 0]; then
+ echo "This script must be run as root. Please use \"sudo bash\" instead."
+ exit 1
+fi
+
printf "\033c"
echo_cyan() {
@@ -45,17 +49,17 @@ Red_Error() {
Install_Node() {
echo_cyan_n "[+] Install Node.JS environment...\n"
- sudo rm -irf "$node_install_path"
+ rm -irf "$node_install_path"
- cd /opt || exit
+ cd /opt || Red_Error "[x] Failed to enter /opt"
- rm -rf node-"$node"-linux-"$arch".tar.gz
+ rm -rf "node-$node-linux-$arch.tar.gz"
- wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
+ wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz"
- tar -zxf node-"$node"-linux-"$arch".tar.gz
+ tar -zxf "node-$node-linux-$arch.tar.gz"
- rm -rf node-"$node"-linux-"$arch".tar.gz
+ rm -rf "node-$node-linux-$arch.tar.gz"
if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
echo_green "Success"
@@ -67,7 +71,7 @@ Install_Node() {
echo
echo_yellow "=============== Node.JS Version ==============="
echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
echo_yellow "=============== Node.JS Version ==============="
echo
@@ -78,35 +82,34 @@ Install_MCSManager() {
echo_cyan "[+] Install MCSManager..."
# stop service
- sudo systemctl stop mcsm-{web,daemon}
- sudo systemctl disable mcsm-{web,daemon}
+ systemctl stop mcsm-{web,daemon}
+ systemctl disable mcsm-{web,daemon}
# delete service
- sudo rm -rf /etc/systemd/system/mcsm-daemon.service
- sudo rm -rf /etc/systemd/system/mcsm-web.service
- sudo systemctl daemon-reload
+ rm -rf /etc/systemd/system/mcsm-{daemon,web}.service
+ systemctl daemon-reload
- mkdir -p ${mcsmanager_install_path} || exit
+ mkdir -p "${mcsmanager_install_path}" || Red_Error "[x] Failed to create ${mcsmanager_install_path}"
# cd /opt/mcsmanager
- cd ${mcsmanager_install_path} || exit
+ cd "${mcsmanager_install_path}" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}"
# donwload MCSManager release
- wget ${mcsmanager_donwload_addr}
- tar -zxf ${package_name} -o || exit
+ wget "${mcsmanager_donwload_addr}" || Red_Error "[x] Failed to download MCSManager"
+ tar -zxf ${package_name} -o || Red_Error "[x] Failed to untar ${package_name}"
rm -rf "${mcsmanager_install_path}/${package_name}"
# echo "[→] cd daemon"
- cd daemon || exit
+ cd "${mcsmanager_install_path}/daemon" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/daemon"
echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
# echo "[←] cd .."
- cd ../web || exit
+ cd "${mcsmanager_install_path}/web" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/web"
echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
echo
echo_yellow "=============== MCSManager ==============="
@@ -116,74 +119,75 @@ Install_MCSManager() {
echo
echo_green "[+] MCSManager installation success!"
- sudo chmod -R 755 /opt/mcsmanager/
+ chmod -R 755 "$mcsmanager_install_path"
sleep 3
}
Create_Service() {
echo_cyan "[+] Create MCSManager service..."
- echo_cyan "[!] Try to register to the "systemctl", This comomand require \"root\" permission."
- sudo echo "[Unit]
+ if id "$mcsmanager_user" &>/dev/null; then
+ userdel "$mcsmanager_user"
+ fi
+
+ useradd -r -M -s "$(which nologin)" "$mcsmanager_user"
+ chown $mcsmanager_user:$mcsmanager_user -R "$mcsmanager_install_path"
+
+ echo "[Unit]
Description=MCSManager-Daemon
[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
+User=${mcsmanager_user}
+WorkingDirectory=${mcsmanager_install_path}/daemon
ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
+ExecReload=/bin/kill -s QUIT \$MAINPID
+ExecStop=/bin/kill -s QUIT \$MAINPID
Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-daemon.service
+" > /etc/systemd/system/mcsm-daemon.service
- sudo echo "[Unit]
+ echo "[Unit]
Description=MCSManager-Web
[Service]
-WorkingDirectory=/opt/mcsmanager/web
+User=${mcsmanager_user}
+WorkingDirectory=${mcsmanager_install_path}/web
ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
+ExecReload=/bin/kill -s QUIT \$MAINPID
+ExecStop=/bin/kill -s QUIT \$MAINPID
Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" >/etc/systemd/system/mcsm-web.service
+" > /etc/systemd/system/mcsm-web.service
- if [ -e "/etc/systemd/system/mcsm-web.service" ]; then
- sudo systemctl daemon-reload
- sudo systemctl enable mcsm-daemon.service --now
- sudo systemctl enable mcsm-web.service --now
- echo_green "Registered!"
- else
- printf "\n\n"
- echo_red "The MCSManager was successfully installed to \"/opt/mcsmanager\"."
- echo_red "But register to the \"systemctl\" failed!\nPlease use the \"root\" account to re-run the script!"
- exit
- fi
+ systemctl daemon-reload
+ systemctl enable mcsm-daemon.service --now
+ systemctl enable mcsm-web.service --now
+ echo_green "Registered!"
sleep 2
printf "\n\n\n\n"
echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_green "Installation is complete! Welcome to the MCSManager!!!"
echo_yellow " "
echo_cyan_n "HTTP Web Service: "
echo_yellow "http://:23333 (Browser)"
echo_cyan_n "Daemon Address: "
echo_yellow "ws://:24444 (Cluster)"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_green "Official Document: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
}
@@ -204,9 +208,7 @@ elif [[ $arch == s390x ]]; then
arch=s390x
#echo "[-] IBM LinuxONE architecture detected"
else
- Red_Error "[x] Sorry, this architecture is not supported yet!"
- Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
- exit
+ Red_Error "[x] Sorry, this architecture is not supported yet!\n[x]Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
fi
# Define the variable Node installation directory
@@ -216,25 +218,24 @@ node_install_path="/opt/node-$node-linux-$arch"
echo_cyan "[-] Architecture: $arch"
# Install related software
-echo_cyan_n "[+] Installing dependent software(git,tar)... "
+echo_cyan_n "[+] Installing dependent software (git, tar)... "
if [[ -x "$(command -v yum)" ]]; then
- sudo yum install -y git tar >error
+ yum install -y git tar
elif [[ -x "$(command -v apt-get)" ]]; then
- sudo apt-get install -y git tar >error
+ apt-get install -y git tar
elif [[ -x "$(command -v pacman)" ]]; then
- sudo pacman -Syu --noconfirm git tar >error
+ pacman -S --noconfirm git tar
elif [[ -x "$(command -v zypper)" ]]; then
- sudo zypper --non-interactive install git tar >error
+ zypper --non-interactive install git tar
+else
+ echo_red "[x] Don't know your package manager! You may need to install git and tar manually!"
fi
# Determine whether the relevant software is installed successfully
if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
echo_green "Success"
else
- echo_red "Failed"
- echo "$error"
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- exit
+ Red_Error "[x] Failed to find git and tar, please install them manually!"
fi
# Install the Node environment
From 387790334b74a5588d1cf07e751952f238a334e6 Mon Sep 17 00:00:00 2001
From: swwind
Date: Fri, 26 Apr 2024 13:36:15 +0800
Subject: [PATCH 117/460] remove useless code
---
setup.sh | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/setup.sh b/setup.sh
index d9cdb4e..2cb01ca 100644
--- a/setup.sh
+++ b/setup.sh
@@ -55,16 +55,15 @@ Install_Node() {
rm -rf "node-$node-linux-$arch.tar.gz"
- wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz"
+ wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
- tar -zxf "node-$node-linux-$arch.tar.gz"
+ tar -zxf "node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to untar node"
rm -rf "node-$node-linux-$arch.tar.gz"
if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
echo_green "Success"
else
- echo_red "Failed"
Red_Error "[x] Node installation failed!"
fi
@@ -82,8 +81,7 @@ Install_MCSManager() {
echo_cyan "[+] Install MCSManager..."
# stop service
- systemctl stop mcsm-{web,daemon}
- systemctl disable mcsm-{web,daemon}
+ systemctl disable --now mcsm-{web,daemon}
# delete service
rm -rf /etc/systemd/system/mcsm-{daemon,web}.service
@@ -103,18 +101,18 @@ Install_MCSManager() {
cd "${mcsmanager_install_path}/daemon" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/daemon"
echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null
# echo "[←] cd .."
cd "${mcsmanager_install_path}/web" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/web"
echo_cyan "[+] Install MCSManager-Web dependencies..."
- env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null
echo
echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_green "Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green "Web: ${mcsmanager_install_path}/web"
echo_yellow "=============== MCSManager ==============="
echo
echo_green "[+] MCSManager installation success!"
@@ -165,8 +163,7 @@ WantedBy=multi-user.target
" > /etc/systemd/system/mcsm-web.service
systemctl daemon-reload
- systemctl enable mcsm-daemon.service --now
- systemctl enable mcsm-web.service --now
+ systemctl enable --now mcsm-{daemon,web}.service
echo_green "Registered!"
sleep 2
@@ -228,7 +225,7 @@ elif [[ -x "$(command -v pacman)" ]]; then
elif [[ -x "$(command -v zypper)" ]]; then
zypper --non-interactive install git tar
else
- echo_red "[x] Don't know your package manager! You may need to install git and tar manually!"
+ echo_red "[!] Cannot find your package manager! You may need to install git and tar manually!"
fi
# Determine whether the relevant software is installed successfully
From 035075aad1e4238f04d2dd07f05e28ae81c25a48 Mon Sep 17 00:00:00 2001
From: swwind
Date: Fri, 26 Apr 2024 13:50:30 +0800
Subject: [PATCH 118/460] Update setup.sh
---
setup.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup.sh b/setup.sh
index 2cb01ca..8b1f2b5 100644
--- a/setup.sh
+++ b/setup.sh
@@ -101,13 +101,13 @@ Install_MCSManager() {
cd "${mcsmanager_install_path}/daemon" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/daemon"
echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/daemon"
# echo "[←] cd .."
cd "${mcsmanager_install_path}/web" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/web"
echo_cyan "[+] Install MCSManager-Web dependencies..."
- env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/web"
echo
echo_yellow "=============== MCSManager ==============="
From 7ab22079afd4a291961cf38d49cbf043f9a9d511 Mon Sep 17 00:00:00 2001
From: swwind
Date: Fri, 26 Apr 2024 14:13:21 +0800
Subject: [PATCH 119/460] add wget to deps list
---
setup.sh | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/setup.sh b/setup.sh
index 8b1f2b5..343a975 100644
--- a/setup.sh
+++ b/setup.sh
@@ -215,24 +215,24 @@ node_install_path="/opt/node-$node-linux-$arch"
echo_cyan "[-] Architecture: $arch"
# Install related software
-echo_cyan_n "[+] Installing dependent software (git, tar)... "
+echo_cyan_n "[+] Installing dependent software (git, tar, wget)... "
if [[ -x "$(command -v yum)" ]]; then
- yum install -y git tar
+ yum install -y git tar wget
elif [[ -x "$(command -v apt-get)" ]]; then
- apt-get install -y git tar
+ apt-get install -y git tar wget
elif [[ -x "$(command -v pacman)" ]]; then
- pacman -S --noconfirm git tar
+ pacman -S --noconfirm git tar wget
elif [[ -x "$(command -v zypper)" ]]; then
- zypper --non-interactive install git tar
+ zypper --non-interactive install git tar wget
else
- echo_red "[!] Cannot find your package manager! You may need to install git and tar manually!"
+ echo_red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
fi
# Determine whether the relevant software is installed successfully
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" && -x "$(command -v wget)" ]]; then
echo_green "Success"
else
- Red_Error "[x] Failed to find git and tar, please install them manually!"
+ Red_Error "[x] Failed to find git, tar and wget, please install them manually!"
fi
# Install the Node environment
From 4863cce4ab8eaa95f92c092529256a6a3f9542ea Mon Sep 17 00:00:00 2001
From: swwind
Date: Fri, 26 Apr 2024 14:21:13 +0800
Subject: [PATCH 120/460] fix: use command -v instead of which
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 343a975..117e338 100644
--- a/setup.sh
+++ b/setup.sh
@@ -129,7 +129,7 @@ Create_Service() {
userdel "$mcsmanager_user"
fi
- useradd -r -M -s "$(which nologin)" "$mcsmanager_user"
+ useradd -r -M -s "$(command -v nologin)" "$mcsmanager_user"
chown $mcsmanager_user:$mcsmanager_user -R "$mcsmanager_install_path"
echo "[Unit]
From b24df0267e1c75bbe00716319f0b46ee4f7fc758 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Fri, 26 Apr 2024 14:34:34 +0800
Subject: [PATCH 121/460] Sync: setup-cn.sh from setup.sh
---
setup.sh | 26 +++++-----
setup_cn.sh | 143 +++++++++++++++++++++++++---------------------------
2 files changed, 83 insertions(+), 86 deletions(-)
diff --git a/setup.sh b/setup.sh
index 8b1f2b5..23dd32e 100644
--- a/setup.sh
+++ b/setup.sh
@@ -4,7 +4,7 @@ mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
mcsmanager_user="mcsm"
package_name="MCSManager-v10-linux.tar.gz"
-node="v16.20.2"
+node="v20.12.2"
arch=$(uname -m)
if [ "$(id -u)" -ne 0]; then
@@ -111,8 +111,8 @@ Install_MCSManager() {
echo
echo_yellow "=============== MCSManager ==============="
- echo_green "Daemon: ${mcsmanager_install_path}/daemon"
- echo_green "Web: ${mcsmanager_install_path}/web"
+ echo_green "Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green "Web: ${mcsmanager_install_path}/web"
echo_yellow "=============== MCSManager ==============="
echo
echo_green "[+] MCSManager installation success!"
@@ -128,7 +128,7 @@ Create_Service() {
if id "$mcsmanager_user" &>/dev/null; then
userdel "$mcsmanager_user"
fi
-
+
useradd -r -M -s "$(which nologin)" "$mcsmanager_user"
chown $mcsmanager_user:$mcsmanager_user -R "$mcsmanager_install_path"
@@ -145,7 +145,7 @@ Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-daemon.service
+" >/etc/systemd/system/mcsm-daemon.service
echo "[Unit]
Description=MCSManager-Web
@@ -160,7 +160,7 @@ Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
-" > /etc/systemd/system/mcsm-web.service
+" >/etc/systemd/system/mcsm-web.service
systemctl daemon-reload
systemctl enable --now mcsm-{daemon,web}.service
@@ -171,20 +171,20 @@ WantedBy=multi-user.target
printf "\n\n\n\n"
echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_green "Installation is complete! Welcome to the MCSManager!!!"
echo_yellow " "
echo_cyan_n "HTTP Web Service: "
echo_yellow "http://:23333 (Browser)"
echo_cyan_n "Daemon Address: "
echo_yellow "ws://:24444 (Cluster)"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_green "Official Document: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
}
diff --git a/setup_cn.sh b/setup_cn.sh
index 613fa13..97c116d 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -2,12 +2,18 @@
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+mcsmanager_user="mcsm"
package_name="MCSManager-v10-linux.tar.gz"
node="v16.20.2"
error=""
arch=$(uname -m)
+if [ "$(id -u)" -ne 0]; then
+ echo "This script must be run as root. Please use \"sudo bash\" instead."
+ exit 1
+fi
+
printf "\033c"
echo_cyan() {
@@ -32,9 +38,6 @@ echo_yellow() {
echo_cyan "+----------------------------------------------------------------------
| MCSManager 安装脚本
+----------------------------------------------------------------------
-
-MCSManager 安装脚本不会破坏您系统上原有的任何服务以及环境变量,安装脚本所有的一切均为无污染的安全行为!
-我们只会在 /opt 目录下创建两个文件夹,一个用于存放 NodeJS 运行时,一个用于存放 MCSManager 代码文件,并且尝试添加 MCSM 到系统服务!
"
Red_Error() {
@@ -45,31 +48,30 @@ Red_Error() {
}
Install_Node() {
- echo_cyan_n "[+] 正在安装 NodeJS 运行时环境...\n"
+ echo_cyan_n "[+] Install Node.JS environment...\n"
- sudo rm -irf "$node_install_path"
+ rm -irf "$node_install_path"
- cd /opt || exit
+ cd /opt || Red_Error "[x] Failed to enter /opt"
- rm -rf node-"$node"-linux-"$arch".tar.gz
+ rm -rf "node-$node-linux-$arch.tar.gz"
- wget https://nodejs.org/dist/"$node"/node-"$node"-linux-"$arch".tar.gz
+ wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
- tar -zxf node-"$node"-linux-"$arch".tar.gz
+ tar -zxf "node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to untar node"
- rm -rf node-"$node"-linux-"$arch".tar.gz
+ rm -rf "node-$node-linux-$arch.tar.gz"
if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
echo_green "Success"
else
- echo_red "Failed"
Red_Error "[x] Node installation failed!"
fi
echo
echo_yellow "=============== Node.JS Version ==============="
echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(/usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
echo_yellow "=============== Node.JS Version ==============="
echo
@@ -77,115 +79,113 @@ Install_Node() {
}
Install_MCSManager() {
- echo_cyan "[+] 正在安装面板..."
+ echo_cyan "[+] Install MCSManager..."
# stop service
- sudo systemctl stop mcsm-{web,daemon}
- sudo systemctl disable mcsm-{web,daemon}
+ systemctl disable --now mcsm-{web,daemon}
# delete service
- sudo rm -rf /etc/systemd/system/mcsm-daemon.service
- sudo rm -rf /etc/systemd/system/mcsm-web.service
- sudo systemctl daemon-reload
+ rm -rf /etc/systemd/system/mcsm-{daemon,web}.service
+ systemctl daemon-reload
- mkdir -p ${mcsmanager_install_path} || exit
+ mkdir -p "${mcsmanager_install_path}" || Red_Error "[x] Failed to create ${mcsmanager_install_path}"
# cd /opt/mcsmanager
- cd ${mcsmanager_install_path} || exit
+ cd "${mcsmanager_install_path}" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}"
# donwload MCSManager release
- wget ${mcsmanager_donwload_addr}
- tar -zxf ${package_name} -o || exit
+ wget "${mcsmanager_donwload_addr}" || Red_Error "[x] Failed to download MCSManager"
+ tar -zxf ${package_name} -o || Red_Error "[x] Failed to untar ${package_name}"
rm -rf "${mcsmanager_install_path}/${package_name}"
# echo "[→] cd daemon"
- cd daemon || exit
+ cd "${mcsmanager_install_path}/daemon" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/daemon"
echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/daemon"
# echo "[←] cd .."
- cd ../web || exit
+ cd "${mcsmanager_install_path}/web" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/web"
echo_cyan "[+] Install MCSManager-Web dependencies..."
- /usr/bin/env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit >npm_install_log
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --registry=https://registry.npmmirror.com --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/web"
echo
echo_yellow "=============== MCSManager ==============="
- echo_green " Daemon: ${mcsmanager_install_path}/daemon"
- echo_green " Web: ${mcsmanager_install_path}/web"
+ echo_green "Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green "Web: ${mcsmanager_install_path}/web"
echo_yellow "=============== MCSManager ==============="
echo
echo_green "[+] MCSManager installation success!"
- sudo chmod -R 755 /opt/mcsmanager/
+ chmod -R 755 "$mcsmanager_install_path"
sleep 3
}
Create_Service() {
- echo_cyan "[+] 注册系统服务中..."
- echo_cyan "[!] Try to register to the "systemctl", This comomand require \"root\" permission."
+ echo_cyan "[+] Create MCSManager service..."
+
+ if id "$mcsmanager_user" &>/dev/null; then
+ userdel "$mcsmanager_user"
+ fi
+
+ useradd -r -M -s "$(which nologin)" "$mcsmanager_user"
+ chown $mcsmanager_user:$mcsmanager_user -R "$mcsmanager_install_path"
- sudo echo "[Unit]
+ echo "[Unit]
Description=MCSManager-Daemon
[Service]
-WorkingDirectory=/opt/mcsmanager/daemon
+User=${mcsmanager_user}
+WorkingDirectory=${mcsmanager_install_path}/daemon
ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
+ExecReload=/bin/kill -s QUIT \$MAINPID
+ExecStop=/bin/kill -s QUIT \$MAINPID
Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
" >/etc/systemd/system/mcsm-daemon.service
- sudo echo "[Unit]
+ echo "[Unit]
Description=MCSManager-Web
[Service]
-WorkingDirectory=/opt/mcsmanager/web
+User=${mcsmanager_user}
+WorkingDirectory=${mcsmanager_install_path}/web
ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT $MAINPID
-ExecStop=/bin/kill -s QUIT $MAINPID
+ExecReload=/bin/kill -s QUIT \$MAINPID
+ExecStop=/bin/kill -s QUIT \$MAINPID
Environment=\"PATH=${PATH}\"
[Install]
WantedBy=multi-user.target
" >/etc/systemd/system/mcsm-web.service
- if [ -e "/etc/systemd/system/mcsm-web.service" ]; then
- sudo systemctl daemon-reload
- sudo systemctl enable mcsm-daemon.service --now
- sudo systemctl enable mcsm-web.service --now
- echo_green "Registered!"
- else
- printf "\n\n"
- echo_red "面板已成功安装到目录: \"/opt/mcsmanager\"."
- echo_red "但是由于权限不足,无法注册到系统服务中,你可以手动启动面板(参考 Github Readme.md)或重新使用 root 权限安装!"
- exit
- fi
+ systemctl daemon-reload
+ systemctl enable --now mcsm-{daemon,web}.service
+ echo_green "Registered!"
sleep 2
printf "\n\n\n\n"
echo_yellow "=================================================================="
- echo_green "MCSManager 面板已安装完成!接下来您只需在浏览器访问即可愉快的使用它!"
+ echo_green "Installation is complete! Welcome to the MCSManager!!!"
echo_yellow " "
- echo_cyan_n "请使用浏览器访问此地址: "
- echo_yellow "http://<公网IP>:23333"
- echo_cyan_n "守护进程地址(集群用): "
- echo_yellow "ws://<公网IP>:24444"
- echo_red "注意:您必须开放 23333 和 24444 两个端口才能保证服务正常访问!"
+ echo_cyan_n "HTTP Web Service: "
+ echo_yellow "http://:23333 (Browser)"
+ echo_cyan_n "Daemon Address: "
+ echo_yellow "ws://:24444 (Cluster)"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
echo_yellow " "
- echo_cyan "面板常用命令:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service # 开启面板"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service # 关闭面板"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service # 重启面板"
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
echo_yellow " "
- echo_green "官方文档: https://docs.mcsmanager.com/"
+ echo_green "Official Document: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
}
@@ -206,9 +206,7 @@ elif [[ $arch == s390x ]]; then
arch=s390x
#echo "[-] IBM LinuxONE architecture detected"
else
- Red_Error "[x] Sorry, this architecture is not supported yet!"
- Red_Error "[x] Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
- exit
+ Red_Error "[x] Sorry, this architecture is not supported yet!\n[x]Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
fi
# Define the variable Node installation directory
@@ -218,25 +216,24 @@ node_install_path="/opt/node-$node-linux-$arch"
echo_cyan "[-] Architecture: $arch"
# Install related software
-echo_cyan_n "[+] Installing dependent software(git,tar)... "
+echo_cyan_n "[+] Installing dependent software (git, tar)... "
if [[ -x "$(command -v yum)" ]]; then
- sudo yum install -y git tar >error
+ yum install -y git tar
elif [[ -x "$(command -v apt-get)" ]]; then
- sudo apt-get install -y git tar >error
+ apt-get install -y git tar
elif [[ -x "$(command -v pacman)" ]]; then
- sudo pacman -Syu --noconfirm git tar >error
+ pacman -S --noconfirm git tar
elif [[ -x "$(command -v zypper)" ]]; then
- sudo zypper --non-interactive install git tar >error
+ zypper --non-interactive install git tar
+else
+ echo_red "[!] Cannot find your package manager! You may need to install git and tar manually!"
fi
# Determine whether the relevant software is installed successfully
if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
echo_green "Success"
else
- echo_red "Failed"
- echo "$error"
- Red_Error "[x] Related software installation failed, please install git and tar packages manually!"
- exit
+ Red_Error "[x] Failed to find git and tar, please install them manually!"
fi
# Install the Node environment
From fbd7d86d9cdf165e0895af83a5fd99e1b613f089 Mon Sep 17 00:00:00 2001
From: swwind
Date: Fri, 26 Apr 2024 14:39:46 +0800
Subject: [PATCH 122/460] fix: change home directory to install path
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 117e338..b8486ee 100644
--- a/setup.sh
+++ b/setup.sh
@@ -129,7 +129,7 @@ Create_Service() {
userdel "$mcsmanager_user"
fi
- useradd -r -M -s "$(command -v nologin)" "$mcsmanager_user"
+ useradd -r -M -s "$(command -v nologin)" -d "$mcsmanager_install_path" "$mcsmanager_user"
chown $mcsmanager_user:$mcsmanager_user -R "$mcsmanager_install_path"
echo "[Unit]
From f1f1392a7d9b3157b20b1bb0be2dc7f372d98443 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Fri, 26 Apr 2024 15:02:47 +0800
Subject: [PATCH 123/460] Sync: setup.sh
---
setup_cn.sh | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index 97c116d..1d6242c 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -5,8 +5,6 @@ mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManag
mcsmanager_user="mcsm"
package_name="MCSManager-v10-linux.tar.gz"
node="v16.20.2"
-
-error=""
arch=$(uname -m)
if [ "$(id -u)" -ne 0]; then
@@ -35,6 +33,7 @@ echo_yellow() {
printf '\033[1;33m%b\033[0m\n' "$@"
}
+# script info
echo_cyan "+----------------------------------------------------------------------
| MCSManager 安装脚本
+----------------------------------------------------------------------
@@ -130,7 +129,8 @@ Create_Service() {
userdel "$mcsmanager_user"
fi
- useradd -r -M -s "$(which nologin)" "$mcsmanager_user"
+ useradd -r -M -s "$(command -v nologin)" -d "$mcsmanager_install_path" "$mcsmanager_user"
+
chown $mcsmanager_user:$mcsmanager_user -R "$mcsmanager_install_path"
echo "[Unit]
@@ -216,24 +216,24 @@ node_install_path="/opt/node-$node-linux-$arch"
echo_cyan "[-] Architecture: $arch"
# Install related software
-echo_cyan_n "[+] Installing dependent software (git, tar)... "
+echo_cyan_n "[+] Installing dependent software (git, tar, wget)... "
if [[ -x "$(command -v yum)" ]]; then
- yum install -y git tar
+ yum install -y git tar wget
elif [[ -x "$(command -v apt-get)" ]]; then
- apt-get install -y git tar
+ apt-get install -y git tar wget
elif [[ -x "$(command -v pacman)" ]]; then
- pacman -S --noconfirm git tar
+ pacman -S --noconfirm git tar wget
elif [[ -x "$(command -v zypper)" ]]; then
- zypper --non-interactive install git tar
+ zypper --non-interactive install git tar wget
else
- echo_red "[!] Cannot find your package manager! You may need to install git and tar manually!"
+ echo_red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
fi
# Determine whether the relevant software is installed successfully
-if [[ -x "$(command -v git)" && -x "$(command -v tar)" ]]; then
+if [[ -x "$(command -v git)" && -x "$(command -v tar)" && -x "$(command -v wget)" ]]; then
echo_green "Success"
else
- Red_Error "[x] Failed to find git and tar, please install them manually!"
+ Red_Error "[x] Failed to find git, tar and wget, please install them manually!"
fi
# Install the Node environment
From 9f63b3a9c01431119722a374a1791b9e851d9195 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Fri, 26 Apr 2024 15:46:43 +0800
Subject: [PATCH 124/460] Fix: Docker group
---
setup.sh | 4 +++-
setup_cn.sh | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/setup.sh b/setup.sh
index 0e14e79..852d74a 100644
--- a/setup.sh
+++ b/setup.sh
@@ -130,9 +130,11 @@ Create_Service() {
fi
useradd -r -M -s "$(command -v nologin)" -d "$mcsmanager_install_path" "$mcsmanager_user"
-
chown $mcsmanager_user:$mcsmanager_user -R "$mcsmanager_install_path"
+ groupadd docker
+ usermod -aG docker mcsm
+
echo "[Unit]
Description=MCSManager-Daemon
diff --git a/setup_cn.sh b/setup_cn.sh
index 1d6242c..f28c8f9 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -130,9 +130,11 @@ Create_Service() {
fi
useradd -r -M -s "$(command -v nologin)" -d "$mcsmanager_install_path" "$mcsmanager_user"
-
chown $mcsmanager_user:$mcsmanager_user -R "$mcsmanager_install_path"
+ groupadd docker
+ usermod -aG docker mcsm
+
echo "[Unit]
Description=MCSManager-Daemon
From ba03e7c46938132e0bd66600c51c9fd1a92dc7da Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Fri, 26 Apr 2024 16:07:33 +0800
Subject: [PATCH 125/460] Feat: del mcsm user
---
setup.sh | 227 +++++++++++++++++++++++++---------------------------
setup_cn.sh | 13 ---
2 files changed, 107 insertions(+), 133 deletions(-)
diff --git a/setup.sh b/setup.sh
index 852d74a..0f6eeff 100644
--- a/setup.sh
+++ b/setup.sh
@@ -2,35 +2,34 @@
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
-mcsmanager_user="mcsm"
package_name="MCSManager-v10-linux.tar.gz"
node="v20.12.2"
arch=$(uname -m)
if [ "$(id -u)" -ne 0]; then
- echo "This script must be run as root. Please use \"sudo bash\" instead."
- exit 1
+ echo "This script must be run as root. Please use \"sudo bash\" instead."
+ exit 1
fi
printf "\033c"
echo_cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
+ printf '\033[1;36m%b\033[0m\n' "$@"
}
echo_red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
+ printf '\033[1;31m%b\033[0m\n' "$@"
}
echo_green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
+ printf '\033[1;32m%b\033[0m\n' "$@"
}
echo_cyan_n() {
- printf '\033[1;36m%b\033[0m' "$@"
+ printf '\033[1;36m%b\033[0m' "$@"
}
echo_yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
+ printf '\033[1;33m%b\033[0m\n' "$@"
}
# script info
@@ -40,106 +39,95 @@ echo_cyan "+--------------------------------------------------------------------
"
Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
}
Install_Node() {
- echo_cyan_n "[+] Install Node.JS environment...\n"
+ echo_cyan_n "[+] Install Node.JS environment...\n"
- rm -irf "$node_install_path"
+ rm -irf "$node_install_path"
- cd /opt || Red_Error "[x] Failed to enter /opt"
+ cd /opt || Red_Error "[x] Failed to enter /opt"
- rm -rf "node-$node-linux-$arch.tar.gz"
+ rm -rf "node-$node-linux-$arch.tar.gz"
- wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
+ wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
- tar -zxf "node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to untar node"
+ tar -zxf "node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to untar node"
- rm -rf "node-$node-linux-$arch.tar.gz"
+ rm -rf "node-$node-linux-$arch.tar.gz"
- if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
- echo_green "Success"
- else
- Red_Error "[x] Node installation failed!"
- fi
-
- echo
- echo_yellow "=============== Node.JS Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node.JS Version ==============="
- echo
-
- sleep 3
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
+ echo_green "Success"
+ else
+ Red_Error "[x] Node installation failed!"
+ fi
+
+ echo
+ echo_yellow "=============== Node.JS Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node.JS Version ==============="
+ echo
+
+ sleep 3
}
Install_MCSManager() {
- echo_cyan "[+] Install MCSManager..."
+ echo_cyan "[+] Install MCSManager..."
- # stop service
- systemctl disable --now mcsm-{web,daemon}
+ # stop service
+ systemctl disable --now mcsm-{web,daemon}
- # delete service
- rm -rf /etc/systemd/system/mcsm-{daemon,web}.service
- systemctl daemon-reload
+ # delete service
+ rm -rf /etc/systemd/system/mcsm-{daemon,web}.service
+ systemctl daemon-reload
- mkdir -p "${mcsmanager_install_path}" || Red_Error "[x] Failed to create ${mcsmanager_install_path}"
+ mkdir -p "${mcsmanager_install_path}" || Red_Error "[x] Failed to create ${mcsmanager_install_path}"
- # cd /opt/mcsmanager
- cd "${mcsmanager_install_path}" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}"
+ # cd /opt/mcsmanager
+ cd "${mcsmanager_install_path}" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}"
- # donwload MCSManager release
- wget "${mcsmanager_donwload_addr}" || Red_Error "[x] Failed to download MCSManager"
- tar -zxf ${package_name} -o || Red_Error "[x] Failed to untar ${package_name}"
- rm -rf "${mcsmanager_install_path}/${package_name}"
+ # donwload MCSManager release
+ wget "${mcsmanager_donwload_addr}" || Red_Error "[x] Failed to download MCSManager"
+ tar -zxf ${package_name} -o || Red_Error "[x] Failed to untar ${package_name}"
+ rm -rf "${mcsmanager_install_path}/${package_name}"
- # echo "[→] cd daemon"
- cd "${mcsmanager_install_path}/daemon" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/daemon"
+ # echo "[→] cd daemon"
+ cd "${mcsmanager_install_path}/daemon" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/daemon"
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/daemon"
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/daemon"
- # echo "[←] cd .."
- cd "${mcsmanager_install_path}/web" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/web"
+ # echo "[←] cd .."
+ cd "${mcsmanager_install_path}/web" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/web"
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/web"
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/web"
- echo
- echo_yellow "=============== MCSManager ==============="
- echo_green "Daemon: ${mcsmanager_install_path}/daemon"
- echo_green "Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
- echo
- echo_green "[+] MCSManager installation success!"
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green "Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green "Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ echo_green "[+] MCSManager installation success!"
- chmod -R 755 "$mcsmanager_install_path"
+ chmod -R 755 "$mcsmanager_install_path"
- sleep 3
+ sleep 3
}
Create_Service() {
- echo_cyan "[+] Create MCSManager service..."
-
- if id "$mcsmanager_user" &>/dev/null; then
- userdel "$mcsmanager_user"
- fi
+ echo_cyan "[+] Create MCSManager service..."
- useradd -r -M -s "$(command -v nologin)" -d "$mcsmanager_install_path" "$mcsmanager_user"
- chown $mcsmanager_user:$mcsmanager_user -R "$mcsmanager_install_path"
-
- groupadd docker
- usermod -aG docker mcsm
-
- echo "[Unit]
+ echo "[Unit]
Description=MCSManager-Daemon
[Service]
-User=${mcsmanager_user}
WorkingDirectory=${mcsmanager_install_path}/daemon
ExecStart=${node_install_path}/bin/node app.js
ExecReload=/bin/kill -s QUIT \$MAINPID
@@ -150,11 +138,10 @@ Environment=\"PATH=${PATH}\"
WantedBy=multi-user.target
" >/etc/systemd/system/mcsm-daemon.service
- echo "[Unit]
+ echo "[Unit]
Description=MCSManager-Web
[Service]
-User=${mcsmanager_user}
WorkingDirectory=${mcsmanager_install_path}/web
ExecStart=${node_install_path}/bin/node app.js
ExecReload=/bin/kill -s QUIT \$MAINPID
@@ -165,50 +152,50 @@ Environment=\"PATH=${PATH}\"
WantedBy=multi-user.target
" >/etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
- systemctl enable --now mcsm-{daemon,web}.service
- echo_green "Registered!"
-
- sleep 2
-
- printf "\n\n\n\n"
-
- echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager!!!"
- echo_yellow " "
- echo_cyan_n "HTTP Web Service: "
- echo_yellow "http://:23333 (Browser)"
- echo_cyan_n "Daemon Address: "
- echo_yellow "ws://:24444 (Cluster)"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ systemctl daemon-reload
+ systemctl enable --now mcsm-{daemon,web}.service
+ echo_green "Registered!"
+
+ sleep 2
+
+ printf "\n\n\n\n"
+
+ echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_yellow " "
+ echo_cyan_n "HTTP Web Service: "
+ echo_yellow "http://:23333 (Browser)"
+ echo_cyan_n "Daemon Address: "
+ echo_yellow "ws://:24444 (Cluster)"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
}
# Environmental inspection
if [[ "$arch" == x86_64 ]]; then
- arch=x64
- #echo "[-] x64 architecture detected"
+ arch=x64
+ #echo "[-] x64 architecture detected"
elif [[ $arch == aarch64 ]]; then
- arch=arm64
- #echo "[-] 64-bit ARM architecture detected"
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
elif [[ $arch == arm ]]; then
- arch=armv7l
- #echo "[-] 32-bit ARM architecture detected"
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
elif [[ $arch == ppc64le ]]; then
- arch=ppc64le
- #echo "[-] IBM POWER architecture detected"
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
elif [[ $arch == s390x ]]; then
- arch=s390x
- #echo "[-] IBM LinuxONE architecture detected"
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
else
- Red_Error "[x] Sorry, this architecture is not supported yet!\n[x]Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
+ Red_Error "[x] Sorry, this architecture is not supported yet!\n[x]Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
fi
# Define the variable Node installation directory
@@ -220,22 +207,22 @@ echo_cyan "[-] Architecture: $arch"
# Install related software
echo_cyan_n "[+] Installing dependent software (git, tar, wget)... "
if [[ -x "$(command -v yum)" ]]; then
- yum install -y git tar wget
+ yum install -y git tar wget
elif [[ -x "$(command -v apt-get)" ]]; then
- apt-get install -y git tar wget
+ apt-get install -y git tar wget
elif [[ -x "$(command -v pacman)" ]]; then
- pacman -S --noconfirm git tar wget
+ pacman -S --noconfirm git tar wget
elif [[ -x "$(command -v zypper)" ]]; then
- zypper --non-interactive install git tar wget
+ zypper --non-interactive install git tar wget
else
- echo_red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
+ echo_red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
fi
# Determine whether the relevant software is installed successfully
if [[ -x "$(command -v git)" && -x "$(command -v tar)" && -x "$(command -v wget)" ]]; then
- echo_green "Success"
+ echo_green "Success"
else
- Red_Error "[x] Failed to find git, tar and wget, please install them manually!"
+ Red_Error "[x] Failed to find git, tar and wget, please install them manually!"
fi
# Install the Node environment
diff --git a/setup_cn.sh b/setup_cn.sh
index f28c8f9..a518aa6 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -2,7 +2,6 @@
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
-mcsmanager_user="mcsm"
package_name="MCSManager-v10-linux.tar.gz"
node="v16.20.2"
arch=$(uname -m)
@@ -125,21 +124,10 @@ Install_MCSManager() {
Create_Service() {
echo_cyan "[+] Create MCSManager service..."
- if id "$mcsmanager_user" &>/dev/null; then
- userdel "$mcsmanager_user"
- fi
-
- useradd -r -M -s "$(command -v nologin)" -d "$mcsmanager_install_path" "$mcsmanager_user"
- chown $mcsmanager_user:$mcsmanager_user -R "$mcsmanager_install_path"
-
- groupadd docker
- usermod -aG docker mcsm
-
echo "[Unit]
Description=MCSManager-Daemon
[Service]
-User=${mcsmanager_user}
WorkingDirectory=${mcsmanager_install_path}/daemon
ExecStart=${node_install_path}/bin/node app.js
ExecReload=/bin/kill -s QUIT \$MAINPID
@@ -154,7 +142,6 @@ WantedBy=multi-user.target
Description=MCSManager-Web
[Service]
-User=${mcsmanager_user}
WorkingDirectory=${mcsmanager_install_path}/web
ExecStart=${node_install_path}/bin/node app.js
ExecReload=/bin/kill -s QUIT \$MAINPID
From 1c1aa38206a1f1198d4bd3d8b8cc47bf9babc19e Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 30 Apr 2024 14:34:08 +0800
Subject: [PATCH 126/460] Feat: add Templates.json for Quick Install
---
templates.json | 154 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 154 insertions(+)
create mode 100644 templates.json
diff --git a/templates.json b/templates.json
new file mode 100644
index 0000000..7a0fe9f
--- /dev/null
+++ b/templates.json
@@ -0,0 +1,154 @@
+{
+ "remark": "This file is only used for quick deployment.",
+ "languages": [
+ {
+ "label": "English",
+ "value": "en_us"
+ },
+ {
+ "label": "简体中文",
+ "value": "zh_cn"
+ }
+ ],
+ "packages": [
+ {
+ "language": "en_us",
+ "description": "[Paper] Recommendation for friends with multiple players, Fast setup.",
+ "title": "Minecraft 1.20.4 Java",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G",
+ "size": "140MB",
+ "remark": "Paper Software",
+ "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.20.4.zip",
+ "author": "mcsmanager.com"
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Recommendation for friends with multiple players",
+ "title": "Minecraft 1.19.2 Java",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G",
+ "size": "140MB",
+ "remark": "Paper Software",
+ "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.19.2.zip",
+ "author": "mcsmanager.com"
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Recommendation for friends with multiple players",
+ "title": "Minecraft 1.18.2 Java",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G",
+ "size": "140MB",
+ "remark": "Paper Software",
+ "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.18.2.zip",
+ "author": "mcsmanager.com"
+ },
+
+ {
+ "language": "zh_cn",
+ "description": "[Paper] 中小型互通服推荐,1.20.4 版本,快速开服,包含ESS、锁箱子、操作回滚、领地商店等基础插件。",
+ "title": "Minecraft 1.20.4",
+ "runtime": "Java 17+",
+ "size": "140MB",
+ "remark": "支持插件,最低 8GB 内存要求",
+ "targetLink": "https://url.alww.top/mcsm/paper1.20.4",
+ "author": "alongw.cn",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -Xmx2048M -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "zh_cn",
+ "description": "[原版生存] 朋友联机推荐,1.19.2 版本,快速开服,享受原汁原味的极致生存与探索。",
+ "title": "Minecraft 1.19.2 Java 原版",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G",
+ "size": "140MB",
+ "remark": "支持插件,最低 8GB 内存要求",
+ "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.2.zip",
+ "author": "mcsmanager.com"
+ },
+ {
+ "language": "zh_cn",
+ "description": "[整合包] 小型服务器推荐,包含基础插件、箱子锁、操作回滚、领地和商店等插件。",
+ "title": "Minecraft 1.19.2 Java 版整合包",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G",
+ "size": "210MB",
+ "remark": "支持插件,最低 8GB 内存要求",
+ "targetLink": "https://url.alww.top/mcsm/paper1.19.2",
+ "author": "alongw.cn"
+ },
+ {
+ "language": "zh_cn",
+ "description": "[Arclight] 小型服务器推荐,1.19.2 版本,可安装mod,互通基岩版,快速开服,包含ESS、锁箱子、操作回滚、领地商店等基础插件。",
+ "title": "Minecraft 1.19.2",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G",
+ "size": "100MB",
+ "remark": "支持插件,支持mod(Forge),最低 6GB 内存要求",
+ "targetLink": "https://url.alww.top/mcsm/arclight1.19.2",
+ "author": "alongw.cn"
+ },
+ {
+ "language": "zh_cn",
+ "description": "[整合包/Java&基岩版互通] 小型服务器推荐,互通基岩版,包含基础插件、箱子锁、操作回滚、领地和商店等插件。",
+ "title": "Minecraft 1.19.2 基岩互通版",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G",
+ "size": "230MB",
+ "remark": "支持插件,最低 6GB 内存要求",
+ "targetLink": "https://url.alww.top/mcsm/paper-geyser1.19.2",
+ "author": "alongw.cn"
+ },
+ {
+ "language": "zh_cn",
+ "description": "[原版生存] 朋友联机推荐,让你和你的小伙伴一起享受原汁原味的极致生存。",
+ "title": "Minecraft 1.19.1 Java 原版",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G",
+ "size": "140MB",
+ "remark": "支持插件,最低 4GB 内存要求",
+ "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.1.zip",
+ "author": "mcsmanager.com"
+ },
+ {
+ "language": "zh_cn",
+ "description": "[原版生存] 适合朋友联机,“荒野更新”(The Wild)旨在为玩家带来现有生物群系的改进和优化。",
+ "title": "Minecraft 1.19 Java 原版",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G",
+ "size": "140MB",
+ "remark": "支持插件,最低 4GB 内存要求",
+ "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.zip",
+ "author": "mcsmanager.com"
+ },
+ {
+ "language": "zh_cn",
+ "description": "[原版生存] 适合朋友联机推荐,继承上版本的功能并进行了一系列的优化,主流联机版本,插件与MOD较为丰富。",
+ "title": "Minecraft 1.18.2 Java 原版",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G",
+ "size": "140MB",
+ "remark": "支持插件,最低 4GB 内存要求",
+ "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.18.2.zip",
+ "author": "mcsmanager.com"
+ },
+ {
+ "language": "zh_cn",
+ "description": "[原版生存] 适合朋友联机,快速开服,服务器搭建,回味老版本的地穴探索。",
+ "title": "Minecraft 17.1 Java 原版",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G",
+ "size": "160MB",
+ "remark": "支持插件,最低 4GB 内存要求",
+ "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.17.1.zip",
+ "author": "mcsmanager.com"
+ }
+ ]
+}
From eef70ca1141ad85a01b03b9d00b8f49ea08ad633 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sat, 4 May 2024 23:53:19 +0800
Subject: [PATCH 127/460] add global arguments
---
install_update.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 install_update.sh
diff --git a/install_update.sh b/install_update.sh
new file mode 100644
index 0000000..f31ecc0
--- /dev/null
+++ b/install_update.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+#Global arguments
+mcsmanager_install_path="/opt/mcsmanager"
+mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+package_name="MCSManager-v10-linux.tar.gz"
+node="v20.12.2"
+arch=$(uname -m)
+
+# Default systemd user is 'mcsm'
+USER="mcsm"
+COMMAND="all"
+
From b8f03d759732e4552df697b3f208a39e4173d950 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sat, 4 May 2024 23:53:56 +0800
Subject: [PATCH 128/460] add some helper functions
---
install_update.sh | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index f31ecc0..bbe7b51 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -11,3 +11,44 @@ arch=$(uname -m)
USER="mcsm"
COMMAND="all"
+# Helper Functions
+usage() {
+ echo "Usage: $0 [-u user] [-c command]"
+ echo " -u Specify the user (mcsm or root), default is 'mcsm'"
+ echo " -c Specify the command (web, daemon, or all), default is 'all'"
+ exit 1
+}
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
+
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
+
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
+
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
+}
+
+# Check root permission
+check_sudo() {
+ if [ "$EUID" -ne 0 ]; then
+ echo "This script must be run as root. Please use \"sudo or root user\" instead."
+ exit 1
+ fi
+}
+check_sudo
+
From 330b0d526b6259d3d0d4e2bb067d7f780d9fc146 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sat, 4 May 2024 23:54:16 +0800
Subject: [PATCH 129/460] add argument parsing
---
install_update.sh | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index bbe7b51..bec5291 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -52,3 +52,32 @@ check_sudo() {
}
check_sudo
+# Parse provided arguments
+while getopts "u:c:" opt; do
+ case ${opt} in
+ u )
+ if [[ "${OPTARG}" == "mcsm" || "${OPTARG}" == "root" ]]; then
+ user="${OPTARG}"
+ else
+ echo "Invalid user specified."
+ usage
+ fi
+ ;;
+ c )
+ if [[ "${OPTARG}" == "web" || "${OPTARG}" == "daemon" || "${OPTARG}" == "all" ]]; then
+ command="${OPTARG}"
+ else
+ echo "Invalid command specified."
+ usage
+ fi
+ ;;
+ \? )
+ usage
+ ;;
+ : )
+ echo "Option -$OPTARG requires an argument."
+ usage
+ ;;
+ esac
+done
+
From 8a6f4018e1ba3ddee820e1b8c4a5114edd83e51c Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sat, 4 May 2024 23:54:37 +0800
Subject: [PATCH 130/460] add placeholder for different users
---
install_update.sh | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index bec5291..6bf7e34 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -81,3 +81,15 @@ while getopts "u:c:" opt; do
esac
done
+# Logic for different users
+case ${USER} in
+ root)
+ ;;
+ mcsm)
+ ;;
+ *)
+ echo "Unknown user: ${USER}. Using default user mcsm..."
+ ;;
+esac
+
+
From 952422167a400652e0387b22f233f4ae9ae81148 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sat, 4 May 2024 23:54:55 +0800
Subject: [PATCH 131/460] add logic to check if MCSM is installed
---
install_update.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index 6bf7e34..9e79729 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -93,3 +93,16 @@ case ${USER} in
esac
+# Check if the mcsmanager_install_path exists
+if [ -d "$mcsmanager_install_path" ]; then
+ echo "The directory '$mcsmanager_install_path' exists."
+ # Logic branch when the directory exists
+ # For example, list the contents
+ echo "Listing contents of $mcsmanager_install_path:"
+ ls -l "$directory"
+else
+ echo "The directory '$mcsmanager_install_path' does not exist."
+ # Logic branch when the directory does not exist
+ # For example, create the directory
+ echo "Creating $mcsmanager_install_path..."
+fi
\ No newline at end of file
From bc84a77778d8ef947806e98b2b0eb672d3cbe673 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sun, 5 May 2024 22:23:55 +0800
Subject: [PATCH 132/460] add the original node.js installation function
---
install_update.sh | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index 9e79729..043f2f6 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -1,9 +1,17 @@
#!/bin/bash
#Global arguments
+#MCSM install dir
mcsmanager_install_path="/opt/mcsmanager"
+#MCSM backup dir
+mcsm_backup_dir="/opt/"
+#Created backup absolute path
+backup_path=""
+#Download URL
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+#File name
package_name="MCSManager-v10-linux.tar.gz"
+#Node.js version to install
node="v20.12.2"
arch=$(uname -m)
@@ -43,6 +51,37 @@ echo_yellow() {
printf '\033[1;33m%b\033[0m\n' "$@"
}
+Install_node() {
+ echo_cyan_n "[+] Install Node.js environment...\n"
+
+ rm -irf "$node_install_path"
+
+ cd /opt || Red_Error "[x] Failed to enter /opt"
+
+ rm -rf "node-$node-linux-$arch.tar.gz"
+
+ wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
+
+ tar -zxf "node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to untar node"
+
+ rm -rf "node-$node-linux-$arch.tar.gz"
+
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
+ echo_green "Success"
+ else
+ Red_Error "[x] Node installation failed!"
+ fi
+
+ echo
+ echo_yellow "=============== Node.JS Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node.JS Version ==============="
+ echo
+
+ sleep 3
+}
+
# Check root permission
check_sudo() {
if [ "$EUID" -ne 0 ]; then
From 11c3054886ef43f531eabeab70014b4537881c5e Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sun, 5 May 2024 22:26:12 +0800
Subject: [PATCH 133/460] add function to create backup
---
install_update.sh | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index 043f2f6..3b7b770 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -82,6 +82,44 @@ Install_node() {
sleep 3
}
+backup_mcs_manager() {
+ # Ensure both directories are provided
+ if [ -z "$mcsmanager_install_path" ] || [ -z "$mcsm_backup_dir" ]; then
+ echo "Error: Backup or source path not set."
+ return 1 # Return with error
+ fi
+
+ # Check if the source directory exists
+ if [ ! -d "$mcsmanager_install_path" ]; then
+ echo "Error: Source directory does not exist."
+ return 1 # Return with error
+ fi
+
+ # Create backup directory (/opt) if it doesn't exist
+ if [ ! -d "$mcsm_backup_dir" ]; then
+ echo "Creating backup directory."
+ mkdir -p "$mcsm_backup_dir"
+ fi
+
+ # Format the date for the backup filename
+ local current_date=$(date +%Y_%m_%d)
+
+ # Define the backup path
+ backup_path="${mcsm_backup_dir}/mcsm_backup_${current_date}.tar.gz"
+
+ # Create the backup
+ echo "Creating backup..."
+ tar -czf "$backup_path" -C "$mcsmanager_install_path" .
+
+ # Check if the backup was successful
+ if [ $? -eq 0 ]; then
+ echo "Backup created successfully at $backup_path"
+ else
+ echo "Error creating backup."
+ return 1 # Return with error
+ fi
+}
+
# Check root permission
check_sudo() {
if [ "$EUID" -ne 0 ]; then
From 530b17761c081461cfcc3091850539241cd5189f Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sun, 5 May 2024 22:26:42 +0800
Subject: [PATCH 134/460] rename backup function
---
install_update.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install_update.sh b/install_update.sh
index 3b7b770..14cc182 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -82,7 +82,7 @@ Install_node() {
sleep 3
}
-backup_mcs_manager() {
+Backup_MCSM() {
# Ensure both directories are provided
if [ -z "$mcsmanager_install_path" ] || [ -z "$mcsm_backup_dir" ]; then
echo "Error: Backup or source path not set."
From b130f3d55671fa4b3c518907040c054137a00c72 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sun, 5 May 2024 22:32:43 +0800
Subject: [PATCH 135/460] add dependencies installation
---
install_update.sh | 63 ++++++++++++++++++++++++++++++++---------------
1 file changed, 43 insertions(+), 20 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 14cc182..d606d00 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -1,19 +1,24 @@
#!/bin/bash
#Global arguments
-#MCSM install dir
+# System architecture
+arch=$(uname -m)
+# MCSM install dir
mcsmanager_install_path="/opt/mcsmanager"
-#MCSM backup dir
+# MCSM backup dir
mcsm_backup_dir="/opt/"
-#Created backup absolute path
+# Created backup absolute path
backup_path=""
-#Download URL
+# Download URL
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
-#File name
+# File name
package_name="MCSManager-v10-linux.tar.gz"
-#Node.js version to install
+# Node.js version to install
node="v20.12.2"
-arch=$(uname -m)
+# Node.js install dir
+node_install_path="/opt/node-$node-linux-$arch"
+
+
# Default systemd user is 'mcsm'
USER="mcsm"
@@ -51,6 +56,30 @@ echo_yellow() {
printf '\033[1;33m%b\033[0m\n' "$@"
}
+# Check root permission
+check_sudo() {
+ if [ "$EUID" -ne 0 ]; then
+ echo "This script must be run as root. Please use \"sudo or root user\" instead."
+ exit 1
+ fi
+}
+
+Install_dependencies() {
+ # Install related software
+ echo_cyan_n "[+] Installing dependent software (git, tar, wget)... "
+ if [[ -x "$(command -v yum)" ]]; then
+ yum install -y git tar wget
+ elif [[ -x "$(command -v apt-get)" ]]; then
+ apt-get install -y git tar wget
+ elif [[ -x "$(command -v pacman)" ]]; then
+ pacman -S --noconfirm git tar wget
+ elif [[ -x "$(command -v zypper)" ]]; then
+ zypper --non-interactive install git tar wget
+ else
+ echo_red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
+ fi
+}
+
Install_node() {
echo_cyan_n "[+] Install Node.js environment...\n"
@@ -119,15 +148,10 @@ Backup_MCSM() {
return 1 # Return with error
fi
}
-
-# Check root permission
-check_sudo() {
- if [ "$EUID" -ne 0 ]; then
- echo "This script must be run as root. Please use \"sudo or root user\" instead."
- exit 1
- fi
-}
+########### Main Logic ################
check_sudo
+# Install Dependencies
+Install_dependencies
# Parse provided arguments
while getopts "u:c:" opt; do
@@ -172,11 +196,10 @@ esac
# Check if the mcsmanager_install_path exists
if [ -d "$mcsmanager_install_path" ]; then
- echo "The directory '$mcsmanager_install_path' exists."
- # Logic branch when the directory exists
- # For example, list the contents
- echo "Listing contents of $mcsmanager_install_path:"
- ls -l "$directory"
+ # Backup first
+ Backup_MCSM
+ # Install Node.js, this is to ensure the version is up to date.
+
else
echo "The directory '$mcsmanager_install_path' does not exist."
# Logic branch when the directory does not exist
From 7070e2dd5deaefc2c6b483bf789f768389063933 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sun, 5 May 2024 22:33:47 +0800
Subject: [PATCH 136/460] add original functions to check dependencies
---
install_update.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index d606d00..fdd92a5 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -78,6 +78,14 @@ Install_dependencies() {
else
echo_red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
fi
+
+ # Determine whether the relevant software is installed successfully
+ if [[ -x "$(command -v git)" && -x "$(command -v tar)" && -x "$(command -v wget)" ]]; then
+ echo_green "Success"
+ else
+ Red_Error "[x] Failed to find git, tar and wget, please install them manually!"
+ fi
+
}
Install_node() {
From 16e55ed38b8f8cec8556456edf1e5833a4bab07c Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sun, 5 May 2024 22:46:43 +0800
Subject: [PATCH 137/460] put current_date as a global variable
---
install_update.sh | 77 +++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 71 insertions(+), 6 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index fdd92a5..bb25489 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -17,8 +17,12 @@ package_name="MCSManager-v10-linux.tar.gz"
node="v20.12.2"
# Node.js install dir
node_install_path="/opt/node-$node-linux-$arch"
-
-
+# MCSM Web dir name
+mcsm_web="web"
+# MCSM daemon dir name
+mcsm_daemon="daemon"
+# The date variable to be shared across functions
+local current_date=$(date +%Y_%m_%d)
# Default systemd user is 'mcsm'
USER="mcsm"
@@ -110,7 +114,7 @@ Install_node() {
fi
echo
- echo_yellow "=============== Node.JS Version ==============="
+ echo_yellow "=============== Node.js Version ==============="
echo_yellow " node: $("$node_install_path"/bin/node -v)"
echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
echo_yellow "=============== Node.JS Version ==============="
@@ -138,9 +142,6 @@ Backup_MCSM() {
mkdir -p "$mcsm_backup_dir"
fi
- # Format the date for the backup filename
- local current_date=$(date +%Y_%m_%d)
-
# Define the backup path
backup_path="${mcsm_backup_dir}/mcsm_backup_${current_date}.tar.gz"
@@ -156,6 +157,68 @@ Backup_MCSM() {
return 1 # Return with error
fi
}
+
+# MCSM Web Update & Installation
+Install_Web() {
+ web_path="$mcsmanager_install_path/$mcsm_web"
+ web_data="$mcsmanager_install_path/web_data"
+ if [ -d "$web_path" ]; then
+ echo_cyan "[+] Updating MCSManager Web..."
+ # The backup should be created already, moving the DATA dir to /opt/mcsmanager/web_data should be fast and safe.
+ # Use web_data, do not use data as in rare circumstance user may run both update at the same time.
+ # Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
+
+ else
+ echo "The directory '$mcsmanager_install_path' does not exist."
+ # Logic branch when the directory does not exist
+ # For example, create the directory
+ echo "Creating $mcsmanager_install_path..."
+ fi
+ echo_cyan "[+] Install MCSManager Web..."
+
+ # stop service
+ systemctl disable --now mcsm-{web}
+
+ # delete service
+ rm -rf /etc/systemd/system/mcsm-{daemon,web}.service
+ systemctl daemon-reload
+
+ mkdir -p "${mcsmanager_install_path}" || Red_Error "[x] Failed to create ${mcsmanager_install_path}"
+
+ # cd /opt/mcsmanager
+ cd "${mcsmanager_install_path}" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}"
+
+ # donwload MCSManager release
+ wget "${mcsmanager_donwload_addr}" || Red_Error "[x] Failed to download MCSManager"
+ tar -zxf ${package_name} -o || Red_Error "[x] Failed to untar ${package_name}"
+ rm -rf "${mcsmanager_install_path}/${package_name}"
+
+ # echo "[→] cd daemon"
+ cd "${mcsmanager_install_path}/daemon" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/daemon"
+
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/daemon"
+
+ # echo "[←] cd .."
+ cd "${mcsmanager_install_path}/web" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/web"
+
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/web"
+
+ echo
+ echo_yellow "=============== MCSManager ==============="
+ echo_green "Daemon: ${mcsmanager_install_path}/daemon"
+ echo_green "Web: ${mcsmanager_install_path}/web"
+ echo_yellow "=============== MCSManager ==============="
+ echo
+ echo_green "[+] MCSManager installation success!"
+
+ chmod -R 755 "$mcsmanager_install_path"
+
+ sleep 3
+}
+
+
########### Main Logic ################
check_sudo
# Install Dependencies
@@ -207,6 +270,8 @@ if [ -d "$mcsmanager_install_path" ]; then
# Backup first
Backup_MCSM
# Install Node.js, this is to ensure the version is up to date.
+ Install_node
+ #
else
echo "The directory '$mcsmanager_install_path' does not exist."
From ff1ab79b3476b7f418acc923cd1571e9221393b2 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sun, 5 May 2024 22:56:10 +0800
Subject: [PATCH 138/460] create separate function for program initialize
---
install_update.sh | 38 +++++++++++++++++++++++++++-----------
1 file changed, 27 insertions(+), 11 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index bb25489..6565e8f 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -23,7 +23,8 @@ mcsm_web="web"
mcsm_daemon="daemon"
# The date variable to be shared across functions
local current_date=$(date +%Y_%m_%d)
-
+# MCSM local temp dir for downloaded source
+mcsm_down_temp="/opt/mcsmanager_${current_date}"
# Default systemd user is 'mcsm'
USER="mcsm"
COMMAND="all"
@@ -122,6 +123,17 @@ Install_node() {
sleep 3
}
+# Initialization
+Initialize() {
+ # Check sudo
+ check_sudo
+
+ # Check dependencies
+ Install_dependencies
+
+ # Check and download MCSM source
+
+}
Backup_MCSM() {
# Ensure both directories are provided
@@ -157,22 +169,29 @@ Backup_MCSM() {
return 1 # Return with error
fi
}
+# MCSM Web Base Installation
+Install_MCSM_Web_Base() {
+
+
+}
+
# MCSM Web Update & Installation
-Install_Web() {
- web_path="$mcsmanager_install_path/$mcsm_web"
- web_data="$mcsmanager_install_path/web_data"
+Install_Web_wrapper() {
+ web_path="${mcsmanager_install_path}/${mcsm_web}"
+ web_data="${web_path}/data"
+ web_data_tmp="${mcsmanager_install_path}/web_data_${current_date}"
if [ -d "$web_path" ]; then
echo_cyan "[+] Updating MCSManager Web..."
# The backup should be created already, moving the DATA dir to /opt/mcsmanager/web_data should be fast and safe.
# Use web_data, do not use data as in rare circumstance user may run both update at the same time.
# Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
+ mv "$web_data" "$web_data_tmp"
+ # Remove the old web dir
+ rm -rf "$web_path"
else
echo "The directory '$mcsmanager_install_path' does not exist."
- # Logic branch when the directory does not exist
- # For example, create the directory
- echo "Creating $mcsmanager_install_path..."
fi
echo_cyan "[+] Install MCSManager Web..."
@@ -220,10 +239,7 @@ Install_Web() {
########### Main Logic ################
-check_sudo
-# Install Dependencies
-Install_dependencies
-
+Initialize
# Parse provided arguments
while getopts "u:c:" opt; do
case ${opt} in
From cdb216052dea3f1d2cf12644eea5233f634d9299 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sun, 5 May 2024 23:15:20 +0800
Subject: [PATCH 139/460] create separate install base
---
install_update.sh | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 6565e8f..54fcc47 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -3,12 +3,12 @@
#Global arguments
# System architecture
arch=$(uname -m)
+# Install base dir
+install_base="/opt"
# MCSM install dir
-mcsmanager_install_path="/opt/mcsmanager"
+mcsmanager_install_path="${install_base}/mcsmanager"
# MCSM backup dir
-mcsm_backup_dir="/opt/"
-# Created backup absolute path
-backup_path=""
+mcsm_backup_dir="${install_base}"
# Download URL
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
# File name
@@ -16,7 +16,7 @@ package_name="MCSManager-v10-linux.tar.gz"
# Node.js version to install
node="v20.12.2"
# Node.js install dir
-node_install_path="/opt/node-$node-linux-$arch"
+node_install_path="${install_base}/node-$node-linux-$arch"
# MCSM Web dir name
mcsm_web="web"
# MCSM daemon dir name
@@ -28,6 +28,8 @@ mcsm_down_temp="/opt/mcsmanager_${current_date}"
# Default systemd user is 'mcsm'
USER="mcsm"
COMMAND="all"
+# Created backup absolute path
+backup_path=""
# Helper Functions
usage() {
@@ -123,11 +125,27 @@ Install_node() {
sleep 3
}
+# Check and download MCSM source
+Check_and_download_source() {
+ if [ -d "$mcsm_down_temp" ]; then
+ echo_cyan "[+] Downloading MCSManager..."
+ # Remove the downloaded source if existed, the source dir name contains current date, so its unlikely to coincide with other name(s)
+ rm -rf "$mcsm_down_temp"
+ mkdir -p "$mcsm_down_temp" || Red_Error "[x] Failed to create ${mcsm_down_temp}"
+
+ else
+ mkdir -p "$mcsm_down_temp" || Red_Error "[x] Failed to create ${mcsm_down_temp}"
+ fi
+
+}
# Initialization
Initialize() {
# Check sudo
check_sudo
-
+
+ # Check if install base (/opt) exist
+ mkdir -p "$install_base"
+
# Check dependencies
Install_dependencies
From b07692f9061628f3a4f27d06fbc770c437ad2c5f Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sun, 5 May 2024 23:36:56 +0800
Subject: [PATCH 140/460] add function to check and download MCSM source
---
install_update.sh | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 54fcc47..e13eee0 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -127,17 +127,27 @@ Install_node() {
}
# Check and download MCSM source
Check_and_download_source() {
- if [ -d "$mcsm_down_temp" ]; then
- echo_cyan "[+] Downloading MCSManager..."
- # Remove the downloaded source if existed, the source dir name contains current date, so its unlikely to coincide with other name(s)
- rm -rf "$mcsm_down_temp"
- mkdir -p "$mcsm_down_temp" || Red_Error "[x] Failed to create ${mcsm_down_temp}"
-
- else
- mkdir -p "$mcsm_down_temp" || Red_Error "[x] Failed to create ${mcsm_down_temp}"
- fi
+ # Empty the temp dir if existed
+ rm -rf "$mcsm_down_temp"
+ mkdir -p "$mcsm_down_temp"
+
+ # Download the archive directly into the temporary directory
+ wget -O "${mcsm_down_temp}/mcsmanager.tar.gz" "$mcsmanager_download_addr"
+ if [ $? -ne 0 ]; then
+ echo "Download failed."
+ return 1 # Exit if download fails
+ fi
+
+ # Extract the archive without changing directories
+ tar -xzf "${mcsm_down_temp}/mcsmanager.tar.gz" -C "$mcsm_down_temp" --strip-components=1
+ if [ $? -ne 0 ]; then
+ echo "Extraction failed."
+ return 1 # Exit if extraction fails
+ fi
+
+ # Clean up the downloaded tar.gz file
+ rm "${mcsm_down_temp}/mcsmanager.tar.gz"
-}
# Initialization
Initialize() {
# Check sudo
@@ -150,7 +160,7 @@ Initialize() {
Install_dependencies
# Check and download MCSM source
-
+ Check_and_download_source
}
Backup_MCSM() {
@@ -188,6 +198,7 @@ Backup_MCSM() {
fi
}
# MCSM Web Base Installation
+# Assume a fresh install (i.e. no file(s) from previous installation)
Install_MCSM_Web_Base() {
From d92adc59a14cf72c7a7ba04546732d76e3a45c5c Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sun, 5 May 2024 23:39:18 +0800
Subject: [PATCH 141/460] update initialization section
---
install_update.sh | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index e13eee0..03e3824 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -156,6 +156,9 @@ Initialize() {
# Check if install base (/opt) exist
mkdir -p "$install_base"
+ # Create mcsmanager path if not already
+ mkdir -p "$mcsmanager_install_path"
+
# Check dependencies
Install_dependencies
@@ -198,9 +201,9 @@ Backup_MCSM() {
fi
}
# MCSM Web Base Installation
-# Assume a fresh install (i.e. no file(s) from previous installation)
+# Assuming a fresh install (i.e. no file(s) from previous installation) and downloaded source
Install_MCSM_Web_Base() {
-
+ # Creat
}
From d0e43edba44d3fb09900a9f6abfde38ddd1c8d69 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Sun, 5 May 2024 23:58:31 +0800
Subject: [PATCH 142/460] add web base install
---
install_update.sh | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 03e3824..1256cb5 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -11,8 +11,6 @@ mcsmanager_install_path="${install_base}/mcsmanager"
mcsm_backup_dir="${install_base}"
# Download URL
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
-# File name
-package_name="MCSManager-v10-linux.tar.gz"
# Node.js version to install
node="v20.12.2"
# Node.js install dir
@@ -203,13 +201,23 @@ Backup_MCSM() {
# MCSM Web Base Installation
# Assuming a fresh install (i.e. no file(s) from previous installation) and downloaded source
Install_MCSM_Web_Base() {
- # Creat
-
+ # Move downloaded path
+ mv "${mcsm_down_temp}/${mcsm_web}" "$web_path"
+ # Move back the data directory
+ rm -rf "$web_data"
+ mv "${web_data_tmp}" "${web_data}"
+ # Dependencies install
+ cd "${web_path}" || Red_Error "[x] Failed to enter ${web_path}"
+ # Install dependencies
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${web_path}"
+ # Return to general dir
+ cd "$mcsmanager_install_path"
}
# MCSM Web Update & Installation
-Install_Web_wrapper() {
+Install_Web_Wrapper() {
web_path="${mcsmanager_install_path}/${mcsm_web}"
web_data="${web_path}/data"
web_data_tmp="${mcsmanager_install_path}/web_data_${current_date}"
@@ -227,13 +235,18 @@ Install_Web_wrapper() {
fi
echo_cyan "[+] Install MCSManager Web..."
- # stop service
- systemctl disable --now mcsm-{web}
+ # stop and disable service
+ systemctl disable --now mcsm-web
# delete service
- rm -rf /etc/systemd/system/mcsm-{daemon,web}.service
+ rm -rf /etc/systemd/system/mcsm-web.service
systemctl daemon-reload
-
+
+ # Install MCSM Web
+ Install_MCSM_Web_Base
+
+
+
mkdir -p "${mcsmanager_install_path}" || Red_Error "[x] Failed to create ${mcsmanager_install_path}"
# cd /opt/mcsmanager
From 092021ce45c9ceef2789b6aad062495bf8ffc2c7 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 00:08:05 +0800
Subject: [PATCH 143/460] add mcsm user creation to initialize
---
install_update.sh | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index 1256cb5..924b03c 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -23,6 +23,10 @@ mcsm_daemon="daemon"
local current_date=$(date +%Y_%m_%d)
# MCSM local temp dir for downloaded source
mcsm_down_temp="/opt/mcsmanager_${current_date}"
+# Service file for MCSCM Web
+service_file_web="/etc/systemd/system/mcsm-web.service"
+# Service file for MCSM daemon
+service_file_daemon="/etc/systemd/system/mcsm-daemon.service"
# Default systemd user is 'mcsm'
USER="mcsm"
COMMAND="all"
@@ -162,6 +166,17 @@ Initialize() {
# Check and download MCSM source
Check_and_download_source
+
+ # Create mcsm user if needed
+ if [[ "$USER" == *"mcsm"* ]]; then
+ # Create the user 'mcsm' if it doesn't already exist
+ if ! id "mcsm" &>/dev/null; then
+ useradd mcsm
+ echo "User 'mcsm' created."
+ else
+ echo "User 'mcsm' already exists."
+ fi
+ fi
}
Backup_MCSM() {
@@ -214,7 +229,24 @@ Install_MCSM_Web_Base() {
# Return to general dir
cd "$mcsmanager_install_path"
}
+# MCSM Web Service Installation
+Install_Web_Systemd() {
+ echo_cyan "[+] Creating MCSManager Web service..."
+ echo "[Unit]
+ Description=MCSManager-Web
+
+ [Service]
+ WorkingDirectory=${web_path}
+ ExecStart=${node_install_path}/bin/node app.js
+ ExecReload=/bin/kill -s QUIT \$MAINPID
+ ExecStop=/bin/kill -s QUIT \$MAINPID
+ Environment=\"PATH=${PATH}\"
+
+ [Install]
+ WantedBy=multi-user.target
+ " >/etc/systemd/system/mcsm-web.service
+}
# MCSM Web Update & Installation
Install_Web_Wrapper() {
From 552fc8c9ce04de565bc7d37280951723e5709c61 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 00:25:31 +0800
Subject: [PATCH 144/460] add mcsm web installation
---
install_update.sh | 60 ++++++++++++++++++-----------------------------
1 file changed, 23 insertions(+), 37 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 924b03c..c962b76 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -228,11 +228,18 @@ Install_MCSM_Web_Base() {
env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${web_path}"
# Return to general dir
cd "$mcsmanager_install_path"
+ # Configure ownership if needed
+ if [[ "$USER" == *"mcsm"* ]]; then
+ # Change file permission to mcsm user
+ chown -R mcsm:mcsm "$web_path"
+ fi
+ chmod -R 755 "$web_path"
}
# MCSM Web Service Installation
Install_Web_Systemd() {
echo_cyan "[+] Creating MCSManager Web service..."
- echo "[Unit]
+ # Create the default service file
+ echo "[Unit]
Description=MCSManager-Web
[Service]
@@ -245,7 +252,19 @@ Install_Web_Systemd() {
[Install]
WantedBy=multi-user.target
" >/etc/systemd/system/mcsm-web.service
-
+ # Add user section if using mcsm user
+ if [[ "$USER" == *"mcsm"* ]]; then
+ # Check if the 'User=mcsm' line already exists in the service file
+ if grep -q "^User=mcsm$" "$service_file"; then
+ echo "The service file is configured already."
+ else
+ # Add 'User=mcsm' to the service file
+ sed -i '/^\[Service\]$/a User=mcsm' "$service_file"
+ fi
+ fi
+ # Reload Systemd Service
+ systemctl daemon-reload
+
}
# MCSM Web Update & Installation
@@ -277,41 +296,8 @@ Install_Web_Wrapper() {
# Install MCSM Web
Install_MCSM_Web_Base
-
-
- mkdir -p "${mcsmanager_install_path}" || Red_Error "[x] Failed to create ${mcsmanager_install_path}"
-
- # cd /opt/mcsmanager
- cd "${mcsmanager_install_path}" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}"
-
- # donwload MCSManager release
- wget "${mcsmanager_donwload_addr}" || Red_Error "[x] Failed to download MCSManager"
- tar -zxf ${package_name} -o || Red_Error "[x] Failed to untar ${package_name}"
- rm -rf "${mcsmanager_install_path}/${package_name}"
-
- # echo "[→] cd daemon"
- cd "${mcsmanager_install_path}/daemon" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/daemon"
-
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
- env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/daemon"
-
- # echo "[←] cd .."
- cd "${mcsmanager_install_path}/web" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}/web"
-
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${mcsmanager_install_path}/web"
-
- echo
- echo_yellow "=============== MCSManager ==============="
- echo_green "Daemon: ${mcsmanager_install_path}/daemon"
- echo_green "Web: ${mcsmanager_install_path}/web"
- echo_yellow "=============== MCSManager ==============="
- echo
- echo_green "[+] MCSManager installation success!"
-
- chmod -R 755 "$mcsmanager_install_path"
-
- sleep 3
+ # Install MCSM Web Service
+ Install_Web_Systemd
}
From 6de15c8eb18fc92b763b775ba71bc263d5fd18e5 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 00:27:27 +0800
Subject: [PATCH 145/460] add mcsm daemon base install
---
install_update.sh | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/install_update.sh b/install_update.sh
index c962b76..6dbc123 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -300,7 +300,28 @@ Install_Web_Wrapper() {
Install_Web_Systemd
}
-
+# MCSM Daemon Base Installation
+# Assuming a fresh install (i.e. no file(s) from previous installation) and downloaded source
+Install_MCSM_Daemon_Base() {
+ # Move downloaded path
+ mv "${mcsm_down_temp}/${mcsm_daemon}" "$daemon_path"
+ # Move back the data directory
+ rm -rf "$daemon_data"
+ mv "${web_daemon_tmp}" "${daemon_data}"
+ # Dependencies install
+ cd "${daemon_path}" || Red_Error "[x] Failed to enter ${daemon_path}"
+ # Install dependencies
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${daemon_path}"
+ # Return to general dir
+ cd "$mcsmanager_install_path"
+ # Configure ownership if needed
+ if [[ "$USER" == *"mcsm"* ]]; then
+ # Change file permission to mcsm user
+ chown -R mcsm:mcsm "$daemon_path"
+ fi
+ chmod -R 755 "$daemon_path"
+}
########### Main Logic ################
Initialize
# Parse provided arguments
From acd7f5ca6730b8c7d5d258c7b27af456f7e857a4 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 00:37:45 +0800
Subject: [PATCH 146/460] add mcsm daemon systemd service
---
install_update.sh | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index 6dbc123..3fda8e0 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -322,6 +322,40 @@ Install_MCSM_Daemon_Base() {
fi
chmod -R 755 "$daemon_path"
}
+
+# MCSM Daemon Service Installation
+Install_Daemon_Systemd() {
+ echo_cyan "[+] Creating MCSManager Daemon service..."
+ # Create the default service file
+ echo "[Unit]
+ Description=MCSManager-Daemon
+
+ [Service]
+ WorkingDirectory=${daemon_path}
+ ExecStart=${node_install_path}/bin/node app.js
+ ExecReload=/bin/kill -s QUIT \$MAINPID
+ ExecStop=/bin/kill -s QUIT \$MAINPID
+ Environment=\"PATH=${PATH}\"
+
+ [Install]
+ WantedBy=multi-user.target
+ " >/etc/systemd/system/mcsm-daemon.service
+ # Add user section if using mcsm user
+ if [[ "$USER" == *"mcsm"* ]]; then
+ # Check if the 'User=mcsm' line already exists in the service file
+ if grep -q "^User=mcsm$" "$service_file"; then
+ echo "The service file is configured already."
+ else
+ # Add 'User=mcsm' to the service file
+ sed -i '/^\[Service\]$/a User=mcsm' "$service_file"
+ fi
+ fi
+ # Reload Systemd Service
+ systemctl daemon-reload
+
+}
+
+
########### Main Logic ################
Initialize
# Parse provided arguments
From 9433bf24bbb334e1e54d553ba34fd8cd6fa1354c Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 00:38:54 +0800
Subject: [PATCH 147/460] consolidate systemd commands
---
install_update.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 3fda8e0..6d8213e 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -238,6 +238,13 @@ Install_MCSM_Web_Base() {
# MCSM Web Service Installation
Install_Web_Systemd() {
echo_cyan "[+] Creating MCSManager Web service..."
+ # stop and disable existing service
+ systemctl disable --now mcsm-web
+
+ # delete existing service
+ rm -rf /etc/systemd/system/mcsm-web.service
+ systemctl daemon-reload
+
# Create the default service file
echo "[Unit]
Description=MCSManager-Web
@@ -285,13 +292,6 @@ Install_Web_Wrapper() {
echo "The directory '$mcsmanager_install_path' does not exist."
fi
echo_cyan "[+] Install MCSManager Web..."
-
- # stop and disable service
- systemctl disable --now mcsm-web
-
- # delete service
- rm -rf /etc/systemd/system/mcsm-web.service
- systemctl daemon-reload
# Install MCSM Web
Install_MCSM_Web_Base
From 197ef9b12e9e209fae235a3248cbc75a509c5afe Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 00:52:44 +0800
Subject: [PATCH 148/460] add argument parsing to separate function
---
install_update.sh | 98 +++++++++++++++++++++++++++++------------------
1 file changed, 60 insertions(+), 38 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 6d8213e..4b51331 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -354,49 +354,71 @@ Install_Daemon_Systemd() {
systemctl daemon-reload
}
+# MCSM Web Update & Installation
+Install_Daemon_Wrapper() {
+ web_path="${mcsmanager_install_path}/${mcsm_daemon}"
+ web_data="${web_daemon}/data"
+ web_data_tmp="${mcsmanager_install_path}/daemon_data_${current_date}"
+ if [ -d "$daemon_path" ]; then
+ echo_cyan "[+] Updating MCSManager Daemon..."
+ # The backup should be created already, moving the DATA dir to /opt/mcsmanager/daemon_data should be fast and safe.
+ # Use daemon_data, do not use data as in rare circumstance user may run both update at the same time.
+ # Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
+ mv "$daemon_data" "$daemon_data_tmp"
+ # Remove the old daemon dir
+ rm -rf "$daemon_path"
+
+ else
+ echo "The directory '$mcsmanager_install_path' does not exist."
+ fi
+ echo_cyan "[+] Install MCSManager daemon..."
+
+ # Install MCSM Web
+ Install_MCSM_Daemon_Base
+
+ # Install MCSM Web Service
+ Install_Daemon_Systemd
+}
+# Arguments parsing
+Parse_Arguments() {
+
+}
+
+# Wrapper for installation
+Install_Update() {
+ while getopts "u:c:" opt; do
+ case ${opt} in
+ u )
+ if [[ "${OPTARG}" == "mcsm" || "${OPTARG}" == "root" ]]; then
+ user="${OPTARG}"
+ else
+ echo "Invalid user specified."
+ usage
+ fi
+ ;;
+ c )
+ if [[ "${OPTARG}" == "web" || "${OPTARG}" == "daemon" || "${OPTARG}" == "all" ]]; then
+ command="${OPTARG}"
+ else
+ echo "Invalid command specified."
+ usage
+ fi
+ ;;
+ \? )
+ usage
+ ;;
+ : )
+ echo "Option -$OPTARG requires an argument."
+ usage
+ ;;
+ esac
+ done
+}
########### Main Logic ################
Initialize
# Parse provided arguments
-while getopts "u:c:" opt; do
- case ${opt} in
- u )
- if [[ "${OPTARG}" == "mcsm" || "${OPTARG}" == "root" ]]; then
- user="${OPTARG}"
- else
- echo "Invalid user specified."
- usage
- fi
- ;;
- c )
- if [[ "${OPTARG}" == "web" || "${OPTARG}" == "daemon" || "${OPTARG}" == "all" ]]; then
- command="${OPTARG}"
- else
- echo "Invalid command specified."
- usage
- fi
- ;;
- \? )
- usage
- ;;
- : )
- echo "Option -$OPTARG requires an argument."
- usage
- ;;
- esac
-done
-
-# Logic for different users
-case ${USER} in
- root)
- ;;
- mcsm)
- ;;
- *)
- echo "Unknown user: ${USER}. Using default user mcsm..."
- ;;
-esac
# Check if the mcsmanager_install_path exists
From 87cf66b242938d12e66239ecb3b5c24f9445a844 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 00:53:09 +0800
Subject: [PATCH 149/460] fix argument parsing position
---
install_update.sh | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 4b51331..8adcf07 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -381,13 +381,6 @@ Install_Daemon_Wrapper() {
}
# Arguments parsing
Parse_Arguments() {
-
-
-
-}
-
-# Wrapper for installation
-Install_Update() {
while getopts "u:c:" opt; do
case ${opt} in
u )
@@ -416,6 +409,10 @@ Install_Update() {
esac
done
}
+
+# Wrapper for installation
+Install_Update() {
+}
########### Main Logic ################
Initialize
# Parse provided arguments
From 57d02555f87fe4704b90a03f2d6554d5dbf23f9e Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 00:59:03 +0800
Subject: [PATCH 150/460] rearrange some commands
---
install_update.sh | 42 ++++++++++++++++++++++++++++++++++++------
1 file changed, 36 insertions(+), 6 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 8adcf07..c7b67a4 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -412,6 +412,33 @@ Parse_Arguments() {
# Wrapper for installation
Install_Update() {
+ case "$COMMAND" in
+ all)
+ Install_Web_Wrapper
+ Install_Daemon_Wrapper
+ ;;
+
+ web)
+ Install_Web_Wrapper
+ ;;
+
+ daemon)
+ Install_Daemon_Wrapper
+ ;;
+
+ *)
+ echo "Unknown command: $COMMAND, this should not happen in general :( Please report this bug."
+ # Exit with an error if COMMAND is unrecognized
+ exit 1
+ ;;
+esac
+}
+# Finalize installation
+Finalize() {
+
+
+
+
}
########### Main Logic ################
Initialize
@@ -424,11 +451,14 @@ if [ -d "$mcsmanager_install_path" ]; then
Backup_MCSM
# Install Node.js, this is to ensure the version is up to date.
Install_node
- #
else
- echo "The directory '$mcsmanager_install_path' does not exist."
- # Logic branch when the directory does not exist
- # For example, create the directory
- echo "Creating $mcsmanager_install_path..."
-fi
\ No newline at end of file
+ # Install Node.js, this is to ensure the version is up to date.
+ Install_node
+fi
+
+# Install Services based on command
+Install_Update
+
+# Print Information
+echo "Installation Complete!"
\ No newline at end of file
From 112ecda518cb652c9d08f05a8c25c6c45de96400 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 00:59:37 +0800
Subject: [PATCH 151/460] enable and start service as install
---
install_update.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index c7b67a4..77b00ba 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -271,7 +271,7 @@ Install_Web_Systemd() {
fi
# Reload Systemd Service
systemctl daemon-reload
-
+ systemctl enable --now mcsm-web
}
# MCSM Web Update & Installation
@@ -352,7 +352,7 @@ Install_Daemon_Systemd() {
fi
# Reload Systemd Service
systemctl daemon-reload
-
+ systemctl enable --now mcsm-daemon
}
# MCSM Web Update & Installation
Install_Daemon_Wrapper() {
From 4ae4d8465013836c82191b3762bc1136d9209486 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 01:04:39 +0800
Subject: [PATCH 152/460] print different information based on install cmd
---
install_update.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 62 insertions(+), 1 deletion(-)
diff --git a/install_update.sh b/install_update.sh
index 77b00ba..992d617 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -435,7 +435,68 @@ esac
}
# Finalize installation
Finalize() {
-
+ printf "\n\n\n\n"
+ case "$COMMAND" in
+ all)
+ echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_yellow " "
+ echo_cyan_n "HTTP Web Service: "
+ echo_yellow "http://:23333 (Browser)"
+ echo_cyan_n "Daemon Address: "
+ echo_yellow "ws://:24444 (Cluster)"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+ ;;
+
+ web)
+ echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_yellow " "
+ echo_cyan_n "HTTP Web Service: "
+ echo_yellow "http://:23333 (Browser)"
+ echo_red "You must expose port 23333 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-web.service"
+ echo_cyan "systemctl stop mcsm-web.service"
+ echo_cyan "systemctl restart mcsm-web.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+ ;;
+
+ daemon)
+ echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_yellow " "
+ echo_cyan_n "Daemon Address: "
+ echo_yellow "ws://:24444 (Cluster)"
+ echo_red "You must expose port 24444 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-daemon.service"
+ echo_cyan "systemctl stop mcsm-daemon.service"
+ echo_cyan "systemctl restart mcsm-daemon.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+ ;;
+
+ *)
+ echo "Unknown command: $COMMAND, this should not happen in general :( Please report this bug."
+ # Exit with an error if COMMAND is unrecognized
+ exit 1
+ ;;
+
+
From bbc062eb870e701ace94b371d8d73a34ac38e406 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 01:08:00 +0800
Subject: [PATCH 153/460] complete main logic
---
install_update.sh | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 992d617..0c87f6a 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -495,11 +495,11 @@ Finalize() {
# Exit with an error if COMMAND is unrecognized
exit 1
;;
-
-
-
-
-
+ # Check if backup_path is not empty
+ if [[ -n "$backup_path" ]]; then
+ echo "Your MCSM has been updated and/or installed. A complete backup was created at: $backup_path"
+ echo "You can manually delete the backup using command: rm ${backup_path}"
+ fi
}
########### Main Logic ################
Initialize
@@ -521,5 +521,7 @@ fi
# Install Services based on command
Install_Update
-# Print Information
+# Print helping Information
+Finalize
+
echo "Installation Complete!"
\ No newline at end of file
From a8dc6dba70f39b136c109646f41e9608671d00de Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 01:08:45 +0800
Subject: [PATCH 154/460] add main function
---
install_update.sh | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 0c87f6a..e225551 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -502,26 +502,30 @@ Finalize() {
fi
}
########### Main Logic ################
-Initialize
-# Parse provided arguments
+main() {
+ Initialize
+ # Parse provided arguments
-# Check if the mcsmanager_install_path exists
-if [ -d "$mcsmanager_install_path" ]; then
- # Backup first
- Backup_MCSM
- # Install Node.js, this is to ensure the version is up to date.
- Install_node
-
-else
- # Install Node.js, this is to ensure the version is up to date.
- Install_node
-fi
+ # Check if the mcsmanager_install_path exists
+ if [ -d "$mcsmanager_install_path" ]; then
+ # Backup first
+ Backup_MCSM
+ # Install Node.js, this is to ensure the version is up to date.
+ Install_node
+
+ else
+ # Install Node.js, this is to ensure the version is up to date.
+ Install_node
+ fi
+
+ # Install Services based on command
+ Install_Update
-# Install Services based on command
-Install_Update
+ # Print helping Information
+ Finalize
-# Print helping Information
-Finalize
+ echo "Installation Complete!"
+}
-echo "Installation Complete!"
\ No newline at end of file
+main
\ No newline at end of file
From f795bde90048609a26839978a4a028e11abd1987 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 01:12:04 +0800
Subject: [PATCH 155/460] add architecture detection
---
install_update.sh | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index e225551..caa7ee8 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -1,13 +1,13 @@
#!/bin/bash
-#Global arguments
+#Global varialbles
# System architecture
arch=$(uname -m)
# Install base dir
install_base="/opt"
# MCSM install dir
mcsmanager_install_path="${install_base}/mcsmanager"
-# MCSM backup dir
+# MCSM backup dir during upgrade
mcsm_backup_dir="${install_base}"
# Download URL
mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
@@ -150,11 +150,35 @@ Check_and_download_source() {
# Clean up the downloaded tar.gz file
rm "${mcsm_down_temp}/mcsmanager.tar.gz"
+# Detect architecture
+Detect_Architecture() {
+ if [[ "$arch" == x86_64 ]]; then
+ arch=x64
+ #echo "[-] x64 architecture detected"
+ elif [[ $arch == aarch64 ]]; then
+ arch=arm64
+ #echo "[-] 64-bit ARM architecture detected"
+ elif [[ $arch == arm ]]; then
+ arch=armv7l
+ #echo "[-] 32-bit ARM architecture detected"
+ elif [[ $arch == ppc64le ]]; then
+ arch=ppc64le
+ #echo "[-] IBM POWER architecture detected"
+ elif [[ $arch == s390x ]]; then
+ arch=s390x
+ #echo "[-] IBM LinuxONE architecture detected"
+ else
+ Red_Error "[x] Sorry, this architecture is not supported yet!\n[x]Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
+ fi
+}
# Initialization
Initialize() {
# Check sudo
check_sudo
+ # Update architecture
+ Detect_Architecture
+
# Check if install base (/opt) exist
mkdir -p "$install_base"
From dfb2ec53ebfd4592c51255b17bae215f722dd07c Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 01:23:19 +0800
Subject: [PATCH 156/460] remove local from variable
---
install_update.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install_update.sh b/install_update.sh
index caa7ee8..7000efa 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -20,7 +20,7 @@ mcsm_web="web"
# MCSM daemon dir name
mcsm_daemon="daemon"
# The date variable to be shared across functions
-local current_date=$(date +%Y_%m_%d)
+current_date=$(date +%Y_%m_%d)
# MCSM local temp dir for downloaded source
mcsm_down_temp="/opt/mcsmanager_${current_date}"
# Service file for MCSCM Web
From 6fae21f6416ee085df1805da454add403a81c74a Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 01:28:04 +0800
Subject: [PATCH 157/460] fix unclosed cases
---
install_update.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/install_update.sh b/install_update.sh
index 7000efa..e32f754 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -455,7 +455,7 @@ Install_Update() {
# Exit with an error if COMMAND is unrecognized
exit 1
;;
-esac
+ esac
}
# Finalize installation
Finalize() {
@@ -519,6 +519,7 @@ Finalize() {
# Exit with an error if COMMAND is unrecognized
exit 1
;;
+ esac
# Check if backup_path is not empty
if [[ -n "$backup_path" ]]; then
echo "Your MCSM has been updated and/or installed. A complete backup was created at: $backup_path"
From d0cabc18c211de54d94e77628a035ea30e294f9e Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 01:30:03 +0800
Subject: [PATCH 158/460] fix unclosed function
---
install_update.sh | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index e32f754..11098c6 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -149,7 +149,7 @@ Check_and_download_source() {
# Clean up the downloaded tar.gz file
rm "${mcsm_down_temp}/mcsmanager.tar.gz"
-
+}
# Detect architecture
Detect_Architecture() {
if [[ "$arch" == x86_64 ]]; then
@@ -529,9 +529,6 @@ Finalize() {
########### Main Logic ################
main() {
Initialize
- # Parse provided arguments
-
-
# Check if the mcsmanager_install_path exists
if [ -d "$mcsmanager_install_path" ]; then
# Backup first
From 4f81d40876419c70cc0b491c9453e5f84b8b0ac8 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 01:41:03 +0800
Subject: [PATCH 159/460] use red error instaed of return 1
---
install_update.sh | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 11098c6..91dcb6b 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -115,6 +115,9 @@ Install_node() {
if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
echo_green "Success"
else
+ echo "${node_install_path}/bin/node"
+ $("$node_install_path"/bin/node -v)
+
Red_Error "[x] Node installation failed!"
fi
@@ -136,15 +139,13 @@ Check_and_download_source() {
# Download the archive directly into the temporary directory
wget -O "${mcsm_down_temp}/mcsmanager.tar.gz" "$mcsmanager_download_addr"
if [ $? -ne 0 ]; then
- echo "Download failed."
- return 1 # Exit if download fails
+ Red_Error "MCSManager Download failed."
fi
# Extract the archive without changing directories
tar -xzf "${mcsm_down_temp}/mcsmanager.tar.gz" -C "$mcsm_down_temp" --strip-components=1
if [ $? -ne 0 ]; then
- echo "Extraction failed."
- return 1 # Exit if extraction fails
+ Red_Error "Extraction failed."
fi
# Clean up the downloaded tar.gz file
@@ -152,8 +153,10 @@ Check_and_download_source() {
}
# Detect architecture
Detect_Architecture() {
- if [[ "$arch" == x86_64 ]]; then
+ echo "Detected"
+ if [[ $arch == x86_64 ]]; then
arch=x64
+ echo "Detected x64"
#echo "[-] x64 architecture detected"
elif [[ $arch == aarch64 ]]; then
arch=arm64
@@ -206,14 +209,12 @@ Initialize() {
Backup_MCSM() {
# Ensure both directories are provided
if [ -z "$mcsmanager_install_path" ] || [ -z "$mcsm_backup_dir" ]; then
- echo "Error: Backup or source path not set."
- return 1 # Return with error
+ Red_Error "Error: Backup or source path not set."
fi
# Check if the source directory exists
if [ ! -d "$mcsmanager_install_path" ]; then
- echo "Error: Source directory does not exist."
- return 1 # Return with error
+ Red_Error "Error: Source directory does not exist."
fi
# Create backup directory (/opt) if it doesn't exist
@@ -233,8 +234,7 @@ Backup_MCSM() {
if [ $? -eq 0 ]; then
echo "Backup created successfully at $backup_path"
else
- echo "Error creating backup."
- return 1 # Return with error
+ Red_Error "Error creating backup."
fi
}
# MCSM Web Base Installation
From 61b9e055095bd9c4c58a49847e9f8278f7624e5e Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 01:47:02 +0800
Subject: [PATCH 160/460] fix typo for original variable name
---
install_update.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install_update.sh b/install_update.sh
index 91dcb6b..908d170 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -10,7 +10,7 @@ mcsmanager_install_path="${install_base}/mcsmanager"
# MCSM backup dir during upgrade
mcsm_backup_dir="${install_base}"
# Download URL
-mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+mcsmanager_download_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
# Node.js version to install
node="v20.12.2"
# Node.js install dir
From 88ff6f43d7949e82f5c4ec4199685609190335a4 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 02:00:59 +0800
Subject: [PATCH 161/460] automatically get package name from URL & bug fix
---
install_update.sh | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 908d170..514d6fb 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -32,6 +32,8 @@ USER="mcsm"
COMMAND="all"
# Created backup absolute path
backup_path=""
+# Downloaded package name
+package_name="${mcsmanager_download_addr##*/}"
# Helper Functions
usage() {
@@ -143,7 +145,7 @@ Check_and_download_source() {
fi
# Extract the archive without changing directories
- tar -xzf "${mcsm_down_temp}/mcsmanager.tar.gz" -C "$mcsm_down_temp" --strip-components=1
+ tar -xzf "${mcsm_down_temp}/${package_name}" -C "$mcsm_down_temp" --strip-components=1
if [ $? -ne 0 ]; then
Red_Error "Extraction failed."
fi
@@ -154,25 +156,27 @@ Check_and_download_source() {
# Detect architecture
Detect_Architecture() {
echo "Detected"
+ echo "$arch"
if [[ $arch == x86_64 ]]; then
- arch=x64
+ arch="x64"
echo "Detected x64"
#echo "[-] x64 architecture detected"
elif [[ $arch == aarch64 ]]; then
- arch=arm64
+ arch="arm64"
#echo "[-] 64-bit ARM architecture detected"
elif [[ $arch == arm ]]; then
- arch=armv7l
+ arch="armv7l"
#echo "[-] 32-bit ARM architecture detected"
elif [[ $arch == ppc64le ]]; then
- arch=ppc64le
+ arch="ppc64le"
#echo "[-] IBM POWER architecture detected"
elif [[ $arch == s390x ]]; then
- arch=s390x
+ arch="s390x"
#echo "[-] IBM LinuxONE architecture detected"
else
Red_Error "[x] Sorry, this architecture is not supported yet!\n[x]Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
fi
+ echo "$arch"
}
# Initialization
Initialize() {
From 6e059d9db9fef8e1db19ecbb7d5d1a3cf6543093 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 02:03:00 +0800
Subject: [PATCH 162/460] fix extraction dir
---
install_update.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 514d6fb..82fbe9a 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -145,13 +145,13 @@ Check_and_download_source() {
fi
# Extract the archive without changing directories
- tar -xzf "${mcsm_down_temp}/${package_name}" -C "$mcsm_down_temp" --strip-components=1
+ tar -xzf "${mcsm_down_temp}/${package_name}" -C "$mcsm_down_temp"
if [ $? -ne 0 ]; then
Red_Error "Extraction failed."
fi
# Clean up the downloaded tar.gz file
- rm "${mcsm_down_temp}/mcsmanager.tar.gz"
+ rm "${mcsm_down_temp}/${package_name}"
}
# Detect architecture
Detect_Architecture() {
From d8bb978d5fdc514286e61975daf311e845a3a059 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 02:06:34 +0800
Subject: [PATCH 163/460] include the helper files
---
install_update.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index 82fbe9a..fafa095 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -246,6 +246,8 @@ Backup_MCSM() {
Install_MCSM_Web_Base() {
# Move downloaded path
mv "${mcsm_down_temp}/${mcsm_web}" "$web_path"
+ # Move helper file(s)
+ mv "${mcsm_down_temp}/start-web.sh" "${mcsmanager_install_path}/start-web.sh"
# Move back the data directory
rm -rf "$web_data"
mv "${web_data_tmp}" "${web_data}"
@@ -333,6 +335,9 @@ Install_Web_Wrapper() {
Install_MCSM_Daemon_Base() {
# Move downloaded path
mv "${mcsm_down_temp}/${mcsm_daemon}" "$daemon_path"
+ # Move helper file(s)
+ mv "${mcsm_down_temp}/start-daemon.sh" "${mcsmanager_install_path}/start-daemon.sh"
+
# Move back the data directory
rm -rf "$daemon_data"
mv "${web_daemon_tmp}" "${daemon_data}"
@@ -529,6 +534,12 @@ Finalize() {
echo "Your MCSM has been updated and/or installed. A complete backup was created at: $backup_path"
echo "You can manually delete the backup using command: rm ${backup_path}"
fi
+ # Move quickstart.md
+ mv "${mcsm_down_temp}/quick-start.md" "${mcsmanager_install_path}/quick-start.md"
+ # Remove the temp folder
+ rm -rf "${mcsm_down_temp}"
+
+
}
########### Main Logic ################
main() {
From 5d7d4d3404fff22c028a2139c020dd980df0c6f0 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 02:17:29 +0800
Subject: [PATCH 164/460] bypassing Node.js install if already
---
install_update.sh | 46 +++++++++++++++++++++++-----------------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index fafa095..9d2e706 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -13,8 +13,6 @@ mcsm_backup_dir="${install_base}"
mcsmanager_download_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
# Node.js version to install
node="v20.12.2"
-# Node.js install dir
-node_install_path="${install_base}/node-$node-linux-$arch"
# MCSM Web dir name
mcsm_web="web"
# MCSM daemon dir name
@@ -34,6 +32,8 @@ COMMAND="all"
backup_path=""
# Downloaded package name
package_name="${mcsmanager_download_addr##*/}"
+# Node.js install dir
+node_install_path=""
# Helper Functions
usage() {
@@ -100,28 +100,30 @@ Install_dependencies() {
}
Install_node() {
- echo_cyan_n "[+] Install Node.js environment...\n"
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
+ echo_green "Desired Node.js is already installed at the target dir, bypassing installation..."
+ else
+ echo_cyan_n "[+] Install Node.js environment...\n"
- rm -irf "$node_install_path"
+ rm -irf "$node_install_path"
- cd /opt || Red_Error "[x] Failed to enter /opt"
+ cd /opt || Red_Error "[x] Failed to enter /opt"
- rm -rf "node-$node-linux-$arch.tar.gz"
+ rm -rf "node-$node-linux-$arch.tar.gz"
- wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
+ wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
- tar -zxf "node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to untar node"
+ tar -zxf "node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to untar node"
- rm -rf "node-$node-linux-$arch.tar.gz"
+ rm -rf "node-$node-linux-$arch.tar.gz"
- if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
- echo_green "Success"
- else
- echo "${node_install_path}/bin/node"
- $("$node_install_path"/bin/node -v)
-
- Red_Error "[x] Node installation failed!"
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
+ echo_green "Success"
+ else
+ Red_Error "[x] Node installation failed!"
+ fi
fi
+
echo
echo_yellow "=============== Node.js Version ==============="
@@ -129,7 +131,7 @@ Install_node() {
echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
echo_yellow "=============== Node.JS Version ==============="
echo
-
+ exit 0
sleep 3
}
# Check and download MCSM source
@@ -139,7 +141,7 @@ Check_and_download_source() {
mkdir -p "$mcsm_down_temp"
# Download the archive directly into the temporary directory
- wget -O "${mcsm_down_temp}/mcsmanager.tar.gz" "$mcsmanager_download_addr"
+ wget -O "${mcsm_down_temp}/${package_name}" "$mcsmanager_download_addr"
if [ $? -ne 0 ]; then
Red_Error "MCSManager Download failed."
fi
@@ -155,11 +157,8 @@ Check_and_download_source() {
}
# Detect architecture
Detect_Architecture() {
- echo "Detected"
- echo "$arch"
if [[ $arch == x86_64 ]]; then
arch="x64"
- echo "Detected x64"
#echo "[-] x64 architecture detected"
elif [[ $arch == aarch64 ]]; then
arch="arm64"
@@ -176,7 +175,8 @@ Detect_Architecture() {
else
Red_Error "[x] Sorry, this architecture is not supported yet!\n[x]Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
fi
- echo "$arch"
+
+ node_install_path="${install_base}/node-$node-linux-$arch"
}
# Initialization
Initialize() {
@@ -196,7 +196,7 @@ Initialize() {
Install_dependencies
# Check and download MCSM source
- Check_and_download_source
+ #Check_and_download_source
# Create mcsm user if needed
if [[ "$USER" == *"mcsm"* ]]; then
From e75bf36340b09659a37824ecd4390ccd10f0364a Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 02:21:33 +0800
Subject: [PATCH 165/460] create backup containing the mcsmanager dir
---
install_update.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 9d2e706..897d628 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -131,7 +131,6 @@ Install_node() {
echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
echo_yellow "=============== Node.JS Version ==============="
echo
- exit 0
sleep 3
}
# Check and download MCSM source
@@ -232,7 +231,9 @@ Backup_MCSM() {
# Create the backup
echo "Creating backup..."
- tar -czf "$backup_path" -C "$mcsmanager_install_path" .
+ #tar -czf "$backup_path" -C "$mcsmanager_install_path" .
+ tar -czf "$backup_path" -C "$(dirname "$mcsmanager_install_path")" "$(basename "$mcsmanager_install_path")"
+
# Check if the backup was successful
if [ $? -eq 0 ]; then
@@ -240,6 +241,7 @@ Backup_MCSM() {
else
Red_Error "Error creating backup."
fi
+ exit 1
}
# MCSM Web Base Installation
# Assuming a fresh install (i.e. no file(s) from previous installation) and downloaded source
From 125a869ebe511989a329351c441ab317aef88b72 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 02:27:50 +0800
Subject: [PATCH 166/460] updating some messages
---
install_update.sh | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 897d628..a5d8142 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -195,13 +195,13 @@ Initialize() {
Install_dependencies
# Check and download MCSM source
- #Check_and_download_source
+ Check_and_download_source
# Create mcsm user if needed
if [[ "$USER" == *"mcsm"* ]]; then
# Create the user 'mcsm' if it doesn't already exist
if ! id "mcsm" &>/dev/null; then
- useradd mcsm
+ /usr/sbin/useradd mcsm
echo "User 'mcsm' created."
else
echo "User 'mcsm' already exists."
@@ -241,7 +241,6 @@ Backup_MCSM() {
else
Red_Error "Error creating backup."
fi
- exit 1
}
# MCSM Web Base Installation
# Assuming a fresh install (i.e. no file(s) from previous installation) and downloaded source
@@ -321,9 +320,9 @@ Install_Web_Wrapper() {
rm -rf "$web_path"
else
- echo "The directory '$mcsmanager_install_path' does not exist."
+ echo_cyan "[+] Install MCSManager Web..."
fi
- echo_cyan "[+] Install MCSManager Web..."
+
# Install MCSM Web
Install_MCSM_Web_Base
From fd4c550df204976f09749118d5b2db137433b331 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 02:31:00 +0800
Subject: [PATCH 167/460] use variables for service files
---
install_update.sh | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index a5d8142..aa0554a 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -273,23 +273,24 @@ Install_Web_Systemd() {
systemctl disable --now mcsm-web
# delete existing service
- rm -rf /etc/systemd/system/mcsm-web.service
+ rm -rf "$service_file_web"
systemctl daemon-reload
# Create the default service file
echo "[Unit]
- Description=MCSManager-Web
-
- [Service]
- WorkingDirectory=${web_path}
- ExecStart=${node_install_path}/bin/node app.js
- ExecReload=/bin/kill -s QUIT \$MAINPID
- ExecStop=/bin/kill -s QUIT \$MAINPID
- Environment=\"PATH=${PATH}\"
-
- [Install]
- WantedBy=multi-user.target
- " >/etc/systemd/system/mcsm-web.service
+Description=MCSManager-Web
+
+[Service]
+WorkingDirectory=${web_path}
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s QUIT \$MAINPID
+ExecStop=/bin/kill -s QUIT \$MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" >"$service_file_web"
+
# Add user section if using mcsm user
if [[ "$USER" == *"mcsm"* ]]; then
# Check if the 'User=mcsm' line already exists in the service file
@@ -297,7 +298,7 @@ Install_Web_Systemd() {
echo "The service file is configured already."
else
# Add 'User=mcsm' to the service file
- sed -i '/^\[Service\]$/a User=mcsm' "$service_file"
+ sed -i '/^\[Service\]$/a User=mcsm' "$service_file_web"
fi
fi
# Reload Systemd Service
@@ -373,15 +374,16 @@ Install_Daemon_Systemd() {
[Install]
WantedBy=multi-user.target
- " >/etc/systemd/system/mcsm-daemon.service
+ " >"$service_file_daemon"
+
# Add user section if using mcsm user
if [[ "$USER" == *"mcsm"* ]]; then
# Check if the 'User=mcsm' line already exists in the service file
- if grep -q "^User=mcsm$" "$service_file"; then
+ if grep -q "^User=mcsm$" "$service_file_daemon"; then
echo "The service file is configured already."
else
# Add 'User=mcsm' to the service file
- sed -i '/^\[Service\]$/a User=mcsm' "$service_file"
+ sed -i '/^\[Service\]$/a User=mcsm' "$service_file_daemon"
fi
fi
# Reload Systemd Service
From c1a6334f4bd542f74c22fb91582fc6a24e1fc17c Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 02:31:46 +0800
Subject: [PATCH 168/460] remove daemon service before adding
---
install_update.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index aa0554a..ed0747a 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -361,6 +361,13 @@ Install_MCSM_Daemon_Base() {
# MCSM Daemon Service Installation
Install_Daemon_Systemd() {
echo_cyan "[+] Creating MCSManager Daemon service..."
+ # stop and disable existing service
+ systemctl disable --now mcsm-daemon
+
+ # delete existing service
+ rm -rf "$service_file_daemon"
+ systemctl daemon-reload
+
# Create the default service file
echo "[Unit]
Description=MCSManager-Daemon
From 9d1c2d5f80d129ca58fd3d52f869ce3b49111d43 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 02:39:42 +0800
Subject: [PATCH 169/460] fix daemon install
---
install_update.sh | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index ed0747a..7493c61 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -294,7 +294,7 @@ WantedBy=multi-user.target
# Add user section if using mcsm user
if [[ "$USER" == *"mcsm"* ]]; then
# Check if the 'User=mcsm' line already exists in the service file
- if grep -q "^User=mcsm$" "$service_file"; then
+ if grep -q "^User=mcsm$" "$service_file_web"; then
echo "The service file is configured already."
else
# Add 'User=mcsm' to the service file
@@ -399,9 +399,9 @@ Install_Daemon_Systemd() {
}
# MCSM Web Update & Installation
Install_Daemon_Wrapper() {
- web_path="${mcsmanager_install_path}/${mcsm_daemon}"
- web_data="${web_daemon}/data"
- web_data_tmp="${mcsmanager_install_path}/daemon_data_${current_date}"
+ daemon_path="${mcsmanager_install_path}/${mcsm_daemon}"
+ daemon_data="${web_daemon}/data"
+ daemon_data_tmp="${mcsmanager_install_path}/daemon_data_${current_date}"
if [ -d "$daemon_path" ]; then
echo_cyan "[+] Updating MCSManager Daemon..."
# The backup should be created already, moving the DATA dir to /opt/mcsmanager/daemon_data should be fast and safe.
@@ -412,10 +412,9 @@ Install_Daemon_Wrapper() {
rm -rf "$daemon_path"
else
- echo "The directory '$mcsmanager_install_path' does not exist."
+ echo_cyan "[+] Install MCSManager daemon..."
fi
- echo_cyan "[+] Install MCSManager daemon..."
-
+
# Install MCSM Web
Install_MCSM_Daemon_Base
From 13cad79dded61ad6df66f278a709d88fbff5b622 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 02:52:11 +0800
Subject: [PATCH 170/460] fix daemon install
---
install_update.sh | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 7493c61..daff578 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -342,7 +342,7 @@ Install_MCSM_Daemon_Base() {
# Move back the data directory
rm -rf "$daemon_data"
- mv "${web_daemon_tmp}" "${daemon_data}"
+ mv "${daemon_data_tmp}" "${daemon_data}"
# Dependencies install
cd "${daemon_path}" || Red_Error "[x] Failed to enter ${daemon_path}"
# Install dependencies
@@ -370,18 +370,18 @@ Install_Daemon_Systemd() {
# Create the default service file
echo "[Unit]
- Description=MCSManager-Daemon
-
- [Service]
- WorkingDirectory=${daemon_path}
- ExecStart=${node_install_path}/bin/node app.js
- ExecReload=/bin/kill -s QUIT \$MAINPID
- ExecStop=/bin/kill -s QUIT \$MAINPID
- Environment=\"PATH=${PATH}\"
-
- [Install]
- WantedBy=multi-user.target
- " >"$service_file_daemon"
+Description=MCSManager-Daemon
+
+[Service]
+WorkingDirectory=${daemon_path}
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s QUIT \$MAINPID
+ExecStop=/bin/kill -s QUIT \$MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" >"$service_file_daemon"
# Add user section if using mcsm user
if [[ "$USER" == *"mcsm"* ]]; then
@@ -400,13 +400,13 @@ Install_Daemon_Systemd() {
# MCSM Web Update & Installation
Install_Daemon_Wrapper() {
daemon_path="${mcsmanager_install_path}/${mcsm_daemon}"
- daemon_data="${web_daemon}/data"
+ daemon_data="${daemon_path}/data"
daemon_data_tmp="${mcsmanager_install_path}/daemon_data_${current_date}"
if [ -d "$daemon_path" ]; then
echo_cyan "[+] Updating MCSManager Daemon..."
# The backup should be created already, moving the DATA dir to /opt/mcsmanager/daemon_data should be fast and safe.
# Use daemon_data, do not use data as in rare circumstance user may run both update at the same time.
- # Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
+ # Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
mv "$daemon_data" "$daemon_data_tmp"
# Remove the old daemon dir
rm -rf "$daemon_path"
From d76090511978029011f66fa70ff06931b089065d Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 03:02:40 +0800
Subject: [PATCH 171/460] optimize some display
---
install_update.sh | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index daff578..46903f1 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -26,8 +26,8 @@ service_file_web="/etc/systemd/system/mcsm-web.service"
# Service file for MCSM daemon
service_file_daemon="/etc/systemd/system/mcsm-daemon.service"
# Default systemd user is 'mcsm'
-USER="mcsm"
-COMMAND="all"
+USER=""
+COMMAND=""
# Created backup absolute path
backup_path=""
# Downloaded package name
@@ -197,6 +197,12 @@ Initialize() {
# Check and download MCSM source
Check_and_download_source
+ # Parse input arguments
+ Parse_Arguments
+
+ echo "$USER"
+ echo "$COMMAND"
+ exit 1
# Create mcsm user if needed
if [[ "$USER" == *"mcsm"* ]]; then
# Create the user 'mcsm' if it doesn't already exist
@@ -427,7 +433,7 @@ Parse_Arguments() {
case ${opt} in
u )
if [[ "${OPTARG}" == "mcsm" || "${OPTARG}" == "root" ]]; then
- user="${OPTARG}"
+ USER="${OPTARG}"
else
echo "Invalid user specified."
usage
@@ -435,7 +441,7 @@ Parse_Arguments() {
;;
c )
if [[ "${OPTARG}" == "web" || "${OPTARG}" == "daemon" || "${OPTARG}" == "all" ]]; then
- command="${OPTARG}"
+ COMMAND="${OPTARG}"
else
echo "Invalid command specified."
usage
@@ -477,11 +483,13 @@ Install_Update() {
}
# Finalize installation
Finalize() {
+ #Clear screen
+ #clear
printf "\n\n\n\n"
case "$COMMAND" in
all)
echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
echo_yellow " "
echo_cyan_n "HTTP Web Service: "
echo_yellow "http://:23333 (Browser)"
@@ -500,7 +508,7 @@ Finalize() {
web)
echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
echo_yellow " "
echo_cyan_n "HTTP Web Service: "
echo_yellow "http://:23333 (Browser)"
@@ -517,7 +525,7 @@ Finalize() {
daemon)
echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
echo_yellow " "
echo_cyan_n "Daemon Address: "
echo_yellow "ws://:24444 (Cluster)"
@@ -540,8 +548,11 @@ Finalize() {
esac
# Check if backup_path is not empty
if [[ -n "$backup_path" ]]; then
- echo "Your MCSM has been updated and/or installed. A complete backup was created at: $backup_path"
- echo "You can manually delete the backup using command: rm ${backup_path}"
+ echo_green "Your MCSM has been updated from a previous installation. "
+ echo_green "A complete backup was created at:"
+ echo_yellow "$backup_path"
+ echo_green "You can manually delete the backup using command: "
+ echo_red "rm ${backup_path}"
fi
# Move quickstart.md
mv "${mcsm_down_temp}/quick-start.md" "${mcsmanager_install_path}/quick-start.md"
From e0533886f07dcc74df2f3d877fd641f0a8512050 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 03:10:28 +0800
Subject: [PATCH 172/460] fix user selection and components selection
---
install_update.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 46903f1..086a44c 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -26,8 +26,8 @@ service_file_web="/etc/systemd/system/mcsm-web.service"
# Service file for MCSM daemon
service_file_daemon="/etc/systemd/system/mcsm-daemon.service"
# Default systemd user is 'mcsm'
-USER=""
-COMMAND=""
+USER="mcsm"
+COMMAND="all"
# Created backup absolute path
backup_path=""
# Downloaded package name
@@ -198,11 +198,11 @@ Initialize() {
Check_and_download_source
# Parse input arguments
- Parse_Arguments
+ Parse_Arguments "$@"
echo "$USER"
echo "$COMMAND"
- exit 1
+
# Create mcsm user if needed
if [[ "$USER" == *"mcsm"* ]]; then
# Create the user 'mcsm' if it doesn't already exist
@@ -563,7 +563,7 @@ Finalize() {
}
########### Main Logic ################
main() {
- Initialize
+ Initialize "$@"
# Check if the mcsmanager_install_path exists
if [ -d "$mcsmanager_install_path" ]; then
# Backup first
@@ -585,4 +585,4 @@ main() {
echo "Installation Complete!"
}
-main
\ No newline at end of file
+main "$@"
\ No newline at end of file
From 053dd193fd3ff0968fb30c8dbf6501bcf589184b Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 03:11:31 +0800
Subject: [PATCH 173/460] remove debugging info
---
install_update.sh | 3 ---
1 file changed, 3 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 086a44c..8102736 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -199,9 +199,6 @@ Initialize() {
# Parse input arguments
Parse_Arguments "$@"
-
- echo "$USER"
- echo "$COMMAND"
# Create mcsm user if needed
if [[ "$USER" == *"mcsm"* ]]; then
From 065cd8be4efaf58b8fcbb7b167b987bf9f5b0f38 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 03:22:53 +0800
Subject: [PATCH 174/460] suppress mv cmd when not updating
---
install_update.sh | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 8102736..540b418 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -188,9 +188,6 @@ Initialize() {
# Check if install base (/opt) exist
mkdir -p "$install_base"
- # Create mcsmanager path if not already
- mkdir -p "$mcsmanager_install_path"
-
# Check dependencies
Install_dependencies
@@ -249,12 +246,14 @@ Backup_MCSM() {
# Assuming a fresh install (i.e. no file(s) from previous installation) and downloaded source
Install_MCSM_Web_Base() {
# Move downloaded path
- mv "${mcsm_down_temp}/${mcsm_web}" "$web_path"
+ mv "${mcsm_down_temp}/${mcsm_web}" "$web_path" ||
# Move helper file(s)
mv "${mcsm_down_temp}/start-web.sh" "${mcsmanager_install_path}/start-web.sh"
- # Move back the data directory
- rm -rf "$web_data"
- mv "${web_data_tmp}" "${web_data}"
+ # Move back the data directory only if existed
+ if [ -d "$web_data_tmp" ]; then
+ rm -rf "$web_data"
+ mv "${web_data_tmp}" "${web_data}"
+ fi
# Dependencies install
cd "${web_path}" || Red_Error "[x] Failed to enter ${web_path}"
# Install dependencies
@@ -339,13 +338,15 @@ Install_Web_Wrapper() {
# Assuming a fresh install (i.e. no file(s) from previous installation) and downloaded source
Install_MCSM_Daemon_Base() {
# Move downloaded path
- mv "${mcsm_down_temp}/${mcsm_daemon}" "$daemon_path"
- # Move helper file(s)
+ mv "${mcsm_down_temp}/${mcsm_daemon}" "$daemon_path" ||
+ # Move helper file(s)
mv "${mcsm_down_temp}/start-daemon.sh" "${mcsmanager_install_path}/start-daemon.sh"
- # Move back the data directory
- rm -rf "$daemon_data"
- mv "${daemon_data_tmp}" "${daemon_data}"
+ # Move back the data directory only if existed
+ if [ -d "$daemon_data_tmp" ]; then
+ rm -rf "$daemon_data"
+ mv "${daemon_data_tmp}" "${daemon_data}"
+ fi
# Dependencies install
cd "${daemon_path}" || Red_Error "[x] Failed to enter ${daemon_path}"
# Install dependencies
@@ -560,6 +561,7 @@ Finalize() {
}
########### Main Logic ################
main() {
+ # Do not create mcsmanager path yet as it will break the logic detecting existing installation
Initialize "$@"
# Check if the mcsmanager_install_path exists
if [ -d "$mcsmanager_install_path" ]; then
@@ -569,6 +571,8 @@ main() {
Install_node
else
+ # Create mcsmanager path if not already
+ mkdir -p "$mcsmanager_install_path"
# Install Node.js, this is to ensure the version is up to date.
Install_node
fi
From 55c511b9c82353c47d980194128eda246b2a17a4 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 03:36:25 +0800
Subject: [PATCH 175/460] optimize display
---
install_update.sh | 12 ++++++------
setup.sh | 8 ++++++--
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 540b418..20997cd 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -140,7 +140,7 @@ Check_and_download_source() {
mkdir -p "$mcsm_down_temp"
# Download the archive directly into the temporary directory
- wget -O "${mcsm_down_temp}/${package_name}" "$mcsmanager_download_addr"
+ wget -O "${mcsm_down_temp}/${package_name}" "$mcsmanager_download_addr" || Red_Error "[x] Failed to download MCSManager releases..."
if [ $? -ne 0 ]; then
Red_Error "MCSManager Download failed."
fi
@@ -202,9 +202,9 @@ Initialize() {
# Create the user 'mcsm' if it doesn't already exist
if ! id "mcsm" &>/dev/null; then
/usr/sbin/useradd mcsm
- echo "User 'mcsm' created."
+ echo_green "User 'mcsm' created."
else
- echo "User 'mcsm' already exists."
+ echo_yellow "User 'mcsm' already exists."
fi
fi
}
@@ -222,7 +222,7 @@ Backup_MCSM() {
# Create backup directory (/opt) if it doesn't exist
if [ ! -d "$mcsm_backup_dir" ]; then
- echo "Creating backup directory."
+ echo_yellow "Creating backup directory."
mkdir -p "$mcsm_backup_dir"
fi
@@ -230,14 +230,14 @@ Backup_MCSM() {
backup_path="${mcsm_backup_dir}/mcsm_backup_${current_date}.tar.gz"
# Create the backup
- echo "Creating backup..."
+ echo_yellow "Creating backup..."
#tar -czf "$backup_path" -C "$mcsmanager_install_path" .
tar -czf "$backup_path" -C "$(dirname "$mcsmanager_install_path")" "$(basename "$mcsmanager_install_path")"
# Check if the backup was successful
if [ $? -eq 0 ]; then
- echo "Backup created successfully at $backup_path"
+ echo_green "Successfully created backup at $backup_path"
else
Red_Error "Error creating backup."
fi
diff --git a/setup.sh b/setup.sh
index 0f6eeff..308c3a3 100644
--- a/setup.sh
+++ b/setup.sh
@@ -19,7 +19,7 @@ echo_cyan() {
echo_red() {
printf '\033[1;31m%b\033[0m\n' "$@"
}
-
+vv
echo_green() {
printf '\033[1;32m%b\033[0m\n' "$@"
}
@@ -167,7 +167,11 @@ WantedBy=multi-user.target
echo_yellow "http://:23333 (Browser)"
echo_cyan_n "Daemon Address: "
echo_yellow "ws://:24444 (Cluster)"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_red "You must expose ports "
+ echo_yellow "23333"
+ echo_red " and "
+ echo_yellow "24444"
+ echo_red " to use the service properly on the Internet."
echo_yellow " "
echo_cyan "Usage:"
echo_cyan "systemctl start mcsm-{daemon,web}.service"
From f4cb8c155facacfaedac8484e6d8f0450ab9565c Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 03:37:00 +0800
Subject: [PATCH 176/460] reduce sleep time
---
install_update.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install_update.sh b/install_update.sh
index 20997cd..b8c5e11 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -131,7 +131,7 @@ Install_node() {
echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
echo_yellow "=============== Node.JS Version ==============="
echo
- sleep 3
+ sleep 1
}
# Check and download MCSM source
Check_and_download_source() {
From 13e9eff69637750f2c8ed00597a620d1aaf54150 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 03:43:46 +0800
Subject: [PATCH 177/460] add ASCII art
---
install_update.sh | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index b8c5e11..ad347f5 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -482,8 +482,15 @@ Install_Update() {
# Finalize installation
Finalize() {
#Clear screen
- #clear
- printf "\n\n\n\n"
+ clear
+ #printf "\n\n\n\n"
+ echo "______ _______________________ ___"
+ echo "___ |/ /_ ____/_ ___/__ |/ /_____ _____________ _______ _____________"
+ echo "__ /|_/ /_ / _____ \__ /|_/ /_ __ \`/_ __ \ __ \`/_ __ \`/ _ \_ ___/"
+ echo "_ / / / / /___ ____/ /_ / / / / /_/ /_ / / / /_/ /_ /_/ // __/ /"
+ echo "/_/ /_/ \____/ /____/ /_/ /_/ \__,_/ /_/ /_/\__,_/ _\__, / \___//_/"
+ echo " /____/"
+
case "$COMMAND" in
all)
echo_yellow "=================================================================="
From 9c113d06542747b649fed0fef90997410d86175f Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 03:44:34 +0800
Subject: [PATCH 178/460] add initial CN implementation
---
install_update_cn.sh | 596 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 596 insertions(+)
create mode 100644 install_update_cn.sh
diff --git a/install_update_cn.sh b/install_update_cn.sh
new file mode 100644
index 0000000..ad347f5
--- /dev/null
+++ b/install_update_cn.sh
@@ -0,0 +1,596 @@
+#!/bin/bash
+
+#Global varialbles
+# System architecture
+arch=$(uname -m)
+# Install base dir
+install_base="/opt"
+# MCSM install dir
+mcsmanager_install_path="${install_base}/mcsmanager"
+# MCSM backup dir during upgrade
+mcsm_backup_dir="${install_base}"
+# Download URL
+mcsmanager_download_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+# Node.js version to install
+node="v20.12.2"
+# MCSM Web dir name
+mcsm_web="web"
+# MCSM daemon dir name
+mcsm_daemon="daemon"
+# The date variable to be shared across functions
+current_date=$(date +%Y_%m_%d)
+# MCSM local temp dir for downloaded source
+mcsm_down_temp="/opt/mcsmanager_${current_date}"
+# Service file for MCSCM Web
+service_file_web="/etc/systemd/system/mcsm-web.service"
+# Service file for MCSM daemon
+service_file_daemon="/etc/systemd/system/mcsm-daemon.service"
+# Default systemd user is 'mcsm'
+USER="mcsm"
+COMMAND="all"
+# Created backup absolute path
+backup_path=""
+# Downloaded package name
+package_name="${mcsmanager_download_addr##*/}"
+# Node.js install dir
+node_install_path=""
+
+# Helper Functions
+usage() {
+ echo "Usage: $0 [-u user] [-c command]"
+ echo " -u Specify the user (mcsm or root), default is 'mcsm'"
+ echo " -c Specify the command (web, daemon, or all), default is 'all'"
+ exit 1
+}
+Red_Error() {
+ echo '================================================='
+ printf '\033[1;31;40m%b\033[0m\n' "$@"
+ echo '================================================='
+ exit 1
+}
+echo_cyan() {
+ printf '\033[1;36m%b\033[0m\n' "$@"
+}
+echo_red() {
+ printf '\033[1;31m%b\033[0m\n' "$@"
+}
+
+echo_green() {
+ printf '\033[1;32m%b\033[0m\n' "$@"
+}
+
+echo_cyan_n() {
+ printf '\033[1;36m%b\033[0m' "$@"
+}
+
+echo_yellow() {
+ printf '\033[1;33m%b\033[0m\n' "$@"
+}
+
+# Check root permission
+check_sudo() {
+ if [ "$EUID" -ne 0 ]; then
+ echo "This script must be run as root. Please use \"sudo or root user\" instead."
+ exit 1
+ fi
+}
+
+Install_dependencies() {
+ # Install related software
+ echo_cyan_n "[+] Installing dependent software (git, tar, wget)... "
+ if [[ -x "$(command -v yum)" ]]; then
+ yum install -y git tar wget
+ elif [[ -x "$(command -v apt-get)" ]]; then
+ apt-get install -y git tar wget
+ elif [[ -x "$(command -v pacman)" ]]; then
+ pacman -S --noconfirm git tar wget
+ elif [[ -x "$(command -v zypper)" ]]; then
+ zypper --non-interactive install git tar wget
+ else
+ echo_red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
+ fi
+
+ # Determine whether the relevant software is installed successfully
+ if [[ -x "$(command -v git)" && -x "$(command -v tar)" && -x "$(command -v wget)" ]]; then
+ echo_green "Success"
+ else
+ Red_Error "[x] Failed to find git, tar and wget, please install them manually!"
+ fi
+
+}
+
+Install_node() {
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
+ echo_green "Desired Node.js is already installed at the target dir, bypassing installation..."
+ else
+ echo_cyan_n "[+] Install Node.js environment...\n"
+
+ rm -irf "$node_install_path"
+
+ cd /opt || Red_Error "[x] Failed to enter /opt"
+
+ rm -rf "node-$node-linux-$arch.tar.gz"
+
+ wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
+
+ tar -zxf "node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to untar node"
+
+ rm -rf "node-$node-linux-$arch.tar.gz"
+
+ if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
+ echo_green "Success"
+ else
+ Red_Error "[x] Node installation failed!"
+ fi
+ fi
+
+
+ echo
+ echo_yellow "=============== Node.js Version ==============="
+ echo_yellow " node: $("$node_install_path"/bin/node -v)"
+ echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ echo_yellow "=============== Node.JS Version ==============="
+ echo
+ sleep 1
+}
+# Check and download MCSM source
+Check_and_download_source() {
+ # Empty the temp dir if existed
+ rm -rf "$mcsm_down_temp"
+ mkdir -p "$mcsm_down_temp"
+
+ # Download the archive directly into the temporary directory
+ wget -O "${mcsm_down_temp}/${package_name}" "$mcsmanager_download_addr" || Red_Error "[x] Failed to download MCSManager releases..."
+ if [ $? -ne 0 ]; then
+ Red_Error "MCSManager Download failed."
+ fi
+
+ # Extract the archive without changing directories
+ tar -xzf "${mcsm_down_temp}/${package_name}" -C "$mcsm_down_temp"
+ if [ $? -ne 0 ]; then
+ Red_Error "Extraction failed."
+ fi
+
+ # Clean up the downloaded tar.gz file
+ rm "${mcsm_down_temp}/${package_name}"
+}
+# Detect architecture
+Detect_Architecture() {
+ if [[ $arch == x86_64 ]]; then
+ arch="x64"
+ #echo "[-] x64 architecture detected"
+ elif [[ $arch == aarch64 ]]; then
+ arch="arm64"
+ #echo "[-] 64-bit ARM architecture detected"
+ elif [[ $arch == arm ]]; then
+ arch="armv7l"
+ #echo "[-] 32-bit ARM architecture detected"
+ elif [[ $arch == ppc64le ]]; then
+ arch="ppc64le"
+ #echo "[-] IBM POWER architecture detected"
+ elif [[ $arch == s390x ]]; then
+ arch="s390x"
+ #echo "[-] IBM LinuxONE architecture detected"
+ else
+ Red_Error "[x] Sorry, this architecture is not supported yet!\n[x]Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
+ fi
+
+ node_install_path="${install_base}/node-$node-linux-$arch"
+}
+# Initialization
+Initialize() {
+ # Check sudo
+ check_sudo
+
+ # Update architecture
+ Detect_Architecture
+
+ # Check if install base (/opt) exist
+ mkdir -p "$install_base"
+
+ # Check dependencies
+ Install_dependencies
+
+ # Check and download MCSM source
+ Check_and_download_source
+
+ # Parse input arguments
+ Parse_Arguments "$@"
+
+ # Create mcsm user if needed
+ if [[ "$USER" == *"mcsm"* ]]; then
+ # Create the user 'mcsm' if it doesn't already exist
+ if ! id "mcsm" &>/dev/null; then
+ /usr/sbin/useradd mcsm
+ echo_green "User 'mcsm' created."
+ else
+ echo_yellow "User 'mcsm' already exists."
+ fi
+ fi
+}
+
+Backup_MCSM() {
+ # Ensure both directories are provided
+ if [ -z "$mcsmanager_install_path" ] || [ -z "$mcsm_backup_dir" ]; then
+ Red_Error "Error: Backup or source path not set."
+ fi
+
+ # Check if the source directory exists
+ if [ ! -d "$mcsmanager_install_path" ]; then
+ Red_Error "Error: Source directory does not exist."
+ fi
+
+ # Create backup directory (/opt) if it doesn't exist
+ if [ ! -d "$mcsm_backup_dir" ]; then
+ echo_yellow "Creating backup directory."
+ mkdir -p "$mcsm_backup_dir"
+ fi
+
+ # Define the backup path
+ backup_path="${mcsm_backup_dir}/mcsm_backup_${current_date}.tar.gz"
+
+ # Create the backup
+ echo_yellow "Creating backup..."
+ #tar -czf "$backup_path" -C "$mcsmanager_install_path" .
+ tar -czf "$backup_path" -C "$(dirname "$mcsmanager_install_path")" "$(basename "$mcsmanager_install_path")"
+
+
+ # Check if the backup was successful
+ if [ $? -eq 0 ]; then
+ echo_green "Successfully created backup at $backup_path"
+ else
+ Red_Error "Error creating backup."
+ fi
+}
+# MCSM Web Base Installation
+# Assuming a fresh install (i.e. no file(s) from previous installation) and downloaded source
+Install_MCSM_Web_Base() {
+ # Move downloaded path
+ mv "${mcsm_down_temp}/${mcsm_web}" "$web_path" ||
+ # Move helper file(s)
+ mv "${mcsm_down_temp}/start-web.sh" "${mcsmanager_install_path}/start-web.sh"
+ # Move back the data directory only if existed
+ if [ -d "$web_data_tmp" ]; then
+ rm -rf "$web_data"
+ mv "${web_data_tmp}" "${web_data}"
+ fi
+ # Dependencies install
+ cd "${web_path}" || Red_Error "[x] Failed to enter ${web_path}"
+ # Install dependencies
+ echo_cyan "[+] Install MCSManager-Web dependencies..."
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${web_path}"
+ # Return to general dir
+ cd "$mcsmanager_install_path"
+ # Configure ownership if needed
+ if [[ "$USER" == *"mcsm"* ]]; then
+ # Change file permission to mcsm user
+ chown -R mcsm:mcsm "$web_path"
+ fi
+ chmod -R 755 "$web_path"
+}
+# MCSM Web Service Installation
+Install_Web_Systemd() {
+ echo_cyan "[+] Creating MCSManager Web service..."
+ # stop and disable existing service
+ systemctl disable --now mcsm-web
+
+ # delete existing service
+ rm -rf "$service_file_web"
+ systemctl daemon-reload
+
+ # Create the default service file
+ echo "[Unit]
+Description=MCSManager-Web
+
+[Service]
+WorkingDirectory=${web_path}
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s QUIT \$MAINPID
+ExecStop=/bin/kill -s QUIT \$MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" >"$service_file_web"
+
+ # Add user section if using mcsm user
+ if [[ "$USER" == *"mcsm"* ]]; then
+ # Check if the 'User=mcsm' line already exists in the service file
+ if grep -q "^User=mcsm$" "$service_file_web"; then
+ echo "The service file is configured already."
+ else
+ # Add 'User=mcsm' to the service file
+ sed -i '/^\[Service\]$/a User=mcsm' "$service_file_web"
+ fi
+ fi
+ # Reload Systemd Service
+ systemctl daemon-reload
+ systemctl enable --now mcsm-web
+}
+
+# MCSM Web Update & Installation
+Install_Web_Wrapper() {
+ web_path="${mcsmanager_install_path}/${mcsm_web}"
+ web_data="${web_path}/data"
+ web_data_tmp="${mcsmanager_install_path}/web_data_${current_date}"
+ if [ -d "$web_path" ]; then
+ echo_cyan "[+] Updating MCSManager Web..."
+ # The backup should be created already, moving the DATA dir to /opt/mcsmanager/web_data should be fast and safe.
+ # Use web_data, do not use data as in rare circumstance user may run both update at the same time.
+ # Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
+ mv "$web_data" "$web_data_tmp"
+ # Remove the old web dir
+ rm -rf "$web_path"
+
+ else
+ echo_cyan "[+] Install MCSManager Web..."
+ fi
+
+
+ # Install MCSM Web
+ Install_MCSM_Web_Base
+
+ # Install MCSM Web Service
+ Install_Web_Systemd
+}
+
+# MCSM Daemon Base Installation
+# Assuming a fresh install (i.e. no file(s) from previous installation) and downloaded source
+Install_MCSM_Daemon_Base() {
+ # Move downloaded path
+ mv "${mcsm_down_temp}/${mcsm_daemon}" "$daemon_path" ||
+ # Move helper file(s)
+ mv "${mcsm_down_temp}/start-daemon.sh" "${mcsmanager_install_path}/start-daemon.sh"
+
+ # Move back the data directory only if existed
+ if [ -d "$daemon_data_tmp" ]; then
+ rm -rf "$daemon_data"
+ mv "${daemon_data_tmp}" "${daemon_data}"
+ fi
+ # Dependencies install
+ cd "${daemon_path}" || Red_Error "[x] Failed to enter ${daemon_path}"
+ # Install dependencies
+ echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${daemon_path}"
+ # Return to general dir
+ cd "$mcsmanager_install_path"
+ # Configure ownership if needed
+ if [[ "$USER" == *"mcsm"* ]]; then
+ # Change file permission to mcsm user
+ chown -R mcsm:mcsm "$daemon_path"
+ fi
+ chmod -R 755 "$daemon_path"
+}
+
+# MCSM Daemon Service Installation
+Install_Daemon_Systemd() {
+ echo_cyan "[+] Creating MCSManager Daemon service..."
+ # stop and disable existing service
+ systemctl disable --now mcsm-daemon
+
+ # delete existing service
+ rm -rf "$service_file_daemon"
+ systemctl daemon-reload
+
+ # Create the default service file
+ echo "[Unit]
+Description=MCSManager-Daemon
+
+[Service]
+WorkingDirectory=${daemon_path}
+ExecStart=${node_install_path}/bin/node app.js
+ExecReload=/bin/kill -s QUIT \$MAINPID
+ExecStop=/bin/kill -s QUIT \$MAINPID
+Environment=\"PATH=${PATH}\"
+
+[Install]
+WantedBy=multi-user.target
+" >"$service_file_daemon"
+
+ # Add user section if using mcsm user
+ if [[ "$USER" == *"mcsm"* ]]; then
+ # Check if the 'User=mcsm' line already exists in the service file
+ if grep -q "^User=mcsm$" "$service_file_daemon"; then
+ echo "The service file is configured already."
+ else
+ # Add 'User=mcsm' to the service file
+ sed -i '/^\[Service\]$/a User=mcsm' "$service_file_daemon"
+ fi
+ fi
+ # Reload Systemd Service
+ systemctl daemon-reload
+ systemctl enable --now mcsm-daemon
+}
+# MCSM Web Update & Installation
+Install_Daemon_Wrapper() {
+ daemon_path="${mcsmanager_install_path}/${mcsm_daemon}"
+ daemon_data="${daemon_path}/data"
+ daemon_data_tmp="${mcsmanager_install_path}/daemon_data_${current_date}"
+ if [ -d "$daemon_path" ]; then
+ echo_cyan "[+] Updating MCSManager Daemon..."
+ # The backup should be created already, moving the DATA dir to /opt/mcsmanager/daemon_data should be fast and safe.
+ # Use daemon_data, do not use data as in rare circumstance user may run both update at the same time.
+ # Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
+ mv "$daemon_data" "$daemon_data_tmp"
+ # Remove the old daemon dir
+ rm -rf "$daemon_path"
+
+ else
+ echo_cyan "[+] Install MCSManager daemon..."
+ fi
+
+ # Install MCSM Web
+ Install_MCSM_Daemon_Base
+
+ # Install MCSM Web Service
+ Install_Daemon_Systemd
+}
+# Arguments parsing
+Parse_Arguments() {
+ while getopts "u:c:" opt; do
+ case ${opt} in
+ u )
+ if [[ "${OPTARG}" == "mcsm" || "${OPTARG}" == "root" ]]; then
+ USER="${OPTARG}"
+ else
+ echo "Invalid user specified."
+ usage
+ fi
+ ;;
+ c )
+ if [[ "${OPTARG}" == "web" || "${OPTARG}" == "daemon" || "${OPTARG}" == "all" ]]; then
+ COMMAND="${OPTARG}"
+ else
+ echo "Invalid command specified."
+ usage
+ fi
+ ;;
+ \? )
+ usage
+ ;;
+ : )
+ echo "Option -$OPTARG requires an argument."
+ usage
+ ;;
+ esac
+ done
+}
+
+# Wrapper for installation
+Install_Update() {
+ case "$COMMAND" in
+ all)
+ Install_Web_Wrapper
+ Install_Daemon_Wrapper
+ ;;
+
+ web)
+ Install_Web_Wrapper
+ ;;
+
+ daemon)
+ Install_Daemon_Wrapper
+ ;;
+
+ *)
+ echo "Unknown command: $COMMAND, this should not happen in general :( Please report this bug."
+ # Exit with an error if COMMAND is unrecognized
+ exit 1
+ ;;
+ esac
+}
+# Finalize installation
+Finalize() {
+ #Clear screen
+ clear
+ #printf "\n\n\n\n"
+ echo "______ _______________________ ___"
+ echo "___ |/ /_ ____/_ ___/__ |/ /_____ _____________ _______ _____________"
+ echo "__ /|_/ /_ / _____ \__ /|_/ /_ __ \`/_ __ \ __ \`/_ __ \`/ _ \_ ___/"
+ echo "_ / / / / /___ ____/ /_ / / / / /_/ /_ / / / /_/ /_ /_/ // __/ /"
+ echo "/_/ /_/ \____/ /____/ /_/ /_/ \__,_/ /_/ /_/\__,_/ _\__, / \___//_/"
+ echo " /____/"
+
+ case "$COMMAND" in
+ all)
+ echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
+ echo_yellow " "
+ echo_cyan_n "HTTP Web Service: "
+ echo_yellow "http://:23333 (Browser)"
+ echo_cyan_n "Daemon Address: "
+ echo_yellow "ws://:24444 (Cluster)"
+ echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+ ;;
+
+ web)
+ echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
+ echo_yellow " "
+ echo_cyan_n "HTTP Web Service: "
+ echo_yellow "http://:23333 (Browser)"
+ echo_red "You must expose port 23333 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-web.service"
+ echo_cyan "systemctl stop mcsm-web.service"
+ echo_cyan "systemctl restart mcsm-web.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+ ;;
+
+ daemon)
+ echo_yellow "=================================================================="
+ echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
+ echo_yellow " "
+ echo_cyan_n "Daemon Address: "
+ echo_yellow "ws://:24444 (Cluster)"
+ echo_red "You must expose port 24444 to use the service properly on the Internet."
+ echo_yellow " "
+ echo_cyan "Usage:"
+ echo_cyan "systemctl start mcsm-daemon.service"
+ echo_cyan "systemctl stop mcsm-daemon.service"
+ echo_cyan "systemctl restart mcsm-daemon.service"
+ echo_yellow " "
+ echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_yellow "=================================================================="
+ ;;
+
+ *)
+ echo "Unknown command: $COMMAND, this should not happen in general :( Please report this bug."
+ # Exit with an error if COMMAND is unrecognized
+ exit 1
+ ;;
+ esac
+ # Check if backup_path is not empty
+ if [[ -n "$backup_path" ]]; then
+ echo_green "Your MCSM has been updated from a previous installation. "
+ echo_green "A complete backup was created at:"
+ echo_yellow "$backup_path"
+ echo_green "You can manually delete the backup using command: "
+ echo_red "rm ${backup_path}"
+ fi
+ # Move quickstart.md
+ mv "${mcsm_down_temp}/quick-start.md" "${mcsmanager_install_path}/quick-start.md"
+ # Remove the temp folder
+ rm -rf "${mcsm_down_temp}"
+
+
+}
+########### Main Logic ################
+main() {
+ # Do not create mcsmanager path yet as it will break the logic detecting existing installation
+ Initialize "$@"
+ # Check if the mcsmanager_install_path exists
+ if [ -d "$mcsmanager_install_path" ]; then
+ # Backup first
+ Backup_MCSM
+ # Install Node.js, this is to ensure the version is up to date.
+ Install_node
+
+ else
+ # Create mcsmanager path if not already
+ mkdir -p "$mcsmanager_install_path"
+ # Install Node.js, this is to ensure the version is up to date.
+ Install_node
+ fi
+
+ # Install Services based on command
+ Install_Update
+
+ # Print helping Information
+ Finalize
+
+ echo "Installation Complete!"
+}
+
+main "$@"
\ No newline at end of file
From c754062b681f016f6e5642c94c7a006276a3517f Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 03:50:00 +0800
Subject: [PATCH 179/460] optimizing text styles
---
install_update.sh | 7 ++++++-
install_update_cn.sh | 12 ++++++++----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index ad347f5..3a3e94c 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -77,7 +77,7 @@ check_sudo() {
Install_dependencies() {
# Install related software
- echo_cyan_n "[+] Installing dependent software (git, tar, wget)... "
+ echo_cyan "[+] Installing dependent software (git, tar, wget)... "
if [[ -x "$(command -v yum)" ]]; then
yum install -y git tar wget
elif [[ -x "$(command -v apt-get)" ]]; then
@@ -179,6 +179,11 @@ Detect_Architecture() {
}
# Initialization
Initialize() {
+ echo_cyan "+----------------------------------------------------------------------
+| MCSManager V10 Installation & Upgrading Script
++----------------------------------------------------------------------
+ "
+
# Check sudo
check_sudo
diff --git a/install_update_cn.sh b/install_update_cn.sh
index ad347f5..28d3236 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -12,7 +12,7 @@ mcsm_backup_dir="${install_base}"
# Download URL
mcsmanager_download_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
# Node.js version to install
-node="v20.12.2"
+node="v16.20.2"
# MCSM Web dir name
mcsm_web="web"
# MCSM daemon dir name
@@ -77,7 +77,7 @@ check_sudo() {
Install_dependencies() {
# Install related software
- echo_cyan_n "[+] Installing dependent software (git, tar, wget)... "
+ echo_cyan "[+] Installing dependent software (git, tar, wget)... "
if [[ -x "$(command -v yum)" ]]; then
yum install -y git tar wget
elif [[ -x "$(command -v apt-get)" ]]; then
@@ -179,6 +179,10 @@ Detect_Architecture() {
}
# Initialization
Initialize() {
+ echo_cyan "+----------------------------------------------------------------------
+| MCSManager V10安装升级脚本
++----------------------------------------------------------------------
+ "
# Check sudo
check_sudo
@@ -482,7 +486,7 @@ Install_Update() {
# Finalize installation
Finalize() {
#Clear screen
- clear
+ #clear
#printf "\n\n\n\n"
echo "______ _______________________ ___"
echo "___ |/ /_ ____/_ ___/__ |/ /_____ _____________ _______ _____________"
@@ -494,7 +498,7 @@ Finalize() {
case "$COMMAND" in
all)
echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
+ echo_green "安装已完成! 欢迎使用 MCSManager V10!!!"
echo_yellow " "
echo_cyan_n "HTTP Web Service: "
echo_yellow "http://:23333 (Browser)"
From 008b50239d0d0761e2e2d3c79fefe2f4131e5158 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 03:54:00 +0800
Subject: [PATCH 180/460] add cn translation
---
install_update_cn.sh | 64 ++++++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/install_update_cn.sh b/install_update_cn.sh
index 28d3236..794a501 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -500,52 +500,52 @@ Finalize() {
echo_yellow "=================================================================="
echo_green "安装已完成! 欢迎使用 MCSManager V10!!!"
echo_yellow " "
- echo_cyan_n "HTTP Web Service: "
- echo_yellow "http://:23333 (Browser)"
- echo_cyan_n "Daemon Address: "
- echo_yellow "ws://:24444 (Cluster)"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_cyan_n "网页 服务: "
+ echo_yellow "http://<您的 IP>:23333 (Browser)"
+ echo_cyan_n "节点 地址: "
+ echo_yellow "ws://<您的 IP>:24444 (Cluster)"
+ echo_red "您必须开放 23333 与 24444 端口才可以正常从公网访问"
echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
+ echo_cyan "使用方法:"
+ echo_cyan "启动: systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "关闭: systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "重启: systemctl restart mcsm-{daemon,web}.service"
echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_green "官方文档: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
;;
web)
echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
+ echo_green "安装已完成! 欢迎使用 MCSManager V10!!!"
echo_yellow " "
- echo_cyan_n "HTTP Web Service: "
- echo_yellow "http://:23333 (Browser)"
- echo_red "You must expose port 23333 to use the service properly on the Internet."
+ echo_cyan_n "网页 服务: "
+ echo_yellow "http://<您的 IP>:23333 (Browser)"
+ echo_red "您必须开放 23333 端口才可以正常从公网访问"
echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-web.service"
- echo_cyan "systemctl stop mcsm-web.service"
- echo_cyan "systemctl restart mcsm-web.service"
+ echo_cyan "使用方法:"
+ echo_cyan "启动: systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "关闭: systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "重启: systemctl restart mcsm-{daemon,web}.service"
echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_green "官方文档: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
;;
daemon)
echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
+ echo_green "安装已完成! 欢迎使用 MCSManager V10!!!"
echo_yellow " "
- echo_cyan_n "Daemon Address: "
- echo_yellow "ws://:24444 (Cluster)"
- echo_red "You must expose port 24444 to use the service properly on the Internet."
+ echo_cyan_n "节点 地址: "
+ echo_yellow "ws://<您的 IP>:24444 (Cluster)"
+ echo_red "您必须开放 24444 端口才可以正常从公网访问"
echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-daemon.service"
- echo_cyan "systemctl stop mcsm-daemon.service"
- echo_cyan "systemctl restart mcsm-daemon.service"
+ echo_cyan "使用方法:"
+ echo_cyan "启动: systemctl start mcsm-{daemon,web}.service"
+ echo_cyan "关闭: systemctl stop mcsm-{daemon,web}.service"
+ echo_cyan "重启: systemctl restart mcsm-{daemon,web}.service"
echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_green "官方文档: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
;;
@@ -557,10 +557,10 @@ Finalize() {
esac
# Check if backup_path is not empty
if [[ -n "$backup_path" ]]; then
- echo_green "Your MCSM has been updated from a previous installation. "
- echo_green "A complete backup was created at:"
+ echo_green "您的MCSManager是从上一个版本升级而来. "
+ echo_green "我们已经为您创建了一个备份, 位于:"
echo_yellow "$backup_path"
- echo_green "You can manually delete the backup using command: "
+ echo_green "如果需要, 您可以使用下列命令手动删除备份: "
echo_red "rm ${backup_path}"
fi
# Move quickstart.md
@@ -594,7 +594,7 @@ main() {
# Print helping Information
Finalize
- echo "Installation Complete!"
+ echo "安装或升级已完成!"
}
main "$@"
\ No newline at end of file
From f5bc278b0fc265d68df2ead8957b0e882383e478 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 03:54:33 +0800
Subject: [PATCH 181/460] optimize text style
---
install_update.sh | 2 +-
install_update_cn.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 3a3e94c..a92cd09 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -595,7 +595,7 @@ main() {
# Print helping Information
Finalize
- echo "Installation Complete!"
+ echo_green "Installation/Upgrading Complete!"
}
main "$@"
\ No newline at end of file
diff --git a/install_update_cn.sh b/install_update_cn.sh
index 794a501..ff1add3 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -594,7 +594,7 @@ main() {
# Print helping Information
Finalize
- echo "安装或升级已完成!"
+ echo_green "安装或升级已完成!"
}
main "$@"
\ No newline at end of file
From 856ac0afa2726b7bff265cd209ab5460531b10ac Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 04:01:25 +0800
Subject: [PATCH 182/460] cn localization
---
install_update_cn.sh | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/install_update_cn.sh b/install_update_cn.sh
index ff1add3..66ee6e5 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -38,8 +38,8 @@ node_install_path=""
# Helper Functions
usage() {
echo "Usage: $0 [-u user] [-c command]"
- echo " -u Specify the user (mcsm or root), default is 'mcsm'"
- echo " -c Specify the command (web, daemon, or all), default is 'all'"
+ echo " -u 指定用户安装 (mcsm 或 root), 默认是 'mcsm'"
+ echo " -c 安装指定组件 (web, daemon, 或 all), 默认是 'all'"
exit 1
}
Red_Error() {
@@ -92,7 +92,7 @@ Install_dependencies() {
# Determine whether the relevant software is installed successfully
if [[ -x "$(command -v git)" && -x "$(command -v tar)" && -x "$(command -v wget)" ]]; then
- echo_green "Success"
+ echo_green "成功!"
else
Red_Error "[x] Failed to find git, tar and wget, please install them manually!"
fi
@@ -101,9 +101,9 @@ Install_dependencies() {
Install_node() {
if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
- echo_green "Desired Node.js is already installed at the target dir, bypassing installation..."
+ echo_green "检测到已安装的Node.js版本, 已为您跳过安装."
else
- echo_cyan_n "[+] Install Node.js environment...\n"
+ echo_cyan_n "[+] 安装 Node.js 环境中...\n"
rm -irf "$node_install_path"
@@ -206,9 +206,9 @@ Initialize() {
# Create the user 'mcsm' if it doesn't already exist
if ! id "mcsm" &>/dev/null; then
/usr/sbin/useradd mcsm
- echo_green "User 'mcsm' created."
+ echo_green "用户 'mcsm' 已创建."
else
- echo_yellow "User 'mcsm' already exists."
+ echo_yellow "用户 'mcsm' 已经存在."
fi
fi
}
@@ -216,17 +216,17 @@ Initialize() {
Backup_MCSM() {
# Ensure both directories are provided
if [ -z "$mcsmanager_install_path" ] || [ -z "$mcsm_backup_dir" ]; then
- Red_Error "Error: Backup or source path not set."
+ Red_Error "错误: 备份或源路径为空."
fi
# Check if the source directory exists
if [ ! -d "$mcsmanager_install_path" ]; then
- Red_Error "Error: Source directory does not exist."
+ Red_Error "错误: 源目录不存在."
fi
# Create backup directory (/opt) if it doesn't exist
if [ ! -d "$mcsm_backup_dir" ]; then
- echo_yellow "Creating backup directory."
+ echo_yellow "正在创建备份目录..."
mkdir -p "$mcsm_backup_dir"
fi
@@ -234,16 +234,16 @@ Backup_MCSM() {
backup_path="${mcsm_backup_dir}/mcsm_backup_${current_date}.tar.gz"
# Create the backup
- echo_yellow "Creating backup..."
+ echo_yellow "正在创建备份..."
#tar -czf "$backup_path" -C "$mcsmanager_install_path" .
tar -czf "$backup_path" -C "$(dirname "$mcsmanager_install_path")" "$(basename "$mcsmanager_install_path")"
# Check if the backup was successful
if [ $? -eq 0 ]; then
- echo_green "Successfully created backup at $backup_path"
+ echo_green "成功创建了备份,位于: $backup_path"
else
- Red_Error "Error creating backup."
+ Red_Error "创建备份时出错"
fi
}
# MCSM Web Base Installation
@@ -261,8 +261,8 @@ Install_MCSM_Web_Base() {
# Dependencies install
cd "${web_path}" || Red_Error "[x] Failed to enter ${web_path}"
# Install dependencies
- echo_cyan "[+] Install MCSManager-Web dependencies..."
- env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${web_path}"
+ echo_cyan "[+] 安装 MCSManager 网页 依赖中..."
+ env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] 在 ${web_path} 安装依赖时出错."
# Return to general dir
cd "$mcsmanager_install_path"
# Configure ownership if needed
@@ -274,7 +274,7 @@ Install_MCSM_Web_Base() {
}
# MCSM Web Service Installation
Install_Web_Systemd() {
- echo_cyan "[+] Creating MCSManager Web service..."
+ echo_cyan "[+] 创建 MCSManager 网页服务中..."
# stop and disable existing service
systemctl disable --now mcsm-web
@@ -318,7 +318,7 @@ Install_Web_Wrapper() {
web_data="${web_path}/data"
web_data_tmp="${mcsmanager_install_path}/web_data_${current_date}"
if [ -d "$web_path" ]; then
- echo_cyan "[+] Updating MCSManager Web..."
+ echo_cyan "[+] 升级 MCSManager 网页端中..."
# The backup should be created already, moving the DATA dir to /opt/mcsmanager/web_data should be fast and safe.
# Use web_data, do not use data as in rare circumstance user may run both update at the same time.
# Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
@@ -327,7 +327,7 @@ Install_Web_Wrapper() {
rm -rf "$web_path"
else
- echo_cyan "[+] Install MCSManager Web..."
+ echo_cyan "[+] 安装 MCSManager 网页端中..."
fi
@@ -354,7 +354,7 @@ Install_MCSM_Daemon_Base() {
# Dependencies install
cd "${daemon_path}" || Red_Error "[x] Failed to enter ${daemon_path}"
# Install dependencies
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ echo_cyan "[+] 安装 MCSManager 节点依赖中..."
env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${daemon_path}"
# Return to general dir
cd "$mcsmanager_install_path"
@@ -368,7 +368,7 @@ Install_MCSM_Daemon_Base() {
# MCSM Daemon Service Installation
Install_Daemon_Systemd() {
- echo_cyan "[+] Creating MCSManager Daemon service..."
+ echo_cyan "[+] 创建 MCSManager 节点服务中..."
# stop and disable existing service
systemctl disable --now mcsm-daemon
@@ -411,7 +411,7 @@ Install_Daemon_Wrapper() {
daemon_data="${daemon_path}/data"
daemon_data_tmp="${mcsmanager_install_path}/daemon_data_${current_date}"
if [ -d "$daemon_path" ]; then
- echo_cyan "[+] Updating MCSManager Daemon..."
+ echo_cyan "[+] 升级 MCSManager 节点中..."
# The backup should be created already, moving the DATA dir to /opt/mcsmanager/daemon_data should be fast and safe.
# Use daemon_data, do not use data as in rare circumstance user may run both update at the same time.
# Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
@@ -420,7 +420,7 @@ Install_Daemon_Wrapper() {
rm -rf "$daemon_path"
else
- echo_cyan "[+] Install MCSManager daemon..."
+ echo_cyan "[+] 安装 MCSManager 节点中..."
fi
# Install MCSM Web
From 36a3f3704b63c08496ba1d92d9ceec7f8a27531e Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 04:02:37 +0800
Subject: [PATCH 183/460] optimize cn text
---
install_update_cn.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/install_update_cn.sh b/install_update_cn.sh
index 66ee6e5..73bee7d 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -77,7 +77,7 @@ check_sudo() {
Install_dependencies() {
# Install related software
- echo_cyan "[+] Installing dependent software (git, tar, wget)... "
+ echo_cyan "[+] 正在安装以来软件 (git, tar, wget)... "
if [[ -x "$(command -v yum)" ]]; then
yum install -y git tar wget
elif [[ -x "$(command -v apt-get)" ]]; then
@@ -557,7 +557,7 @@ Finalize() {
esac
# Check if backup_path is not empty
if [[ -n "$backup_path" ]]; then
- echo_green "您的MCSManager是从上一个版本升级而来. "
+ echo_green "您的MCSManager是由一个已存在的版本升级而来. "
echo_green "我们已经为您创建了一个备份, 位于:"
echo_yellow "$backup_path"
echo_green "如果需要, 您可以使用下列命令手动删除备份: "
From ff9a71e6a23324c34098312960b7c0f449726677 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 04:04:21 +0800
Subject: [PATCH 184/460] optimize cn text
---
install_update_cn.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/install_update_cn.sh b/install_update_cn.sh
index 73bee7d..60e64b6 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -77,7 +77,7 @@ check_sudo() {
Install_dependencies() {
# Install related software
- echo_cyan "[+] 正在安装以来软件 (git, tar, wget)... "
+ echo_cyan "[+] 正在安装依赖软件 (git, tar, wget)... "
if [[ -x "$(command -v yum)" ]]; then
yum install -y git tar wget
elif [[ -x "$(command -v apt-get)" ]]; then
@@ -126,10 +126,10 @@ Install_node() {
echo
- echo_yellow "=============== Node.js Version ==============="
+ echo_yellow "=============== Node.js 版本 ==============="
echo_yellow " node: $("$node_install_path"/bin/node -v)"
echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node.JS Version ==============="
+ echo_yellow "=============== Node.js 版本 ==============="
echo
sleep 1
}
From c3ac0771da79f92d2bd9e7742e0c4a6d6cd4bc3f Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 04:04:39 +0800
Subject: [PATCH 185/460] optimized text
---
install_update.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install_update.sh b/install_update.sh
index a92cd09..5ef103e 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -129,7 +129,7 @@ Install_node() {
echo_yellow "=============== Node.js Version ==============="
echo_yellow " node: $("$node_install_path"/bin/node -v)"
echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node.JS Version ==============="
+ echo_yellow "=============== Node.js Version ==============="
echo
sleep 1
}
From b96deae51c0c44b76bfb01a46d51a06b70172e67 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 04:06:18 +0800
Subject: [PATCH 186/460] wipe screen once installed
---
install_update_cn.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install_update_cn.sh b/install_update_cn.sh
index 60e64b6..2b5c4db 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -486,7 +486,7 @@ Install_Update() {
# Finalize installation
Finalize() {
#Clear screen
- #clear
+ clear
#printf "\n\n\n\n"
echo "______ _______________________ ___"
echo "___ |/ /_ ____/_ ___/__ |/ /_____ _____________ _______ _____________"
From d4f7c77fa27ae7515d2fb818a6084f05bd07c0b5 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 04:19:12 +0800
Subject: [PATCH 187/460] use github link for latest release
---
install_update.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install_update.sh b/install_update.sh
index 5ef103e..4bec48a 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -10,7 +10,7 @@ mcsmanager_install_path="${install_base}/mcsmanager"
# MCSM backup dir during upgrade
mcsm_backup_dir="${install_base}"
# Download URL
-mcsmanager_download_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+mcsmanager_download_addr="https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz "
# Node.js version to install
node="v20.12.2"
# MCSM Web dir name
From 3ff580dda564cdd7b798649bbb02b3165dc7092e Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 13:10:14 +0800
Subject: [PATCH 188/460] remove typo
---
setup.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 308c3a3..1291155 100644
--- a/setup.sh
+++ b/setup.sh
@@ -19,7 +19,6 @@ echo_cyan() {
echo_red() {
printf '\033[1;31m%b\033[0m\n' "$@"
}
-vv
echo_green() {
printf '\033[1;32m%b\033[0m\n' "$@"
}
From 87eae296650a25d58d8370d99c2b10a103bc9171 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Mon, 6 May 2024 13:12:24 +0800
Subject: [PATCH 189/460] disable backup
---
install_update.sh | 4 ++--
install_update_cn.sh | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index 4bec48a..f4f11eb 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -577,8 +577,8 @@ main() {
Initialize "$@"
# Check if the mcsmanager_install_path exists
if [ -d "$mcsmanager_install_path" ]; then
- # Backup first
- Backup_MCSM
+ # Backup first, due to potential large file being archived, backup is disabled.
+ # Backup_MCSM
# Install Node.js, this is to ensure the version is up to date.
Install_node
diff --git a/install_update_cn.sh b/install_update_cn.sh
index 2b5c4db..a292ece 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -576,8 +576,8 @@ main() {
Initialize "$@"
# Check if the mcsmanager_install_path exists
if [ -d "$mcsmanager_install_path" ]; then
- # Backup first
- Backup_MCSM
+ # Backup first, due to potential large file being archived, backup is disabled.
+ # Backup_MCSM
# Install Node.js, this is to ensure the version is up to date.
Install_node
From fbfa9fecd94af7a001df0dc8d5cf9669f05fc25d Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Mon, 6 May 2024 14:15:22 +0800
Subject: [PATCH 190/460] Fix: https://github.com/MCSManager/Script/pull/28
---
setup.sh | 6 +++---
setup_cn.sh | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/setup.sh b/setup.sh
index 0f6eeff..87714b5 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,7 +1,7 @@
#!/bin/bash
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+mcsmanager_download_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
package_name="MCSManager-v10-linux.tar.gz"
node="v20.12.2"
arch=$(uname -m)
@@ -91,8 +91,8 @@ Install_MCSManager() {
# cd /opt/mcsmanager
cd "${mcsmanager_install_path}" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}"
- # donwload MCSManager release
- wget "${mcsmanager_donwload_addr}" || Red_Error "[x] Failed to download MCSManager"
+ # download MCSManager release
+ wget "${mcsmanager_download_addr}" || Red_Error "[x] Failed to download MCSManager"
tar -zxf ${package_name} -o || Red_Error "[x] Failed to untar ${package_name}"
rm -rf "${mcsmanager_install_path}/${package_name}"
diff --git a/setup_cn.sh b/setup_cn.sh
index a518aa6..8af40ec 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -1,7 +1,7 @@
#!/bin/bash
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_donwload_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+mcsmanager_download_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
package_name="MCSManager-v10-linux.tar.gz"
node="v16.20.2"
arch=$(uname -m)
@@ -91,8 +91,8 @@ Install_MCSManager() {
# cd /opt/mcsmanager
cd "${mcsmanager_install_path}" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}"
- # donwload MCSManager release
- wget "${mcsmanager_donwload_addr}" || Red_Error "[x] Failed to download MCSManager"
+ # download MCSManager release
+ wget "${mcsmanager_download_addr}" || Red_Error "[x] Failed to download MCSManager"
tar -zxf ${package_name} -o || Red_Error "[x] Failed to untar ${package_name}"
rm -rf "${mcsmanager_install_path}/${package_name}"
From 8738b986b8d406b1882e3316e78cc3d0e1ce7849 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 7 May 2024 11:45:17 +0800
Subject: [PATCH 191/460] Feat: add forge
---
templates.json | 120 ++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 108 insertions(+), 12 deletions(-)
diff --git a/templates.json b/templates.json
index 7a0fe9f..6c67663 100644
--- a/templates.json
+++ b/templates.json
@@ -11,6 +11,25 @@
}
],
"packages": [
+ {
+ "language": "en_us",
+ "description": "[Forge] Forge-1.19.2-43.3.13-installer.jar",
+ "title": "Forge 1.19.2-43.3.13",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.2-43.3.13/forge-1.19.2-43.3.13-installer.jar",
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.19.2-43.3.13-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "en_us",
"description": "[Paper] Recommendation for friends with multiple players, Fast setup.",
@@ -20,7 +39,14 @@
"size": "140MB",
"remark": "Paper Software",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.20.4.zip",
- "author": "mcsmanager.com"
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
},
{
"language": "en_us",
@@ -31,7 +57,14 @@
"size": "140MB",
"remark": "Paper Software",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.19.2.zip",
- "author": "mcsmanager.com"
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
},
{
"language": "en_us",
@@ -42,7 +75,14 @@
"size": "140MB",
"remark": "Paper Software",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.18.2.zip",
- "author": "mcsmanager.com"
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
},
{
@@ -56,7 +96,7 @@
"author": "alongw.cn",
"setupInfo": {
"type": "minecraft/java",
- "startCommand": "java -Xmx2048M -jar server.jar -nogui",
+ "startCommand": "java -jar server.jar -nogui",
"stopCommand": "stop",
"ie": "utf-8",
"oe": "utf-8"
@@ -71,7 +111,14 @@
"size": "140MB",
"remark": "支持插件,最低 8GB 内存要求",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.2.zip",
- "author": "mcsmanager.com"
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
},
{
"language": "zh_cn",
@@ -82,7 +129,14 @@
"size": "210MB",
"remark": "支持插件,最低 8GB 内存要求",
"targetLink": "https://url.alww.top/mcsm/paper1.19.2",
- "author": "alongw.cn"
+ "author": "alongw.cn",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
},
{
"language": "zh_cn",
@@ -93,7 +147,14 @@
"size": "100MB",
"remark": "支持插件,支持mod(Forge),最低 6GB 内存要求",
"targetLink": "https://url.alww.top/mcsm/arclight1.19.2",
- "author": "alongw.cn"
+ "author": "alongw.cn",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
},
{
"language": "zh_cn",
@@ -104,7 +165,14 @@
"size": "230MB",
"remark": "支持插件,最低 6GB 内存要求",
"targetLink": "https://url.alww.top/mcsm/paper-geyser1.19.2",
- "author": "alongw.cn"
+ "author": "alongw.cn",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
},
{
"language": "zh_cn",
@@ -115,7 +183,14 @@
"size": "140MB",
"remark": "支持插件,最低 4GB 内存要求",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.1.zip",
- "author": "mcsmanager.com"
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
},
{
"language": "zh_cn",
@@ -126,7 +201,14 @@
"size": "140MB",
"remark": "支持插件,最低 4GB 内存要求",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.zip",
- "author": "mcsmanager.com"
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
},
{
"language": "zh_cn",
@@ -137,7 +219,14 @@
"size": "140MB",
"remark": "支持插件,最低 4GB 内存要求",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.18.2.zip",
- "author": "mcsmanager.com"
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
},
{
"language": "zh_cn",
@@ -148,7 +237,14 @@
"size": "160MB",
"remark": "支持插件,最低 4GB 内存要求",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.17.1.zip",
- "author": "mcsmanager.com"
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
}
]
}
From d9063109f0a8f77be23c7e7742791837e2abb9a0 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 7 May 2024 14:26:02 +0800
Subject: [PATCH 192/460] Feat: add forge pack
---
templates.json | 82 ++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 69 insertions(+), 13 deletions(-)
diff --git a/templates.json b/templates.json
index 6c67663..55354e4 100644
--- a/templates.json
+++ b/templates.json
@@ -11,10 +11,29 @@
}
],
"packages": [
+ {
+ "language": "en_us",
+ "description": "[Forge] forge-1.20.6-50.0.8-installer.jar",
+ "title": "Forge 1.20.6 (Support Mods)",
+ "runtime": "Java 21+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.6-50.0.8/forge-1.20.6-50.0.8-installer.jar",
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.20.6-50.0.8-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "en_us",
"description": "[Forge] Forge-1.19.2-43.3.13-installer.jar",
- "title": "Forge 1.19.2-43.3.13",
+ "title": "Forge 1.19.2 (Support Mods)",
"runtime": "Java 17+",
"hardware": "RAM 8G+",
"size": "7MB",
@@ -35,7 +54,7 @@
"description": "[Paper] Recommendation for friends with multiple players, Fast setup.",
"title": "Minecraft 1.20.4 Java",
"runtime": "Java 17+",
- "hardware": "RAM 8G",
+ "hardware": "RAM 8G+",
"size": "140MB",
"remark": "Paper Software",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.20.4.zip",
@@ -53,7 +72,7 @@
"description": "[Paper] Recommendation for friends with multiple players",
"title": "Minecraft 1.19.2 Java",
"runtime": "Java 17+",
- "hardware": "RAM 8G",
+ "hardware": "RAM 8G+",
"size": "140MB",
"remark": "Paper Software",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.19.2.zip",
@@ -71,7 +90,7 @@
"description": "[Paper] Recommendation for friends with multiple players",
"title": "Minecraft 1.18.2 Java",
"runtime": "Java 17+",
- "hardware": "RAM 8G",
+ "hardware": "RAM 8G+",
"size": "140MB",
"remark": "Paper Software",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.18.2.zip",
@@ -84,7 +103,44 @@
"oe": "utf-8"
}
},
-
+ {
+ "language": "zh_cn",
+ "description": "[Forge] forge-1.20.6-50.0.8-installer.jar,来自官方网站源。",
+ "title": "Forge 1.20.6 Java 版 (支持模组)",
+ "runtime": "Java 21+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.6-50.0.8/forge-1.20.6-50.0.8-installer.jar",
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.20.6-50.0.8-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "zh_cn",
+ "description": "[Forge] Forge-1.19.2-43.3.13,支持安装 MOD。",
+ "title": "Forge 1.19.2 Java 版 (支持模组)",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.2-43.3.13/forge-1.19.2-43.3.13-installer.jar",
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.19.2-43.3.13-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "zh_cn",
"description": "[Paper] 中小型互通服推荐,1.20.4 版本,快速开服,包含ESS、锁箱子、操作回滚、领地商店等基础插件。",
@@ -107,7 +163,7 @@
"description": "[原版生存] 朋友联机推荐,1.19.2 版本,快速开服,享受原汁原味的极致生存与探索。",
"title": "Minecraft 1.19.2 Java 原版",
"runtime": "Java 17+",
- "hardware": "RAM 8G",
+ "hardware": "RAM 8G+",
"size": "140MB",
"remark": "支持插件,最低 8GB 内存要求",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.2.zip",
@@ -125,7 +181,7 @@
"description": "[整合包] 小型服务器推荐,包含基础插件、箱子锁、操作回滚、领地和商店等插件。",
"title": "Minecraft 1.19.2 Java 版整合包",
"runtime": "Java 17+",
- "hardware": "RAM 8G",
+ "hardware": "RAM 8G+",
"size": "210MB",
"remark": "支持插件,最低 8GB 内存要求",
"targetLink": "https://url.alww.top/mcsm/paper1.19.2",
@@ -143,7 +199,7 @@
"description": "[Arclight] 小型服务器推荐,1.19.2 版本,可安装mod,互通基岩版,快速开服,包含ESS、锁箱子、操作回滚、领地商店等基础插件。",
"title": "Minecraft 1.19.2",
"runtime": "Java 17+",
- "hardware": "RAM 8G",
+ "hardware": "RAM 8G+",
"size": "100MB",
"remark": "支持插件,支持mod(Forge),最低 6GB 内存要求",
"targetLink": "https://url.alww.top/mcsm/arclight1.19.2",
@@ -161,7 +217,7 @@
"description": "[整合包/Java&基岩版互通] 小型服务器推荐,互通基岩版,包含基础插件、箱子锁、操作回滚、领地和商店等插件。",
"title": "Minecraft 1.19.2 基岩互通版",
"runtime": "Java 17+",
- "hardware": "RAM 8G",
+ "hardware": "RAM 8G+",
"size": "230MB",
"remark": "支持插件,最低 6GB 内存要求",
"targetLink": "https://url.alww.top/mcsm/paper-geyser1.19.2",
@@ -179,7 +235,7 @@
"description": "[原版生存] 朋友联机推荐,让你和你的小伙伴一起享受原汁原味的极致生存。",
"title": "Minecraft 1.19.1 Java 原版",
"runtime": "Java 17+",
- "hardware": "RAM 8G",
+ "hardware": "RAM 8G+",
"size": "140MB",
"remark": "支持插件,最低 4GB 内存要求",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.1.zip",
@@ -197,7 +253,7 @@
"description": "[原版生存] 适合朋友联机,“荒野更新”(The Wild)旨在为玩家带来现有生物群系的改进和优化。",
"title": "Minecraft 1.19 Java 原版",
"runtime": "Java 17+",
- "hardware": "RAM 8G",
+ "hardware": "RAM 8G+",
"size": "140MB",
"remark": "支持插件,最低 4GB 内存要求",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.zip",
@@ -215,7 +271,7 @@
"description": "[原版生存] 适合朋友联机推荐,继承上版本的功能并进行了一系列的优化,主流联机版本,插件与MOD较为丰富。",
"title": "Minecraft 1.18.2 Java 原版",
"runtime": "Java 17+",
- "hardware": "RAM 8G",
+ "hardware": "RAM 8G+",
"size": "140MB",
"remark": "支持插件,最低 4GB 内存要求",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.18.2.zip",
@@ -233,7 +289,7 @@
"description": "[原版生存] 适合朋友联机,快速开服,服务器搭建,回味老版本的地穴探索。",
"title": "Minecraft 17.1 Java 原版",
"runtime": "Java 17+",
- "hardware": "RAM 8G",
+ "hardware": "RAM 8G+",
"size": "160MB",
"remark": "支持插件,最低 4GB 内存要求",
"targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.17.1.zip",
From 9783e858592af55cc9f02e6e1d9f379f97cbd002 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 7 May 2024 14:51:05 +0800
Subject: [PATCH 193/460] Feat: add forge pack
---
templates.json | 91 ++++++++------------------------------------------
1 file changed, 14 insertions(+), 77 deletions(-)
diff --git a/templates.json b/templates.json
index 55354e4..bfacc70 100644
--- a/templates.json
+++ b/templates.json
@@ -13,14 +13,14 @@
"packages": [
{
"language": "en_us",
- "description": "[Forge] forge-1.20.6-50.0.8-installer.jar",
+ "description": "Forge-1.20.6-50.0.8-installer.jar",
"title": "Forge 1.20.6 (Support Mods)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
"targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.6-50.0.8/forge-1.20.6-50.0.8-installer.jar",
- "author": "mcsmanager.com",
+ "author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
@@ -32,14 +32,14 @@
},
{
"language": "en_us",
- "description": "[Forge] Forge-1.19.2-43.3.13-installer.jar",
+ "description": "Forge-1.19.2-43.3.13-installer.jar",
"title": "Forge 1.19.2 (Support Mods)",
"runtime": "Java 17+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
"targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.2-43.3.13/forge-1.19.2-43.3.13-installer.jar",
- "author": "mcsmanager.com",
+ "author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
@@ -63,6 +63,7 @@
"type": "minecraft/java",
"startCommand": "java -jar server.jar -nogui",
"stopCommand": "stop",
+ "updateCommand": "",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -81,6 +82,7 @@
"type": "minecraft/java",
"startCommand": "java -jar server.jar -nogui",
"stopCommand": "stop",
+ "updateCommand": "",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -99,6 +101,7 @@
"type": "minecraft/java",
"startCommand": "java -jar server.jar -nogui",
"stopCommand": "stop",
+ "updateCommand": "",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -112,7 +115,7 @@
"size": "7MB",
"remark": "Minecraft Forge",
"targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.6-50.0.8/forge-1.20.6-50.0.8-installer.jar",
- "author": "mcsmanager.com",
+ "author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
@@ -131,7 +134,7 @@
"size": "7MB",
"remark": "Minecraft Forge",
"targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.2-43.3.13/forge-1.19.2-43.3.13-installer.jar",
- "author": "mcsmanager.com",
+ "author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
@@ -141,23 +144,6 @@
"oe": "utf-8"
}
},
- {
- "language": "zh_cn",
- "description": "[Paper] 中小型互通服推荐,1.20.4 版本,快速开服,包含ESS、锁箱子、操作回滚、领地商店等基础插件。",
- "title": "Minecraft 1.20.4",
- "runtime": "Java 17+",
- "size": "140MB",
- "remark": "支持插件,最低 8GB 内存要求",
- "targetLink": "https://url.alww.top/mcsm/paper1.20.4",
- "author": "alongw.cn",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
{
"language": "zh_cn",
"description": "[原版生存] 朋友联机推荐,1.19.2 版本,快速开服,享受原汁原味的极致生存与探索。",
@@ -172,60 +158,7 @@
"type": "minecraft/java",
"startCommand": "java -jar server.jar -nogui",
"stopCommand": "stop",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "zh_cn",
- "description": "[整合包] 小型服务器推荐,包含基础插件、箱子锁、操作回滚、领地和商店等插件。",
- "title": "Minecraft 1.19.2 Java 版整合包",
- "runtime": "Java 17+",
- "hardware": "RAM 8G+",
- "size": "210MB",
- "remark": "支持插件,最低 8GB 内存要求",
- "targetLink": "https://url.alww.top/mcsm/paper1.19.2",
- "author": "alongw.cn",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "zh_cn",
- "description": "[Arclight] 小型服务器推荐,1.19.2 版本,可安装mod,互通基岩版,快速开服,包含ESS、锁箱子、操作回滚、领地商店等基础插件。",
- "title": "Minecraft 1.19.2",
- "runtime": "Java 17+",
- "hardware": "RAM 8G+",
- "size": "100MB",
- "remark": "支持插件,支持mod(Forge),最低 6GB 内存要求",
- "targetLink": "https://url.alww.top/mcsm/arclight1.19.2",
- "author": "alongw.cn",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "zh_cn",
- "description": "[整合包/Java&基岩版互通] 小型服务器推荐,互通基岩版,包含基础插件、箱子锁、操作回滚、领地和商店等插件。",
- "title": "Minecraft 1.19.2 基岩互通版",
- "runtime": "Java 17+",
- "hardware": "RAM 8G+",
- "size": "230MB",
- "remark": "支持插件,最低 6GB 内存要求",
- "targetLink": "https://url.alww.top/mcsm/paper-geyser1.19.2",
- "author": "alongw.cn",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
+ "updateCommand": "",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -244,6 +177,7 @@
"type": "minecraft/java",
"startCommand": "java -jar server.jar -nogui",
"stopCommand": "stop",
+ "updateCommand": "",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -262,6 +196,7 @@
"type": "minecraft/java",
"startCommand": "java -jar server.jar -nogui",
"stopCommand": "stop",
+ "updateCommand": "",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -280,6 +215,7 @@
"type": "minecraft/java",
"startCommand": "java -jar server.jar -nogui",
"stopCommand": "stop",
+ "updateCommand": "",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -298,6 +234,7 @@
"type": "minecraft/java",
"startCommand": "java -jar server.jar -nogui",
"stopCommand": "stop",
+ "updateCommand": "",
"ie": "utf-8",
"oe": "utf-8"
}
From deecea070efc388377e234ccf30ff8b7c2f8c132 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 7 May 2024 14:59:53 +0800
Subject: [PATCH 194/460] Feat: pack
---
templates.json | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/templates.json b/templates.json
index bfacc70..5b74fa9 100644
--- a/templates.json
+++ b/templates.json
@@ -106,6 +106,25 @@
"oe": "utf-8"
}
},
+ {
+ "language": "zh_cn",
+ "description": "[Paper] 中小型互通服推荐,1.20.4 版本,快速开服,包含ESS、锁箱子、操作回滚、领地商店等基础插件。",
+ "title": "Minecraft 1.20.4",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G+",
+ "size": "140MB",
+ "remark": "支持插件,最低 8GB 内存要求",
+ "targetLink": "https://url.alww.top/mcsm/paper1.20.4.zip",
+ "author": "alongw.cn",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "zh_cn",
"description": "[Forge] forge-1.20.6-50.0.8-installer.jar,来自官方网站源。",
From e761f8d3fe5fe6928d7c61915319d9d7400c1b20 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 7 May 2024 15:04:25 +0800
Subject: [PATCH 195/460] Feat: pack
---
templates.json | 46 +++++++++++++++++++++++-----------------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/templates.json b/templates.json
index 5b74fa9..5529dae 100644
--- a/templates.json
+++ b/templates.json
@@ -11,6 +11,25 @@
}
],
"packages": [
+ {
+ "language": "en_us",
+ "description": "[Paper] Recommendation for friends with multiple players, Fast setup.",
+ "title": "Minecraft 1.20.4 Java",
+ "runtime": "Java 17+",
+ "hardware": "RAM 6G+",
+ "size": "140MB",
+ "remark": "Paper Software",
+ "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.20.4.zip",
+ "author": "mcsmanager.com",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "en_us",
"description": "Forge-1.20.6-50.0.8-installer.jar",
@@ -49,25 +68,6 @@
"oe": "utf-8"
}
},
- {
- "language": "en_us",
- "description": "[Paper] Recommendation for friends with multiple players, Fast setup.",
- "title": "Minecraft 1.20.4 Java",
- "runtime": "Java 17+",
- "hardware": "RAM 8G+",
- "size": "140MB",
- "remark": "Paper Software",
- "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.20.4.zip",
- "author": "mcsmanager.com",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
{
"language": "en_us",
"description": "[Paper] Recommendation for friends with multiple players",
@@ -109,9 +109,9 @@
{
"language": "zh_cn",
"description": "[Paper] 中小型互通服推荐,1.20.4 版本,快速开服,包含ESS、锁箱子、操作回滚、领地商店等基础插件。",
- "title": "Minecraft 1.20.4",
+ "title": "Minecraft 1.20.4 (低配机器推荐)",
"runtime": "Java 17+",
- "hardware": "RAM 8G+",
+ "hardware": "RAM 6G+",
"size": "140MB",
"remark": "支持插件,最低 8GB 内存要求",
"targetLink": "https://url.alww.top/mcsm/paper1.20.4.zip",
@@ -127,7 +127,7 @@
},
{
"language": "zh_cn",
- "description": "[Forge] forge-1.20.6-50.0.8-installer.jar,来自官方网站源。",
+ "description": "[Forge] forge-1.20.6-50.0.8-installer.jar,来自官方网站源,需要高配机器支撑。",
"title": "Forge 1.20.6 Java 版 (支持模组)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
@@ -146,7 +146,7 @@
},
{
"language": "zh_cn",
- "description": "[Forge] Forge-1.19.2-43.3.13,支持安装 MOD。",
+ "description": "[Forge] Forge-1.19.2-43.3.13,支持安装 MOD,需要高配机器支撑。",
"title": "Forge 1.19.2 Java 版 (支持模组)",
"runtime": "Java 17+",
"hardware": "RAM 8G+",
From 67aa076d532adf3b88aa6c0e67f7a0668192f3a3 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Thu, 9 May 2024 22:13:46 +0800
Subject: [PATCH 196/460] update function signature
---
install_update.sh | 190 +++++++++++++++++++++----------------------
install_update_cn.sh | 181 ++++++++++++++++++++---------------------
2 files changed, 185 insertions(+), 186 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index f4f11eb..5ffff6f 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -36,7 +36,7 @@ package_name="${mcsmanager_download_addr##*/}"
node_install_path=""
# Helper Functions
-usage() {
+Usage() {
echo "Usage: $0 [-u user] [-c command]"
echo " -u Specify the user (mcsm or root), default is 'mcsm'"
echo " -c Specify the command (web, daemon, or all), default is 'all'"
@@ -48,36 +48,36 @@ Red_Error() {
echo '================================================='
exit 1
}
-echo_cyan() {
+Echo_Cyan() {
printf '\033[1;36m%b\033[0m\n' "$@"
}
-echo_red() {
+Echo_Red() {
printf '\033[1;31m%b\033[0m\n' "$@"
}
-echo_green() {
+Echo_Green() {
printf '\033[1;32m%b\033[0m\n' "$@"
}
-echo_cyan_n() {
+Echo_Cyan_N() {
printf '\033[1;36m%b\033[0m' "$@"
}
-echo_yellow() {
+Echo_Yellow() {
printf '\033[1;33m%b\033[0m\n' "$@"
}
# Check root permission
-check_sudo() {
+Check_Sudo() {
if [ "$EUID" -ne 0 ]; then
echo "This script must be run as root. Please use \"sudo or root user\" instead."
exit 1
fi
}
-Install_dependencies() {
+Install_Dependencies() {
# Install related software
- echo_cyan "[+] Installing dependent software (git, tar, wget)... "
+ Echo_Cyan "[+] Installing dependent software (git, tar, wget)... "
if [[ -x "$(command -v yum)" ]]; then
yum install -y git tar wget
elif [[ -x "$(command -v apt-get)" ]]; then
@@ -87,23 +87,23 @@ Install_dependencies() {
elif [[ -x "$(command -v zypper)" ]]; then
zypper --non-interactive install git tar wget
else
- echo_red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
+ Echo_Red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
fi
# Determine whether the relevant software is installed successfully
if [[ -x "$(command -v git)" && -x "$(command -v tar)" && -x "$(command -v wget)" ]]; then
- echo_green "Success"
+ Echo_Green "Success"
else
Red_Error "[x] Failed to find git, tar and wget, please install them manually!"
fi
}
-Install_node() {
+Install_Node() {
if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
- echo_green "Desired Node.js is already installed at the target dir, bypassing installation..."
+ Echo_Green "Desired Node.js is already installed at the target dir, bypassing installation..."
else
- echo_cyan_n "[+] Install Node.js environment...\n"
+ Echo_Cyan_N "[+] Install Node.js environment...\n"
rm -irf "$node_install_path"
@@ -118,7 +118,7 @@ Install_node() {
rm -rf "node-$node-linux-$arch.tar.gz"
if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
- echo_green "Success"
+ Echo_Green "Success"
else
Red_Error "[x] Node installation failed!"
fi
@@ -126,15 +126,15 @@ Install_node() {
echo
- echo_yellow "=============== Node.js Version ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node.js Version ==============="
+ Echo_Yellow "=============== Node.js Version ==============="
+ Echo_Yellow " node: $("$node_install_path"/bin/node -v)"
+ Echo_Yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ Echo_Yellow "=============== Node.js Version ==============="
echo
sleep 1
}
# Check and download MCSM source
-Check_and_download_source() {
+Check_And_Download_Source() {
# Empty the temp dir if existed
rm -rf "$mcsm_down_temp"
mkdir -p "$mcsm_down_temp"
@@ -179,13 +179,13 @@ Detect_Architecture() {
}
# Initialization
Initialize() {
- echo_cyan "+----------------------------------------------------------------------
+ Echo_Cyan "+----------------------------------------------------------------------
| MCSManager V10 Installation & Upgrading Script
+----------------------------------------------------------------------
"
# Check sudo
- check_sudo
+ Check_Sudo
# Update architecture
Detect_Architecture
@@ -194,10 +194,10 @@ Initialize() {
mkdir -p "$install_base"
# Check dependencies
- Install_dependencies
+ Install_Dependencies
# Check and download MCSM source
- Check_and_download_source
+ Check_And_Download_Source
# Parse input arguments
Parse_Arguments "$@"
@@ -207,9 +207,9 @@ Initialize() {
# Create the user 'mcsm' if it doesn't already exist
if ! id "mcsm" &>/dev/null; then
/usr/sbin/useradd mcsm
- echo_green "User 'mcsm' created."
+ Echo_Green "User 'mcsm' created."
else
- echo_yellow "User 'mcsm' already exists."
+ Echo_Yellow "User 'mcsm' already exists."
fi
fi
}
@@ -227,7 +227,7 @@ Backup_MCSM() {
# Create backup directory (/opt) if it doesn't exist
if [ ! -d "$mcsm_backup_dir" ]; then
- echo_yellow "Creating backup directory."
+ Echo_Yellow "Creating backup directory."
mkdir -p "$mcsm_backup_dir"
fi
@@ -235,14 +235,14 @@ Backup_MCSM() {
backup_path="${mcsm_backup_dir}/mcsm_backup_${current_date}.tar.gz"
# Create the backup
- echo_yellow "Creating backup..."
+ Echo_Yellow "Creating backup..."
#tar -czf "$backup_path" -C "$mcsmanager_install_path" .
tar -czf "$backup_path" -C "$(dirname "$mcsmanager_install_path")" "$(basename "$mcsmanager_install_path")"
# Check if the backup was successful
if [ $? -eq 0 ]; then
- echo_green "Successfully created backup at $backup_path"
+ Echo_Green "Successfully created backup at $backup_path"
else
Red_Error "Error creating backup."
fi
@@ -262,7 +262,7 @@ Install_MCSM_Web_Base() {
# Dependencies install
cd "${web_path}" || Red_Error "[x] Failed to enter ${web_path}"
# Install dependencies
- echo_cyan "[+] Install MCSManager-Web dependencies..."
+ Echo_Cyan "[+] Install MCSManager-Web dependencies..."
env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${web_path}"
# Return to general dir
cd "$mcsmanager_install_path"
@@ -275,7 +275,7 @@ Install_MCSM_Web_Base() {
}
# MCSM Web Service Installation
Install_Web_Systemd() {
- echo_cyan "[+] Creating MCSManager Web service..."
+ Echo_Cyan "[+] Creating MCSManager Web service..."
# stop and disable existing service
systemctl disable --now mcsm-web
@@ -319,7 +319,7 @@ Install_Web_Wrapper() {
web_data="${web_path}/data"
web_data_tmp="${mcsmanager_install_path}/web_data_${current_date}"
if [ -d "$web_path" ]; then
- echo_cyan "[+] Updating MCSManager Web..."
+ Echo_Cyan "[+] Updating MCSManager Web..."
# The backup should be created already, moving the DATA dir to /opt/mcsmanager/web_data should be fast and safe.
# Use web_data, do not use data as in rare circumstance user may run both update at the same time.
# Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
@@ -328,7 +328,7 @@ Install_Web_Wrapper() {
rm -rf "$web_path"
else
- echo_cyan "[+] Install MCSManager Web..."
+ Echo_Cyan "[+] Install MCSManager Web..."
fi
@@ -355,7 +355,7 @@ Install_MCSM_Daemon_Base() {
# Dependencies install
cd "${daemon_path}" || Red_Error "[x] Failed to enter ${daemon_path}"
# Install dependencies
- echo_cyan "[+] Install MCSManager-Daemon dependencies..."
+ Echo_Cyan "[+] Install MCSManager-Daemon dependencies..."
env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${daemon_path}"
# Return to general dir
cd "$mcsmanager_install_path"
@@ -369,7 +369,7 @@ Install_MCSM_Daemon_Base() {
# MCSM Daemon Service Installation
Install_Daemon_Systemd() {
- echo_cyan "[+] Creating MCSManager Daemon service..."
+ Echo_Cyan "[+] Creating MCSManager Daemon service..."
# stop and disable existing service
systemctl disable --now mcsm-daemon
@@ -412,7 +412,7 @@ Install_Daemon_Wrapper() {
daemon_data="${daemon_path}/data"
daemon_data_tmp="${mcsmanager_install_path}/daemon_data_${current_date}"
if [ -d "$daemon_path" ]; then
- echo_cyan "[+] Updating MCSManager Daemon..."
+ Echo_Cyan "[+] Updating MCSManager Daemon..."
# The backup should be created already, moving the DATA dir to /opt/mcsmanager/daemon_data should be fast and safe.
# Use daemon_data, do not use data as in rare circumstance user may run both update at the same time.
# Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
@@ -421,7 +421,7 @@ Install_Daemon_Wrapper() {
rm -rf "$daemon_path"
else
- echo_cyan "[+] Install MCSManager daemon..."
+ Echo_Cyan "[+] Install MCSManager daemon..."
fi
# Install MCSM Web
@@ -439,7 +439,7 @@ Parse_Arguments() {
USER="${OPTARG}"
else
echo "Invalid user specified."
- usage
+ Usage
fi
;;
c )
@@ -447,15 +447,15 @@ Parse_Arguments() {
COMMAND="${OPTARG}"
else
echo "Invalid command specified."
- usage
+ Usage
fi
;;
\? )
- usage
+ Usage
;;
: )
echo "Option -$OPTARG requires an argument."
- usage
+ Usage
;;
esac
done
@@ -498,56 +498,56 @@ Finalize() {
case "$COMMAND" in
all)
- echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
- echo_yellow " "
- echo_cyan_n "HTTP Web Service: "
- echo_yellow "http://:23333 (Browser)"
- echo_cyan_n "Daemon Address: "
- echo_yellow "ws://:24444 (Cluster)"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-{daemon,web}.service"
- echo_cyan "systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ Echo_Yellow "=================================================================="
+ Echo_Green "Installation is complete! Welcome to the MCSManager V10!!!"
+ Echo_Yellow " "
+ Echo_Cyan_N "HTTP Web Service: "
+ Echo_Yellow "http://:23333 (Browser)"
+ Echo_Cyan_N "Daemon Address: "
+ Echo_Yellow "ws://:24444 (Cluster)"
+ Echo_Red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ Echo_Yellow " "
+ Echo_Cyan "Usage:"
+ Echo_Cyan "systemctl start mcsm-{daemon,web}.service"
+ Echo_Cyan "systemctl stop mcsm-{daemon,web}.service"
+ Echo_Cyan "systemctl restart mcsm-{daemon,web}.service"
+ Echo_Yellow " "
+ Echo_Green "Official Document: https://docs.mcsmanager.com/"
+ Echo_Yellow "=================================================================="
;;
web)
- echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
- echo_yellow " "
- echo_cyan_n "HTTP Web Service: "
- echo_yellow "http://:23333 (Browser)"
- echo_red "You must expose port 23333 to use the service properly on the Internet."
- echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-web.service"
- echo_cyan "systemctl stop mcsm-web.service"
- echo_cyan "systemctl restart mcsm-web.service"
- echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ Echo_Yellow "=================================================================="
+ Echo_Green "Installation is complete! Welcome to the MCSManager V10!!!"
+ Echo_Yellow " "
+ Echo_Cyan_N "HTTP Web Service: "
+ Echo_Yellow "http://:23333 (Browser)"
+ Echo_Red "You must expose port 23333 to use the service properly on the Internet."
+ Echo_Yellow " "
+ Echo_Cyan "Usage:"
+ Echo_Cyan "systemctl start mcsm-web.service"
+ Echo_Cyan "systemctl stop mcsm-web.service"
+ Echo_Cyan "systemctl restart mcsm-web.service"
+ Echo_Yellow " "
+ Echo_Green "Official Document: https://docs.mcsmanager.com/"
+ Echo_Yellow "=================================================================="
;;
daemon)
- echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager V10!!!"
- echo_yellow " "
- echo_cyan_n "Daemon Address: "
- echo_yellow "ws://:24444 (Cluster)"
- echo_red "You must expose port 24444 to use the service properly on the Internet."
- echo_yellow " "
- echo_cyan "Usage:"
- echo_cyan "systemctl start mcsm-daemon.service"
- echo_cyan "systemctl stop mcsm-daemon.service"
- echo_cyan "systemctl restart mcsm-daemon.service"
- echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ Echo_Yellow "=================================================================="
+ Echo_Green "Installation is complete! Welcome to the MCSManager V10!!!"
+ Echo_Yellow " "
+ Echo_Cyan_N "Daemon Address: "
+ Echo_Yellow "ws://:24444 (Cluster)"
+ Echo_Red "You must expose port 24444 to use the service properly on the Internet."
+ Echo_Yellow " "
+ Echo_Cyan "Usage:"
+ Echo_Cyan "systemctl start mcsm-daemon.service"
+ Echo_Cyan "systemctl stop mcsm-daemon.service"
+ Echo_Cyan "systemctl restart mcsm-daemon.service"
+ Echo_Yellow " "
+ Echo_Green "Official Document: https://docs.mcsmanager.com/"
+ Echo_Yellow "=================================================================="
;;
*)
@@ -558,11 +558,11 @@ Finalize() {
esac
# Check if backup_path is not empty
if [[ -n "$backup_path" ]]; then
- echo_green "Your MCSM has been updated from a previous installation. "
- echo_green "A complete backup was created at:"
- echo_yellow "$backup_path"
- echo_green "You can manually delete the backup using command: "
- echo_red "rm ${backup_path}"
+ Echo_Green "Your MCSM has been updated from a previous installation. "
+ Echo_Green "A complete backup was created at:"
+ Echo_Yellow "$backup_path"
+ Echo_Green "You can manually delete the backup using command: "
+ Echo_Red "rm ${backup_path}"
fi
# Move quickstart.md
mv "${mcsm_down_temp}/quick-start.md" "${mcsmanager_install_path}/quick-start.md"
@@ -572,7 +572,7 @@ Finalize() {
}
########### Main Logic ################
-main() {
+Main() {
# Do not create mcsmanager path yet as it will break the logic detecting existing installation
Initialize "$@"
# Check if the mcsmanager_install_path exists
@@ -580,13 +580,13 @@ main() {
# Backup first, due to potential large file being archived, backup is disabled.
# Backup_MCSM
# Install Node.js, this is to ensure the version is up to date.
- Install_node
+ Install_Node
else
# Create mcsmanager path if not already
mkdir -p "$mcsmanager_install_path"
# Install Node.js, this is to ensure the version is up to date.
- Install_node
+ Install_Node
fi
# Install Services based on command
@@ -595,7 +595,7 @@ main() {
# Print helping Information
Finalize
- echo_green "Installation/Upgrading Complete!"
+ Echo_Green "Installation/Upgrading Complete!"
}
-main "$@"
\ No newline at end of file
+Main "$@"
\ No newline at end of file
diff --git a/install_update_cn.sh b/install_update_cn.sh
index a292ece..9d52abf 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -48,36 +48,35 @@ Red_Error() {
echo '================================================='
exit 1
}
-echo_cyan() {
+Echo_Cyan() {
printf '\033[1;36m%b\033[0m\n' "$@"
}
-echo_red() {
+Echo_Red() {
printf '\033[1;31m%b\033[0m\n' "$@"
}
-echo_green() {
+Echo_Green() {
printf '\033[1;32m%b\033[0m\n' "$@"
}
-echo_cyan_n() {
+Echo_Cyan_N() {
printf '\033[1;36m%b\033[0m' "$@"
}
-echo_yellow() {
+Echo_Yellow() {
printf '\033[1;33m%b\033[0m\n' "$@"
}
-
# Check root permission
-check_sudo() {
+Check_Sudo() {
if [ "$EUID" -ne 0 ]; then
echo "This script must be run as root. Please use \"sudo or root user\" instead."
exit 1
fi
}
-Install_dependencies() {
+Install_Dependencies() {
# Install related software
- echo_cyan "[+] 正在安装依赖软件 (git, tar, wget)... "
+ Echo_Cyan "[+] 正在安装依赖软件 (git, tar, wget)... "
if [[ -x "$(command -v yum)" ]]; then
yum install -y git tar wget
elif [[ -x "$(command -v apt-get)" ]]; then
@@ -87,23 +86,23 @@ Install_dependencies() {
elif [[ -x "$(command -v zypper)" ]]; then
zypper --non-interactive install git tar wget
else
- echo_red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
+ Echo_Red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
fi
# Determine whether the relevant software is installed successfully
if [[ -x "$(command -v git)" && -x "$(command -v tar)" && -x "$(command -v wget)" ]]; then
- echo_green "成功!"
+ Echo_Green "成功!"
else
Red_Error "[x] Failed to find git, tar and wget, please install them manually!"
fi
}
-Install_node() {
+Install_Node() {
if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
- echo_green "检测到已安装的Node.js版本, 已为您跳过安装."
+ Echo_Green "检测到已安装的Node.js版本, 已为您跳过安装."
else
- echo_cyan_n "[+] 安装 Node.js 环境中...\n"
+ Echo_Cyan_N "[+] 安装 Node.js 环境中...\n"
rm -irf "$node_install_path"
@@ -118,7 +117,7 @@ Install_node() {
rm -rf "node-$node-linux-$arch.tar.gz"
if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
- echo_green "Success"
+ Echo_Green "Success"
else
Red_Error "[x] Node installation failed!"
fi
@@ -126,15 +125,15 @@ Install_node() {
echo
- echo_yellow "=============== Node.js 版本 ==============="
- echo_yellow " node: $("$node_install_path"/bin/node -v)"
- echo_yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- echo_yellow "=============== Node.js 版本 ==============="
+ Echo_Yellow "=============== Node.js 版本 ==============="
+ Echo_Yellow " node: $("$node_install_path"/bin/node -v)"
+ Echo_Yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
+ Echo_Yellow "=============== Node.js 版本 ==============="
echo
sleep 1
}
# Check and download MCSM source
-Check_and_download_source() {
+Check_And_Download_Source() {
# Empty the temp dir if existed
rm -rf "$mcsm_down_temp"
mkdir -p "$mcsm_down_temp"
@@ -179,12 +178,12 @@ Detect_Architecture() {
}
# Initialization
Initialize() {
- echo_cyan "+----------------------------------------------------------------------
+ Echo_Cyan "+----------------------------------------------------------------------
| MCSManager V10安装升级脚本
+----------------------------------------------------------------------
"
# Check sudo
- check_sudo
+ Check_Sudo
# Update architecture
Detect_Architecture
@@ -193,10 +192,10 @@ Initialize() {
mkdir -p "$install_base"
# Check dependencies
- Install_dependencies
+ Install_Dependencies
# Check and download MCSM source
- Check_and_download_source
+ Check_And_Download_Source
# Parse input arguments
Parse_Arguments "$@"
@@ -206,9 +205,9 @@ Initialize() {
# Create the user 'mcsm' if it doesn't already exist
if ! id "mcsm" &>/dev/null; then
/usr/sbin/useradd mcsm
- echo_green "用户 'mcsm' 已创建."
+ Echo_Green "用户 'mcsm' 已创建."
else
- echo_yellow "用户 'mcsm' 已经存在."
+ Echo_Yellow "用户 'mcsm' 已经存在."
fi
fi
}
@@ -226,7 +225,7 @@ Backup_MCSM() {
# Create backup directory (/opt) if it doesn't exist
if [ ! -d "$mcsm_backup_dir" ]; then
- echo_yellow "正在创建备份目录..."
+ Echo_Yellow "正在创建备份目录..."
mkdir -p "$mcsm_backup_dir"
fi
@@ -234,14 +233,14 @@ Backup_MCSM() {
backup_path="${mcsm_backup_dir}/mcsm_backup_${current_date}.tar.gz"
# Create the backup
- echo_yellow "正在创建备份..."
+ Echo_Yellow "正在创建备份..."
#tar -czf "$backup_path" -C "$mcsmanager_install_path" .
tar -czf "$backup_path" -C "$(dirname "$mcsmanager_install_path")" "$(basename "$mcsmanager_install_path")"
# Check if the backup was successful
if [ $? -eq 0 ]; then
- echo_green "成功创建了备份,位于: $backup_path"
+ Echo_Green "成功创建了备份,位于: $backup_path"
else
Red_Error "创建备份时出错"
fi
@@ -261,7 +260,7 @@ Install_MCSM_Web_Base() {
# Dependencies install
cd "${web_path}" || Red_Error "[x] Failed to enter ${web_path}"
# Install dependencies
- echo_cyan "[+] 安装 MCSManager 网页 依赖中..."
+ Echo_Cyan "[+] 安装 MCSManager 网页 依赖中..."
env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] 在 ${web_path} 安装依赖时出错."
# Return to general dir
cd "$mcsmanager_install_path"
@@ -274,7 +273,7 @@ Install_MCSM_Web_Base() {
}
# MCSM Web Service Installation
Install_Web_Systemd() {
- echo_cyan "[+] 创建 MCSManager 网页服务中..."
+ Echo_Cyan "[+] 创建 MCSManager 网页服务中..."
# stop and disable existing service
systemctl disable --now mcsm-web
@@ -318,7 +317,7 @@ Install_Web_Wrapper() {
web_data="${web_path}/data"
web_data_tmp="${mcsmanager_install_path}/web_data_${current_date}"
if [ -d "$web_path" ]; then
- echo_cyan "[+] 升级 MCSManager 网页端中..."
+ Echo_Cyan "[+] 升级 MCSManager 网页端中..."
# The backup should be created already, moving the DATA dir to /opt/mcsmanager/web_data should be fast and safe.
# Use web_data, do not use data as in rare circumstance user may run both update at the same time.
# Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
@@ -327,7 +326,7 @@ Install_Web_Wrapper() {
rm -rf "$web_path"
else
- echo_cyan "[+] 安装 MCSManager 网页端中..."
+ Echo_Cyan "[+] 安装 MCSManager 网页端中..."
fi
@@ -354,7 +353,7 @@ Install_MCSM_Daemon_Base() {
# Dependencies install
cd "${daemon_path}" || Red_Error "[x] Failed to enter ${daemon_path}"
# Install dependencies
- echo_cyan "[+] 安装 MCSManager 节点依赖中..."
+ Echo_Cyan "[+] 安装 MCSManager 节点依赖中..."
env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${daemon_path}"
# Return to general dir
cd "$mcsmanager_install_path"
@@ -368,7 +367,7 @@ Install_MCSM_Daemon_Base() {
# MCSM Daemon Service Installation
Install_Daemon_Systemd() {
- echo_cyan "[+] 创建 MCSManager 节点服务中..."
+ Echo_Cyan "[+] 创建 MCSManager 节点服务中..."
# stop and disable existing service
systemctl disable --now mcsm-daemon
@@ -411,7 +410,7 @@ Install_Daemon_Wrapper() {
daemon_data="${daemon_path}/data"
daemon_data_tmp="${mcsmanager_install_path}/daemon_data_${current_date}"
if [ -d "$daemon_path" ]; then
- echo_cyan "[+] 升级 MCSManager 节点中..."
+ Echo_Cyan "[+] 升级 MCSManager 节点中..."
# The backup should be created already, moving the DATA dir to /opt/mcsmanager/daemon_data should be fast and safe.
# Use daemon_data, do not use data as in rare circumstance user may run both update at the same time.
# Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
@@ -420,7 +419,7 @@ Install_Daemon_Wrapper() {
rm -rf "$daemon_path"
else
- echo_cyan "[+] 安装 MCSManager 节点中..."
+ Echo_Cyan "[+] 安装 MCSManager 节点中..."
fi
# Install MCSM Web
@@ -497,56 +496,56 @@ Finalize() {
case "$COMMAND" in
all)
- echo_yellow "=================================================================="
- echo_green "安装已完成! 欢迎使用 MCSManager V10!!!"
- echo_yellow " "
- echo_cyan_n "网页 服务: "
- echo_yellow "http://<您的 IP>:23333 (Browser)"
- echo_cyan_n "节点 地址: "
- echo_yellow "ws://<您的 IP>:24444 (Cluster)"
- echo_red "您必须开放 23333 与 24444 端口才可以正常从公网访问"
- echo_yellow " "
- echo_cyan "使用方法:"
- echo_cyan "启动: systemctl start mcsm-{daemon,web}.service"
- echo_cyan "关闭: systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "重启: systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "官方文档: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ Echo_Yellow "=================================================================="
+ Echo_Green "安装已完成! 欢迎使用 MCSManager V10!!!"
+ Echo_Yellow " "
+ Echo_Cyan_N "网页 服务: "
+ Echo_Yellow "http://<您的 IP>:23333 (Browser)"
+ Echo_Cyan_N "节点 地址: "
+ Echo_Yellow "ws://<您的 IP>:24444 (Cluster)"
+ Echo_Red "您必须开放 23333 与 24444 端口才可以正常从公网访问"
+ Echo_Yellow " "
+ Echo_Cyan "使用方法:"
+ Echo_Cyan "启动: systemctl start mcsm-{daemon,web}.service"
+ Echo_Cyan "关闭: systemctl stop mcsm-{daemon,web}.service"
+ Echo_Cyan "重启: systemctl restart mcsm-{daemon,web}.service"
+ Echo_Yellow " "
+ Echo_Green "官方文档: https://docs.mcsmanager.com/"
+ Echo_Yellow "=================================================================="
;;
web)
- echo_yellow "=================================================================="
- echo_green "安装已完成! 欢迎使用 MCSManager V10!!!"
- echo_yellow " "
- echo_cyan_n "网页 服务: "
- echo_yellow "http://<您的 IP>:23333 (Browser)"
- echo_red "您必须开放 23333 端口才可以正常从公网访问"
- echo_yellow " "
- echo_cyan "使用方法:"
- echo_cyan "启动: systemctl start mcsm-{daemon,web}.service"
- echo_cyan "关闭: systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "重启: systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "官方文档: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ Echo_Yellow "=================================================================="
+ Echo_Green "安装已完成! 欢迎使用 MCSManager V10!!!"
+ Echo_Yellow " "
+ Echo_Cyan_N "网页 服务: "
+ Echo_Yellow "http://<您的 IP>:23333 (Browser)"
+ Echo_Red "您必须开放 23333 端口才可以正常从公网访问"
+ Echo_Yellow " "
+ Echo_Cyan "使用方法:"
+ Echo_Cyan "启动: systemctl start mcsm-{daemon,web}.service"
+ Echo_Cyan "关闭: systemctl stop mcsm-{daemon,web}.service"
+ Echo_Cyan "重启: systemctl restart mcsm-{daemon,web}.service"
+ Echo_Yellow " "
+ Echo_Green "官方文档: https://docs.mcsmanager.com/"
+ Echo_Yellow "=================================================================="
;;
daemon)
- echo_yellow "=================================================================="
- echo_green "安装已完成! 欢迎使用 MCSManager V10!!!"
- echo_yellow " "
- echo_cyan_n "节点 地址: "
- echo_yellow "ws://<您的 IP>:24444 (Cluster)"
- echo_red "您必须开放 24444 端口才可以正常从公网访问"
- echo_yellow " "
- echo_cyan "使用方法:"
- echo_cyan "启动: systemctl start mcsm-{daemon,web}.service"
- echo_cyan "关闭: systemctl stop mcsm-{daemon,web}.service"
- echo_cyan "重启: systemctl restart mcsm-{daemon,web}.service"
- echo_yellow " "
- echo_green "官方文档: https://docs.mcsmanager.com/"
- echo_yellow "=================================================================="
+ Echo_Yellow "=================================================================="
+ Echo_Green "安装已完成! 欢迎使用 MCSManager V10!!!"
+ Echo_Yellow " "
+ Echo_Cyan_N "节点 地址: "
+ Echo_Yellow "ws://<您的 IP>:24444 (Cluster)"
+ Echo_Red "您必须开放 24444 端口才可以正常从公网访问"
+ Echo_Yellow " "
+ Echo_Cyan "使用方法:"
+ Echo_Cyan "启动: systemctl start mcsm-{daemon,web}.service"
+ Echo_Cyan "关闭: systemctl stop mcsm-{daemon,web}.service"
+ Echo_Cyan "重启: systemctl restart mcsm-{daemon,web}.service"
+ Echo_Yellow " "
+ Echo_Green "官方文档: https://docs.mcsmanager.com/"
+ Echo_Yellow "=================================================================="
;;
*)
@@ -557,11 +556,11 @@ Finalize() {
esac
# Check if backup_path is not empty
if [[ -n "$backup_path" ]]; then
- echo_green "您的MCSManager是由一个已存在的版本升级而来. "
- echo_green "我们已经为您创建了一个备份, 位于:"
- echo_yellow "$backup_path"
- echo_green "如果需要, 您可以使用下列命令手动删除备份: "
- echo_red "rm ${backup_path}"
+ Echo_Green "您的MCSManager是由一个已存在的版本升级而来. "
+ Echo_Green "我们已经为您创建了一个备份, 位于:"
+ Echo_Yellow "$backup_path"
+ Echo_Green "如果需要, 您可以使用下列命令手动删除备份: "
+ Echo_Red "rm ${backup_path}"
fi
# Move quickstart.md
mv "${mcsm_down_temp}/quick-start.md" "${mcsmanager_install_path}/quick-start.md"
@@ -571,7 +570,7 @@ Finalize() {
}
########### Main Logic ################
-main() {
+Main() {
# Do not create mcsmanager path yet as it will break the logic detecting existing installation
Initialize "$@"
# Check if the mcsmanager_install_path exists
@@ -579,13 +578,13 @@ main() {
# Backup first, due to potential large file being archived, backup is disabled.
# Backup_MCSM
# Install Node.js, this is to ensure the version is up to date.
- Install_node
+ Install_Node
else
# Create mcsmanager path if not already
mkdir -p "$mcsmanager_install_path"
# Install Node.js, this is to ensure the version is up to date.
- Install_node
+ Install_Node
fi
# Install Services based on command
@@ -594,7 +593,7 @@ main() {
# Print helping Information
Finalize
- echo_green "安装或升级已完成!"
+ Echo_Green "安装或升级已完成!"
}
-main "$@"
\ No newline at end of file
+Main "$@"
\ No newline at end of file
From 31e8c0cb343ecde83d9cbbe9720931bb8efc76a2 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Thu, 9 May 2024 22:18:00 +0800
Subject: [PATCH 197/460] update cn text - minor fixes
---
install_update_cn.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/install_update_cn.sh b/install_update_cn.sh
index 9d52abf..8a95698 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -179,7 +179,7 @@ Detect_Architecture() {
# Initialization
Initialize() {
Echo_Cyan "+----------------------------------------------------------------------
-| MCSManager V10安装升级脚本
+| MCSManager V10 安装升级脚本
+----------------------------------------------------------------------
"
# Check sudo
@@ -260,7 +260,7 @@ Install_MCSM_Web_Base() {
# Dependencies install
cd "${web_path}" || Red_Error "[x] Failed to enter ${web_path}"
# Install dependencies
- Echo_Cyan "[+] 安装 MCSManager 网页 依赖中..."
+ Echo_Cyan "[+] 安装 MCSManager 网页依赖中..."
env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] 在 ${web_path} 安装依赖时出错."
# Return to general dir
cd "$mcsmanager_install_path"
From e728511bf271954138b9139f76e627b6f9bfbe9e Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Mon, 13 May 2024 11:33:13 +0800
Subject: [PATCH 198/460] Feat: change download addr
---
setup.sh | 4 ++--
setup_cn.sh | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/setup.sh b/setup.sh
index 87714b5..b5f3d14 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,8 +1,8 @@
#!/bin/bash
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_download_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
-package_name="MCSManager-v10-linux.tar.gz"
+mcsmanager_download_addr="https://github.com/MCSManager/MCSManager/releases/download/v10.2.1/mcsmanager_linux_release.tar.gz"
+package_name="mcsmanager_linux_release.tar.gz"
node="v20.12.2"
arch=$(uname -m)
diff --git a/setup_cn.sh b/setup_cn.sh
index 8af40ec..a8d6909 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -1,8 +1,9 @@
#!/bin/bash
+# 中国大陆需要安装脚本额外配置镜像地址以及低版本的 NodeJS 环境
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_download_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
-package_name="MCSManager-v10-linux.tar.gz"
+package_name="mcsmanager_linux_release.tar.gz"
node="v16.20.2"
arch=$(uname -m)
From 4d5afab43a732c7a49f4d345b57b254e1058ab6a Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Mon, 13 May 2024 11:41:58 +0800
Subject: [PATCH 199/460] Fix: package_name
---
setup_cn.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index a8d6909..2eb4b2c 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -3,7 +3,7 @@
# 中国大陆需要安装脚本额外配置镜像地址以及低版本的 NodeJS 环境
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_download_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
-package_name="mcsmanager_linux_release.tar.gz"
+package_name="MCSManager-v10-linux.tar.gz"
node="v16.20.2"
arch=$(uname -m)
From eef9072bb6296afa9010b5602779d4281b1cd9c7 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Mon, 13 May 2024 11:52:34 +0800
Subject: [PATCH 200/460] Feat: add forge pack
---
templates.json | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/templates.json b/templates.json
index 5529dae..7e98abd 100644
--- a/templates.json
+++ b/templates.json
@@ -13,7 +13,7 @@
"packages": [
{
"language": "en_us",
- "description": "[Paper] Recommendation for friends with multiple players, Fast setup.",
+ "description": "[Paper] Low hardware configuration machine use, Fast setup.",
"title": "Minecraft 1.20.4 Java",
"runtime": "Java 17+",
"hardware": "RAM 6G+",
@@ -49,6 +49,25 @@
"oe": "utf-8"
}
},
+ {
+ "language": "en_us",
+ "description": "Forge-1.20.1-47.2.32-installer.jar",
+ "title": "Forge 1.20.1 (Support Mods)",
+ "runtime": "Java 21+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.32/forge-1.20.1-47.2.32-installer.jar",
+ "author": "minecraftforge.net",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.20.1-47.2.32-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "en_us",
"description": "Forge-1.19.2-43.3.13-installer.jar",
@@ -125,6 +144,25 @@
"oe": "utf-8"
}
},
+ {
+ "language": "zh_cn",
+ "description": "[Forge] forge-1.20.1-47.2.32-installer.jar,来自官方网站源,需要高配机器支撑,支持插件和模组。",
+ "title": "Forge 1.20.1 Java 版 (支持模组)",
+ "runtime": "Java 21+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.32/forge-1.20.1-47.2.32-installer.jar",
+ "author": "minecraftforge.net",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.20.1-47.2.32-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "zh_cn",
"description": "[Forge] forge-1.20.6-50.0.8-installer.jar,来自官方网站源,需要高配机器支撑。",
From 2a89f337c13979ce14ab8e29514334c74e999491 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 4 Jun 2024 17:32:40 +0800
Subject: [PATCH 201/460] Fix: start cmd for windows
---
templates.json | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/templates.json b/templates.json
index 7e98abd..46fe552 100644
--- a/templates.json
+++ b/templates.json
@@ -42,7 +42,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "sh ./run.sh",
+ "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.20.6-50.0.8-installer.jar --installServer",
"ie": "utf-8",
@@ -61,7 +61,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "sh ./run.sh",
+ "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.20.1-47.2.32-installer.jar --installServer",
"ie": "utf-8",
@@ -80,7 +80,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "sh ./run.sh",
+ "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.19.2-43.3.13-installer.jar --installServer",
"ie": "utf-8",
@@ -156,7 +156,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "sh ./run.sh",
+ "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.20.1-47.2.32-installer.jar --installServer",
"ie": "utf-8",
@@ -175,7 +175,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "sh ./run.sh",
+ "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.20.6-50.0.8-installer.jar --installServer",
"ie": "utf-8",
@@ -194,7 +194,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "sh ./run.sh",
+ "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.19.2-43.3.13-installer.jar --installServer",
"ie": "utf-8",
From c5a741e4b1a91baf44279e6a6168426a77f158ce Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 4 Jun 2024 19:28:14 +0800
Subject: [PATCH 202/460] Fix: start cmd
---
templates.json | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/templates.json b/templates.json
index 46fe552..7e98abd 100644
--- a/templates.json
+++ b/templates.json
@@ -42,7 +42,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
+ "startCommand": "sh ./run.sh",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.20.6-50.0.8-installer.jar --installServer",
"ie": "utf-8",
@@ -61,7 +61,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
+ "startCommand": "sh ./run.sh",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.20.1-47.2.32-installer.jar --installServer",
"ie": "utf-8",
@@ -80,7 +80,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
+ "startCommand": "sh ./run.sh",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.19.2-43.3.13-installer.jar --installServer",
"ie": "utf-8",
@@ -156,7 +156,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
+ "startCommand": "sh ./run.sh",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.20.1-47.2.32-installer.jar --installServer",
"ie": "utf-8",
@@ -175,7 +175,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
+ "startCommand": "sh ./run.sh",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.20.6-50.0.8-installer.jar --installServer",
"ie": "utf-8",
@@ -194,7 +194,7 @@
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
- "startCommand": "java -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui",
+ "startCommand": "sh ./run.sh",
"stopCommand": "stop",
"updateCommand": "java -jar forge-1.19.2-43.3.13-installer.jar --installServer",
"ie": "utf-8",
From 26db620de0324e04e5d743eb74af9c139fb93edb Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 4 Jun 2024 19:35:14 +0800
Subject: [PATCH 203/460] feat: windows tip
---
templates.json | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/templates.json b/templates.json
index 7e98abd..2763b7f 100644
--- a/templates.json
+++ b/templates.json
@@ -32,7 +32,7 @@
},
{
"language": "en_us",
- "description": "Forge-1.20.6-50.0.8-installer.jar",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
"title": "Forge 1.20.6 (Support Mods)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
@@ -51,7 +51,7 @@
},
{
"language": "en_us",
- "description": "Forge-1.20.1-47.2.32-installer.jar",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
"title": "Forge 1.20.1 (Support Mods)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
@@ -70,7 +70,7 @@
},
{
"language": "en_us",
- "description": "Forge-1.19.2-43.3.13-installer.jar",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
"title": "Forge 1.19.2 (Support Mods)",
"runtime": "Java 17+",
"hardware": "RAM 8G+",
@@ -146,7 +146,7 @@
},
{
"language": "zh_cn",
- "description": "[Forge] forge-1.20.1-47.2.32-installer.jar,来自官方网站源,需要高配机器支撑,支持插件和模组。",
+ "description": "注意:默认的启动命令是 \"sh ./run.sh\",如果需要在 Windows 上运行,请在安装后将命令修改为 \"start.bat\"",
"title": "Forge 1.20.1 Java 版 (支持模组)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
@@ -165,7 +165,7 @@
},
{
"language": "zh_cn",
- "description": "[Forge] forge-1.20.6-50.0.8-installer.jar,来自官方网站源,需要高配机器支撑。",
+ "description": "注意:默认的启动命令是 \"sh ./run.sh\",如果需要在 Windows 上运行,请在安装后将命令修改为 \"start.bat\"",
"title": "Forge 1.20.6 Java 版 (支持模组)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
@@ -184,7 +184,7 @@
},
{
"language": "zh_cn",
- "description": "[Forge] Forge-1.19.2-43.3.13,支持安装 MOD,需要高配机器支撑。",
+ "description": "注意:默认的启动命令是 \"sh ./run.sh\",如果需要在 Windows 上运行,请在安装后将命令修改为 \"start.bat\"",
"title": "Forge 1.19.2 Java 版 (支持模组)",
"runtime": "Java 17+",
"hardware": "RAM 8G+",
From 309c1e5195607a975e0929d0cea9890d4a1da99c Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Tue, 4 Jun 2024 21:28:36 +0800
Subject: [PATCH 204/460] explicitly set ownership to root with -u root
---
install_update.sh | 6 ++++++
install_update_cn.sh | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/install_update.sh b/install_update.sh
index 5ffff6f..f9782a9 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -270,6 +270,9 @@ Install_MCSM_Web_Base() {
if [[ "$USER" == *"mcsm"* ]]; then
# Change file permission to mcsm user
chown -R mcsm:mcsm "$web_path"
+ else
+ # Change file permission to root user
+ chown -R root:root "$web_path"
fi
chmod -R 755 "$web_path"
}
@@ -363,6 +366,9 @@ Install_MCSM_Daemon_Base() {
if [[ "$USER" == *"mcsm"* ]]; then
# Change file permission to mcsm user
chown -R mcsm:mcsm "$daemon_path"
+ else
+ # Change file permission to root user
+ chown -R root:root "$daemon_path"
fi
chmod -R 755 "$daemon_path"
}
diff --git a/install_update_cn.sh b/install_update_cn.sh
index 8a95698..81cdc46 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -268,6 +268,9 @@ Install_MCSM_Web_Base() {
if [[ "$USER" == *"mcsm"* ]]; then
# Change file permission to mcsm user
chown -R mcsm:mcsm "$web_path"
+ else
+ # Change file permission to root user
+ chown -R root:root "$web_path"
fi
chmod -R 755 "$web_path"
}
@@ -361,6 +364,9 @@ Install_MCSM_Daemon_Base() {
if [[ "$USER" == *"mcsm"* ]]; then
# Change file permission to mcsm user
chown -R mcsm:mcsm "$daemon_path"
+ else
+ # Change file permission to root user
+ chown -R root:root "$daemon_path"
fi
chmod -R 755 "$daemon_path"
}
From 826227d001e6c573b0e1a711af0d2e5fa7b7af88 Mon Sep 17 00:00:00 2001
From: unknown <78304455+KevinLu2000@users.noreply.github.com>
Date: Tue, 4 Jun 2024 21:33:44 +0800
Subject: [PATCH 205/460] we no longer move quick-start.md
---
install_update.sh | 2 +-
install_update_cn.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/install_update.sh b/install_update.sh
index f9782a9..c7986f7 100644
--- a/install_update.sh
+++ b/install_update.sh
@@ -571,7 +571,7 @@ Finalize() {
Echo_Red "rm ${backup_path}"
fi
# Move quickstart.md
- mv "${mcsm_down_temp}/quick-start.md" "${mcsmanager_install_path}/quick-start.md"
+ # mv "${mcsm_down_temp}/quick-start.md" "${mcsmanager_install_path}/quick-start.md"
# Remove the temp folder
rm -rf "${mcsm_down_temp}"
diff --git a/install_update_cn.sh b/install_update_cn.sh
index 81cdc46..3da4b81 100644
--- a/install_update_cn.sh
+++ b/install_update_cn.sh
@@ -569,7 +569,7 @@ Finalize() {
Echo_Red "rm ${backup_path}"
fi
# Move quickstart.md
- mv "${mcsm_down_temp}/quick-start.md" "${mcsmanager_install_path}/quick-start.md"
+ # mv "${mcsm_down_temp}/quick-start.md" "${mcsmanager_install_path}/quick-start.md"
# Remove the temp folder
rm -rf "${mcsm_down_temp}"
From 8d9c710d3f030ebb7ffffd339a1ba9a1333620a3 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 6 Aug 2024 10:51:08 +0800
Subject: [PATCH 206/460] Fix: registry.npmmirror.com NodeJS
---
setup_cn.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index 2eb4b2c..8f70160 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -55,7 +55,11 @@ Install_Node() {
rm -rf "node-$node-linux-$arch.tar.gz"
- wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
+ # From https://nodejs.org/
+ # wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
+
+ # From https://registry.npmmirror.com/
+ wget "https://registry.npmmirror.com/-/binary/node/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
tar -zxf "node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to untar node"
From 46760103c15a31b403997add2c525e8ca5654ea1 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Mon, 12 Aug 2024 17:14:30 +0800
Subject: [PATCH 207/460] Update setup_cn.sh
---
setup_cn.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index 8f70160..184639c 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -2,7 +2,7 @@
# 中国大陆需要安装脚本额外配置镜像地址以及低版本的 NodeJS 环境
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_download_addr="http://oss.duzuii.com/d/MCSManager/MCSManager/MCSManager-v10-linux.tar.gz"
+mcsmanager_download_addr="https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz"
package_name="MCSManager-v10-linux.tar.gz"
node="v16.20.2"
arch=$(uname -m)
From 09c74ead242e9998e79c609c5fcc6211825adc5f Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Mon, 12 Aug 2024 19:18:15 +0800
Subject: [PATCH 208/460] Fix: packname
---
setup_cn.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index 184639c..047cf1d 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -3,7 +3,7 @@
# 中国大陆需要安装脚本额外配置镜像地址以及低版本的 NodeJS 环境
mcsmanager_install_path="/opt/mcsmanager"
mcsmanager_download_addr="https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz"
-package_name="MCSManager-v10-linux.tar.gz"
+package_name="mcsmanager_linux_release.tar.gz"
node="v16.20.2"
arch=$(uname -m)
From b2a67fa4949b9e3bdcc9fd061156ad96ad492826 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Mon, 12 Aug 2024 19:21:36 +0800
Subject: [PATCH 209/460] Fix: download addr
---
setup_cn.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index 047cf1d..8605e12 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -2,7 +2,7 @@
# 中国大陆需要安装脚本额外配置镜像地址以及低版本的 NodeJS 环境
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_download_addr="https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz"
+mcsmanager_download_addr="https://cloud.alongw.cn/f/ZMqsl/mcsmanager_linux_release.tar.gz"
package_name="mcsmanager_linux_release.tar.gz"
node="v16.20.2"
arch=$(uname -m)
From 343da18c4cf943a7537d787563a08a7ac42582da Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Wed, 14 Aug 2024 16:16:06 +0800
Subject: [PATCH 210/460] Fix: : rm http://oss.duzuii.com/
---
templates.json | 152 -------------------------------------------------
1 file changed, 152 deletions(-)
diff --git a/templates.json b/templates.json
index 2763b7f..5d480b1 100644
--- a/templates.json
+++ b/templates.json
@@ -11,25 +11,6 @@
}
],
"packages": [
- {
- "language": "en_us",
- "description": "[Paper] Low hardware configuration machine use, Fast setup.",
- "title": "Minecraft 1.20.4 Java",
- "runtime": "Java 17+",
- "hardware": "RAM 6G+",
- "size": "140MB",
- "remark": "Paper Software",
- "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.20.4.zip",
- "author": "mcsmanager.com",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
{
"language": "en_us",
"description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
@@ -87,44 +68,6 @@
"oe": "utf-8"
}
},
- {
- "language": "en_us",
- "description": "[Paper] Recommendation for friends with multiple players",
- "title": "Minecraft 1.19.2 Java",
- "runtime": "Java 17+",
- "hardware": "RAM 8G+",
- "size": "140MB",
- "remark": "Paper Software",
- "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.19.2.zip",
- "author": "mcsmanager.com",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "en_us",
- "description": "[Paper] Recommendation for friends with multiple players",
- "title": "Minecraft 1.18.2 Java",
- "runtime": "Java 17+",
- "hardware": "RAM 8G+",
- "size": "140MB",
- "remark": "Paper Software",
- "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/Global-Paper-1.18.2.zip",
- "author": "mcsmanager.com",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
{
"language": "zh_cn",
"description": "[Paper] 中小型互通服推荐,1.20.4 版本,快速开服,包含ESS、锁箱子、操作回滚、领地商店等基础插件。",
@@ -200,101 +143,6 @@
"ie": "utf-8",
"oe": "utf-8"
}
- },
- {
- "language": "zh_cn",
- "description": "[原版生存] 朋友联机推荐,1.19.2 版本,快速开服,享受原汁原味的极致生存与探索。",
- "title": "Minecraft 1.19.2 Java 原版",
- "runtime": "Java 17+",
- "hardware": "RAM 8G+",
- "size": "140MB",
- "remark": "支持插件,最低 8GB 内存要求",
- "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.2.zip",
- "author": "mcsmanager.com",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "zh_cn",
- "description": "[原版生存] 朋友联机推荐,让你和你的小伙伴一起享受原汁原味的极致生存。",
- "title": "Minecraft 1.19.1 Java 原版",
- "runtime": "Java 17+",
- "hardware": "RAM 8G+",
- "size": "140MB",
- "remark": "支持插件,最低 4GB 内存要求",
- "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.1.zip",
- "author": "mcsmanager.com",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "zh_cn",
- "description": "[原版生存] 适合朋友联机,“荒野更新”(The Wild)旨在为玩家带来现有生物群系的改进和优化。",
- "title": "Minecraft 1.19 Java 原版",
- "runtime": "Java 17+",
- "hardware": "RAM 8G+",
- "size": "140MB",
- "remark": "支持插件,最低 4GB 内存要求",
- "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.19.zip",
- "author": "mcsmanager.com",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "zh_cn",
- "description": "[原版生存] 适合朋友联机推荐,继承上版本的功能并进行了一系列的优化,主流联机版本,插件与MOD较为丰富。",
- "title": "Minecraft 1.18.2 Java 原版",
- "runtime": "Java 17+",
- "hardware": "RAM 8G+",
- "size": "140MB",
- "remark": "支持插件,最低 4GB 内存要求",
- "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.18.2.zip",
- "author": "mcsmanager.com",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "zh_cn",
- "description": "[原版生存] 适合朋友联机,快速开服,服务器搭建,回味老版本的地穴探索。",
- "title": "Minecraft 17.1 Java 原版",
- "runtime": "Java 17+",
- "hardware": "RAM 8G+",
- "size": "160MB",
- "remark": "支持插件,最低 4GB 内存要求",
- "targetLink": "http://oss.duzuii.com/d/MCSManager/Minecraft-Server-Software/paper-1.17.1.zip",
- "author": "mcsmanager.com",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
}
]
}
From 6deea374a24f3212aafd8dccaf7b6e48da87145b Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Thu, 15 Aug 2024 10:29:56 +0800
Subject: [PATCH 211/460] Feat: add pack
---
templates.json | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/templates.json b/templates.json
index 5d480b1..7916d1f 100644
--- a/templates.json
+++ b/templates.json
@@ -11,6 +11,44 @@
}
],
"packages": [
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.20.2 Paper",
+ "title": "Minecraft 1.20.2",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "150MB",
+ "remark": "Includes some basic plugins",
+ "targetLink": "https://cloud.alongw.cn/f/5XlSW/Paper-1.21.1.zip",
+ "author": "alongw.cn",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.20.1 Paper",
+ "title": "Minecraft 1.20.1",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "200MB",
+ "remark": "Includes some basic plugins",
+ "targetLink": "https://cloud.alongw.cn/f/jwjsl/Paper-1.20.1-EN.zip",
+ "author": "alongw.cn",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "en_us",
"description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
@@ -68,6 +106,26 @@
"oe": "utf-8"
}
},
+
+ {
+ "language": "zh_cn",
+ "description": "[Paper] Minecraft 1.21.1 快速开服",
+ "title": "Minecraft 1.20.1",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "250MB",
+ "remark": "包含基础插件,萌新快速开服!低配机器专属!",
+ "targetLink": "https://cloud.alongw.cn/f/DzvHK/Paper-1.21.1-ZH.zip",
+ "author": "alongw.cn",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "zh_cn",
"description": "[Paper] 中小型互通服推荐,1.20.4 版本,快速开服,包含ESS、锁箱子、操作回滚、领地商店等基础插件。",
From b3222e26a96f806497375c930d1c67aa1b642cc5 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Sun, 29 Sep 2024 11:10:04 +0800
Subject: [PATCH 212/460] feat: update download addr
---
setup.sh | 12 ++++++------
setup_cn.sh | 18 +++++++++---------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/setup.sh b/setup.sh
index 025fd03..81fc5b5 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,7 +1,7 @@
#!/bin/bash
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_download_addr="https://github.com/MCSManager/MCSManager/releases/download/v10.2.1/mcsmanager_linux_release.tar.gz"
+mcsmanager_download_addr="https://awwa.cc/mcsm/linux"
package_name="mcsmanager_linux_release.tar.gz"
node="v20.12.2"
arch=$(uname -m)
@@ -91,7 +91,7 @@ Install_MCSManager() {
cd "${mcsmanager_install_path}" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}"
# download MCSManager release
- wget "${mcsmanager_download_addr}" || Red_Error "[x] Failed to download MCSManager"
+ wget "${mcsmanager_download_addr}" -O "${package_name}" || Red_Error "[x] Failed to download MCSManager"
tar -zxf ${package_name} -o || Red_Error "[x] Failed to untar ${package_name}"
rm -rf "${mcsmanager_install_path}/${package_name}"
@@ -167,10 +167,10 @@ WantedBy=multi-user.target
echo_cyan_n "Daemon Address: "
echo_yellow "ws://:24444 (Cluster)"
echo_red "You must expose ports "
- echo_yellow "23333"
- echo_red " and "
- echo_yellow "24444"
- echo_red " to use the service properly on the Internet."
+ echo_yellow "23333"
+ echo_red " and "
+ echo_yellow "24444"
+ echo_red " to use the service properly on the Internet."
echo_yellow " "
echo_cyan "Usage:"
echo_cyan "systemctl start mcsm-{daemon,web}.service"
diff --git a/setup_cn.sh b/setup_cn.sh
index 8605e12..125fbd4 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -2,7 +2,7 @@
# 中国大陆需要安装脚本额外配置镜像地址以及低版本的 NodeJS 环境
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_download_addr="https://cloud.alongw.cn/f/ZMqsl/mcsmanager_linux_release.tar.gz"
+mcsmanager_download_addr="https://awwa.cc/mcsm/linux"
package_name="mcsmanager_linux_release.tar.gz"
node="v16.20.2"
arch=$(uname -m)
@@ -35,7 +35,7 @@ echo_yellow() {
# script info
echo_cyan "+----------------------------------------------------------------------
-| MCSManager 安装脚本
+| MCSManager 安装脚本 (MCSManager Installer)
+----------------------------------------------------------------------
"
@@ -97,7 +97,7 @@ Install_MCSManager() {
cd "${mcsmanager_install_path}" || Red_Error "[x] Failed to enter ${mcsmanager_install_path}"
# download MCSManager release
- wget "${mcsmanager_download_addr}" || Red_Error "[x] Failed to download MCSManager"
+ wget "${mcsmanager_download_addr}" -O "${package_name}" || Red_Error "[x] Failed to download MCSManager"
tar -zxf ${package_name} -o || Red_Error "[x] Failed to untar ${package_name}"
rm -rf "${mcsmanager_install_path}/${package_name}"
@@ -166,20 +166,20 @@ WantedBy=multi-user.target
printf "\n\n\n\n"
echo_yellow "=================================================================="
- echo_green "Installation is complete! Welcome to the MCSManager!!!"
+ echo_green "安装完成,欢迎使用 MCSManager !"
echo_yellow " "
- echo_cyan_n "HTTP Web Service: "
+ echo_cyan_n "主控网页访问地址: "
echo_yellow "http://:23333 (Browser)"
- echo_cyan_n "Daemon Address: "
+ echo_cyan_n "被控守护进程地址: "
echo_yellow "ws://:24444 (Cluster)"
- echo_red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
+ echo_red "默认情况下,你必须开放 23333 和 24444 端口才能确保面板工作正常!"
echo_yellow " "
- echo_cyan "Usage:"
+ echo_cyan "面板开关指令:"
echo_cyan "systemctl start mcsm-{daemon,web}.service"
echo_cyan "systemctl stop mcsm-{daemon,web}.service"
echo_cyan "systemctl restart mcsm-{daemon,web}.service"
echo_yellow " "
- echo_green "Official Document: https://docs.mcsmanager.com/"
+ echo_green "官方文档: https://docs.mcsmanager.com/"
echo_yellow "=================================================================="
}
From 519412c11e48b2fe6ca540fe339edab98f7ea4f7 Mon Sep 17 00:00:00 2001
From: naruko-hstk <34113239+naruko-hstk@users.noreply.github.com>
Date: Wed, 30 Oct 2024 12:17:20 +0800
Subject: [PATCH 213/460] Add Fabric Loader 1.14~1.21(All is latest version)
---
templates.json | 152 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 152 insertions(+)
diff --git a/templates.json b/templates.json
index 7916d1f..ffa09b7 100644
--- a/templates.json
+++ b/templates.json
@@ -106,6 +106,158 @@
"oe": "utf-8"
}
},
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.14.4 Fabric",
+ "title": "Minecraft 1.14.4 with Fabric Loader",
+ "runtime": "Java 8+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.14.4 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.15.2 Fabric",
+ "title": "Minecraft 1.15.2 with Fabric Loader",
+ "runtime": "Java 8+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.15.2 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.16.5 Fabric",
+ "title": "Minecraft 1.16.5 with Fabric Loader",
+ "runtime": "Java 8+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.16.5 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.17.1 Fabric",
+ "title": "Minecraft 1.17.1 with Fabric Loader",
+ "runtime": "Java 16+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.17.1 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.18.2 Fabric",
+ "title": "Minecraft 1.18.2 with Fabric Loader",
+ "runtime": "Java 17+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.18.2 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.19.4 Fabric",
+ "title": "Minecraft 1.19.4 with Fabric Loader",
+ "runtime": "Java 17+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.19.4 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.20.6 Fabric",
+ "title": "Minecraft 1.20.6 with Fabric Loader",
+ "runtime": "Java 21+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.20.6 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.21.3 Fabric",
+ "title": "Minecraft 1.21.3 with Fabric Loader",
+ "runtime": "Java 21+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.21.3 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "zh_cn",
From 14720f0b4c35b956f24ae7b0b5f1be2edf8c2daa Mon Sep 17 00:00:00 2001
From: naruko-hstk <34113239+naruko-hstk@users.noreply.github.com>
Date: Wed, 30 Oct 2024 23:37:13 +0800
Subject: [PATCH 214/460] Fix command bug
---
templates.json | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/templates.json b/templates.json
index ffa09b7..1498510 100644
--- a/templates.json
+++ b/templates.json
@@ -120,7 +120,7 @@
"type": "minecraft/java/fabric",
"startCommand": "java -jar fabric-server-launch.jar -nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.14.4 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.14.4 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -139,7 +139,7 @@
"type": "minecraft/java/fabric",
"startCommand": "java -jar fabric-server-launch.jar -nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.15.2 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.15.2 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -158,7 +158,7 @@
"type": "minecraft/java/fabric",
"startCommand": "java -jar fabric-server-launch.jar -nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.16.5 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.16.5 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -177,7 +177,7 @@
"type": "minecraft/java/fabric",
"startCommand": "java -jar fabric-server-launch.jar -nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.17.1 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.17.1 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -196,7 +196,7 @@
"type": "minecraft/java/fabric",
"startCommand": "java -jar fabric-server-launch.jar -nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.18.2 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.18.2 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -215,7 +215,7 @@
"type": "minecraft/java/fabric",
"startCommand": "java -jar fabric-server-launch.jar -nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.19.4 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.19.4 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -234,7 +234,7 @@
"type": "minecraft/java/fabric",
"startCommand": "java -jar fabric-server-launch.jar -nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.20.6 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.20.6 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -253,7 +253,7 @@
"type": "minecraft/java/fabric",
"startCommand": "java -jar fabric-server-launch.jar -nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar -mcversion 1.21.3 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.21.3 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
From a5d82fa0d3680eabd2e0b0c1dbed9df1e90207b5 Mon Sep 17 00:00:00 2001
From: YuMao
Date: Fri, 8 Nov 2024 22:48:13 +0800
Subject: [PATCH 215/460] Update setup.sh
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index 81fc5b5..ce65bae 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,7 +1,7 @@
#!/bin/bash
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_download_addr="https://awwa.cc/mcsm/linux"
+mcsmanager_download_addr="https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz"
package_name="mcsmanager_linux_release.tar.gz"
node="v20.12.2"
arch=$(uname -m)
From ca50950ebd803f3fbef0707166545697cb9ddaf5 Mon Sep 17 00:00:00 2001
From: YuMao
Date: Fri, 8 Nov 2024 22:48:25 +0800
Subject: [PATCH 216/460] Update setup_cn.sh
---
setup_cn.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index 125fbd4..ad6c155 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -2,7 +2,7 @@
# 中国大陆需要安装脚本额外配置镜像地址以及低版本的 NodeJS 环境
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_download_addr="https://awwa.cc/mcsm/linux"
+mcsmanager_download_addr="https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz"
package_name="mcsmanager_linux_release.tar.gz"
node="v16.20.2"
arch=$(uname -m)
From 79a13e463728c9e8ac5c48fb678d2eabf290b072 Mon Sep 17 00:00:00 2001
From: YuMao
Date: Fri, 13 Dec 2024 16:24:30 +0800
Subject: [PATCH 217/460] Update templates.json
---
templates.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates.json b/templates.json
index 1498510..2603802 100644
--- a/templates.json
+++ b/templates.json
@@ -13,7 +13,7 @@
"packages": [
{
"language": "en_us",
- "description": "[Paper] Minecraft 1.20.2 Paper",
+ "description": "[Paper] Minecraft 1.21.1 Paper",
"title": "Minecraft 1.20.2",
"runtime": "Java 22",
"hardware": "RAM 4G+",
From b26f1aeb9b35a0912a5b8a674e9f6ea0df457664 Mon Sep 17 00:00:00 2001
From: YuMao
Date: Fri, 13 Dec 2024 16:27:00 +0800
Subject: [PATCH 218/460] Update templates.json
---
templates.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates.json b/templates.json
index 2603802..e2745bb 100644
--- a/templates.json
+++ b/templates.json
@@ -14,7 +14,7 @@
{
"language": "en_us",
"description": "[Paper] Minecraft 1.21.1 Paper",
- "title": "Minecraft 1.20.2",
+ "title": "Minecraft 1.21.1",
"runtime": "Java 22",
"hardware": "RAM 4G+",
"size": "150MB",
From ea92539cc8c7ff97566290a24507889f94c7595b Mon Sep 17 00:00:00 2001
From: Antony Blem
Date: Wed, 25 Dec 2024 12:42:01 +0100
Subject: [PATCH 219/460] Update Server templates in templates.json (only
en_us)
---
templates.json | 815 +++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 749 insertions(+), 66 deletions(-)
diff --git a/templates.json b/templates.json
index 1498510..8d9241e 100644
--- a/templates.json
+++ b/templates.json
@@ -11,40 +11,515 @@
}
],
"packages": [
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.21.3 Purpur",
+ "title": "Minecraft 1.21.3",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://api.purpurmc.org/v2/purpur/1.21.3/2358/download",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.21.3-2358.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.21.1 Purpur",
+ "title": "Minecraft 1.21.1",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://api.purpurmc.org/v2/purpur/1.21.1/2329/download",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.21.1-2329.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.20.6 Purpur",
+ "title": "Minecraft 1.20.6",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://api.purpurmc.org/v2/purpur/1.20.6/2233/download",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.20.6-2233.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.20.4 Purpur",
+ "title": "Minecraft 1.20.4",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://api.purpurmc.org/v2/purpur/1.20.4/2176/download",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.20.4-2176.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.20.1 Purpur",
+ "title": "Minecraft 1.20.1",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://api.purpurmc.org/v2/purpur/1.20.1/2062/download",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.20.1-2062.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.19.2 Purpur",
+ "title": "Minecraft 1.19.2",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://api.purpurmc.org/v2/purpur/1.19.2/1858/download",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.19.2-1858.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.18.2 Purpur",
+ "title": "Minecraft 1.18.2",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://api.purpurmc.org/v2/purpur/1.18.2/1632/download",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.18.2-1632.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.17.1 Purpur",
+ "title": "Minecraft 1.17.1",
+ "runtime": "Java 17",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://api.purpurmc.org/v2/purpur/1.17.1/1428/download",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.17.1-1428.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.16.5 Purpur",
+ "title": "Minecraft 1.16.5",
+ "runtime": "Java 17",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://api.purpurmc.org/v2/purpur/1.16.5/1171/download",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.16.5-1171.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.21.3 Paper",
+ "title": "Minecraft 1.21.3",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.3/builds/82/downloads/paper-1.21.3-82.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.21.3-82.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.21.1 Paper",
+ "title": "Minecraft 1.21.1",
+ "runtime": "Java 22",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.1/builds/132/downloads/paper-1.21.1-132.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.21.1-132.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.20.6 Paper",
+ "title": "Minecraft 1.20.6",
+ "runtime": "Java 21",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.20.6/builds/151/downloads/paper-1.20.6-151.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.20.6-151.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.20.4 Paper",
+ "title": "Minecraft 1.20.4",
+ "runtime": "Java 21",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.20.4/builds/499/downloads/paper-1.20.4-499.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.20.4-499.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "en_us",
"description": "[Paper] Minecraft 1.20.2 Paper",
"title": "Minecraft 1.20.2",
- "runtime": "Java 22",
+ "runtime": "Java 21",
"hardware": "RAM 4G+",
"size": "150MB",
"remark": "Includes some basic plugins",
- "targetLink": "https://cloud.alongw.cn/f/5XlSW/Paper-1.21.1.zip",
- "author": "alongw.cn",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.20.2/builds/318/downloads/paper-1.20.2-318.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.20.2-318.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.20.1 Paper",
+ "title": "Minecraft 1.20.1",
+ "runtime": "Java 21",
+ "hardware": "RAM 4G+",
+ "size": "200MB",
+ "remark": "Includes some basic plugins",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.20.1/builds/196/downloads/paper-1.20.1-196.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.20.1-196.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.19.4 Paper",
+ "title": "Minecraft 1.19.4",
+ "runtime": "Java 21",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.19.4/builds/550/downloads/paper-1.19.4-550.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.19.4-550.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.19.2 Paper",
+ "title": "Minecraft 1.19.2",
+ "runtime": "Java 21",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.19.2/builds/307/downloads/paper-1.19.2-307.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.19.2-307.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.18.2 Paper",
+ "title": "Minecraft 1.18.2",
+ "runtime": "Java 21",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.18.2/builds/388/downloads/paper-1.18.2-388.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.18.2-388.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.17.1 Paper",
+ "title": "Minecraft 1.17.1",
+ "runtime": "Java 21",
+ "hardware": "RAM 4G+",
+ "size": "60MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.17.1/builds/411/downloads/paper-1.17.1-411.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.17.1-411.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.16.5 Paper",
+ "title": "Minecraft 1.16.5",
+ "runtime": "Java 21",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.16.5/builds/794/downloads/paper-1.16.5-794.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.16.5-794.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.12.2 Paper",
+ "title": "Minecraft 1.12.2",
+ "runtime": "Java 21",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.12.2/builds/1620/downloads/paper-1.12.2-1620.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.12.2-1620.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.8.8 Paper",
+ "title": "Minecraft 1.8.8",
+ "runtime": "Java 21",
+ "hardware": "RAM 4G+",
+ "size": "20MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.8.8/builds/445/downloads/paper-1.8.8-445.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar paper-1.8.8-445.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "title": "Forge 1.21.4 (Supports Mods)",
+ "runtime": "Java 21+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.21.4-54.0.12/forge-1.21.4-54.0.12-installer.jar",
+ "author": "minecraftforge.net",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.21.4-54.0.12-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "title": "Forge 1.21.3 (Supports Mods)",
+ "runtime": "Java 21+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.21.3-53.0.33/forge-1.21.3-53.0.33-installer.jar",
+ "author": "minecraftforge.net",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.21.3-53.0.33-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "title": "Forge 1.21.1 (Supports Mods)",
+ "runtime": "Java 21+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.21.1-52.0.37/forge-1.21.1-52.0.37-installer.jar",
+ "author": "minecraftforge.net",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.21.1-52.0.37-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "title": "Forge 1.20.6 (Supports Mods)",
+ "runtime": "Java 21+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.6-50.1.31/forge-1.20.6-50.1.31-installer.jar",
+ "author": "minecraftforge.net",
"setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "",
+ "updateCommand": "java -jar forge-1.20.6-50.1.31-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "[Paper] Minecraft 1.20.1 Paper",
- "title": "Minecraft 1.20.1",
- "runtime": "Java 22",
- "hardware": "RAM 4G+",
- "size": "200MB",
- "remark": "Includes some basic plugins",
- "targetLink": "https://cloud.alongw.cn/f/jwjsl/Paper-1.20.1-EN.zip",
- "author": "alongw.cn",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "title": "Forge 1.20.4 (Supports Mods)",
+ "runtime": "Java 21+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.4-49.1.21/forge-1.20.4-49.1.21-installer.jar",
+ "author": "minecraftforge.net",
"setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "",
+ "updateCommand": "java -jar forge-1.20.4-49.1.21-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -52,18 +527,18 @@
{
"language": "en_us",
"description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
- "title": "Forge 1.20.6 (Support Mods)",
+ "title": "Forge 1.20.1 (Supports Mods)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.6-50.0.8/forge-1.20.6-50.0.8-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.22/forge-1.20.1-47.3.22-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.20.6-50.0.8-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.20.1-47.3.22-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -71,18 +546,18 @@
{
"language": "en_us",
"description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
- "title": "Forge 1.20.1 (Support Mods)",
- "runtime": "Java 21+",
+ "title": "Forge 1.19.4 (Supports Mods)",
+ "runtime": "Java 17+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.32/forge-1.20.1-47.2.32-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.4-45.3.15/forge-1.19.4-45.3.15-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.20.1-47.2.32-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.19.4-45.3.15-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -90,27 +565,141 @@
{
"language": "en_us",
"description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
- "title": "Forge 1.19.2 (Support Mods)",
+ "title": "Forge 1.19.2 (Supports Mods)",
"runtime": "Java 17+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.2-43.3.13/forge-1.19.2-43.3.13-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.2-43.4.12/forge-1.19.2-43.4.12-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.19.2-43.3.13-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.19.2-43.4.12-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "[Fabric] Minecraft 1.14.4 Fabric",
- "title": "Minecraft 1.14.4 with Fabric Loader",
- "runtime": "Java 8+",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "title": "Forge 1.18.2 (Supports Mods)",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.18.2-40.2.31/forge-1.18.2-40.2.31-installer.jar",
+ "author": "minecraftforge.net",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.18.2-40.2.31-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "title": "Forge 1.17.1 (Supports Mods)",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.17.1-37.1.1/forge-1.17.1-37.1.1-installer.jar",
+ "author": "minecraftforge.net",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.17.1-37.1.1-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "title": "Forge 1.16.5 (Supports Mods)",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G+",
+ "size": "7MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.16.5-36.2.42/forge-1.16.5-36.2.42-installer.jar",
+ "author": "minecraftforge.net",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.16.5-36.2.42-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "title": "Forge 1.12.2 (Supports Mods)",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G+",
+ "size": "5MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.12.2-14.23.5.2860/forge-1.12.2-14.23.5.2860-installer.jar",
+ "author": "minecraftforge.net",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.12.2-14.23.5.2860-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "title": "Forge 1.8.9 (Supports Mods)",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G+",
+ "size": "5MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.8.9-11.15.1.2318-1.8.9/forge-1.8.9-11.15.1.2318-1.8.9-installer.jar",
+ "author": "minecraftforge.net",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.8.9-11.15.1.2318-1.8.9-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "title": "Forge 1.7.10 (Supports Mods)",
+ "runtime": "Java 17+",
+ "hardware": "RAM 8G+",
+ "size": "5MB",
+ "remark": "Minecraft Forge",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.7.10-10.13.4.1614-1.7.10/forge-1.7.10-10.13.4.1614-1.7.10-installer.jar",
+ "author": "minecraftforge.net",
+ "setupInfo": {
+ "type": "minecraft/java/forge",
+ "startCommand": "sh ./run.sh",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar forge-1.7.10-10.13.4.1614-1.7.10-installer.jar --installServer",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.21.4 Fabric",
+ "title": "Minecraft 1.21.4 with Fabric Loader",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "5MB",
"remark": "Minecraft Fabric",
@@ -118,18 +707,18 @@
"author": "fabricmc.net",
"setupInfo": {
"type": "minecraft/java/fabric",
- "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.14.4 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.21.4 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "[Fabric] Minecraft 1.15.2 Fabric",
- "title": "Minecraft 1.15.2 with Fabric Loader",
- "runtime": "Java 8+",
+ "description": "[Fabric] Minecraft 1.21.3 Fabric",
+ "title": "Minecraft 1.21.3 with Fabric Loader",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "5MB",
"remark": "Minecraft Fabric",
@@ -137,18 +726,18 @@
"author": "fabricmc.net",
"setupInfo": {
"type": "minecraft/java/fabric",
- "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.15.2 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.21.3 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "[Fabric] Minecraft 1.16.5 Fabric",
- "title": "Minecraft 1.16.5 with Fabric Loader",
- "runtime": "Java 8+",
+ "description": "[Fabric] Minecraft 1.21.1 Fabric",
+ "title": "Minecraft 1.21.1 with Fabric Loader",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "5MB",
"remark": "Minecraft Fabric",
@@ -156,18 +745,18 @@
"author": "fabricmc.net",
"setupInfo": {
"type": "minecraft/java/fabric",
- "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.16.5 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.21.1 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "[Fabric] Minecraft 1.17.1 Fabric",
- "title": "Minecraft 1.17.1 with Fabric Loader",
- "runtime": "Java 16+",
+ "description": "[Fabric] Minecraft 1.20.6 Fabric",
+ "title": "Minecraft 1.20.6 with Fabric Loader",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "5MB",
"remark": "Minecraft Fabric",
@@ -175,18 +764,18 @@
"author": "fabricmc.net",
"setupInfo": {
"type": "minecraft/java/fabric",
- "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.17.1 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.20.6 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "[Fabric] Minecraft 1.18.2 Fabric",
- "title": "Minecraft 1.18.2 with Fabric Loader",
- "runtime": "Java 17+",
+ "description": "[Fabric] Minecraft 1.20.4 Fabric",
+ "title": "Minecraft 1.20.4 with Fabric Loader",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "5MB",
"remark": "Minecraft Fabric",
@@ -194,9 +783,28 @@
"author": "fabricmc.net",
"setupInfo": {
"type": "minecraft/java/fabric",
- "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.18.2 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.20.4 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.20.1 Fabric",
+ "title": "Minecraft 1.20.1 with Fabric Loader",
+ "runtime": "Java 21+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.20.1 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -213,7 +821,7 @@
"author": "fabricmc.net",
"setupInfo": {
"type": "minecraft/java/fabric",
- "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
"stopCommand": "stop",
"updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.19.4 -downloadMinecraft -noprofile",
"ie": "utf-8",
@@ -222,9 +830,9 @@
},
{
"language": "en_us",
- "description": "[Fabric] Minecraft 1.20.6 Fabric",
- "title": "Minecraft 1.20.6 with Fabric Loader",
- "runtime": "Java 21+",
+ "description": "[Fabric] Minecraft 1.19.2 Fabric",
+ "title": "Minecraft 1.19.2 with Fabric Loader",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "5MB",
"remark": "Minecraft Fabric",
@@ -232,18 +840,18 @@
"author": "fabricmc.net",
"setupInfo": {
"type": "minecraft/java/fabric",
- "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.20.6 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.19.2 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "[Fabric] Minecraft 1.21.3 Fabric",
- "title": "Minecraft 1.21.3 with Fabric Loader",
- "runtime": "Java 21+",
+ "description": "[Fabric] Minecraft 1.18.2 Fabric",
+ "title": "Minecraft 1.18.2 with Fabric Loader",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "5MB",
"remark": "Minecraft Fabric",
@@ -251,14 +859,89 @@
"author": "fabricmc.net",
"setupInfo": {
"type": "minecraft/java/fabric",
- "startCommand": "java -jar fabric-server-launch.jar -nogui",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
"stopCommand": "stop",
- "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.21.3 -downloadMinecraft -noprofile",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.18.2 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.17.1 Fabric",
+ "title": "Minecraft 1.17.1 with Fabric Loader",
+ "runtime": "Java 16+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.17.1 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.16.5 Fabric",
+ "title": "Minecraft 1.16.5 with Fabric Loader",
+ "runtime": "Java 8+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.16.5 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.15.2 Fabric",
+ "title": "Minecraft 1.15.2 with Fabric Loader",
+ "runtime": "Java 8+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.15.2 -downloadMinecraft -noprofile",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Fabric] Minecraft 1.14.4 Fabric",
+ "title": "Minecraft 1.14.4 with Fabric Loader",
+ "runtime": "Java 8+",
+ "hardware": "RAM 4G+",
+ "size": "5MB",
+ "remark": "Minecraft Fabric",
+ "targetLink": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar",
+ "author": "fabricmc.net",
+ "setupInfo": {
+ "type": "minecraft/java/fabric",
+ "startCommand": "java -jar fabric-server-launch.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "java -jar fabric-installer-1.0.1.jar server -mcversion 1.14.4 -downloadMinecraft -noprofile",
"ie": "utf-8",
"oe": "utf-8"
}
},
-
{
"language": "zh_cn",
"description": "[Paper] Minecraft 1.21.1 快速开服",
@@ -271,7 +954,7 @@
"author": "alongw.cn",
"setupInfo": {
"type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
+ "startCommand": "java -jar server.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
@@ -290,7 +973,7 @@
"author": "alongw.cn",
"setupInfo": {
"type": "minecraft/java",
- "startCommand": "java -jar server.jar -nogui",
+ "startCommand": "java -jar server.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
From e06eb0703652c241075143c0a59c142dbd8094f6 Mon Sep 17 00:00:00 2001
From: Antony Blem
Date: Wed, 25 Dec 2024 12:54:12 +0100
Subject: [PATCH 220/460] fix: Give Purpur and Paper Instances thier tags
automatically after creating it
---
templates.json | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/templates.json b/templates.json
index 8d9241e..5749d48 100644
--- a/templates.json
+++ b/templates.json
@@ -22,7 +22,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.21.3/2358/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/purpur",
"startCommand": "java -jar purpur-1.21.3-2358.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -41,7 +41,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.21.1/2329/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/purpur",
"startCommand": "java -jar purpur-1.21.1-2329.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -60,7 +60,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.20.6/2233/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/purpur",
"startCommand": "java -jar purpur-1.20.6-2233.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -79,7 +79,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.20.4/2176/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/purpur",
"startCommand": "java -jar purpur-1.20.4-2176.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -98,7 +98,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.20.1/2062/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/purpur",
"startCommand": "java -jar purpur-1.20.1-2062.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -117,7 +117,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.19.2/1858/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/purpur",
"startCommand": "java -jar purpur-1.19.2-1858.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -136,7 +136,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.18.2/1632/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/purpur",
"startCommand": "java -jar purpur-1.18.2-1632.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -155,7 +155,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.17.1/1428/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/purpur",
"startCommand": "java -jar purpur-1.17.1-1428.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -174,7 +174,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.16.5/1171/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/purpur",
"startCommand": "java -jar purpur-1.16.5-1171.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -193,7 +193,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.3/builds/82/downloads/paper-1.21.3-82.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.21.3-82.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -212,7 +212,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.1/builds/132/downloads/paper-1.21.1-132.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.21.1-132.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -231,7 +231,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.20.6/builds/151/downloads/paper-1.20.6-151.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.20.6-151.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -250,7 +250,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.20.4/builds/499/downloads/paper-1.20.4-499.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.20.4-499.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -269,7 +269,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.20.2/builds/318/downloads/paper-1.20.2-318.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.20.2-318.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -288,7 +288,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.20.1/builds/196/downloads/paper-1.20.1-196.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.20.1-196.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -307,7 +307,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.19.4/builds/550/downloads/paper-1.19.4-550.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.19.4-550.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -326,7 +326,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.19.2/builds/307/downloads/paper-1.19.2-307.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.19.2-307.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -364,7 +364,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.17.1/builds/411/downloads/paper-1.17.1-411.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.17.1-411.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -383,7 +383,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.16.5/builds/794/downloads/paper-1.16.5-794.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.16.5-794.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -402,7 +402,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.12.2/builds/1620/downloads/paper-1.12.2-1620.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.12.2-1620.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -421,7 +421,7 @@
"targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.8.8/builds/445/downloads/paper-1.8.8-445.jar",
"author": "papermc.io",
"setupInfo": {
- "type": "minecraft/java",
+ "type": "minecraft/java/paper",
"startCommand": "java -jar paper-1.8.8-445.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
From 3068a1f699c68bf98b3ccc9f22ddf7e329eeca4f Mon Sep 17 00:00:00 2001
From: Antony Blem
Date: Wed, 25 Dec 2024 13:14:34 +0100
Subject: [PATCH 221/460] fix: Remove Purpur tag because the latest version
doesn't support it yet
---
templates.json | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/templates.json b/templates.json
index cdc028f..8f31593 100644
--- a/templates.json
+++ b/templates.json
@@ -22,7 +22,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.21.3/2358/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java/purpur",
+ "type": "minecraft/java",
"startCommand": "java -jar purpur-1.21.3-2358.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -41,7 +41,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.21.1/2329/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java/purpur",
+ "type": "minecraft/java",
"startCommand": "java -jar purpur-1.21.1-2329.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -60,7 +60,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.20.6/2233/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java/purpur",
+ "type": "minecraft/java",
"startCommand": "java -jar purpur-1.20.6-2233.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -79,7 +79,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.20.4/2176/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java/purpur",
+ "type": "minecraft/java",
"startCommand": "java -jar purpur-1.20.4-2176.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -98,7 +98,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.20.1/2062/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java/purpur",
+ "type": "minecraft/java",
"startCommand": "java -jar purpur-1.20.1-2062.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -117,7 +117,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.19.2/1858/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java/purpur",
+ "type": "minecraft/java",
"startCommand": "java -jar purpur-1.19.2-1858.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -136,7 +136,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.18.2/1632/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java/purpur",
+ "type": "minecraft/java",
"startCommand": "java -jar purpur-1.18.2-1632.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -155,7 +155,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.17.1/1428/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java/purpur",
+ "type": "minecraft/java",
"startCommand": "java -jar purpur-1.17.1-1428.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
@@ -174,7 +174,7 @@
"targetLink": "https://api.purpurmc.org/v2/purpur/1.16.5/1171/download",
"author": "purpurmc.org",
"setupInfo": {
- "type": "minecraft/java/purpur",
+ "type": "minecraft/java",
"startCommand": "java -jar purpur-1.16.5-1171.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
From 80a5d31f2e4736fb83ce4c72dbccfaa235251872 Mon Sep 17 00:00:00 2001
From: YuMao
Date: Thu, 26 Dec 2024 16:03:54 +0800
Subject: [PATCH 222/460] Update setup_cn.sh
---
setup_cn.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup_cn.sh b/setup_cn.sh
index ad6c155..4532f2d 100755
--- a/setup_cn.sh
+++ b/setup_cn.sh
@@ -2,7 +2,7 @@
# 中国大陆需要安装脚本额外配置镜像地址以及低版本的 NodeJS 环境
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_download_addr="https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz"
+mcsmanager_download_addr="http://47.99.81.8/mcsmanager_linux_release.tar.gz"
package_name="mcsmanager_linux_release.tar.gz"
node="v16.20.2"
arch=$(uname -m)
From 08b51cead0866b729bf0f412894af0c5a2275eae Mon Sep 17 00:00:00 2001
From: YuMao
Date: Thu, 26 Dec 2024 16:04:13 +0800
Subject: [PATCH 223/460] Update setup.sh
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index ce65bae..df2211b 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,7 +1,7 @@
#!/bin/bash
mcsmanager_install_path="/opt/mcsmanager"
-mcsmanager_download_addr="https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/mcsmanager_linux_release.tar.gz"
+mcsmanager_download_addr="http://47.99.81.8/mcsmanager_linux_release.tar.gz"
package_name="mcsmanager_linux_release.tar.gz"
node="v20.12.2"
arch=$(uname -m)
From 8f95b7662dd0c9537b6b43ee71d0df9fc41ccb7c Mon Sep 17 00:00:00 2001
From: Antony Blem
Date: Mon, 30 Dec 2024 11:56:30 +0100
Subject: [PATCH 224/460] fix: Paper 1.20.2 had code of 1.21.1 in
templates.json
---
templates.json | 5 -----
1 file changed, 5 deletions(-)
diff --git a/templates.json b/templates.json
index 8f31593..f7036f9 100644
--- a/templates.json
+++ b/templates.json
@@ -263,11 +263,6 @@
"description": "[Paper] Minecraft 1.20.2 Paper",
"title": "Minecraft 1.20.2",
"runtime": "Java 21",
-
- "description": "[Paper] Minecraft 1.21.1 Paper",
- "title": "Minecraft 1.21.1",
- "runtime": "Java 22",
-
"hardware": "RAM 4G+",
"size": "150MB",
"remark": "Includes some basic plugins",
From aa6c64f81b8dad3e7ec315043399f0e44ee9c320 Mon Sep 17 00:00:00 2001
From: Antony Blem
Date: Mon, 30 Dec 2024 12:07:11 +0100
Subject: [PATCH 225/460] feat: Add Vanilla Minecraft Versions (only en_US)
---
templates.json | 209 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 209 insertions(+)
diff --git a/templates.json b/templates.json
index f7036f9..7488ecc 100644
--- a/templates.json
+++ b/templates.json
@@ -942,6 +942,215 @@
"oe": "utf-8"
}
},
+ {
+ "language": "en_us",
+ "description": "[Vanilla] Minecraft 1.21.4",
+ "title": "Minecraft 1.21.4",
+ "runtime": "Java 21+",
+ "hardware": "RAM 2G+",
+ "size": "55MB",
+ "remark": "Minecraft Java",
+ "targetLink": "https://piston-data.mojang.com/v1/objects/4707d00eb834b446575d89a61a11b5d548d8c001/server.jar",
+ "author": "Mojang",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Vanilla] Minecraft 1.21.1",
+ "title": "Minecraft 1.21.1",
+ "runtime": "Java 21+",
+ "hardware": "RAM 2G+",
+ "size": "50MB",
+ "remark": "Minecraft Java",
+ "targetLink": "https://piston-data.mojang.com/v1/objects/59353fb40c36d304f2035d51e7d6e6baa98dc05c/server.jar",
+ "author": "Mojang",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Vanilla] Minecraft 1.20.6",
+ "title": "Minecraft 1.20.6",
+ "runtime": "Java 21+",
+ "hardware": "RAM 2G+",
+ "size": "50MB",
+ "remark": "Minecraft Java",
+ "targetLink": "https://piston-data.mojang.com/v1/objects/145ff0858209bcfc164859ba735d4199aafa1eea/server.jar",
+ "author": "Mojang",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Vanilla] Minecraft 1.20.4",
+ "title": "Minecraft 1.20.4",
+ "runtime": "Java 21+",
+ "hardware": "RAM 2G+",
+ "size": "50MB",
+ "remark": "Minecraft Java",
+ "targetLink": "https://piston-data.mojang.com/v1/objects/8dd1a28015f51b1803213892b50b7b4fc76e594d/server.jar",
+ "author": "Mojang",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Vanilla] Minecraft 1.20.1",
+ "title": "Minecraft 1.20.1",
+ "runtime": "Java 21+",
+ "hardware": "RAM 2G+",
+ "size": "50MB",
+ "remark": "Minecraft Java",
+ "targetLink": "https://piston-data.mojang.com/v1/objects/84194a2f286ef7c14ed7ce0090dba59902951553/server.jar",
+ "author": "Mojang",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Vanilla] Minecraft 1.19.4",
+ "title": "Minecraft 1.19.4",
+ "runtime": "Java 19+",
+ "hardware": "RAM 2G+",
+ "size": "50MB",
+ "remark": "Minecraft Java",
+ "targetLink": "https://piston-data.mojang.com/v1/objects/8f3112a1049751cc472ec13e397eade5336ca7ae/server.jar",
+ "author": "Mojang",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Vanilla] Minecraft 1.18.2",
+ "title": "Minecraft 1.18.2",
+ "runtime": "Java 19+",
+ "hardware": "RAM 2G+",
+ "size": "45MB",
+ "remark": "Minecraft Java",
+ "targetLink": "https://piston-data.mojang.com/v1/objects/c8f83c5655308435b3dcf03c06d9fe8740a77469/server.jar",
+ "author": "Mojang",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Vanilla] Minecraft 1.17.1",
+ "title": "Minecraft 1.17.1",
+ "runtime": "Java 19+",
+ "hardware": "RAM 2G+",
+ "size": "45MB",
+ "remark": "Minecraft Java",
+ "targetLink": "https://piston-data.mojang.com/v1/objects/a16d67e5807f57fc4e550299cf20226194497dc2/server.jar",
+ "author": "Mojang",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Vanilla] Minecraft 1.16.5",
+ "title": "Minecraft 1.16.5",
+ "runtime": "Java 19+",
+ "hardware": "RAM 2G+",
+ "size": "45MB",
+ "remark": "Minecraft Java",
+ "targetLink": "https://piston-data.mojang.com/v1/objects/1b557e7b033b583cd9f66746b7a9ab1ec1673ced/server.jar",
+ "author": "Mojang",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Vanilla] Minecraft 1.12.2",
+ "title": "Minecraft 1.12.2",
+ "runtime": "Java 11+",
+ "hardware": "RAM 2G+",
+ "size": "30MB",
+ "remark": "Minecraft Java",
+ "targetLink": "https://piston-data.mojang.com/v1/objects/886945bfb2b978778c3a0288fd7fab09d315b25f/server.jar",
+ "author": "Mojang",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Vanilla] Minecraft 1.8.9",
+ "title": "Minecraft 1.8.9",
+ "runtime": "Java 8+",
+ "hardware": "RAM 2G+",
+ "size": "10MB",
+ "remark": "Minecraft Java",
+ "targetLink": "https://launcher.mojang.com/v1/objects/b58b2ceb36e01bcd8dbf49c8fb66c55a9f0676cd/server.jar",
+ "author": "Mojang",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar server.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "zh_cn",
"description": "[Paper] Minecraft 1.21.1 快速开服",
From 5b19d5e4b34a1875145dce4d2feb6051c3b28c5d Mon Sep 17 00:00:00 2001
From: Antony Blem
Date: Mon, 30 Dec 2024 12:16:44 +0100
Subject: [PATCH 226/460] fix: Correct required Java versions for each MC
version
---
templates.json | 78 +++++++++++++++++++++++++-------------------------
1 file changed, 39 insertions(+), 39 deletions(-)
diff --git a/templates.json b/templates.json
index 7488ecc..f02c372 100644
--- a/templates.json
+++ b/templates.json
@@ -15,7 +15,7 @@
"language": "en_us",
"description": "[Purpur] Minecraft 1.21.3 Purpur",
"title": "Minecraft 1.21.3",
- "runtime": "Java 22",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
@@ -34,7 +34,7 @@
"language": "en_us",
"description": "[Purpur] Minecraft 1.21.1 Purpur",
"title": "Minecraft 1.21.1",
- "runtime": "Java 22",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
@@ -53,7 +53,7 @@
"language": "en_us",
"description": "[Purpur] Minecraft 1.20.6 Purpur",
"title": "Minecraft 1.20.6",
- "runtime": "Java 22",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
@@ -72,7 +72,7 @@
"language": "en_us",
"description": "[Purpur] Minecraft 1.20.4 Purpur",
"title": "Minecraft 1.20.4",
- "runtime": "Java 22",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
@@ -91,7 +91,7 @@
"language": "en_us",
"description": "[Purpur] Minecraft 1.20.1 Purpur",
"title": "Minecraft 1.20.1",
- "runtime": "Java 22",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
@@ -110,7 +110,7 @@
"language": "en_us",
"description": "[Purpur] Minecraft 1.19.2 Purpur",
"title": "Minecraft 1.19.2",
- "runtime": "Java 22",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
@@ -129,7 +129,7 @@
"language": "en_us",
"description": "[Purpur] Minecraft 1.18.2 Purpur",
"title": "Minecraft 1.18.2",
- "runtime": "Java 22",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
@@ -148,7 +148,7 @@
"language": "en_us",
"description": "[Purpur] Minecraft 1.17.1 Purpur",
"title": "Minecraft 1.17.1",
- "runtime": "Java 17",
+ "runtime": "Java 16+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
@@ -167,7 +167,7 @@
"language": "en_us",
"description": "[Purpur] Minecraft 1.16.5 Purpur",
"title": "Minecraft 1.16.5",
- "runtime": "Java 17",
+ "runtime": "Java 8+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
@@ -186,7 +186,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.21.3 Paper",
"title": "Minecraft 1.21.3",
- "runtime": "Java 22",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
@@ -205,7 +205,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.21.1 Paper",
"title": "Minecraft 1.21.1",
- "runtime": "Java 22",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
@@ -224,7 +224,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.20.6 Paper",
"title": "Minecraft 1.20.6",
- "runtime": "Java 21",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
@@ -243,7 +243,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.20.4 Paper",
"title": "Minecraft 1.20.4",
- "runtime": "Java 21",
+ "runtime": "Java 21+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
@@ -262,7 +262,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.20.2 Paper",
"title": "Minecraft 1.20.2",
- "runtime": "Java 21",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "150MB",
"remark": "Includes some basic plugins",
@@ -281,7 +281,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.20.1 Paper",
"title": "Minecraft 1.20.1",
- "runtime": "Java 21",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "200MB",
"remark": "Includes some basic plugins",
@@ -300,7 +300,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.19.4 Paper",
"title": "Minecraft 1.19.4",
- "runtime": "Java 21",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
@@ -319,7 +319,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.19.2 Paper",
"title": "Minecraft 1.19.2",
- "runtime": "Java 21",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
@@ -338,7 +338,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.18.2 Paper",
"title": "Minecraft 1.18.2",
- "runtime": "Java 21",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
@@ -357,7 +357,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.17.1 Paper",
"title": "Minecraft 1.17.1",
- "runtime": "Java 21",
+ "runtime": "Java 16+",
"hardware": "RAM 4G+",
"size": "60MB",
"remark": "Only Paper included",
@@ -376,7 +376,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.16.5 Paper",
"title": "Minecraft 1.16.5",
- "runtime": "Java 21",
+ "runtime": "Java 8+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
@@ -395,7 +395,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.12.2 Paper",
"title": "Minecraft 1.12.2",
- "runtime": "Java 21",
+ "runtime": "Java 8+",
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
@@ -414,7 +414,7 @@
"language": "en_us",
"description": "[Paper] Minecraft 1.8.8 Paper",
"title": "Minecraft 1.8.8",
- "runtime": "Java 21",
+ "runtime": "Java 7+",
"hardware": "RAM 4G+",
"size": "20MB",
"remark": "Only Paper included",
@@ -528,7 +528,7 @@
"language": "en_us",
"description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
"title": "Forge 1.20.1 (Supports Mods)",
- "runtime": "Java 21+",
+ "runtime": "Java 17+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
@@ -604,7 +604,7 @@
"language": "en_us",
"description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
"title": "Forge 1.17.1 (Supports Mods)",
- "runtime": "Java 17+",
+ "runtime": "Java 16+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
@@ -623,7 +623,7 @@
"language": "en_us",
"description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
"title": "Forge 1.16.5 (Supports Mods)",
- "runtime": "Java 17+",
+ "runtime": "Java 8+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
@@ -642,7 +642,7 @@
"language": "en_us",
"description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
"title": "Forge 1.12.2 (Supports Mods)",
- "runtime": "Java 17+",
+ "runtime": "Java 8+",
"hardware": "RAM 8G+",
"size": "5MB",
"remark": "Minecraft Forge",
@@ -661,7 +661,7 @@
"language": "en_us",
"description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
"title": "Forge 1.8.9 (Supports Mods)",
- "runtime": "Java 17+",
+ "runtime": "Java 7+",
"hardware": "RAM 8G+",
"size": "5MB",
"remark": "Minecraft Forge",
@@ -680,7 +680,7 @@
"language": "en_us",
"description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
"title": "Forge 1.7.10 (Supports Mods)",
- "runtime": "Java 17+",
+ "runtime": "Java 7+",
"hardware": "RAM 8G+",
"size": "5MB",
"remark": "Minecraft Forge",
@@ -794,7 +794,7 @@
"language": "en_us",
"description": "[Fabric] Minecraft 1.20.1 Fabric",
"title": "Minecraft 1.20.1 with Fabric Loader",
- "runtime": "Java 21+",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "5MB",
"remark": "Minecraft Fabric",
@@ -1022,7 +1022,7 @@
"language": "en_us",
"description": "[Vanilla] Minecraft 1.20.1",
"title": "Minecraft 1.20.1",
- "runtime": "Java 21+",
+ "runtime": "Java 17+",
"hardware": "RAM 2G+",
"size": "50MB",
"remark": "Minecraft Java",
@@ -1041,7 +1041,7 @@
"language": "en_us",
"description": "[Vanilla] Minecraft 1.19.4",
"title": "Minecraft 1.19.4",
- "runtime": "Java 19+",
+ "runtime": "Java 17+",
"hardware": "RAM 2G+",
"size": "50MB",
"remark": "Minecraft Java",
@@ -1060,7 +1060,7 @@
"language": "en_us",
"description": "[Vanilla] Minecraft 1.18.2",
"title": "Minecraft 1.18.2",
- "runtime": "Java 19+",
+ "runtime": "Java 17+",
"hardware": "RAM 2G+",
"size": "45MB",
"remark": "Minecraft Java",
@@ -1079,7 +1079,7 @@
"language": "en_us",
"description": "[Vanilla] Minecraft 1.17.1",
"title": "Minecraft 1.17.1",
- "runtime": "Java 19+",
+ "runtime": "Java 16+",
"hardware": "RAM 2G+",
"size": "45MB",
"remark": "Minecraft Java",
@@ -1098,7 +1098,7 @@
"language": "en_us",
"description": "[Vanilla] Minecraft 1.16.5",
"title": "Minecraft 1.16.5",
- "runtime": "Java 19+",
+ "runtime": "Java 8+",
"hardware": "RAM 2G+",
"size": "45MB",
"remark": "Minecraft Java",
@@ -1117,7 +1117,7 @@
"language": "en_us",
"description": "[Vanilla] Minecraft 1.12.2",
"title": "Minecraft 1.12.2",
- "runtime": "Java 11+",
+ "runtime": "Java 8+",
"hardware": "RAM 2G+",
"size": "30MB",
"remark": "Minecraft Java",
@@ -1136,7 +1136,7 @@
"language": "en_us",
"description": "[Vanilla] Minecraft 1.8.9",
"title": "Minecraft 1.8.9",
- "runtime": "Java 8+",
+ "runtime": "Java 7+",
"hardware": "RAM 2G+",
"size": "10MB",
"remark": "Minecraft Java",
@@ -1155,7 +1155,7 @@
"language": "zh_cn",
"description": "[Paper] Minecraft 1.21.1 快速开服",
"title": "Minecraft 1.20.1",
- "runtime": "Java 22",
+ "runtime": "Java 17+",
"hardware": "RAM 4G+",
"size": "250MB",
"remark": "包含基础插件,萌新快速开服!低配机器专属!",
@@ -1174,7 +1174,7 @@
"language": "zh_cn",
"description": "[Paper] 中小型互通服推荐,1.20.4 版本,快速开服,包含ESS、锁箱子、操作回滚、领地商店等基础插件。",
"title": "Minecraft 1.20.4 (低配机器推荐)",
- "runtime": "Java 17+",
+ "runtime": "Java 21+",
"hardware": "RAM 6G+",
"size": "140MB",
"remark": "支持插件,最低 8GB 内存要求",
@@ -1193,7 +1193,7 @@
"language": "zh_cn",
"description": "注意:默认的启动命令是 \"sh ./run.sh\",如果需要在 Windows 上运行,请在安装后将命令修改为 \"start.bat\"",
"title": "Forge 1.20.1 Java 版 (支持模组)",
- "runtime": "Java 21+",
+ "runtime": "Java 17+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
From b12d5ab9b8ec3d5c737affceddcbc7b48dc493ad Mon Sep 17 00:00:00 2001
From: Antony Blem
Date: Mon, 13 Jan 2025 19:50:13 +0100
Subject: [PATCH 227/460] feat: Add PaperMC Build 1.21.4-107 as a Server
template
---
templates.json | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/templates.json b/templates.json
index f02c372..f3f3d82 100644
--- a/templates.json
+++ b/templates.json
@@ -182,6 +182,25 @@
"oe": "utf-8"
}
},
+ {
+ "language": "en_us",
+ "description": "[Paper] Minecraft 1.21.4 Paper",
+ "title": "Minecraft 1.21.4",
+ "runtime": "Java 21+",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Paper included",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/107/downloads/paper-1.21.4-107.jar",
+ "author": "papermc.io",
+ "setupInfo": {
+ "type": "minecraft/java/paper",
+ "startCommand": "java -jar paper-1.21.4-107.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "en_us",
"description": "[Paper] Minecraft 1.21.3 Paper",
From 8376dbfb1084190499de545a00f220308064caf9 Mon Sep 17 00:00:00 2001
From: Antony
Date: Tue, 14 Jan 2025 07:58:52 +0100
Subject: [PATCH 228/460] feat: Update Paper Build to 1.21.4-109
---
templates.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates.json b/templates.json
index f3f3d82..983b65d 100644
--- a/templates.json
+++ b/templates.json
@@ -190,11 +190,11 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
- "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/107/downloads/paper-1.21.4-107.jar",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/109/downloads/paper-1.21.4-109.jar",
"author": "papermc.io",
"setupInfo": {
"type": "minecraft/java/paper",
- "startCommand": "java -jar paper-1.21.4-107.jar nogui",
+ "startCommand": "java -jar paper-1.21.4-109.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
From 57f5d21a45310e64860f044abce59769d7a7a553 Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 14 Jan 2025 16:44:02 +0800
Subject: [PATCH 229/460] fix: del purpur packs
---
templates.json | 173 +------------------------------------------------
1 file changed, 1 insertion(+), 172 deletions(-)
diff --git a/templates.json b/templates.json
index f3f3d82..4893e66 100644
--- a/templates.json
+++ b/templates.json
@@ -11,177 +11,6 @@
}
],
"packages": [
- {
- "language": "en_us",
- "description": "[Purpur] Minecraft 1.21.3 Purpur",
- "title": "Minecraft 1.21.3",
- "runtime": "Java 21+",
- "hardware": "RAM 4G+",
- "size": "50MB",
- "remark": "Only Purpur included",
- "targetLink": "https://api.purpurmc.org/v2/purpur/1.21.3/2358/download",
- "author": "purpurmc.org",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar purpur-1.21.3-2358.jar nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "en_us",
- "description": "[Purpur] Minecraft 1.21.1 Purpur",
- "title": "Minecraft 1.21.1",
- "runtime": "Java 21+",
- "hardware": "RAM 4G+",
- "size": "50MB",
- "remark": "Only Purpur included",
- "targetLink": "https://api.purpurmc.org/v2/purpur/1.21.1/2329/download",
- "author": "purpurmc.org",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar purpur-1.21.1-2329.jar nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "en_us",
- "description": "[Purpur] Minecraft 1.20.6 Purpur",
- "title": "Minecraft 1.20.6",
- "runtime": "Java 21+",
- "hardware": "RAM 4G+",
- "size": "50MB",
- "remark": "Only Purpur included",
- "targetLink": "https://api.purpurmc.org/v2/purpur/1.20.6/2233/download",
- "author": "purpurmc.org",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar purpur-1.20.6-2233.jar nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "en_us",
- "description": "[Purpur] Minecraft 1.20.4 Purpur",
- "title": "Minecraft 1.20.4",
- "runtime": "Java 21+",
- "hardware": "RAM 4G+",
- "size": "50MB",
- "remark": "Only Purpur included",
- "targetLink": "https://api.purpurmc.org/v2/purpur/1.20.4/2176/download",
- "author": "purpurmc.org",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar purpur-1.20.4-2176.jar nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "en_us",
- "description": "[Purpur] Minecraft 1.20.1 Purpur",
- "title": "Minecraft 1.20.1",
- "runtime": "Java 17+",
- "hardware": "RAM 4G+",
- "size": "50MB",
- "remark": "Only Purpur included",
- "targetLink": "https://api.purpurmc.org/v2/purpur/1.20.1/2062/download",
- "author": "purpurmc.org",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar purpur-1.20.1-2062.jar nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "en_us",
- "description": "[Purpur] Minecraft 1.19.2 Purpur",
- "title": "Minecraft 1.19.2",
- "runtime": "Java 17+",
- "hardware": "RAM 4G+",
- "size": "50MB",
- "remark": "Only Purpur included",
- "targetLink": "https://api.purpurmc.org/v2/purpur/1.19.2/1858/download",
- "author": "purpurmc.org",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar purpur-1.19.2-1858.jar nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "en_us",
- "description": "[Purpur] Minecraft 1.18.2 Purpur",
- "title": "Minecraft 1.18.2",
- "runtime": "Java 17+",
- "hardware": "RAM 4G+",
- "size": "50MB",
- "remark": "Only Purpur included",
- "targetLink": "https://api.purpurmc.org/v2/purpur/1.18.2/1632/download",
- "author": "purpurmc.org",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar purpur-1.18.2-1632.jar nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "en_us",
- "description": "[Purpur] Minecraft 1.17.1 Purpur",
- "title": "Minecraft 1.17.1",
- "runtime": "Java 16+",
- "hardware": "RAM 4G+",
- "size": "50MB",
- "remark": "Only Purpur included",
- "targetLink": "https://api.purpurmc.org/v2/purpur/1.17.1/1428/download",
- "author": "purpurmc.org",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar purpur-1.17.1-1428.jar nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
- {
- "language": "en_us",
- "description": "[Purpur] Minecraft 1.16.5 Purpur",
- "title": "Minecraft 1.16.5",
- "runtime": "Java 8+",
- "hardware": "RAM 4G+",
- "size": "50MB",
- "remark": "Only Purpur included",
- "targetLink": "https://api.purpurmc.org/v2/purpur/1.16.5/1171/download",
- "author": "purpurmc.org",
- "setupInfo": {
- "type": "minecraft/java",
- "startCommand": "java -jar purpur-1.16.5-1171.jar nogui",
- "stopCommand": "stop",
- "updateCommand": "",
- "ie": "utf-8",
- "oe": "utf-8"
- }
- },
{
"language": "en_us",
"description": "[Paper] Minecraft 1.21.4 Paper",
@@ -427,7 +256,7 @@
"updateCommand": "",
"ie": "utf-8",
"oe": "utf-8"
- }
+ }
},
{
"language": "en_us",
From 89e073e50c8a17216b963afea23f39a5ce9606b2 Mon Sep 17 00:00:00 2001
From: Antony
Date: Tue, 14 Jan 2025 11:41:50 +0000
Subject: [PATCH 230/460] fix: Hopefully fix Purpur Server Versions
---
templates.json | 171 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 171 insertions(+)
diff --git a/templates.json b/templates.json
index 9fd08b6..6fa5b4c 100644
--- a/templates.json
+++ b/templates.json
@@ -11,6 +11,177 @@
}
],
"packages": [
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.21.3 Purpur",
+ "title": "Minecraft 1.21.3",
+ "runtime": "Java 21+",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.21.3-2358.jar",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.21.3-2358.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.21.1 Purpur",
+ "title": "Minecraft 1.21.1",
+ "runtime": "Java 21+",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.21.1-2329.jar",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.21.1-2329.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.20.6 Purpur",
+ "title": "Minecraft 1.20.6",
+ "runtime": "Java 21+",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.20.6-2233.jar",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.20.6-2233.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.20.4 Purpur",
+ "title": "Minecraft 1.20.4",
+ "runtime": "Java 21+",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.20.4-2176.jar",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.20.4-2176.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.20.1 Purpur",
+ "title": "Minecraft 1.20.1",
+ "runtime": "Java 17+",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.20.1-2062.jar",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.20.1-2062.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.19.2 Purpur",
+ "title": "Minecraft 1.19.2",
+ "runtime": "Java 17+",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.19.2-1858.jar",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.19.2-1858.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.18.2 Purpur",
+ "title": "Minecraft 1.18.2",
+ "runtime": "Java 17+",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.18.2-1632.jar",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.18.2-1632.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.17.1 Purpur",
+ "title": "Minecraft 1.17.1",
+ "runtime": "Java 16+",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.17.1-1428.jar",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.17.1-1428.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.16.5 Purpur",
+ "title": "Minecraft 1.16.5",
+ "runtime": "Java 8+",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.16.5-1171.jar",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.16.5-1171.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "en_us",
"description": "[Paper] Minecraft 1.21.4 Paper",
From 8de943a90e3f6775509680c52614b09bd22a59ff Mon Sep 17 00:00:00 2001
From: Antony Blem
Date: Tue, 14 Jan 2025 15:32:18 +0100
Subject: [PATCH 231/460] fix: Update download links for Purpur to download
from Releases
---
templates.json | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/templates.json b/templates.json
index 6fa5b4c..b4b55cb 100644
--- a/templates.json
+++ b/templates.json
@@ -19,7 +19,7 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
- "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.21.3-2358.jar",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.21.3-2358.jar",
"author": "purpurmc.org",
"setupInfo": {
"type": "minecraft/java",
@@ -38,7 +38,7 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
- "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.21.1-2329.jar",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.21.1-2329.jar",
"author": "purpurmc.org",
"setupInfo": {
"type": "minecraft/java",
@@ -57,7 +57,7 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
- "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.20.6-2233.jar",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.20.6-2233.jar",
"author": "purpurmc.org",
"setupInfo": {
"type": "minecraft/java",
@@ -76,7 +76,7 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
- "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.20.4-2176.jar",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.20.4-2176.jar",
"author": "purpurmc.org",
"setupInfo": {
"type": "minecraft/java",
@@ -95,7 +95,7 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
- "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.20.1-2062.jar",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.20.1-2062.jar",
"author": "purpurmc.org",
"setupInfo": {
"type": "minecraft/java",
@@ -114,7 +114,7 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
- "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.19.2-1858.jar",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.19.2-1858.jar",
"author": "purpurmc.org",
"setupInfo": {
"type": "minecraft/java",
@@ -133,7 +133,7 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
- "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.18.2-1632.jar",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.18.2-1632.jar",
"author": "purpurmc.org",
"setupInfo": {
"type": "minecraft/java",
@@ -152,7 +152,7 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
- "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.17.1-1428.jar",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.17.1-1428.jar",
"author": "purpurmc.org",
"setupInfo": {
"type": "minecraft/java",
@@ -171,7 +171,7 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
- "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/raw/refs/heads/master/purpur/purpur-1.16.5-1171.jar",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.16.5-1171.jar",
"author": "purpurmc.org",
"setupInfo": {
"type": "minecraft/java",
From d33a268aabdfebc378c5d98ecf8b61700ffa1b22 Mon Sep 17 00:00:00 2001
From: Antony
Date: Thu, 16 Jan 2025 09:28:15 +0000
Subject: [PATCH 232/460] feat: Update Paper 1.21.4 Build to 114
---
templates.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates.json b/templates.json
index b4b55cb..5a8534b 100644
--- a/templates.json
+++ b/templates.json
@@ -190,11 +190,11 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
- "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/109/downloads/paper-1.21.4-109.jar",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/114/downloads/paper-1.21.4-114.jar",
"author": "papermc.io",
"setupInfo": {
"type": "minecraft/java/paper",
- "startCommand": "java -jar paper-1.21.4-109.jar nogui",
+ "startCommand": "java -jar paper-1.21.4-114.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
From 7c63ad939d8024dbffa0816b61a84be667e65962 Mon Sep 17 00:00:00 2001
From: LuckCrafter <63189107+LuckCrafter@users.noreply.github.com>
Date: Wed, 22 Jan 2025 20:25:15 +0100
Subject: [PATCH 233/460] fix: pacman, download only if needed
---
setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.sh b/setup.sh
index df2211b..02c7223 100644
--- a/setup.sh
+++ b/setup.sh
@@ -214,7 +214,7 @@ if [[ -x "$(command -v yum)" ]]; then
elif [[ -x "$(command -v apt-get)" ]]; then
apt-get install -y git tar wget
elif [[ -x "$(command -v pacman)" ]]; then
- pacman -S --noconfirm git tar wget
+ pacman -S --noconfirm --needed git tar wget
elif [[ -x "$(command -v zypper)" ]]; then
zypper --non-interactive install git tar wget
else
From 58f55d95ec4d2c9454e5ef2de9bb988206136965 Mon Sep 17 00:00:00 2001
From: Antony
Date: Thu, 23 Jan 2025 07:38:08 +0100
Subject: [PATCH 234/460] Update Paper 1.21.4 Build to 121
---
templates.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates.json b/templates.json
index 5a8534b..6be769c 100644
--- a/templates.json
+++ b/templates.json
@@ -190,11 +190,11 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
- "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/114/downloads/paper-1.21.4-114.jar",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/121/downloads/paper-1.21.4-121.jar",
"author": "papermc.io",
"setupInfo": {
"type": "minecraft/java/paper",
- "startCommand": "java -jar paper-1.21.4-114.jar nogui",
+ "startCommand": "java -jar paper-1.21.4-121.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
From 63edb89031b7b7e82b2498a38fc3227d718a6668 Mon Sep 17 00:00:00 2001
From: Antony
Date: Sun, 26 Jan 2025 10:33:18 +0000
Subject: [PATCH 235/460] Update PaperMC 1.21.4 build to 126
---
templates.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates.json b/templates.json
index 6be769c..61c26be 100644
--- a/templates.json
+++ b/templates.json
@@ -190,11 +190,11 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
- "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/121/downloads/paper-1.21.4-121.jar",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/126/downloads/paper-1.21.4-126.jar",
"author": "papermc.io",
"setupInfo": {
"type": "minecraft/java/paper",
- "startCommand": "java -jar paper-1.21.4-121.jar nogui",
+ "startCommand": "java -jar paper-1.21.4-126.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
From 3cea46de3685a97ae30907f6a0c073a04b31e1a4 Mon Sep 17 00:00:00 2001
From: Antony
Date: Tue, 28 Jan 2025 10:38:58 +0000
Subject: [PATCH 236/460] Update 1.21.4 PaperMC Build to 130
---
templates.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates.json b/templates.json
index 61c26be..309eb18 100644
--- a/templates.json
+++ b/templates.json
@@ -190,11 +190,11 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
- "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/126/downloads/paper-1.21.4-126.jar",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/130/downloads/paper-1.21.4-130.jar",
"author": "papermc.io",
"setupInfo": {
"type": "minecraft/java/paper",
- "startCommand": "java -jar paper-1.21.4-126.jar nogui",
+ "startCommand": "java -jar paper-1.21.4-130.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
From 7c02590058bd94648c8c388fbafc2c394f74474e Mon Sep 17 00:00:00 2001
From: Antony
Date: Sat, 1 Feb 2025 10:15:28 +0000
Subject: [PATCH 237/460] Update PaperMC 1.21.4 Build to 136
---
templates.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates.json b/templates.json
index 309eb18..f377747 100644
--- a/templates.json
+++ b/templates.json
@@ -190,11 +190,11 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
- "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/130/downloads/paper-1.21.4-130.jar",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/136/downloads/paper-1.21.4-136.jar",
"author": "papermc.io",
"setupInfo": {
"type": "minecraft/java/paper",
- "startCommand": "java -jar paper-1.21.4-130.jar nogui",
+ "startCommand": "java -jar paper-1.21.4-136.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
From d55f47f17f31de248a2453cd9b7eb6057ed9e4ab Mon Sep 17 00:00:00 2001
From: Antony
Date: Wed, 5 Feb 2025 11:15:32 +0000
Subject: [PATCH 238/460] Update PaperMC 1.21.4 Builds to 138
---
templates.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates.json b/templates.json
index f377747..f177d8b 100644
--- a/templates.json
+++ b/templates.json
@@ -190,11 +190,11 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
- "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/136/downloads/paper-1.21.4-136.jar",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/138/downloads/paper-1.21.4-138.jar",
"author": "papermc.io",
"setupInfo": {
"type": "minecraft/java/paper",
- "startCommand": "java -jar paper-1.21.4-136.jar nogui",
+ "startCommand": "java -jar paper-1.21.4-138.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
From 2d14480ab419df1f92c19972dcc2741ff4c30056 Mon Sep 17 00:00:00 2001
From: BuildTools
Date: Fri, 7 Feb 2025 10:11:44 +0100
Subject: [PATCH 239/460] Add first Stable Build of PurpurMC 1.21.4
---
templates.json | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/templates.json b/templates.json
index f177d8b..983887b 100644
--- a/templates.json
+++ b/templates.json
@@ -11,6 +11,25 @@
}
],
"packages": [
+ {
+ "language": "en_us",
+ "description": "[Purpur] Minecraft 1.21.4 Purpur",
+ "title": "Minecraft 1.21.4",
+ "runtime": "Java 21+",
+ "hardware": "RAM 4G+",
+ "size": "50MB",
+ "remark": "Only Purpur included",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.21.4-2389.jar",
+ "author": "purpurmc.org",
+ "setupInfo": {
+ "type": "minecraft/java",
+ "startCommand": "java -jar purpur-1.21.4-2389.jar nogui",
+ "stopCommand": "stop",
+ "updateCommand": "",
+ "ie": "utf-8",
+ "oe": "utf-8"
+ }
+ },
{
"language": "en_us",
"description": "[Purpur] Minecraft 1.21.3 Purpur",
From 6013d22cc4f5656e75bc98d7a2965ca28f67e37f Mon Sep 17 00:00:00 2001
From: Antony
Date: Sun, 16 Feb 2025 15:32:51 +0100
Subject: [PATCH 240/460] Update PaperMC 1.21.4 Build
Previous Version will stay in the releases until the PR is accepted
---
templates.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates.json b/templates.json
index 983887b..10d67b3 100644
--- a/templates.json
+++ b/templates.json
@@ -19,11 +19,11 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
- "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.21.4-2389.jar",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.21.4-2394.jar",
"author": "purpurmc.org",
"setupInfo": {
"type": "minecraft/java",
- "startCommand": "java -jar purpur-1.21.4-2389.jar nogui",
+ "startCommand": "java -jar purpur-1.21.4-2394.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
From 300a78ba0dc69108db0f3c88d754a4298db8cf2c Mon Sep 17 00:00:00 2001
From: Antony
Date: Thu, 20 Feb 2025 09:04:12 +0100
Subject: [PATCH 241/460] Update PurpurMC 1.21.4 Build
---
templates.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates.json b/templates.json
index 10d67b3..83b1431 100644
--- a/templates.json
+++ b/templates.json
@@ -19,11 +19,11 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Purpur included",
- "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.21.4-2394.jar",
+ "targetLink": "https://github.com/SkyKingPX/MCSManagerServerSoftware/releases/download/PurpurMC/purpur-1.21.4-2398.jar",
"author": "purpurmc.org",
"setupInfo": {
"type": "minecraft/java",
- "startCommand": "java -jar purpur-1.21.4-2394.jar nogui",
+ "startCommand": "java -jar purpur-1.21.4-2398.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
From 07c7e45bf66f2d97a4fae4de9b1f2eabbeb4ea06 Mon Sep 17 00:00:00 2001
From: Antony
Date: Thu, 20 Feb 2025 09:06:22 +0100
Subject: [PATCH 242/460] Update PaperMC 1.21.4 Builds
---
templates.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates.json b/templates.json
index 83b1431..e1c2575 100644
--- a/templates.json
+++ b/templates.json
@@ -209,11 +209,11 @@
"hardware": "RAM 4G+",
"size": "50MB",
"remark": "Only Paper included",
- "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/138/downloads/paper-1.21.4-138.jar",
+ "targetLink": "https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/173/downloads/paper-1.21.4-173.jar",
"author": "papermc.io",
"setupInfo": {
"type": "minecraft/java/paper",
- "startCommand": "java -jar paper-1.21.4-138.jar nogui",
+ "startCommand": "java -jar paper-1.21.4-173.jar nogui",
"stopCommand": "stop",
"updateCommand": "",
"ie": "utf-8",
From 7504839f25d3264a7fce66aea030bfc6bcba094b Mon Sep 17 00:00:00 2001
From: Antony
Date: Thu, 20 Feb 2025 08:57:53 +0000
Subject: [PATCH 243/460] Update Forge Builds & Fix a Typo in the Forge Tips
---
templates.json | 76 +++++++++++++++++++++++++-------------------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/templates.json b/templates.json
index e1c2575..f567240 100644
--- a/templates.json
+++ b/templates.json
@@ -469,178 +469,178 @@
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.21.4 (Supports Mods)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.21.4-54.0.12/forge-1.21.4-54.0.12-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.21.4-54.1.1/forge-1.21.4-54.1.1-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.21.4-54.0.12-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.21.4-54.1.1-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.21.3 (Supports Mods)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.21.3-53.0.33/forge-1.21.3-53.0.33-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.21.3-53.0.53/forge-1.21.3-53.0.53-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.21.3-53.0.33-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.21.3-53.0.53-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.21.1 (Supports Mods)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.21.1-52.0.37/forge-1.21.1-52.0.37-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.21.1-52.0.53/forge-1.21.1-52.0.53-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.21.1-52.0.37-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.21.1-52.0.53-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.20.6 (Supports Mods)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.6-50.1.31/forge-1.20.6-50.1.31-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.6-50.1.48/forge-1.20.6-50.1.48-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.20.6-50.1.31-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.20.6-50.1.48-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.20.4 (Supports Mods)",
"runtime": "Java 21+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.4-49.1.21/forge-1.20.4-49.1.21-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.4-49.1.36/forge-1.20.4-49.1.36-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.20.4-49.1.21-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.20.4-49.1.36-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.20.1 (Supports Mods)",
"runtime": "Java 17+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.22/forge-1.20.1-47.3.22-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.33/forge-1.20.1-47.3.33-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.20.1-47.3.22-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.20.1-47.3.33-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.19.4 (Supports Mods)",
"runtime": "Java 17+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.4-45.3.15/forge-1.19.4-45.3.15-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.4-45.3.24/forge-1.19.4-45.3.24-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.19.4-45.3.15-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.19.4-45.3.24-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.19.2 (Supports Mods)",
"runtime": "Java 17+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.2-43.4.12/forge-1.19.2-43.4.12-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.2-43.4.20/forge-1.19.2-43.4.20-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.19.2-43.4.12-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.19.2-43.4.20-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.18.2 (Supports Mods)",
"runtime": "Java 17+",
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.18.2-40.2.31/forge-1.18.2-40.2.31-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.18.2-40.3.6/forge-1.18.2-40.3.6-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.18.2-40.2.31-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.18.2-40.3.6-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.17.1 (Supports Mods)",
"runtime": "Java 16+",
"hardware": "RAM 8G+",
@@ -659,7 +659,7 @@
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.16.5 (Supports Mods)",
"runtime": "Java 8+",
"hardware": "RAM 8G+",
@@ -678,7 +678,7 @@
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.12.2 (Supports Mods)",
"runtime": "Java 8+",
"hardware": "RAM 8G+",
@@ -697,7 +697,7 @@
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.8.9 (Supports Mods)",
"runtime": "Java 7+",
"hardware": "RAM 8G+",
@@ -716,7 +716,7 @@
},
{
"language": "en_us",
- "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"start.bat\" after installation.",
+ "description": "Tip: The default startup command is \"sh ./run.sh\". If you need to run it on Windows, please change start command to \"run.bat\" after installation.",
"title": "Forge 1.7.10 (Supports Mods)",
"runtime": "Java 7+",
"hardware": "RAM 8G+",
@@ -1235,13 +1235,13 @@
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.32/forge-1.20.1-47.2.32-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.33/forge-1.20.1-47.3.33-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.20.1-47.2.32-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.20.1-47.3.33-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -1254,13 +1254,13 @@
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.6-50.0.8/forge-1.20.6-50.0.8-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.6-50.1.48/forge-1.20.6-50.1.48-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.20.6-50.0.8-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.20.6-50.1.48-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
@@ -1273,13 +1273,13 @@
"hardware": "RAM 8G+",
"size": "7MB",
"remark": "Minecraft Forge",
- "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.2-43.3.13/forge-1.19.2-43.3.13-installer.jar",
+ "targetLink": "https://maven.minecraftforge.net/net/minecraftforge/forge/1.19.2-43.4.20/forge-1.19.2-43.4.20-installer.jar",
"author": "minecraftforge.net",
"setupInfo": {
"type": "minecraft/java/forge",
"startCommand": "sh ./run.sh",
"stopCommand": "stop",
- "updateCommand": "java -jar forge-1.19.2-43.3.13-installer.jar --installServer",
+ "updateCommand": "java -jar forge-1.19.2-43.4.20-installer.jar --installServer",
"ie": "utf-8",
"oe": "utf-8"
}
From f5bfb2cf5a7f7298d6b85d1343d445ae102f463e Mon Sep 17 00:00:00 2001
From: Unitwk
Date: Tue, 25 Feb 2025 14:26:48 +0800
Subject: [PATCH 244/460] feat: update install sh
---
LICENSE | 2 +-
README.md | 2 +-
install_update.sh | 607 -------------------------------------------
install_update_cn.sh | 605 ------------------------------------------
package-lock.json | 6 -
package.json | 8 -
setup.sh | 227 ++++++++--------
setup_cn.sh | 10 +-
8 files changed, 117 insertions(+), 1350 deletions(-)
delete mode 100644 install_update.sh
delete mode 100644 install_update_cn.sh
delete mode 100644 package-lock.json
delete mode 100644 package.json
diff --git a/LICENSE b/LICENSE
index bfd24f9..83ffde2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2021 Suwings
+Copyright (c) 2025 MCSManager
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 8e861f7..e71e2f7 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,6 @@
The files here are all platform-wide install, delete, update scripts, etc. for MCSManager.
-The default installation script on the official website is the `setup.sh` file of gitee repository, it contains multiple languages.
+The default installation script on the official website is the `setup.sh` file of Github repository, it contains multiple languages.
You can also use the following one-click command to perform a quick installation
diff --git a/install_update.sh b/install_update.sh
deleted file mode 100644
index c7986f7..0000000
--- a/install_update.sh
+++ /dev/null
@@ -1,607 +0,0 @@
-#!/bin/bash
-
-#Global varialbles
-# System architecture
-arch=$(uname -m)
-# Install base dir
-install_base="/opt"
-# MCSM install dir
-mcsmanager_install_path="${install_base}/mcsmanager"
-# MCSM backup dir during upgrade
-mcsm_backup_dir="${install_base}"
-# Download URL
-mcsmanager_download_addr="https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz "
-# Node.js version to install
-node="v20.12.2"
-# MCSM Web dir name
-mcsm_web="web"
-# MCSM daemon dir name
-mcsm_daemon="daemon"
-# The date variable to be shared across functions
-current_date=$(date +%Y_%m_%d)
-# MCSM local temp dir for downloaded source
-mcsm_down_temp="/opt/mcsmanager_${current_date}"
-# Service file for MCSCM Web
-service_file_web="/etc/systemd/system/mcsm-web.service"
-# Service file for MCSM daemon
-service_file_daemon="/etc/systemd/system/mcsm-daemon.service"
-# Default systemd user is 'mcsm'
-USER="mcsm"
-COMMAND="all"
-# Created backup absolute path
-backup_path=""
-# Downloaded package name
-package_name="${mcsmanager_download_addr##*/}"
-# Node.js install dir
-node_install_path=""
-
-# Helper Functions
-Usage() {
- echo "Usage: $0 [-u user] [-c command]"
- echo " -u Specify the user (mcsm or root), default is 'mcsm'"
- echo " -c Specify the command (web, daemon, or all), default is 'all'"
- exit 1
-}
-Red_Error() {
- echo '================================================='
- printf '\033[1;31;40m%b\033[0m\n' "$@"
- echo '================================================='
- exit 1
-}
-Echo_Cyan() {
- printf '\033[1;36m%b\033[0m\n' "$@"
-}
-Echo_Red() {
- printf '\033[1;31m%b\033[0m\n' "$@"
-}
-
-Echo_Green() {
- printf '\033[1;32m%b\033[0m\n' "$@"
-}
-
-Echo_Cyan_N() {
- printf '\033[1;36m%b\033[0m' "$@"
-}
-
-Echo_Yellow() {
- printf '\033[1;33m%b\033[0m\n' "$@"
-}
-
-# Check root permission
-Check_Sudo() {
- if [ "$EUID" -ne 0 ]; then
- echo "This script must be run as root. Please use \"sudo or root user\" instead."
- exit 1
- fi
-}
-
-Install_Dependencies() {
- # Install related software
- Echo_Cyan "[+] Installing dependent software (git, tar, wget)... "
- if [[ -x "$(command -v yum)" ]]; then
- yum install -y git tar wget
- elif [[ -x "$(command -v apt-get)" ]]; then
- apt-get install -y git tar wget
- elif [[ -x "$(command -v pacman)" ]]; then
- pacman -S --noconfirm git tar wget
- elif [[ -x "$(command -v zypper)" ]]; then
- zypper --non-interactive install git tar wget
- else
- Echo_Red "[!] Cannot find your package manager! You may need to install git, tar and wget manually!"
- fi
-
- # Determine whether the relevant software is installed successfully
- if [[ -x "$(command -v git)" && -x "$(command -v tar)" && -x "$(command -v wget)" ]]; then
- Echo_Green "Success"
- else
- Red_Error "[x] Failed to find git, tar and wget, please install them manually!"
- fi
-
-}
-
-Install_Node() {
- if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
- Echo_Green "Desired Node.js is already installed at the target dir, bypassing installation..."
- else
- Echo_Cyan_N "[+] Install Node.js environment...\n"
-
- rm -irf "$node_install_path"
-
- cd /opt || Red_Error "[x] Failed to enter /opt"
-
- rm -rf "node-$node-linux-$arch.tar.gz"
-
- wget "https://nodejs.org/dist/$node/node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to download node release"
-
- tar -zxf "node-$node-linux-$arch.tar.gz" || Red_Error "[x] Failed to untar node"
-
- rm -rf "node-$node-linux-$arch.tar.gz"
-
- if [[ -f "$node_install_path"/bin/node ]] && [[ "$("$node_install_path"/bin/node -v)" == "$node" ]]; then
- Echo_Green "Success"
- else
- Red_Error "[x] Node installation failed!"
- fi
- fi
-
-
- echo
- Echo_Yellow "=============== Node.js Version ==============="
- Echo_Yellow " node: $("$node_install_path"/bin/node -v)"
- Echo_Yellow " npm: v$(env "$node_install_path"/bin/node "$node_install_path"/bin/npm -v)"
- Echo_Yellow "=============== Node.js Version ==============="
- echo
- sleep 1
-}
-# Check and download MCSM source
-Check_And_Download_Source() {
- # Empty the temp dir if existed
- rm -rf "$mcsm_down_temp"
- mkdir -p "$mcsm_down_temp"
-
- # Download the archive directly into the temporary directory
- wget -O "${mcsm_down_temp}/${package_name}" "$mcsmanager_download_addr" || Red_Error "[x] Failed to download MCSManager releases..."
- if [ $? -ne 0 ]; then
- Red_Error "MCSManager Download failed."
- fi
-
- # Extract the archive without changing directories
- tar -xzf "${mcsm_down_temp}/${package_name}" -C "$mcsm_down_temp"
- if [ $? -ne 0 ]; then
- Red_Error "Extraction failed."
- fi
-
- # Clean up the downloaded tar.gz file
- rm "${mcsm_down_temp}/${package_name}"
-}
-# Detect architecture
-Detect_Architecture() {
- if [[ $arch == x86_64 ]]; then
- arch="x64"
- #echo "[-] x64 architecture detected"
- elif [[ $arch == aarch64 ]]; then
- arch="arm64"
- #echo "[-] 64-bit ARM architecture detected"
- elif [[ $arch == arm ]]; then
- arch="armv7l"
- #echo "[-] 32-bit ARM architecture detected"
- elif [[ $arch == ppc64le ]]; then
- arch="ppc64le"
- #echo "[-] IBM POWER architecture detected"
- elif [[ $arch == s390x ]]; then
- arch="s390x"
- #echo "[-] IBM LinuxONE architecture detected"
- else
- Red_Error "[x] Sorry, this architecture is not supported yet!\n[x]Please try to install manually: https://github.com/MCSManager/MCSManager#linux"
- fi
-
- node_install_path="${install_base}/node-$node-linux-$arch"
-}
-# Initialization
-Initialize() {
- Echo_Cyan "+----------------------------------------------------------------------
-| MCSManager V10 Installation & Upgrading Script
-+----------------------------------------------------------------------
- "
-
- # Check sudo
- Check_Sudo
-
- # Update architecture
- Detect_Architecture
-
- # Check if install base (/opt) exist
- mkdir -p "$install_base"
-
- # Check dependencies
- Install_Dependencies
-
- # Check and download MCSM source
- Check_And_Download_Source
-
- # Parse input arguments
- Parse_Arguments "$@"
-
- # Create mcsm user if needed
- if [[ "$USER" == *"mcsm"* ]]; then
- # Create the user 'mcsm' if it doesn't already exist
- if ! id "mcsm" &>/dev/null; then
- /usr/sbin/useradd mcsm
- Echo_Green "User 'mcsm' created."
- else
- Echo_Yellow "User 'mcsm' already exists."
- fi
- fi
-}
-
-Backup_MCSM() {
- # Ensure both directories are provided
- if [ -z "$mcsmanager_install_path" ] || [ -z "$mcsm_backup_dir" ]; then
- Red_Error "Error: Backup or source path not set."
- fi
-
- # Check if the source directory exists
- if [ ! -d "$mcsmanager_install_path" ]; then
- Red_Error "Error: Source directory does not exist."
- fi
-
- # Create backup directory (/opt) if it doesn't exist
- if [ ! -d "$mcsm_backup_dir" ]; then
- Echo_Yellow "Creating backup directory."
- mkdir -p "$mcsm_backup_dir"
- fi
-
- # Define the backup path
- backup_path="${mcsm_backup_dir}/mcsm_backup_${current_date}.tar.gz"
-
- # Create the backup
- Echo_Yellow "Creating backup..."
- #tar -czf "$backup_path" -C "$mcsmanager_install_path" .
- tar -czf "$backup_path" -C "$(dirname "$mcsmanager_install_path")" "$(basename "$mcsmanager_install_path")"
-
-
- # Check if the backup was successful
- if [ $? -eq 0 ]; then
- Echo_Green "Successfully created backup at $backup_path"
- else
- Red_Error "Error creating backup."
- fi
-}
-# MCSM Web Base Installation
-# Assuming a fresh install (i.e. no file(s) from previous installation) and downloaded source
-Install_MCSM_Web_Base() {
- # Move downloaded path
- mv "${mcsm_down_temp}/${mcsm_web}" "$web_path" ||
- # Move helper file(s)
- mv "${mcsm_down_temp}/start-web.sh" "${mcsmanager_install_path}/start-web.sh"
- # Move back the data directory only if existed
- if [ -d "$web_data_tmp" ]; then
- rm -rf "$web_data"
- mv "${web_data_tmp}" "${web_data}"
- fi
- # Dependencies install
- cd "${web_path}" || Red_Error "[x] Failed to enter ${web_path}"
- # Install dependencies
- Echo_Cyan "[+] Install MCSManager-Web dependencies..."
- env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${web_path}"
- # Return to general dir
- cd "$mcsmanager_install_path"
- # Configure ownership if needed
- if [[ "$USER" == *"mcsm"* ]]; then
- # Change file permission to mcsm user
- chown -R mcsm:mcsm "$web_path"
- else
- # Change file permission to root user
- chown -R root:root "$web_path"
- fi
- chmod -R 755 "$web_path"
-}
-# MCSM Web Service Installation
-Install_Web_Systemd() {
- Echo_Cyan "[+] Creating MCSManager Web service..."
- # stop and disable existing service
- systemctl disable --now mcsm-web
-
- # delete existing service
- rm -rf "$service_file_web"
- systemctl daemon-reload
-
- # Create the default service file
- echo "[Unit]
-Description=MCSManager-Web
-
-[Service]
-WorkingDirectory=${web_path}
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT \$MAINPID
-ExecStop=/bin/kill -s QUIT \$MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >"$service_file_web"
-
- # Add user section if using mcsm user
- if [[ "$USER" == *"mcsm"* ]]; then
- # Check if the 'User=mcsm' line already exists in the service file
- if grep -q "^User=mcsm$" "$service_file_web"; then
- echo "The service file is configured already."
- else
- # Add 'User=mcsm' to the service file
- sed -i '/^\[Service\]$/a User=mcsm' "$service_file_web"
- fi
- fi
- # Reload Systemd Service
- systemctl daemon-reload
- systemctl enable --now mcsm-web
-}
-
-# MCSM Web Update & Installation
-Install_Web_Wrapper() {
- web_path="${mcsmanager_install_path}/${mcsm_web}"
- web_data="${web_path}/data"
- web_data_tmp="${mcsmanager_install_path}/web_data_${current_date}"
- if [ -d "$web_path" ]; then
- Echo_Cyan "[+] Updating MCSManager Web..."
- # The backup should be created already, moving the DATA dir to /opt/mcsmanager/web_data should be fast and safe.
- # Use web_data, do not use data as in rare circumstance user may run both update at the same time.
- # Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
- mv "$web_data" "$web_data_tmp"
- # Remove the old web dir
- rm -rf "$web_path"
-
- else
- Echo_Cyan "[+] Install MCSManager Web..."
- fi
-
-
- # Install MCSM Web
- Install_MCSM_Web_Base
-
- # Install MCSM Web Service
- Install_Web_Systemd
-}
-
-# MCSM Daemon Base Installation
-# Assuming a fresh install (i.e. no file(s) from previous installation) and downloaded source
-Install_MCSM_Daemon_Base() {
- # Move downloaded path
- mv "${mcsm_down_temp}/${mcsm_daemon}" "$daemon_path" ||
- # Move helper file(s)
- mv "${mcsm_down_temp}/start-daemon.sh" "${mcsmanager_install_path}/start-daemon.sh"
-
- # Move back the data directory only if existed
- if [ -d "$daemon_data_tmp" ]; then
- rm -rf "$daemon_data"
- mv "${daemon_data_tmp}" "${daemon_data}"
- fi
- # Dependencies install
- cd "${daemon_path}" || Red_Error "[x] Failed to enter ${daemon_path}"
- # Install dependencies
- Echo_Cyan "[+] Install MCSManager-Daemon dependencies..."
- env "$node_install_path"/bin/node "$node_install_path"/bin/npm install --production --no-fund --no-audit &>/dev/null || Red_Error "[x] Failed to npm install in ${daemon_path}"
- # Return to general dir
- cd "$mcsmanager_install_path"
- # Configure ownership if needed
- if [[ "$USER" == *"mcsm"* ]]; then
- # Change file permission to mcsm user
- chown -R mcsm:mcsm "$daemon_path"
- else
- # Change file permission to root user
- chown -R root:root "$daemon_path"
- fi
- chmod -R 755 "$daemon_path"
-}
-
-# MCSM Daemon Service Installation
-Install_Daemon_Systemd() {
- Echo_Cyan "[+] Creating MCSManager Daemon service..."
- # stop and disable existing service
- systemctl disable --now mcsm-daemon
-
- # delete existing service
- rm -rf "$service_file_daemon"
- systemctl daemon-reload
-
- # Create the default service file
- echo "[Unit]
-Description=MCSManager-Daemon
-
-[Service]
-WorkingDirectory=${daemon_path}
-ExecStart=${node_install_path}/bin/node app.js
-ExecReload=/bin/kill -s QUIT \$MAINPID
-ExecStop=/bin/kill -s QUIT \$MAINPID
-Environment=\"PATH=${PATH}\"
-
-[Install]
-WantedBy=multi-user.target
-" >"$service_file_daemon"
-
- # Add user section if using mcsm user
- if [[ "$USER" == *"mcsm"* ]]; then
- # Check if the 'User=mcsm' line already exists in the service file
- if grep -q "^User=mcsm$" "$service_file_daemon"; then
- echo "The service file is configured already."
- else
- # Add 'User=mcsm' to the service file
- sed -i '/^\[Service\]$/a User=mcsm' "$service_file_daemon"
- fi
- fi
- # Reload Systemd Service
- systemctl daemon-reload
- systemctl enable --now mcsm-daemon
-}
-# MCSM Web Update & Installation
-Install_Daemon_Wrapper() {
- daemon_path="${mcsmanager_install_path}/${mcsm_daemon}"
- daemon_data="${daemon_path}/data"
- daemon_data_tmp="${mcsmanager_install_path}/daemon_data_${current_date}"
- if [ -d "$daemon_path" ]; then
- Echo_Cyan "[+] Updating MCSManager Daemon..."
- # The backup should be created already, moving the DATA dir to /opt/mcsmanager/daemon_data should be fast and safe.
- # Use daemon_data, do not use data as in rare circumstance user may run both update at the same time.
- # Use mv command, this won't create issue in case of an incomplete previous installation (e.g. empty mcsm dir)
- mv "$daemon_data" "$daemon_data_tmp"
- # Remove the old daemon dir
- rm -rf "$daemon_path"
-
- else
- Echo_Cyan "[+] Install MCSManager daemon..."
- fi
-
- # Install MCSM Web
- Install_MCSM_Daemon_Base
-
- # Install MCSM Web Service
- Install_Daemon_Systemd
-}
-# Arguments parsing
-Parse_Arguments() {
- while getopts "u:c:" opt; do
- case ${opt} in
- u )
- if [[ "${OPTARG}" == "mcsm" || "${OPTARG}" == "root" ]]; then
- USER="${OPTARG}"
- else
- echo "Invalid user specified."
- Usage
- fi
- ;;
- c )
- if [[ "${OPTARG}" == "web" || "${OPTARG}" == "daemon" || "${OPTARG}" == "all" ]]; then
- COMMAND="${OPTARG}"
- else
- echo "Invalid command specified."
- Usage
- fi
- ;;
- \? )
- Usage
- ;;
- : )
- echo "Option -$OPTARG requires an argument."
- Usage
- ;;
- esac
- done
-}
-
-# Wrapper for installation
-Install_Update() {
- case "$COMMAND" in
- all)
- Install_Web_Wrapper
- Install_Daemon_Wrapper
- ;;
-
- web)
- Install_Web_Wrapper
- ;;
-
- daemon)
- Install_Daemon_Wrapper
- ;;
-
- *)
- echo "Unknown command: $COMMAND, this should not happen in general :( Please report this bug."
- # Exit with an error if COMMAND is unrecognized
- exit 1
- ;;
- esac
-}
-# Finalize installation
-Finalize() {
- #Clear screen
- clear
- #printf "\n\n\n\n"
- echo "______ _______________________ ___"
- echo "___ |/ /_ ____/_ ___/__ |/ /_____ _____________ _______ _____________"
- echo "__ /|_/ /_ / _____ \__ /|_/ /_ __ \`/_ __ \ __ \`/_ __ \`/ _ \_ ___/"
- echo "_ / / / / /___ ____/ /_ / / / / /_/ /_ / / / /_/ /_ /_/ // __/ /"
- echo "/_/ /_/ \____/ /____/ /_/ /_/ \__,_/ /_/ /_/\__,_/ _\__, / \___//_/"
- echo " /____/"
-
- case "$COMMAND" in
- all)
- Echo_Yellow "=================================================================="
- Echo_Green "Installation is complete! Welcome to the MCSManager V10!!!"
- Echo_Yellow " "
- Echo_Cyan_N "HTTP Web Service: "
- Echo_Yellow "http://:23333 (Browser)"
- Echo_Cyan_N "Daemon Address: "
- Echo_Yellow "ws://:24444 (Cluster)"
- Echo_Red "You must expose ports 23333 and 24444 to use the service properly on the Internet."
- Echo_Yellow " "
- Echo_Cyan "Usage:"
- Echo_Cyan "systemctl start mcsm-{daemon,web}.service"
- Echo_Cyan "systemctl stop mcsm-{daemon,web}.service"
- Echo_Cyan "systemctl restart mcsm-{daemon,web}.service"
- Echo_Yellow " "
- Echo_Green "Official Document: https://docs.mcsmanager.com/"
- Echo_Yellow "=================================================================="
- ;;
-
- web)
- Echo_Yellow "=================================================================="
- Echo_Green "Installation is complete! Welcome to the MCSManager V10!!!"
- Echo_Yellow " "
- Echo_Cyan_N "HTTP Web Service: "
- Echo_Yellow "http://