diff --git a/bin/clashfm.tar.gz b/bin/clashfm.tar.gz index c436376..c78dacd 100644 Binary files a/bin/clashfm.tar.gz and b/bin/clashfm.tar.gz differ diff --git a/bin/version b/bin/version index 7af1fc9..fa992fd 100644 --- a/bin/version +++ b/bin/version @@ -1,4 +1,4 @@ clash_v=1.6.0 clashpre_v=2021.05.08 GeoIP_v=20210514 -versionsh=1.3.4 +versionsh=1.3.5 diff --git a/install.sh b/install.sh index 6b3429b..e962625 100644 --- a/install.sh +++ b/install.sh @@ -93,6 +93,8 @@ gettar(){ sed -i '/versionsh_l=*/'d $clashdir/mark echo versionsh_l=$release_new >> $clashdir/mark #设置环境变量 + [ -w /opt/etc/profile ] && profile=/opt/etc/profile + [ -w /jffs/configs/profile.add ] && profile=/jffs/configs/profile.add [ -w ~/.bashrc ] && profile=~/.bashrc [ -w /etc/profile ] && profile=/etc/profile if [ -n "$profile" ];then @@ -105,7 +107,7 @@ gettar(){ exit 1 fi #华硕/Padavan额外设置 - [ -n "$systype" ] && echo "$clashdir/start.sh init #运行ShellClash开机初始化脚本" >> $initdir + [ -n "$systype" ] && sed -i '/ShellClash初始化/'d $initdir && echo "$clashdir/start.sh init #ShellClash初始化脚本" >> $initdir #删除临时文件 rm -rf /tmp/clashfm.tar.gz rm -rf $clashdir/clashservice diff --git a/scripts/clash.sh b/scripts/clash.sh index 400b2c0..fc39c65 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -985,6 +985,7 @@ tools(){ [ -f "/etc/firewall.user" ] && echo -e " 2 \033[32m配置\033[0m外网访问SSH" #echo -e " 3 配置DDNS服务: \033[36m$ipv6_support\033[0m ————待施工" [ -x /usr/sbin/otapredownload ] && echo -e " 3 \033[33m$mi_update\033[0m小米系统自动更新" + [ -w "/etc/config/firewall" ] && echo -e " 4 \033[32修复\033[0mRedir_host模式Netflix访问" echo ----------------------------------------------- echo -e " 0 返回上级菜单 \033[0m" echo ----------------------------------------------- @@ -1008,7 +1009,15 @@ tools(){ echo -e "已\033[33m$mi_update\033[0m小米路由器的自动启动,如未生效,请在官方APP中同步设置!" sleep 1 tools - + + elif [ "$num" = 4 ]; then + sed -i "s/drop_invalid\ \'1\'/drop_invalid\ \'0\'/g" /etc/config/firewall + echo ----------------------------------------------- + read -P "已修复,是否立即重启设备使其生效?(1/0) > " res + [ "$res" = 1 ] && reboot + sleep 1 + tools + else errornum fi @@ -1043,11 +1052,13 @@ clashcron(){ read -p "是否确认添加定时任务?(1/0) > " res if [ "$res" = '1' ]; then cronwords="$min $hour * * $week $cronset >/dev/null 2>&1 #$week1的$hour点$min分$cronname" - crontab -l > /tmp/conf - sed -i "/$cronname/d" /tmp/conf - sed -i '/^$/d' /tmp/conf - echo "$cronwords" >> /tmp/conf && crontab /tmp/conf - rm -f /tmp/conf + crondir=/tmp/cron_$USER + crontab -l > $crondir + sed -i "/$cronname/d" $crondir + sed -i '/^$/d' $crondir + echo "$cronwords" >> $crondir && crontab $crondir + #华硕/Padavan固件存档在本地,其他则删除 + [ "$clashdir" = "/jffs/clash" -o "$clashdir" = "/etc/storage/clash" ] && mv -f $crondir $clashdir/cron || rm -f $crondir echo ----------------------------------------------- echo -e "\033[31m定时任务已添加!!!\033[0m" fi @@ -1071,6 +1082,7 @@ clashcron(){ i= elif [ "$num" = 9 ]; then crontab -l > /tmp/conf && sed -i "/$cronname/d" /tmp/conf && crontab /tmp/conf + sed -i "/$cronname/d" $clashdir/cron rm -f /tmp/conf echo ----------------------------------------------- echo -e "\033[31m定时任务:$cronname已删除!\033[0m" diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 33c19e9..e7352c0 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -355,7 +355,6 @@ gettar(){ mv $clashdir/clash.service $sysdir/clash.service sed -i "s%/etc/clash%$clashdir%g" $sysdir/clash.service systemctl daemon-reload - #useradd shellclash else #设为保守模式启动 sed -i '/start_old=*/'d $clashdir/mark @@ -368,7 +367,9 @@ gettar(){ chmod 777 $clashdir/start.sh sed -i '/versionsh_l=*/'d $clashdir/mark echo versionsh_l=$release_new >> $clashdir/mark - #设置环境变量 + #设置环境变量 + [ -w /opt/etc/profile ] && profile=/opt/etc/profile + [ -w /jffs/configs/profile.add ] && profile=/jffs/configs/profile.add [ -w ~/.bashrc ] && profile=~/.bashrc [ -w /etc/profile ] && profile=/etc/profile if [ -n "$profile" ];then @@ -380,6 +381,8 @@ gettar(){ echo 无法写入环境变量!请检查安装权限! exit 1 fi + #华硕/Padavan额外设置 + [ -n "$systype" ] && sed -i '/ShellClash初始化/'d $initdir && echo "$clashdir/start.sh init #ShellClash初始化脚本" >> $initdir #删除临时文件 rm -rf /tmp/clashfm.tar.gz rm -rf $clashdir/clashservice @@ -845,6 +848,8 @@ update(){ sed -i '/all_proxy/'d $profile sed -i '/ALL_PROXY/'d $profile sed -i "/启用外网访问SSH服务/d" /etc/firewall.user + sed -i '/ShellClash初始化/'d /etc/storage/started_script.sh 2>/dev/null + sed -i '/ShellClash初始化/'d /jffs/.asusrouter 2>/dev/null rm -rf $clashdir rm -rf /etc/init.d/clash rm -rf /etc/systemd/system/clash.service diff --git a/scripts/start.sh b/scripts/start.sh index dbbd5eb..c24ad06 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -4,8 +4,8 @@ #脚本内部工具 getconfig(){ #加载配置文件 - [ -n "/etc/storage/clash" ] && clashdir=/etc/storage/clash - [ -n "/jffs/clash" ] && clashdir=/etc/storage/clash + [ -d "/etc/storage/clash" ] && clashdir=/etc/storage/clash + [ -d "/jffs/clash" ] && clashdir=/jffs/clash [ -z "$clashdir" ] && clashdir=$(cat /etc/profile | grep clashdir | awk -F "\"" '{print $2}') [ -z "$clashdir" ] && clashdir=$(cat ~/.bashrc | grep clashdir | awk -F "\"" '{print $2}') ccfg=$clashdir/mark @@ -643,7 +643,7 @@ afstart(){ #设置本机代理 [ "$local_proxy" = "已开启" ] && $0 set_proxy $mix_port $db_port #启用面板配置自动保存 - 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 & #后台还原面板配置 else logger "clash服务启动失败!请查看报错信息!" 31 @@ -708,11 +708,12 @@ restart) $0 start ;; init) - [ -n "/etc/storage/clash" ] && clashdir=/etc/storage/clash - [ -n "/jffs/clash" ] && clashdir=/etc/storage/clash - echo "alias clash=\"$clashdir/clash.sh\"" >> /opt/etc/profile - echo "export clashdir=\"$clashdir\"" >> /opt/etc/profile + [ -d "/etc/storage/clash" ] && clashdir=/etc/storage/clash && profile=/opt/etc/profile + [ -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 + crontab $clashdir/cron ;; getyaml) getconfig @@ -735,7 +736,7 @@ web_restore) ;; daemon) getconfig - cronset '#clash保守模式守护进程' "*/1 * * * * test -z \"$(pidof clash)\" && $clashdir/start.sh restart #clash保守模式守护进程" + cronset '#clash保守模式守护进程' "*/1 * * * * test -z \"\$(pidof clash)\" && $clashdir/start.sh restart #clash保守模式守护进程" ;; cronset) cronset $2 $3