diff --git a/bin/clashfm.tar.gz b/bin/clashfm.tar.gz index 724991b..f4a5cbd 100644 Binary files a/bin/clashfm.tar.gz and b/bin/clashfm.tar.gz differ diff --git a/bin/version b/bin/version index 8a86498..2d89ca6 100644 --- a/bin/version +++ b/bin/version @@ -3,4 +3,4 @@ GeoIP_v=202201280303 clashpre_v=2021.09.15 clash_v=v1.7.1 meta_v=develop-76dcceb -versionsh=1.5.2 +versionsh=1.5.3 diff --git a/install.sh b/install.sh index 026815a..0df1831 100644 --- a/install.sh +++ b/install.sh @@ -13,6 +13,7 @@ echo "***********************************************" [ -f "/etc/storage/started_script.sh" ] && systype=Padavan && initdir='/etc/storage/started_script.sh' [ -d "/jffs/scripts" ] && systype=asusrouter && initdir='/jffs/scripts/net-start' [ -f "/jffs/.asusrouter" ] && systype=asusrouter && initdir='/jffs/.asusrouter' +[ -f "/data/etc/crontabs/root" ] && systype=mi_snapshot #检查root权限 if [ "$USER" != "root" -a -z "$systype" ];then echo 当前用户:$USER @@ -124,7 +125,12 @@ gettar(){ exit 1 fi #华硕/Padavan额外设置 - [ -n "$systype" ] && sed -i '/ShellClash初始化/'d $initdir && echo "$clashdir/start.sh init #ShellClash初始化脚本" >> $initdir + [ -n "$initdir" ] && sed -i '/ShellClash初始化/'d $initdir && touch $initdir && echo "$clashdir/start.sh init #ShellClash初始化脚本" >> $initdir + #小米镜像化OpenWrt额外设置 + [ "$systype" = "mi_snapshot" ] && echo "*/1 * * * * test -z \"\$(pidof clash)\" && $clashdir/start.sh init #ShellClash初始化及守护进程" >> /data/etc/crontabs/root + sed -i '/start_old=*/'d $clashdir/mark + echo start_old=已开启 >> $clashdir/mark + rm -rf /etc/init.d/clash #删除临时文件 rm -rf /tmp/clashfm.tar.gz rm -rf $clashdir/clashservice @@ -147,6 +153,7 @@ setdir(){ if [ -n "$systype" ];then [ "$systype" = "Padavan" ] && dir=/etc/storage [ "$systype" = "asusrouter" ] && dir=/jffs + [ "$systype" = "mi_snapshot" ] && dir=/data else echo ----------------------------------------------- $echo "\033[33m安装ShellClash至少需要预留约1MB的磁盘空间\033[0m" diff --git a/scripts/clash.sh b/scripts/clash.sh index fad1157..4be5588 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -1496,6 +1496,7 @@ case "$1" in $clashdir/start.sh stop $clashdir/start.sh cronset "clash服务" $clashdir/start.sh cronset "订阅链接" + $clashdir/start.sh cronset "ShellClash初始化" [ -w ~/.bashrc ] && profile=~/.bashrc [ -w /etc/profile ] && profile=/etc/profile sed -i '/alias clash=*/'d $profile diff --git a/scripts/start.sh b/scripts/start.sh index 5476822..13f51df 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -772,7 +772,7 @@ start_old(){ $nohup $bindir/clash -d $bindir >/dev/null 2>&1 & fi afstart - $0 daemon + [ -z "$(crontab -l | grep ShellClash初始化)" ] && $0 daemon } case "$1" in @@ -832,8 +832,20 @@ init) profile=/etc/profile sed -i '' $profile #将软链接转化为一般文件 fi + elif [ -d "/jffs/clash" ];then + clashdir=/jffs/clash + profile=/jffs/configs/profile.add + elif [ -d "/data/clash" ];then + clashdir=/data/clash + profile=/etc/profile + #开启SSH + nvram set telnet_en=1 + nvram set uart_en=1 + nvram set ssh_en=1 + nvram commit + sed -i 's/channel=.*/channel="debug"/g' /etc/init.d/dropbear + /etc/init.d/dropbear start fi - [ -d "/jffs/clash" ] && clashdir=/jffs/clash && profile=/jffs/configs/profile.add echo "alias clash=\"$clashdir/clash.sh\"" >> $profile echo "export clashdir=\"$clashdir\"" >> $profile $0 start