From d4e9980285803a96dea920688b8ffdacbf84145a Mon Sep 17 00:00:00 2001 From: juewuy Date: Sat, 20 Dec 2025 11:35:07 +0800 Subject: [PATCH] =?UTF-8?q?~=E4=BF=AE=E5=A4=8D=E9=95=9C=E5=83=8F=E5=8C=96?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E8=87=AA=E5=AE=9A=E4=B9=89=E5=88=AB=E5=90=8D?= =?UTF-8?q?=E9=87=8D=E5=90=AF=E5=90=8E=E5=A4=B1=E6=95=88=E7=9A=84bug=20~?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BD=8E=E5=86=85=E5=AD=98=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=86=85=E6=A0=B8=E6=97=B6=E7=9A=84/tmp?= =?UTF-8?q?=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/init.sh | 3 +-- scripts/misnap_init.sh | 12 ++++++------ scripts/start.sh | 11 +++++------ scripts/webget.sh | 5 ++++- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/scripts/init.sh b/scripts/init.sh index 3a9a0476..885b7868 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -256,8 +256,7 @@ grep -q 'firewall_mod' "$CRASHDIR/configs/ShellClash.cfg" 2>/dev/null || { [ -w /etc/profile ] && profile=/etc/profile set_profile() { [ -z "$my_alias" ] && my_alias=crash - sed -i "/alias crash=*/"d "$1" - sed -i "/alias ${my_alias}=*/"d "$1" + sed -i "/ShellCrash\/menu.sh/"d "$profile" echo "alias ${my_alias}=\"$shtype $CRASHDIR/menu.sh\"" >>"$1" #设置快捷命令环境变量 sed -i '/export CRASHDIR=*/'d "$1" echo "export CRASHDIR=\"$CRASHDIR\"" >>"$1" #设置路径环境变量 diff --git a/scripts/misnap_init.sh b/scripts/misnap_init.sh index e7a820c7..8a1a69d4 100644 --- a/scripts/misnap_init.sh +++ b/scripts/misnap_init.sh @@ -3,6 +3,7 @@ CRASHDIR="$(uci get firewall.ShellCrash.path | sed 's/\/misnap_init.sh//')" profile=/etc/profile +. "$CRASHDIR"/configs/ShellCrash.cfg autoSSH(){ #自动开启SSH @@ -55,12 +56,11 @@ init(){ done sleep 20 #初始化环境变量 - sed -i "/alias crash/d" $profile - sed -i "/alias clash/d" $profile - sed -i "/export CRASHDIR/d" $profile - echo "alias crash=\"sh $CRASHDIR/menu.sh\"" >>$profile - echo "alias clash=\"sh $CRASHDIR/menu.sh\"" >>$profile - echo "export CRASHDIR=\"$CRASHDIR\"" >>$profile + [ -z "$my_alias" ] && my_alias=crash + sed -i "/ShellCrash\/menu.sh/"d "$profile" + echo "alias ${my_alias}=\"sh $CRASHDIR/menu.sh\"" >>"$profile" + sed -i "/export CRASHDIR/d" "$profile" + echo "export CRASHDIR=\"$CRASHDIR\"" >>"$profile" autoSSH #软固化功能 auto_clean #自动清理 #设置init.d服务 diff --git a/scripts/start.sh b/scripts/start.sh index d1e53456..3ca56e18 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -2148,12 +2148,11 @@ init) profile=$(cat /etc/profile | grep -oE '\-f.*jffs.*profile' | awk '{print $2}') fi fi - sed -i "/alias crash/d" $profile - sed -i "/alias clash/d" $profile - sed -i "/export CRASHDIR/d" $profile - echo "alias crash=\"$CRASHDIR/menu.sh\"" >>$profile - echo "alias clash=\"$CRASHDIR/menu.sh\"" >>$profile - echo "export CRASHDIR=\"$CRASHDIR\"" >>$profile + [ -z "$my_alias" ] && my_alias=crash + sed -i "/ShellCrash\/menu.sh/"d "$profile" + echo "alias ${my_alias}=\"sh $CRASHDIR/menu.sh\"" >>"$profile" + sed -i "/export CRASHDIR/d" "$profile" + echo "export CRASHDIR=\"$CRASHDIR\"" >>"$profile" [ -f "$CRASHDIR"/.dis_startup ] && cronset "保守模式守护进程" || $0 start ;; webget) diff --git a/scripts/webget.sh b/scripts/webget.sh index 77b24551..d8700df4 100644 --- a/scripts/webget.sh +++ b/scripts/webget.sh @@ -1333,7 +1333,10 @@ getcore(){ #下载内核文件 rm -rf ${TMPDIR}/core_new.tar.gz [ -z "$custcorelink" ] && error_down else - [ -n "$(pidof CrashCore)" ] && ${CRASHDIR}/start.sh stop #停止内核服务防止内存不足 + [ -n "$(pidof CrashCore)" ] && { + ${CRASHDIR}/start.sh stop #停止内核服务防止内存不足 + rm -rf "$TMPDIR"/CrashCore #删除缓存内核防止缓存空间不足 + } [ -f ${TMPDIR}/core_new.tar.gz ] && { mkdir -p ${TMPDIR}/core_tmp [ "$BINDIR" = "$TMPDIR" ] && rm -rf ${TMPDIR}/CrashCore #小闪存模式防止空间不足