-
Notifications
You must be signed in to change notification settings - Fork 167
/
install.sh
65 lines (57 loc) · 1.3 KB
/
install.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/sh
# MihomoTProxy's installer
# check env
if [[ ! -x "/bin/opkg" && ! -x "/usr/bin/apk" || ! -x "/sbin/fw4" ]]; then
echo "only supports OpenWrt build with firewall4!"
exit 1
fi
# include openwrt_release
. /etc/openwrt_release
# get branch/arch
arch="$DISTRIB_ARCH"
branch=
case "$DISTRIB_RELEASE" in
*"23.05"*)
branch="openwrt-23.05"
;;
*"24.10"*)
branch="openwrt-24.10"
;;
"SNAPSHOT")
branch="SNAPSHOT"
;;
*)
echo "unsupported release: $DISTRIB_RELEASE"
exit 1
;;
esac
# download tarball
echo "download tarball"
tarball="mihomo_$arch-$branch.tar.gz"
curl -s -L -o "$tarball" "https://github.com/morytyann/OpenWrt-mihomo/releases/latest/download/$tarball"
# extract tarball
echo "extract tarball"
tar -x -z -f "$tarball"
rm -f "$tarball"
if [ -x "/bin/opkg" ]; then
# update feeds
echo "update feeds"
opkg update
# install ipks
echo "install ipks"
opkg install mihomo_*.ipk
opkg install luci-app-mihomo_*.ipk
opkg install luci-i18n-mihomo-zh-cn_*.ipk
rm -f -- *mihomo*.ipk
elif [ -x "/usr/bin/apk" ]; then
# update feeds
echo "update feeds"
apk update
# install apks
echo "install apks"
apk add --allow-untrusted mihomo-*.apk
apk add --allow-untrusted luci-app-mihomo-*.apk
apk add --allow-untrusted luci-i18n-mihomo-zh-cn-*.apk
rm -f -- *mihomo*.apk
fi
echo "success"