mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-10 23:41:22 +00:00
~修复镜像化设备自定义别名重启后失效的bug
~优化低内存设备更新内核时的/tmp占用
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
|
||||
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" #设置路径环境变量
|
||||
|
||||
@@ -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服务
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 #小闪存模式防止空间不足
|
||||
|
||||
Reference in New Issue
Block a user