v1.5.5
~全面适配ax6s等小米镜像化系统设备 ·支持procd守护进程 ·支持设置开机启动 ·支持自动开启SSH及备份还原SSH秘钥 ~重做小米SSH工具,现在支持各类小米路由设备软件固化SSH(待测试) ~重写自启逻辑,现在支持Padavan、梅林开关开机启动功能
This commit is contained in:
@@ -1226,13 +1226,22 @@ tools(){
|
|||||||
tools
|
tools
|
||||||
|
|
||||||
elif [ -f /usr/sbin/otapredownload ] && [ "$num" = 6 ]; then
|
elif [ -f /usr/sbin/otapredownload ] && [ "$num" = 6 ]; then
|
||||||
[ "$mi_autoSSH" = "已启用" ] && mi_autoSSH=禁用 || mi_autoSSH=已启用
|
if [ "$mi_autoSSH" = "已启用" ];then
|
||||||
|
mi_autoSSH=禁用
|
||||||
|
else
|
||||||
|
echo -----------------------------------------------
|
||||||
|
echo -e "\033[33m本功能使用软件命令进行固化不保证100%成功!\033[0m"
|
||||||
|
echo -e "本功能需依赖clash服务,请确保clash为开机启动状态!"
|
||||||
|
echo -e "\033[33m如有问题请加群反馈:\033[36;4mhttps://t.me/clashfm\033[0m"
|
||||||
|
mi_autoSSH=已启用
|
||||||
|
if [ "$systype" = "mi_snapshot" ];then
|
||||||
|
cp -f /etc/dropbear/dropbear_rsa_host_key $clashdir/dropbear_rsa_host_key 2>/dev/null
|
||||||
|
echo -e "\033[32m检测当前为小米镜像化系统,已将SSH秘钥备份到脚本安装目录!\033[0m"
|
||||||
|
echo -e "\033[32mClash会在启动时自动还原已备份的秘钥文件!\033[0m"
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
setconfig mi_autoSSH $mi_autoSSH
|
setconfig mi_autoSSH $mi_autoSSH
|
||||||
echo -----------------------------------------------
|
|
||||||
echo -e "\033[33m本功能使用软件命令进行固化不保证100%成功!\033[0m"
|
|
||||||
echo -e "本功能需依赖clash服务,请确保clash为开机启动状态!"
|
|
||||||
echo -e "\033[33m如有问题请加群反馈:\033[36;4mhttps://t.me/clashfm\033[0m"
|
|
||||||
sleep 2
|
|
||||||
tools
|
tools
|
||||||
else
|
else
|
||||||
errornum
|
errornum
|
||||||
|
|||||||
@@ -4,21 +4,6 @@
|
|||||||
clashdir=/data/clash
|
clashdir=/data/clash
|
||||||
profile=/etc/profile
|
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初始化环境变量
|
#h初始化环境变量
|
||||||
echo "alias clash=\"$clashdir/clash.sh\"" >> $profile
|
echo "alias clash=\"$clashdir/clash.sh\"" >> $profile
|
||||||
echo "export clashdir=\"$clashdir\"" >> $profile
|
echo "export clashdir=\"$clashdir\"" >> $profile
|
||||||
@@ -27,9 +12,7 @@ echo "export clashdir=\"$clashdir\"" >> $profile
|
|||||||
ln -sf $clashdir/clashservice /etc/init.d/clash
|
ln -sf $clashdir/clashservice /etc/init.d/clash
|
||||||
chmod 755 /etc/init.d/clash
|
chmod 755 /etc/init.d/clash
|
||||||
|
|
||||||
log
|
if [ ! -f $clashdir/.dis_startup ];then
|
||||||
|
|
||||||
[ -f $clashdir/.dis_startup ] || {
|
|
||||||
log_file=`uci get system.@system[0].log_file`
|
log_file=`uci get system.@system[0].log_file`
|
||||||
while [ "$i" -lt 10 ];do
|
while [ "$i" -lt 10 ];do
|
||||||
sleep 3
|
sleep 3
|
||||||
@@ -37,7 +20,4 @@ log
|
|||||||
done
|
done
|
||||||
/etc/init.d/clash start
|
/etc/init.d/clash start
|
||||||
/etc/init.d/clash enable
|
/etc/init.d/clash enable
|
||||||
}
|
fi
|
||||||
|
|
||||||
sleep 10
|
|
||||||
log
|
|
||||||
|
|||||||
@@ -121,15 +121,17 @@ steaming(){
|
|||||||
}
|
}
|
||||||
autoSSH(){
|
autoSSH(){
|
||||||
#自动开启SSH
|
#自动开启SSH
|
||||||
echo `date`ssh状态设置 >> /data/clash/ui/log
|
[ "$(nvram get ssh_en)" = 0 ] && nvram set ssh_en=1 && nvram commit
|
||||||
nvram set telnet_en=1
|
[ "`uci -c /usr/share/xiaoqiang get xiaoqiang_version.version.CHANNEL`" != 'stable' ] && {
|
||||||
nvram set ssh_en=1
|
uci -c /usr/share/xiaoqiang set xiaoqiang_version.version.CHANNEL='stable'
|
||||||
nvram set uart_en=1
|
|
||||||
nvram commit
|
|
||||||
uci -c /usr/share/xiaoqiang set xiaoqiang_version.version.CHANNEL='stable'
|
|
||||||
uci -c /usr/share/xiaoqiang commit xiaoqiang_version.version
|
uci -c /usr/share/xiaoqiang commit xiaoqiang_version.version
|
||||||
|
}
|
||||||
|
[ -z "$(pidof dropbear)" -o -z "$(netstat -ntul | grep :22)" ] && {
|
||||||
sed -i 's/channel=.*/channel="debug"/g' /etc/init.d/dropbear
|
sed -i 's/channel=.*/channel="debug"/g' /etc/init.d/dropbear
|
||||||
/etc/init.d/dropbear restart
|
/etc/init.d/dropbear restart
|
||||||
|
}
|
||||||
|
#备份还原SSH秘钥
|
||||||
|
[ -f $clashdir/dropbear_rsa_host_key ] && ln -sf $clashdir/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key
|
||||||
}
|
}
|
||||||
#配置文件相关
|
#配置文件相关
|
||||||
getyaml(){
|
getyaml(){
|
||||||
@@ -805,7 +807,7 @@ afstart(){
|
|||||||
cronset '#每10分钟保存节点配置' "*/10 * * * * test -n \"\$(pidof clash)\" && $clashdir/start.sh web_save #每10分钟保存节点配置"
|
cronset '#每10分钟保存节点配置' "*/10 * * * * test -n \"\$(pidof clash)\" && $clashdir/start.sh web_save #每10分钟保存节点配置"
|
||||||
[ -f $clashdir/web_save ] && web_restore & #后台还原面板配置
|
[ -f $clashdir/web_save ] && web_restore & #后台还原面板配置
|
||||||
#自动开启SSH
|
#自动开启SSH
|
||||||
[ "$mi_autoSSH" = "已启用" ] && [ -z "$(pidof dropbear)" -o -z "$(netstat -ntul | grep :22)" ] && autoSSH 2>/dev/null
|
[ "$mi_autoSSH" = "已启用" ] && autoSSH 2>/dev/null
|
||||||
else
|
else
|
||||||
logger "clash服务启动失败!请查看报错信息!" 31
|
logger "clash服务启动失败!请查看报错信息!" 31
|
||||||
$bindir/clash -t -d $bindir
|
$bindir/clash -t -d $bindir
|
||||||
@@ -968,6 +970,9 @@ unset_proxy)
|
|||||||
steaming)
|
steaming)
|
||||||
steaming
|
steaming
|
||||||
;;
|
;;
|
||||||
|
db)
|
||||||
|
$2
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user