Merge pull request #679 from Cookie987/dev

fix: Linux脚本支持dev分支,修改部分提示
This commit is contained in:
SengokuCola
2025-04-05 14:45:54 +08:00
committed by GitHub

View File

@@ -4,7 +4,7 @@
# 适用于Arch/Ubuntu 24.10/Debian 12/CentOS 9
# 请小心使用任何一键脚本!
INSTALLER_VERSION="0.0.1-refactor"
INSTALLER_VERSION="0.0.2-refactor"
LANG=C.UTF-8
# 如无法访问GitHub请修改此处镜像地址
@@ -62,7 +62,7 @@ show_menu() {
"4" "启动Nonebot adapter" \
"5" "停止Nonebot adapter" \
"6" "重启Nonebot adapter" \
"7" "新MaiCore及其依赖" \
"7" "拉取最新MaiCore仓库" \
"8" "切换分支" \
"9" "退出" 3>&1 1>&2 2>&3)
@@ -111,6 +111,8 @@ show_menu() {
# 更新依赖
update_dependencies() {
whiptail --title "⚠" --msgbox "更新后请阅读教程" 10 60
systemctl stop ${SERVICE_NAME}
cd "${INSTALL_DIR}/MaiBot" || {
whiptail --msgbox "🚫 无法进入安装目录!" 10 60
return 1
@@ -126,8 +128,7 @@ update_dependencies() {
return 1
fi
deactivate
systemctl restart ${SERVICE_NAME}
whiptail --msgbox "✅ 依赖已更新并重启服务!" 10 60
whiptail --msgbox "✅ 已停止服务并拉取最新仓库提交" 10 60
}
# 切换分支
@@ -157,7 +158,7 @@ switch_branch() {
whiptail --msgbox "🚫 代码拉取失败!" 10 60
return 1
fi
systemctl stop ${SERVICE_NAME}
source "${INSTALL_DIR}/venv/bin/activate"
pip install -r requirements.txt
deactivate
@@ -165,8 +166,7 @@ switch_branch() {
sed -i "s/^BRANCH=.*/BRANCH=${new_branch}/" /etc/maicore_install.conf
BRANCH="${new_branch}"
check_eula
systemctl restart ${SERVICE_NAME}
whiptail --msgbox "✅ 已切换到分支 ${new_branch} 并重启服务!" 10 60
whiptail --msgbox "✅ 已停止服务并切换到分支 ${new_branch} " 10 60
}
check_eula() {
@@ -228,6 +228,8 @@ run_installation() {
fi
fi
whiptail --title " 提示" --msgbox "如果您没有特殊需求请优先使用docker方式部署。" 10 60
# 协议确认
if ! (whiptail --title " [1/6] 使用协议" --yes-button "我同意" --no-button "我拒绝" --yesno "使用MaiCore及此脚本前请先阅读EULA协议及隐私协议\nhttps://github.com/MaiM-with-u/MaiBot/blob/refactor/EULA.md\nhttps://github.com/MaiM-with-u/MaiBot/blob/refactor/PRIVACY.md\n\n您是否同意上述协议" 12 70); then
exit 1
@@ -370,12 +372,13 @@ run_installation() {
# 选择分支
choose_branch() {
BRANCH=$(whiptail --title "🔀 选择分支" --radiolist "请选择要安装的分支:" 15 60 4 \
"main" "稳定最新版(推荐)" ON \
"classical" "经典版" OFF \
"main" "稳定版(推荐)" ON \
"dev" "开发版(不知道什么意思就别选)" OFF \
"classical" "经典版0.6.0以前的版本)" OFF \
"custom" "自定义分支" OFF 3>&1 1>&2 2>&3)
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
whiptail --msgbox "操作取消!" 10 60
whiptail --msgbox "🚫 操作取消!" 10 60
exit 1
fi
@@ -383,7 +386,7 @@ run_installation() {
BRANCH=$(whiptail --title "🔀 自定义分支" --inputbox "请输入自定义分支名称:" 10 60 "refactor" 3>&1 1>&2 2>&3)
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
whiptail --msgbox "输入取消!" 10 60
whiptail --msgbox "🚫 输入取消!" 10 60
exit 1
fi
if [[ -z "$BRANCH" ]]; then