fix: 安装最新文档修改一键脚本
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# MaiCore & Nonebot adapter一键安装脚本 by Cookie_987
|
# MaiCore & NapCat Adapter一键安装脚本 by Cookie_987
|
||||||
# 适用于Arch/Ubuntu 24.10/Debian 12/CentOS 9
|
# 适用于Arch/Ubuntu 24.10/Debian 12/CentOS 9
|
||||||
# 请小心使用任何一键脚本!
|
# 请小心使用任何一键脚本!
|
||||||
|
|
||||||
INSTALLER_VERSION="0.0.2-refactor"
|
INSTALLER_VERSION="0.0.3-refactor"
|
||||||
LANG=C.UTF-8
|
LANG=C.UTF-8
|
||||||
|
|
||||||
# 如无法访问GitHub请修改此处镜像地址
|
# 如无法访问GitHub请修改此处镜像地址
|
||||||
@@ -31,7 +31,7 @@ DEFAULT_INSTALL_DIR="/opt/maicore"
|
|||||||
# 服务名称
|
# 服务名称
|
||||||
SERVICE_NAME="maicore"
|
SERVICE_NAME="maicore"
|
||||||
SERVICE_NAME_WEB="maicore-web"
|
SERVICE_NAME_WEB="maicore-web"
|
||||||
SERVICE_NAME_NBADAPTER="maicore-nonebot-adapter"
|
SERVICE_NAME_NBADAPTER="maibot-napcat-adapter"
|
||||||
|
|
||||||
IS_INSTALL_MONGODB=false
|
IS_INSTALL_MONGODB=false
|
||||||
IS_INSTALL_NAPCAT=false
|
IS_INSTALL_NAPCAT=false
|
||||||
@@ -59,9 +59,9 @@ show_menu() {
|
|||||||
"1" "启动MaiCore" \
|
"1" "启动MaiCore" \
|
||||||
"2" "停止MaiCore" \
|
"2" "停止MaiCore" \
|
||||||
"3" "重启MaiCore" \
|
"3" "重启MaiCore" \
|
||||||
"4" "启动Nonebot adapter" \
|
"4" "启动NapCat Adapter" \
|
||||||
"5" "停止Nonebot adapter" \
|
"5" "停止NapCat Adapter" \
|
||||||
"6" "重启Nonebot adapter" \
|
"6" "重启NapCat Adapter" \
|
||||||
"7" "拉取最新MaiCore仓库" \
|
"7" "拉取最新MaiCore仓库" \
|
||||||
"8" "切换分支" \
|
"8" "切换分支" \
|
||||||
"9" "退出" 3>&1 1>&2 2>&3)
|
"9" "退出" 3>&1 1>&2 2>&3)
|
||||||
@@ -83,15 +83,15 @@ show_menu() {
|
|||||||
;;
|
;;
|
||||||
4)
|
4)
|
||||||
systemctl start ${SERVICE_NAME_NBADAPTER}
|
systemctl start ${SERVICE_NAME_NBADAPTER}
|
||||||
whiptail --msgbox "✅Nonebot adapter已启动" 10 60
|
whiptail --msgbox "✅NapCat Adapter已启动" 10 60
|
||||||
;;
|
;;
|
||||||
5)
|
5)
|
||||||
systemctl stop ${SERVICE_NAME_NBADAPTER}
|
systemctl stop ${SERVICE_NAME_NBADAPTER}
|
||||||
whiptail --msgbox "🛑Nonebot adapter已停止" 10 60
|
whiptail --msgbox "🛑NapCat Adapter已停止" 10 60
|
||||||
;;
|
;;
|
||||||
6)
|
6)
|
||||||
systemctl restart ${SERVICE_NAME_NBADAPTER}
|
systemctl restart ${SERVICE_NAME_NBADAPTER}
|
||||||
whiptail --msgbox "🔄Nonebot adapter已重启" 10 60
|
whiptail --msgbox "🔄NapCat Adapter已重启" 10 60
|
||||||
;;
|
;;
|
||||||
7)
|
7)
|
||||||
update_dependencies
|
update_dependencies
|
||||||
@@ -410,7 +410,7 @@ run_installation() {
|
|||||||
# 确认安装
|
# 确认安装
|
||||||
confirm_install() {
|
confirm_install() {
|
||||||
local confirm_msg="请确认以下更改:\n\n"
|
local confirm_msg="请确认以下更改:\n\n"
|
||||||
confirm_msg+="📂 安装MaiCore、Nonebot Adapter到: $INSTALL_DIR\n"
|
confirm_msg+="📂 安装MaiCore、NapCat Adapter到: $INSTALL_DIR\n"
|
||||||
confirm_msg+="🔀 分支: $BRANCH\n"
|
confirm_msg+="🔀 分支: $BRANCH\n"
|
||||||
[[ $IS_INSTALL_DEPENDENCIES == true ]] && confirm_msg+="📦 安装依赖:${missing_packages[@]}\n"
|
[[ $IS_INSTALL_DEPENDENCIES == true ]] && confirm_msg+="📦 安装依赖:${missing_packages[@]}\n"
|
||||||
[[ $IS_INSTALL_MONGODB == true || $IS_INSTALL_NAPCAT == true ]] && confirm_msg+="📦 安装额外组件:\n"
|
[[ $IS_INSTALL_MONGODB == true || $IS_INSTALL_NAPCAT == true ]] && confirm_msg+="📦 安装额外组件:\n"
|
||||||
@@ -499,50 +499,28 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo -e "${GREEN}克隆 nonebot-plugin-maibot-adapters 仓库...${RESET}"
|
echo -e "${GREEN}克隆 nonebot-plugin-maibot-adapters 仓库...${RESET}"
|
||||||
git clone $GITHUB_REPO/MaiM-with-u/nonebot-plugin-maibot-adapters.git || {
|
git clone $GITHUB_REPO/MaiM-with-u/MaiBot-Napcat-Adapter.git || {
|
||||||
echo -e "${RED}克隆 nonebot-plugin-maibot-adapters 仓库失败!${RESET}"
|
echo -e "${RED}克隆 MaiBot-Napcat-Adapter.git 仓库失败!${RESET}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo -e "${GREEN}安装Python依赖...${RESET}"
|
echo -e "${GREEN}安装Python依赖...${RESET}"
|
||||||
pip install -r MaiBot/requirements.txt
|
pip install -r MaiBot/requirements.txt
|
||||||
pip install nb-cli
|
cd MaiBot
|
||||||
pip install nonebot-adapter-onebot
|
pip install uv
|
||||||
pip install 'nonebot2[fastapi]'
|
uv pip install -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt
|
||||||
|
cd ..
|
||||||
|
|
||||||
echo -e "${GREEN}安装maim_message依赖...${RESET}"
|
echo -e "${GREEN}安装maim_message依赖...${RESET}"
|
||||||
cd maim_message
|
cd maim_message
|
||||||
pip install -e .
|
uv pip install -i https://mirrors.aliyun.com/pypi/simple -e .
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
echo -e "${GREEN}部署Nonebot adapter...${RESET}"
|
echo -e "${GREEN}部署MaiBot Napcat Adapter...${RESET}"
|
||||||
cd MaiBot
|
cd MaiBot-Napcat-Adapter
|
||||||
mkdir nonebot-maibot-adapter
|
uv pip install -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt
|
||||||
cd nonebot-maibot-adapter
|
|
||||||
cat > pyproject.toml <<EOF
|
|
||||||
[project]
|
|
||||||
name = "nonebot-maibot-adapter"
|
|
||||||
version = "0.1.0"
|
|
||||||
description = "nonebot-maibot-adapter"
|
|
||||||
readme = "README.md"
|
|
||||||
requires-python = ">=3.9, <4.0"
|
|
||||||
|
|
||||||
[tool.nonebot]
|
|
||||||
adapters = [
|
|
||||||
{ name = "OneBot V11", module_name = "nonebot.adapters.onebot.v11" }
|
|
||||||
]
|
|
||||||
plugins = []
|
|
||||||
plugin_dirs = ["src/plugins"]
|
|
||||||
builtin_plugins = []
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "Manually created by run.sh" > README.md
|
|
||||||
mkdir src
|
|
||||||
cp -r ../../nonebot-plugin-maibot-adapters/nonebot_plugin_maibot_adapters src/plugins/nonebot_plugin_maibot_adapters
|
|
||||||
cd ..
|
cd ..
|
||||||
cd ..
|
|
||||||
|
|
||||||
|
|
||||||
echo -e "${GREEN}同意协议...${RESET}"
|
echo -e "${GREEN}同意协议...${RESET}"
|
||||||
|
|
||||||
@@ -590,13 +568,13 @@ EOF
|
|||||||
|
|
||||||
cat > /etc/systemd/system/${SERVICE_NAME_NBADAPTER}.service <<EOF
|
cat > /etc/systemd/system/${SERVICE_NAME_NBADAPTER}.service <<EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Maicore Nonebot adapter
|
Description=MaiBot Napcat Adapter
|
||||||
After=network.target mongod.service
|
After=network.target mongod.service ${SERVICE_NAME}.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=${INSTALL_DIR}/MaiBot/nonebot-maibot-adapter
|
WorkingDirectory=${INSTALL_DIR}/MaiBot-Napcat-Adapter
|
||||||
ExecStart=/bin/bash -c "source $INSTALL_DIR/venv/bin/activate && nb run --reload"
|
ExecStart=$INSTALL_DIR/venv/bin/python3 main.py
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10s
|
RestartSec=10s
|
||||||
|
|
||||||
@@ -605,7 +583,6 @@ WantedBy=multi-user.target
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable ${SERVICE_NAME}
|
|
||||||
|
|
||||||
# 保存安装信息
|
# 保存安装信息
|
||||||
echo "INSTALLER_VERSION=${INSTALLER_VERSION}" > /etc/maicore_install.conf
|
echo "INSTALLER_VERSION=${INSTALLER_VERSION}" > /etc/maicore_install.conf
|
||||||
|
|||||||
Reference in New Issue
Block a user