forked from cooip-jm/About-openwrt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alpine-mihomo.sh
65 lines (50 loc) · 1.96 KB
/
alpine-mihomo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
#基础环境
#Alpine设置时区和一些基础环境以及mihomo的脚本,。
##运行
### apk add wget
### wget -O - https://raw.githubusercontent.com/cooip-jm/About-openwrt/main/alpine-mihomo.sh | sh -s -- -v
###
#或者打自己单行复制粘贴执行。
#不限制系统架构
set -e -o pipefail
echo "确保本Alpine能够正常访问Github,TUN已经开启"
echo "换国内源"
sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
apk update
echo "修正时区/安装curl nano"
apk add tzdata curl git gzip nano
date
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo "Asia/Shanghai" > /etc/timezone
date
ARCH_RAW=$(uname -m)
case "${ARCH_RAW}" in
'x86_64') ARCH='amd64';;
'x86' | 'i686' | 'i386') ARCH='386';;
'aarch64' | 'arm64') ARCH='arm64';;
'armv7l') ARCH='armv7';;
's390x') ARCH='s390x';;
*) echo "Unsupported architecture: ${ARCH_RAW}"; exit 1;;
esac
echo "当前设备架构${ARCH_RAW}"
VERSION=$(curl -L "https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/version.txt")
echo "获取到的版本:${VERSION}"
curl -Lo mihomo.gz "https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/mihomo-linux-${ARCH}-${VERSION}.gz"
echo "${VERSION}下载完成,开始安装"
gzip -d mihomo.gz
chmod +x mihomo
mv mihomo /usr/local/bin/
echo "配置开机启动"
wget https://raw.githubusercontent.com/cooip-jm/About-openwrt/main/mihomo.openrc -O /etc/init.d/mihomo
chmod +x /etc/init.d/mihomo
rc-update add mihomo
echo "安装UI"
git clone https://github.com/metacubex/metacubexd.git -b gh-pages /etc/mihomo/ui
echo "获取懒人配置"
wget https://wiki.metacubex.one/example/mrs -O /etc/mihomo/config.yaml
ln -s /etc/mihomo/config.yaml /root/config.yaml
sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mihomo/config.yaml
echo "nano ~/config.yaml 修改配置文件订阅内容"
echo "修改配置文件后,重启reboot或者rc-service mihomo start"
echo "完成"