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 #小闪存模式防止空间不足