~添加重启设备的定时任务
~修复不显示运行时长的bug
~修复卸载时部分报错
~修复下载列表结构错乱的bug
~修复数据库版本号显示不正常的bug
~修复重复下载面板的bug
~修复未能正确移除版本升级包及安装包的bug
This commit is contained in:
juewuy 2024-01-05 13:12:52 +08:00
parent 809a5b224c
commit 99a0c8494c
9 changed files with 47 additions and 40 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,4 +3,4 @@ clashpre_v=2022.11.25
clash_v=v1.7.1 clash_v=v1.7.1
meta_v=v1.17.0 meta_v=v1.17.0
GeoIP_v=20231230 GeoIP_v=20231230
versionsh=1.8.3d versionsh=1.8.3e

View File

@ -13,4 +13,6 @@
113#$CRASHDIR/task/task.sh update_mmdb#自动更新数据库文件 113#$CRASHDIR/task/task.sh update_mmdb#自动更新数据库文件
121#$CRASHDIR/task/task.sh reset_firewall#重设透明路由防火墙 121#$CRASHDIR/task/task.sh reset_firewall#重设透明路由防火墙
122#reboot#重启路由设备(慎用)

View File

@ -22,12 +22,12 @@ ckstatus(){
#检查重复行并去除 #检查重复行并去除
[ -n "$(awk 'a[$0]++' $CFG_PATH)" ] && awk '!a[$0]++' $CFG_PATH > $CFG_PATH [ -n "$(awk 'a[$0]++' $CFG_PATH)" ] && awk '!a[$0]++' $CFG_PATH > $CFG_PATH
#检查时间戳 #检查时间戳
touch $TMPDIR/clash_start_time touch $TMPDIR/crash_start_time
#使用source加载配置文件 #使用source加载配置文件
source $CFG_PATH > /dev/null source $CFG_PATH > /dev/null
else else
mkdir -p $CRASHDIR/configs mkdir -p $CRASHDIR/configs
echo '#标识clash运行状态的文件不明勿动' > $CFG_PATH echo '#标识ShellCrash运行状态的文件不明勿动' > $CFG_PATH
fi fi
versionsh=$(cat $CRASHDIR/init.sh | grep -E ^version= | head -n 1 | sed 's/version=//') versionsh=$(cat $CRASHDIR/init.sh | grep -E ^version= | head -n 1 | sed 's/version=//')
[ -n "$versionsh" ] && versionsh_l=$versionsh [ -n "$versionsh" ] && versionsh_l=$versionsh
@ -62,10 +62,10 @@ ckstatus(){
#开机自启描述 #开机自启描述
if [ "$autostart" = "enable" ]; then if [ "$autostart" = "enable" ]; then
auto="\033[32m已设置开机启动\033[0m" auto="\033[32m已设置开机启动\033[0m"
auto1="\033[36m禁用\033[0mclash开机启动" auto1="\033[36m禁用\033[0mShellCrash开机启动"
else else
auto="\033[31m未设置开机启动\033[0m" auto="\033[31m未设置开机启动\033[0m"
auto1="\033[36m允许\033[0mclash开机启动" auto1="\033[36m允许\033[0mShellCrash开机启动"
fi fi
#获取运行状态 #获取运行状态
PID=$(pidof clash | awk '{print $NF}') PID=$(pidof clash | awk '{print $NF}')
@ -73,8 +73,8 @@ ckstatus(){
run="\033[32m正在运行$redir_mod\033[0m" run="\033[32m正在运行$redir_mod\033[0m"
VmRSS=`cat /proc/$PID/status|grep -w VmRSS|awk '{print $2,$3}'` VmRSS=`cat /proc/$PID/status|grep -w VmRSS|awk '{print $2,$3}'`
#获取运行时长 #获取运行时长
touch $TMPDIR/clash_start_time #用于延迟启动的校验 touch $TMPDIR/crash_start_time #用于延迟启动的校验
start_time=$(cat $TMPDIR/clash_start_time) start_time=$(cat $TMPDIR/crash_start_time)
if [ -n "$start_time" ]; then if [ -n "$start_time" ]; then
time=$((`date +%s`-start_time)) time=$((`date +%s`-start_time))
day=$((time/86400)) day=$((time/86400))
@ -589,7 +589,7 @@ setdns(){
elif [ "$num" = 6 ]; then elif [ "$num" = 6 ]; then
echo ----------------------------------------------- echo -----------------------------------------------
if [ "$dns_redir" = "未开启" ]; then if [ "$dns_redir" = "未开启" ]; then
echo -e "\033[31m将使用OpenWrt中Dnsmasq插件自带的DNS转发功能转发DNS请求至clash内核!\033[0m" echo -e "\033[31m将使用OpenWrt中Dnsmasq插件自带的DNS转发功能转发DNS请求至内核!\033[0m"
echo -e "\033[33m启用后将禁用本插件自带的iptables转发功能\033[0m" echo -e "\033[33m启用后将禁用本插件自带的iptables转发功能\033[0m"
dns_redir=已开启 dns_redir=已开启
echo -e "\033[32m已启用Dnsmasq转发DNS功能\033[0m" echo -e "\033[32m已启用Dnsmasq转发DNS功能\033[0m"
@ -761,7 +761,7 @@ checkport(){
for portx in $dns_port $mix_port $redir_port $db_port ;do for portx in $dns_port $mix_port $redir_port $db_port ;do
if [ -n "$(netstat -ntul 2>&1 |grep '\:$portx ')" ];then if [ -n "$(netstat -ntul 2>&1 |grep '\:$portx ')" ];then
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "检测到端口【$portx】被以下进程占用!clash可能无法正常启动!\033[33m" echo -e "检测到端口【$portx】被以下进程占用!内核可能无法正常启动!\033[33m"
echo $(netstat -ntul | grep :$portx | head -n 1) echo $(netstat -ntul | grep :$portx | head -n 1)
echo -e "\033[0m-----------------------------------------------" echo -e "\033[0m-----------------------------------------------"
echo -e "\033[36m请修改默认端口配置\033[0m" echo -e "\033[36m请修改默认端口配置\033[0m"
@ -926,7 +926,7 @@ localproxy(){
3) 3)
if [ -z "$authentication" -o "$authentication" = "未设置" ];then if [ -z "$authentication" -o "$authentication" = "未设置" ];then
local_type="环境变量" local_type="环境变量"
echo -e "\033[33m注意请重启clash后手动输入以下命令使配置生效\033[0m" echo -e "\033[33m注意请重启ShellCrash服务后手动输入以下命令使配置生效\033[0m"
echo -e "【\033[32m source /etc/profile > /dev/null \033[0m】" echo -e "【\033[32m source /etc/profile > /dev/null \033[0m】"
local_proxy=已开启 local_proxy=已开启
else else
@ -951,7 +951,7 @@ setboot(){
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[30;47m欢迎使用启动设置菜单\033[0m" echo -e "\033[30;47m欢迎使用启动设置菜单\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e " 1 ${auto_set}\033[0mclash开机启动" echo -e " 1 ${auto_set}\033[0mShellCrash开机启动"
echo -e " 2 使用保守模式: \033[36m$start_old\033[0m ————基于定时任务(每分钟检测)" echo -e " 2 使用保守模式: \033[36m$start_old\033[0m ————基于定时任务(每分钟检测)"
echo -e " 3 设置自启延时: \033[36m$delay\033[0m ————用于解决自启后服务受限" echo -e " 3 设置自启延时: \033[36m$delay\033[0m ————用于解决自启后服务受限"
echo -e " 4 启用小闪存模式: \033[36m$mini_clash\033[0m ————用于闪存空间不足的设备" echo -e " 4 启用小闪存模式: \033[36m$mini_clash\033[0m ————用于闪存空间不足的设备"
@ -1283,7 +1283,7 @@ clashcfg(){
} }
echo -e " 4 只代理常用端口: \033[36m$common_ports\033[0m ————用于过滤P2P流量" echo -e " 4 只代理常用端口: \033[36m$common_ports\033[0m ————用于过滤P2P流量"
echo -e " 5 过滤局域网设备: \033[36m$mac_return\033[0m ————使用黑/白名单进行过滤" echo -e " 5 过滤局域网设备: \033[36m$mac_return\033[0m ————使用黑/白名单进行过滤"
echo -e " 6 设置本机代理服务: \033[36m$local_proxy\033[0m ————使本机流量经过clash内核" echo -e " 6 设置本机代理服务: \033[36m$local_proxy\033[0m ————使本机流量经过ShellCrash内核"
echo -e " 7 屏蔽QUIC流量: \033[36m$quic_rj\033[0m ————优化视频性能" echo -e " 7 屏蔽QUIC流量: \033[36m$quic_rj\033[0m ————优化视频性能"
[ "$disoverride" != "1" ] && { [ "$disoverride" != "1" ] && {
[ "$dns_mod" = "fake-ip" ] && \ [ "$dns_mod" = "fake-ip" ] && \
@ -1372,7 +1372,7 @@ clashcfg(){
echo ----------------------------------------------- echo -----------------------------------------------
if [ -n "$(echo "$redir_mod" | grep -oE '混合|Tproxy|Tun')" ];then if [ -n "$(echo "$redir_mod" | grep -oE '混合|Tproxy|Tun')" ];then
if [ "$quic_rj" = "未开启" ]; then if [ "$quic_rj" = "未开启" ]; then
echo -e "\033[33m已禁止QUIC流量通过clash内核\033[0m" echo -e "\033[33m已禁止QUIC流量通过ShellCrash内核\033[0m"
quic_rj=已启用 quic_rj=已启用
else else
echo -e "\033[33m已取消禁止QUIC协议流量\033[0m" echo -e "\033[33m已取消禁止QUIC协议流量\033[0m"
@ -1426,7 +1426,7 @@ clashadv(){
# #
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[30;47m欢迎使用进阶模式菜单\033[0m" echo -e "\033[30;47m欢迎使用进阶模式菜单\033[0m"
echo -e "\033[33m如您并不了解clash的运行机制请勿更改本页面功能\033[0m" echo -e "\033[33m如您并不了解ShellCrash的运行机制请勿更改本页面功能\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
[ "$disoverride" != "1" ] && echo -e " 1 ipv6相关" [ "$disoverride" != "1" ] && echo -e " 1 ipv6相关"
#echo -e " 2 配置Meta特性" #echo -e " 2 配置Meta特性"
@ -1461,7 +1461,7 @@ clashadv(){
rm -rf $bindir/clash rm -rf $bindir/clash
clashcore=meta clashcore=meta
setconfig clashcore $clashcore setconfig clashcore $clashcore
echo "已将clash内核切换为Meta内核域名嗅探依赖Meta或者高版本clashpre内核" echo "已将ShellCrash内核切换为Meta内核域名嗅探依赖Meta或者高版本clashpre内核"
fi fi
sniffer=已启用 sniffer=已启用
elif [ "$clashcore" = "clashpre" -a "$dns_mod" = "redir_host" ];then elif [ "$clashcore" = "clashpre" -a "$dns_mod" = "redir_host" ];then
@ -1823,8 +1823,8 @@ case "$1" in
echo " -u 卸载脚本" echo " -u 卸载脚本"
echo " -i 初始化脚本" echo " -i 初始化脚本"
echo ----------------------------------------- echo -----------------------------------------
echo " clash -s start 启动服务" echo " crash -s start 启动服务"
echo " clash -s stop 停止服务" echo " crash -s stop 停止服务"
echo " 安装目录/start.sh init 开机初始化" echo " 安装目录/start.sh init 开机初始化"
echo ----------------------------------------- echo -----------------------------------------
echo "在线求助t.me/ShellClash" echo "在线求助t.me/ShellClash"
@ -1850,9 +1850,9 @@ case "$1" in
read -p "确认卸载ShellCrash(警告:该操作不可逆!)[1/0] > " res read -p "确认卸载ShellCrash(警告:该操作不可逆!)[1/0] > " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
$CRASHDIR/start.sh stop $CRASHDIR/start.sh stop
$CRASHDIR/start.sh cronset "clash服务" $CRASHDIR/start.sh cronset "clash服务" 2>/dev/null
$CRASHDIR/start.sh cronset "订阅链接" $CRASHDIR/start.sh cronset "订阅链接" 2>/dev/null
$CRASHDIR/start.sh cronset "ShellCrash初始化" $CRASHDIR/start.sh cronset "ShellCrash初始化" 2>/dev/null
read -p "是否保留脚本配置及订阅文件?[1/0] > " res read -p "是否保留脚本配置及订阅文件?[1/0] > " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
mv -f $CRASHDIR/configs /tmp/clash_$USER mv -f $CRASHDIR/configs /tmp/clash_$USER
@ -1884,9 +1884,9 @@ case "$1" in
userdel -r shellclash 2>/dev/null userdel -r shellclash 2>/dev/null
nvram set script_usbmount="" 2>/dev/null nvram set script_usbmount="" 2>/dev/null
nvram commit 2>/dev/null nvram commit 2>/dev/null
uci delete firewall.ShellClash uci delete firewall.ShellClash 2>/dev/null
uci delete firewall.ShellCrash uci delete firewall.ShellCrash 2>/dev/null
uci commit firewall uci commit firewall 2>/dev/null
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[36m已卸载ShellCrash相关文件有缘再会\033[0m" echo -e "\033[36m已卸载ShellCrash相关文件有缘再会\033[0m"
echo -e "\033[33m请手动关闭当前窗口以重置环境变量\033[0m" echo -e "\033[33m请手动关闭当前窗口以重置环境变量\033[0m"

View File

@ -746,7 +746,6 @@ gettar(){
mkdir -p $CRASHDIR > /dev/null mkdir -p $CRASHDIR > /dev/null
tar -zxvf "$TMPDIR/clashfm.tar.gz" -C $CRASHDIR/ || tar -zxvf "$TMPDIR/clashfm.tar.gz" --no-same-owner -C $CRASHDIR/ tar -zxvf "$TMPDIR/clashfm.tar.gz" -C $CRASHDIR/ || tar -zxvf "$TMPDIR/clashfm.tar.gz" --no-same-owner -C $CRASHDIR/
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
rm -rf $TMPDIR/clashfm.tar.gz
echo -e "\033[33m文件解压失败\033[0m" echo -e "\033[33m文件解压失败\033[0m"
error_down error_down
else else
@ -754,6 +753,7 @@ gettar(){
echo -e "\033[32m脚本更新成功\033[0m" echo -e "\033[32m脚本更新成功\033[0m"
fi fi
fi fi
rm -rf $TMPDIR/clashfm.tar.gz
exit exit
} }
getsh(){ getsh(){
@ -955,6 +955,7 @@ getgeo(){
sleep 1 sleep 1
} }
setgeo(){ setgeo(){
source $CFG_PATH > /dev/null
[ -n "$cn_mini.mmdb_v" ] && geo_type_des=精简版 || geo_type_des=全球版 [ -n "$cn_mini.mmdb_v" ] && geo_type_des=精简版 || geo_type_des=全球版
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[36m请选择需要更新的GeoIP/CN_IP数据库\033[0m" echo -e "\033[36m请选择需要更新的GeoIP/CN_IP数据库\033[0m"
@ -969,17 +970,22 @@ setgeo(){
echo " 0 返回上级菜单" echo " 0 返回上级菜单"
echo ----------------------------------------------- echo -----------------------------------------------
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
if [ "$num" = '1' ]; then case "$num" in
0)
;;
1)
geotype=Country.mmdb geotype=Country.mmdb
geoname=Country.mmdb geoname=Country.mmdb
getgeo getgeo
setgeo setgeo
elif [ "$num" = '2' ]; then ;;
2)
geotype=cn_mini.mmdb geotype=cn_mini.mmdb
geoname=Country.mmdb geoname=Country.mmdb
getgeo getgeo
setgeo setgeo
elif [ "$num" = '3' ]; then ;;
3)
if [ "$cn_ip_route" = "已开启" ]; then if [ "$cn_ip_route" = "已开启" ]; then
geotype=china_ip_list.txt geotype=china_ip_list.txt
geoname=cn_ip.txt geoname=cn_ip.txt
@ -990,7 +996,8 @@ setgeo(){
sleep 1 sleep 1
fi fi
setgeo setgeo
elif [ "$num" = '4' ]; then ;;
4)
if [ "$cn_ipv6_route" = "已开启" -a "$ipv6_redir" = "已开启" ]; then if [ "$cn_ipv6_route" = "已开启" -a "$ipv6_redir" = "已开启" ]; then
geotype=china_ipv6_list.txt geotype=china_ipv6_list.txt
geoname=cn_ipv6.txt geoname=cn_ipv6.txt
@ -1001,7 +1008,8 @@ setgeo(){
sleep 1 sleep 1
fi fi
setgeo setgeo
elif [ "$num" = '5' ]; then ;;
5)
if [ "$clashcore" = "meta" ]; then if [ "$clashcore" = "meta" ]; then
geotype=geosite.dat geotype=geosite.dat
geoname=GeoSite.dat geoname=GeoSite.dat
@ -1012,9 +1020,11 @@ setgeo(){
sleep 1 sleep 1
fi fi
setgeo setgeo
else ;;
update *)
fi errornum
;;
esac
} }
getdb(){ getdb(){
@ -1115,23 +1125,18 @@ setdb(){
if [ "$num" = '1' ]; then if [ "$num" = '1' ]; then
db_type=clashdb db_type=clashdb
dbdir dbdir
getdb
elif [ "$num" = '2' ]; then elif [ "$num" = '2' ]; then
db_type=meta_db db_type=meta_db
dbdir dbdir
getdb
elif [ "$num" = '3' ]; then elif [ "$num" = '3' ]; then
db_type=yacd db_type=yacd
dbdir dbdir
getdb
elif [ "$num" = '4' ]; then elif [ "$num" = '4' ]; then
db_type=meta_yacd db_type=meta_yacd
dbdir dbdir
getdb
elif [ "$num" = '5' ]; then elif [ "$num" = '5' ]; then
db_type=meta_xd db_type=meta_xd
dbdir dbdir
getdb
elif [ "$num" = '6' ]; then elif [ "$num" = '6' ]; then
read -p "确认卸载本地面板?(1/0) > " res read -p "确认卸载本地面板?(1/0) > " res
if [ "$res" = 1 ];then if [ "$res" = 1 ];then

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# Copyright (C) Juewuy # Copyright (C) Juewuy
version=1.8.3d version=1.8.3e
setdir(){ setdir(){
dir_avail(){ dir_avail(){
@ -231,7 +231,7 @@ fi
nvram commit nvram commit
} }
#删除临时文件 #删除临时文件
rm -rf /tmp/*lash*gz rm -rf /tmp/*rash*gz
rm -rf /tmp/SC_tmp rm -rf /tmp/SC_tmp
#转换&清理旧版本文件 #转换&清理旧版本文件
mkdir -p $CRASHDIR/yamls mkdir -p $CRASHDIR/yamls

View File

@ -294,7 +294,7 @@ task_type(){ #任务条件选择菜单
echo -e " 输入 6-18 代表\033[36m早6点至晚18点间每小时\033[0m运行" echo -e " 输入 6-18 代表\033[36m早6点至晚18点间每小时\033[0m运行"
read -p "想在每日的具体哪个小时执行0-23 > " hour read -p "想在每日的具体哪个小时执行0-23 > " hour
echo ----------------------------------------------- echo -----------------------------------------------
read -p "想在具体哪分钟执行?(1-59的整数 > " min read -p "想在具体哪分钟执行?(0-59的整数 > " min
cron_time="在每日的$hour点$min分" cron_time="在每日的$hour点$min分"
set_cron set_cron
;; ;;