Skip to content

Commit 51841bb

Browse files
committed
添加 | 修改
1 parent 2ee25f8 commit 51841bb

File tree

3 files changed

+102
-7
lines changed

3 files changed

+102
-7
lines changed

Termux/install-MB

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/data/data/com.termux/files/usr/bin/bash -e
2+
3+
echo -e "\033]0;MaiBot半自动安装\007"
4+
5+
# 前景色(普通)
6+
red='\033[1;31m'
7+
magenta='\033[0;1;35;95m'
8+
green='\033[1;32m'
9+
yellow='\033[1;33m'
10+
blue='\033[1;34m'
11+
light_cyan='\033[1;96m'
12+
13+
# 前景色(更亮/加粗)
14+
red_fg_strong='\033[1;91m'
15+
green_fg_strong='\033[1;92m'
16+
yellow_fg_strong='\033[1;93m'
17+
blue_fg_strong='\033[1;94m'
18+
19+
# 背景色
20+
red_bg='\033[41m'
21+
green_bg='\033[42m'
22+
yellow_bg='\033[43m'
23+
blue_bg='\033[44m'
24+
light_cyan_bg='\033[106m'
25+
26+
# 复位
27+
reset='\033[0m'
28+
29+
30+
log() {
31+
current_time=$(date +'%H:%M:%S')
32+
case "$1" in
33+
"INFO")
34+
echo -e "${blue_bg}[$current_time]${reset} ${blue_fg_strong}[信息]${reset} $2"
35+
;;
36+
"WARN")
37+
echo -e "${yellow_bg}[$current_time]${reset} ${yellow_fg_strong}[警告]${reset} $2"
38+
;;
39+
"ERROR")
40+
echo -e "${red_bg}[$current_time]${reset} ${red_fg_strong}[错误]${reset} $2"
41+
;;
42+
*)
43+
echo -e "${blue_bg}[$current_time]${reset} ${blue_fg_strong}[调试]${reset} $2"
44+
;;
45+
esac
46+
}
47+
48+
# 检查命令是否存在
49+
command_exists() {
50+
command -v "$1" >/dev/null 2>&1
51+
}
52+
53+
# 更新源到清华镜像
54+
if ! grep -q "mirrors.tuna.tsinghua.edu.cn" "$PREFIX/etc/apt/sources.list"; then
55+
log "INFO" "更新软件源到清华镜像..."
56+
cp "$PREFIX/etc/apt/sources.list" "$PREFIX/etc/apt/sources.list.bak"
57+
sed -i 's@^\(deb.*stable main\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/termux-packages-24 stable main@' "$PREFIX/etc/apt/sources.list"
58+
fi
59+
60+
for cmd in proot-distro; do
61+
command_exists "$cmd" || pkg install -y "$cmd"
62+
done
63+
64+
if [ -f "$PREFIX/etc/apt/sources.list.bak" ]; then
65+
mv "$PREFIX/etc/apt/sources.list.bak" "$PREFIX/etc/apt/sources.list"
66+
fi
67+
68+
if [ ! -d "$PREFIX/var/lib/proot-distro/installed-rootfs/maibot/" ]; then
69+
log "INFO" "安装ubuntu容器..."
70+
export PD_OVERRIDE_TARBALL_URL="https://gh-proxy.com/https://raw.githubusercontent.com/Dong-Jing-Yu/Dong-Jing-Yu.github.io/refs/heads/main/Termux/proot-distro/ubuntu-noble-aarch64-pd-v4.18.0.tar.xz"
71+
proot-distro install ubuntu --override-alias maibot
72+
log "INFO" "安装完成!"
73+
fi
74+
75+
76+
77+
init_cmd="cd ~ && \
78+
apt update -y && \
79+
apt install -y sudo vim git python3-dev python3.12-venv build-essential screen curl python3-pip && \
80+
mkdir maimai && \
81+
cd maimai && \
82+
git clone https://gh-proxy.com/https://github.com/MaiM-with-u/MaiBot.git.git \
83+
git clone https://gh-proxy.com/https://github.com/MaiM-with-u/MaiBot-Napcat-Adapter.git.git \
84+
apt autoremove -y && \
85+
apt clean && \
86+
rm -rf /tmp/* /var/lib/apt/lists && \
87+
pip3 install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple uv
88+
"
89+
proot-distro sh maibot -- bash -c "$init_cmd"
90+
91+
echo -e "${red}https://docs.mai-mai.org/manual/deployment/mmc_deploy_android.html#传统方式环境配置${reset}\n"
92+
echo -e "脚本已执行到 ${green}安装 uv (推荐)${reset}\n"
93+
echo -e "进入容器: ${green}proot-distro login nc${reset}\n"

Termux/install-NC

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/data/data/com.termux/files/usr/bin/bash -e
22

3+
echo -e "\033]0;NapCat安装\007"
4+
35
# 前景色(普通)
46
red='\033[1;31m'
57
magenta='\033[0;1;35;95m'
@@ -61,10 +63,10 @@ done
6163
if [ -f "$PREFIX/etc/apt/sources.list.bak" ]; then
6264
mv "$PREFIX/etc/apt/sources.list.bak" "$PREFIX/etc/apt/sources.list"
6365
fi
64-
if [ ! -d "$PREFIX/var/lib/proot-distro/installed-rootfs/nc/" ]; then
66+
if [ ! -d "$PREFIX/var/lib/proot-distro/installed-rootfs/napcat/" ]; then
6567
log "INFO" "安装debian容器..."
6668
export PD_OVERRIDE_TARBALL_URL="https://gh-proxy.com/https://raw.githubusercontent.com/Dong-Jing-Yu/Dong-Jing-Yu.github.io/refs/heads/main/Termux/proot-distro/debian-bookworm-aarch64-pd-v4.17.3.tar.xz"
67-
proot-distro install debian --override-alias nc
69+
proot-distro install debian --override-alias napcat
6870
log "INFO" "安装完成!"
6971
fi
7072

@@ -77,10 +79,10 @@ sudo bash install.sh --docker n --cli n --proxy 10 && \
7779
apt autoremove -y && \
7880
apt clean && \
7981
rm -rf /tmp/* /var/lib/apt/lists"
80-
proot-distro sh nc -- bash -c "$init_cmd"
82+
proot-distro sh napcat -- bash -c "$init_cmd"
8183

8284
echo -e "${red}napcat容器安装成功,但请注意在运行上述指令时请加上⬇${reset}\n"
83-
echo -e "${green}proot-distro sh nc -- bash -c "[指令]"${reset}\n"
84-
echo -e "保持后台可以使用 ${green}screen -dmS nc bash -c 'proot-distro sh nc -- bash -c "[指令]"'${reset}\n\n"
85-
echo -e "进入容器: ${green}proot-distro login nc${reset}\n"
86-
echo -e "启动: ${green}proot-distro sh nc -- bash -c \"xvfb-run -a qq --no-sandbox\"${reset}\n"
85+
echo -e "${green}proot-distro sh napcat -- bash -c "[指令]"${reset}\n"
86+
echo -e "保持后台可以使用 ${green}screen -dmS napcat bash -c 'proot-distro sh napcat -- bash -c "[指令]"'${reset}\n\n"
87+
echo -e "进入容器: ${green}proot-distro login napcat${reset}\n"
88+
echo -e "启动: ${green}proot-distro sh napcat -- bash -c \"xvfb-run -a qq --no-sandbox\"${reset}\n"
61.2 MB
Binary file not shown.

0 commit comments

Comments
 (0)