Skip to content

Commit 605239e

Browse files
committed
修改 | 添加
1 parent f6af3c0 commit 605239e

File tree

3 files changed

+92
-1
lines changed

3 files changed

+92
-1
lines changed

Termux/install-NC

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/data/data/com.termux/files/usr/bin/bash -e
2+
3+
# 前景色(普通)
4+
red='\033[1;31m'
5+
green='\033[1;32m'
6+
yellow='\033[1;33m'
7+
blue='\033[1;34m'
8+
light_cyan='\033[1;96m'
9+
10+
# 前景色(更亮/加粗)
11+
red_fg_strong='\033[1;91m'
12+
green_fg_strong='\033[1;92m'
13+
yellow_fg_strong='\033[1;93m'
14+
blue_fg_strong='\033[1;94m'
15+
16+
# 背景色
17+
red_bg='\033[41m'
18+
green_bg='\033[42m'
19+
yellow_bg='\033[43m'
20+
blue_bg='\033[44m'
21+
light_cyan_bg='\033[106m'
22+
23+
# 复位
24+
reset='\033[0m'
25+
26+
27+
log() {
28+
current_time=$(date +'%H:%M:%S')
29+
case "$1" in
30+
"INFO")
31+
echo -e "${blue_bg}[$current_time]${reset} ${blue_fg_strong}[信息]${reset} $2"
32+
;;
33+
"WARN")
34+
echo -e "${yellow_bg}[$current_time]${reset} ${yellow_fg_strong}[警告]${reset} $2"
35+
;;
36+
"ERROR")
37+
echo -e "${red_bg}[$current_time]${reset} ${red_fg_strong}[错误]${reset} $2"
38+
;;
39+
*)
40+
echo -e "${blue_bg}[$current_time]${reset} ${blue_fg_strong}[调试]${reset} $2"
41+
;;
42+
esac
43+
}
44+
45+
# 更新源到清华镜像
46+
if ! grep -q "mirrors.tuna.tsinghua.edu.cn" "$PREFIX/etc/apt/sources.list"; then
47+
log "INFO" "更新软件源到清华镜像..."
48+
cp "$PREFIX/etc/apt/sources.list" "$PREFIX/etc/apt/sources.list.bak"
49+
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"
50+
51+
fi
52+
53+
for cmd in screen proot-distro; do
54+
command -v "$cmd" >/dev/null 2>&1 || pkg install -y "$cmd"
55+
done
56+
log "INFO" "安装debian容器..."
57+
proot-distro install debian --override-alias NC --tarball-url
58+
log "INFO" "安装完成!"
59+
mv "$PREFIX/etc/apt/sources.list.bak" "$PREFIX/etc/apt/sources.list"
60+
61+
cmdline="proot \\
62+
--link2symlink \\
63+
-0 \\
64+
-r $CHROOT \\
65+
-b /dev \\
66+
-b /proc \\
67+
-b /sdcard \\
68+
-b $CHROOT\$home:/dev/shm \\
69+
-w \$home \\
70+
/usr/bin/env -i \\
71+
HOME=\$home \\
72+
PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \\
73+
TERM=\$TERM \\
74+
LANG=C.UTF-8 \\
75+
\$start"

Termux/install-NH

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,13 +536,29 @@ function print_banner() {
536536
}
537537

538538
function main() {
539-
# 颜色定义
539+
# 前景色(普通)
540540
red='\033[1;31m'
541541
green='\033[1;32m'
542542
yellow='\033[1;33m'
543543
blue='\033[1;34m'
544544
light_cyan='\033[1;96m'
545+
546+
# 前景色(更亮/加粗)
547+
red_fg_strong='\033[1;91m'
548+
green_fg_strong='\033[1;92m'
549+
yellow_fg_strong='\033[1;93m'
550+
blue_fg_strong='\033[1;94m'
551+
552+
# 背景色
553+
red_bg='\033[41m'
554+
green_bg='\033[42m'
555+
yellow_bg='\033[43m'
556+
blue_bg='\033[44m'
557+
light_cyan_bg='\033[106m'
558+
559+
# 复位
545560
reset='\033[0m'
561+
546562

547563
# 切换到用户主目录
548564
cd "$HOME"
40.9 MB
Binary file not shown.

0 commit comments

Comments
 (0)