-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Joseph Mory <[email protected]>
- Loading branch information
Showing
1 changed file
with
46 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,51 @@ | ||
#!/bin/sh | ||
|
||
# uninstall mihomo | ||
# Rename from MihomoTProxy to Nikki | ||
|
||
# if mihomo is installed, uninstall it | ||
# if nikki is not installed, install it | ||
# if config and files exists, migrate it | ||
# if mihomo feed is configured, remove it and add nikki feed | ||
|
||
migrate() { | ||
if [ -f "/etc/config/mihomo" ]; then | ||
cp -f /etc/config/mihomo /etc/config/nikki | ||
rm -f /etc/config/mihomo | ||
fi | ||
if [ -d "/etc/mihomo" ]; then | ||
mkdir -p /etc/nikki | ||
cp -r /etc/mihomo/. /etc/nikki | ||
rm -rf /etc/mihomo | ||
fi | ||
service nikki restart | ||
} | ||
|
||
if [ -x "/bin/opkg" ]; then | ||
opkg remove luci-i18n-mihomo-zh-cn | ||
opkg remove luci-app-mihomo | ||
opkg remove mihomo | ||
if (opkg list-installed | grep -q mihomo); then | ||
opkg remove luci-i18n-mihomo-zh-cn | ||
opkg remove luci-app-mihomo | ||
opkg remove mihomo | ||
fi | ||
if (! opkg list-installed | grep -q nikki); then | ||
curl -s -L https://github.com/nikkinikki-org/OpenWrt-nikki/raw/refs/heads/main/install.sh | ash | ||
fi | ||
migrate | ||
if (grep -q mihomo /etc/opkg/customfeeds.conf); then | ||
sed -i '/mihomo/d' /etc/opkg/customfeeds.conf | ||
curl -s -L https://github.com/nikkinikki-org/OpenWrt-nikki/raw/refs/heads/main/feed.sh | ash | ||
fi | ||
elif [ -x "/usr/bin/apk" ]; then | ||
apk del luci-i18n-mihomo-zh-cn | ||
apk del luci-app-mihomo | ||
apk del mihomo | ||
if (apk list -I | grep -q mihomo); then | ||
apk del luci-i18n-mihomo-zh-cn | ||
apk del luci-app-mihomo | ||
apk del mihomo | ||
fi | ||
if (apk list -I | grep -q nikki); then | ||
curl -s -L https://github.com/nikkinikki-org/OpenWrt-nikki/raw/refs/heads/main/install.sh | ash | ||
fi | ||
migrate | ||
if (grep -q mihomo /etc/apk/repositories.d/customfeeds.list); then | ||
sed -i '/mihomo/d' /etc/apk/repositories.d/customfeeds.list | ||
curl -s -L https://github.com/nikkinikki-org/OpenWrt-nikki/raw/refs/heads/main/feed.sh | ash | ||
fi | ||
fi | ||
# copy config from mihomo to nikki | ||
cp -f /etc/config/mihomo /etc/config/nikki | ||
# copy files from mihomo to nikki | ||
cp -rf /etc/nikki /etc/mihomo | ||
# remove mihomo config | ||
rm -f /etc/config/mihomo | ||
# remove mihomo files | ||
rm -rf /etc/mihomo | ||
# reload nikki service | ||
service nikki reload |