mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-12 00:11:31 +00:00
~脚本进行大量拆分和优化
This commit is contained in:
34
scripts/starts/general_init.sh
Normal file
34
scripts/starts/general_init.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) Juewuy
|
||||
|
||||
#初始化目录
|
||||
CRASHDIR=$(
|
||||
cd $(dirname $0)
|
||||
cd ..
|
||||
pwd
|
||||
)
|
||||
profile=/etc/profile
|
||||
. "$CRASHDIR"/libs/set_profile.sh
|
||||
. "$CRASHDIR"/libs/set_cron.sh
|
||||
. "$CRASHDIR"/configs/ShellCrash.cfg
|
||||
#padavan和华硕环境变量目录设置
|
||||
if [ -d "/etc/storage/clash" -o -d "/etc/storage/ShellCrash" ]; then
|
||||
i=1
|
||||
while [ ! -w /etc/profile -a "$i" -lt 10 ]; do
|
||||
sleep 3 && i=$((i + 1))
|
||||
done
|
||||
[ -w "$profile" ] || profile=/etc_ro/profile
|
||||
mount -t tmpfs -o remount,rw,size=45M tmpfs /tmp #增加/tmp空间以适配新的内核压缩方式
|
||||
sed -i '' "$profile" #将软链接转化为一般文件
|
||||
elif [ -d "/jffs" ]; then
|
||||
sleep 60
|
||||
[ -w "$profile" ] || profile=$(cat /etc/profile | grep -oE '\-f.*jffs.*profile' | awk '{print $2}')
|
||||
fi
|
||||
#写入环境变量
|
||||
set_profile "$profile"
|
||||
#启动进程或删除守护进程
|
||||
if [ -f "$CRASHDIR"/.dis_startup ];then
|
||||
cronset "保守模式守护进程"
|
||||
else
|
||||
"$CRASHDIR"/start.sh start
|
||||
fi
|
||||
Reference in New Issue
Block a user