Files
ShellCrash/scripts/misnap_init.sh
juewuy c9daea0979 v1.5.5
~全面适配ax6s等小米镜像化系统设备
~重做小米SSH工具,现在支持各类小米路由设备软件固化SSH
~重写开机启动逻辑,现在支持Padavan、梅林及小米镜像化系统
2022-03-16 15:00:11 +08:00

44 lines
1023 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# Copyright (C) Juewuy
clashdir=/data/clash
profile=/etc/profile
log(){
dir=$clashdir/ui/log
echo `date`ssh状态获取 >> $dir
nvram get telnet_en >> $dir
nvram get ssh_en >> $dir
nvram get uart_en >> $dir
uci -c /usr/share/xiaoqiang get xiaoqiang_version.version.CHANNEL >> $dir
grep 'channel=.*' /etc/init.d/dropbear >> $dir
/etc/init.d/dropbear enabled
echo dropbear自启状态$? >> $dir
}
#还原SSH秘钥
ln -sf $clashdir/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key
#h初始化环境变量
echo "alias clash=\"$clashdir/clash.sh\"" >> $profile
echo "export clashdir=\"$clashdir\"" >> $profile
#设置init.d服务并启动clash服务
ln -sf $clashdir/clashservice /etc/init.d/clash
chmod 755 /etc/init.d/clash
log
[ -f $clashdir/.dis_startup ] || {
log_file=`uci get system.@system[0].log_file`
while [ "$i" -lt 10 ];do
sleep 3
[ -n "$(grep 'init complete' $log_file)" ] && i=10 || i=$((i+1))
done
/etc/init.d/clash start
/etc/init.d/clash enable
}
sleep 10
log