~适配AX6s等小米镜像化系统设备
This commit is contained in:
juewuy 2022-03-05 17:31:42 +08:00
parent 0f3573c304
commit fe9784517a
5 changed files with 24 additions and 4 deletions

Binary file not shown.

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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