~适配华硕官方固件(自启需插入任意USB设备)
~优化梅林固件自启逻辑
~优化小米设备安装目录选择
~增加安装到外置存储选项
~修复部分设备时间显示异常的bug
~修复部分设备环境变量配置重复的bug
This commit is contained in:
juewuy
2022-09-22 20:36:53 +08:00
parent 0c659083dc
commit eee0f06faf
6 changed files with 100 additions and 22 deletions

View File

@@ -1630,6 +1630,8 @@ case "$1" in
rm -rf /tmp/clash_$USER
sed -Ei s/0:7890/7890:7890/g /etc/passwd
userdel -r shellclash 2>/dev/null
nvram set script_usbmount="" 2>/dev/null
nvram commit 2>/dev/null
echo -----------------------------------------------
echo -e "\033[36m已卸载ShellClash相关文件有缘再会\033[0m"
echo -e "\033[33m请手动关闭当前窗口以重置环境变量\033[0m"

View File

@@ -5,12 +5,10 @@ clashdir=/data/clash
profile=/etc/profile
#h初始化环境变量
if [ `type -t clash` != "alias" ];then
echo "alias clash=\"$clashdir/clash.sh\"" >> $profile
fi
if [ -z $clashdir ];then
echo "export clashdir=\"$clashdir\"" >> $profile
fi
sed -i "/alias clash/d" $profile
sed -i "/export clashdir/d" $profile
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

View File

@@ -986,21 +986,28 @@ restart)
$0 start
;;
init)
sleep 30
if [ -d "/etc/storage/clash" ];then
clashdir=/etc/storage/clash
i=1
while [ ! -w "/etc/profile" -a "$i" -lt 60 ];do
sleep 1 && i=$((i+1))
while [ ! -w "/etc/profile" -a "$i" -lt 7 ];do
sleep 5 && i=$((i+1))
done
profile=/etc/profile
sed -i '' $profile #将软链接转化为一般文件
elif [ -d "/jffs/clash" ];then
clashdir=/jffs/clash
profile=/jffs/configs/profile.add
if [ -w /etc/profile ];then
profile=/etc/profile
else
profile=$(cat /etc/profile | grep -oE '\-f.*jffs.*profile' | awk '{print $2}')
fi
else
clashdir=$(cd $(dirname $0);pwd)
profile=/etc/profile
fi
sed -i "/alias clash/d" $profile
sed -i "/export clashdir/d" $profile
echo "alias clash=\"$clashdir/clash.sh\"" >> $profile
echo "export clashdir=\"$clashdir\"" >> $profile
[ -f $clashdir/.dis_startup ] && cronset "clash保守模式守护进程" || $0 start