58 lines
879 B
Bash
Executable File
58 lines
879 B
Bash
Executable File
#!/bin/sh
|
|
|
|
. $IPKG_INSTROOT/etc/mihomo/scripts/constants.sh
|
|
|
|
action=$1
|
|
shift
|
|
|
|
case "$action" in
|
|
clear_log)
|
|
case "$1" in
|
|
app)
|
|
echo -n > "$APP_LOG_PATH"
|
|
;;
|
|
core)
|
|
echo -n > "$CORE_LOG_PATH"
|
|
;;
|
|
esac
|
|
;;
|
|
subscription)
|
|
case "$1" in
|
|
update)
|
|
/etc/init.d/mihomo update_subscription "$2"
|
|
;;
|
|
esac
|
|
;;
|
|
load)
|
|
case "$1" in
|
|
profile)
|
|
yq -M -o json < "$RUN_PROFILE_PATH"
|
|
;;
|
|
esac
|
|
;;
|
|
service)
|
|
case "$1" in
|
|
reload)
|
|
/etc/init.d/mihomo reload
|
|
;;
|
|
restart)
|
|
/etc/init.d/mihomo restart
|
|
;;
|
|
esac
|
|
;;
|
|
version)
|
|
case "$1" in
|
|
app)
|
|
if [ -x "/bin/opkg" ]; then
|
|
opkg list-installed "luci-app-mihomo" | cut -d " " -f 3
|
|
elif [ -x "/usr/bin/apk" ]; then
|
|
apk list -I "luci-app-mihomo" | cut -d ' ' -f 1 | cut -d '-' -f 4
|
|
fi
|
|
;;
|
|
core)
|
|
mihomo -v | grep "Mihomo" | cut -d " " -f 3
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|