-
-
Notifications
You must be signed in to change notification settings - Fork 525
Expand file tree
/
Copy pathinstall.sh
More file actions
74 lines (66 loc) · 2.04 KB
/
install.sh
File metadata and controls
74 lines (66 loc) · 2.04 KB
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
66
67
68
69
70
71
72
73
74
#!/bin/sh
# Nikki'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
*"24.10"*)
branch="openwrt-24.10"
;;
*"25.12"*)
branch="openwrt-25.12"
;;
"SNAPSHOT")
branch="SNAPSHOT"
;;
*)
echo "unsupported release: $DISTRIB_RELEASE"
exit 1
;;
esac
# feed url
repository_url="https://nikkinikki.pages.dev"
feed_url="$repository_url/$branch/$arch/nikki"
if [ -x "/bin/opkg" ]; then
# update feeds
echo "update feeds"
opkg update
# get languages
echo "get languages"
languages=$(opkg list-installed luci-i18n-base-* | cut -d ' ' -f 1 | cut -d '-' -f 4-)
# get latest version
echo "get latest version"
wget -O nikki.version $feed_url/index.json
# install ipks
echo "install ipks"
eval "$(jsonfilter -i nikki.version -e "mihomo_meta_version=@['packages']['mihomo-meta']" -e "nikki_version=@['packages']['nikki']" -e "luci_app_nikki_version=@['packages']['luci-app-nikki']")"
opkg install "$feed_url/mihomo-meta_${mihomo_meta_version}_${arch}.ipk"
opkg install "$feed_url/nikki_${nikki_version}_${arch}.ipk"
opkg install "$feed_url/luci-app-nikki_${luci_app_nikki_version}_all.ipk"
for lang in $languages; do
lang_version=$(jsonfilter -i nikki.version -e "@['packages']['luci-i18n-nikki-${lang}']")
opkg install "$feed_url/luci-i18n-nikki-${lang}_${lang_version}_all.ipk"
done
rm -f nikki.version
elif [ -x "/usr/bin/apk" ]; then
# update feeds
echo "update feeds"
apk update
# get languages
echo "get languages"
languages=$(apk list --installed --manifest luci-i18n-base-* | cut -d ' ' -f 1 | cut -d '-' -f 4-)
# install apks from remote repository
echo "install apks from remote repository"
apk add --allow-untrusted -X $feed_url/packages.adb mihomo-meta nikki luci-app-nikki
for lang in $languages; do
apk add --allow-untrusted -X $feed_url/packages.adb "luci-i18n-nikki-${lang}"
done
fi
echo "success"