mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-13 08:51:30 +00:00
Merge branch 'dev' into gateway
This commit is contained in:
@@ -256,8 +256,7 @@ grep -q 'firewall_mod' "$CRASHDIR/configs/ShellClash.cfg" 2>/dev/null || {
|
|||||||
[ -w /etc/profile ] && profile=/etc/profile
|
[ -w /etc/profile ] && profile=/etc/profile
|
||||||
set_profile() {
|
set_profile() {
|
||||||
[ -z "$my_alias" ] && my_alias=crash
|
[ -z "$my_alias" ] && my_alias=crash
|
||||||
sed -i "/alias crash=*/"d "$1"
|
sed -i "/ShellCrash\/menu.sh/"d "$profile"
|
||||||
sed -i "/alias ${my_alias}=*/"d "$1"
|
|
||||||
echo "alias ${my_alias}=\"$shtype $CRASHDIR/menu.sh\"" >>"$1" #设置快捷命令环境变量
|
echo "alias ${my_alias}=\"$shtype $CRASHDIR/menu.sh\"" >>"$1" #设置快捷命令环境变量
|
||||||
sed -i '/export CRASHDIR=*/'d "$1"
|
sed -i '/export CRASHDIR=*/'d "$1"
|
||||||
echo "export CRASHDIR=\"$CRASHDIR\"" >>"$1" #设置路径环境变量
|
echo "export CRASHDIR=\"$CRASHDIR\"" >>"$1" #设置路径环境变量
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
CRASHDIR="$(uci get firewall.ShellCrash.path | sed 's/\/misnap_init.sh//')"
|
CRASHDIR="$(uci get firewall.ShellCrash.path | sed 's/\/misnap_init.sh//')"
|
||||||
profile=/etc/profile
|
profile=/etc/profile
|
||||||
|
. "$CRASHDIR"/configs/ShellCrash.cfg
|
||||||
|
|
||||||
autoSSH(){
|
autoSSH(){
|
||||||
#自动开启SSH
|
#自动开启SSH
|
||||||
@@ -55,12 +56,11 @@ init(){
|
|||||||
done
|
done
|
||||||
sleep 20
|
sleep 20
|
||||||
#初始化环境变量
|
#初始化环境变量
|
||||||
sed -i "/alias crash/d" $profile
|
[ -z "$my_alias" ] && my_alias=crash
|
||||||
sed -i "/alias clash/d" $profile
|
sed -i "/ShellCrash\/menu.sh/"d "$profile"
|
||||||
sed -i "/export CRASHDIR/d" $profile
|
echo "alias ${my_alias}=\"sh $CRASHDIR/menu.sh\"" >>"$profile"
|
||||||
echo "alias crash=\"sh $CRASHDIR/menu.sh\"" >>$profile
|
sed -i "/export CRASHDIR/d" "$profile"
|
||||||
echo "alias clash=\"sh $CRASHDIR/menu.sh\"" >>$profile
|
echo "export CRASHDIR=\"$CRASHDIR\"" >>"$profile"
|
||||||
echo "export CRASHDIR=\"$CRASHDIR\"" >>$profile
|
|
||||||
autoSSH #软固化功能
|
autoSSH #软固化功能
|
||||||
auto_clean #自动清理
|
auto_clean #自动清理
|
||||||
#设置init.d服务
|
#设置init.d服务
|
||||||
|
|||||||
@@ -2155,12 +2155,11 @@ init)
|
|||||||
profile=$(cat /etc/profile | grep -oE '\-f.*jffs.*profile' | awk '{print $2}')
|
profile=$(cat /etc/profile | grep -oE '\-f.*jffs.*profile' | awk '{print $2}')
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
sed -i "/alias crash/d" $profile
|
[ -z "$my_alias" ] && my_alias=crash
|
||||||
sed -i "/alias clash/d" $profile
|
sed -i "/ShellCrash\/menu.sh/"d "$profile"
|
||||||
sed -i "/export CRASHDIR/d" $profile
|
echo "alias ${my_alias}=\"sh $CRASHDIR/menu.sh\"" >>"$profile"
|
||||||
echo "alias crash=\"$CRASHDIR/menu.sh\"" >>$profile
|
sed -i "/export CRASHDIR/d" "$profile"
|
||||||
echo "alias clash=\"$CRASHDIR/menu.sh\"" >>$profile
|
echo "export CRASHDIR=\"$CRASHDIR\"" >>"$profile"
|
||||||
echo "export CRASHDIR=\"$CRASHDIR\"" >>$profile
|
|
||||||
[ -f "$CRASHDIR"/.dis_startup ] && cronset "保守模式守护进程" || $0 start
|
[ -f "$CRASHDIR"/.dis_startup ] && cronset "保守模式守护进程" || $0 start
|
||||||
;;
|
;;
|
||||||
webget)
|
webget)
|
||||||
|
|||||||
@@ -1333,7 +1333,10 @@ getcore(){ #下载内核文件
|
|||||||
rm -rf ${TMPDIR}/core_new.tar.gz
|
rm -rf ${TMPDIR}/core_new.tar.gz
|
||||||
[ -z "$custcorelink" ] && error_down
|
[ -z "$custcorelink" ] && error_down
|
||||||
else
|
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 ] && {
|
[ -f ${TMPDIR}/core_new.tar.gz ] && {
|
||||||
mkdir -p ${TMPDIR}/core_tmp
|
mkdir -p ${TMPDIR}/core_tmp
|
||||||
[ "$BINDIR" = "$TMPDIR" ] && rm -rf ${TMPDIR}/CrashCore #小闪存模式防止空间不足
|
[ "$BINDIR" = "$TMPDIR" ] && rm -rf ${TMPDIR}/CrashCore #小闪存模式防止空间不足
|
||||||
|
|||||||
Reference in New Issue
Block a user