mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-10 23:41:22 +00:00
~修复setconfig()函数变更带来的bug
This commit is contained in:
@@ -130,7 +130,7 @@ if [ "$systype" = "mi_snapshot" -o "$systype" = "ng_snapshot" ]; then
|
||||
chmod 755 "$CRASHDIR"/starts/snapshot_init.sh
|
||||
if [ "$systype" = "mi_snapshot" ];then
|
||||
path="/data/shellcrash_init.sh"
|
||||
setconfig CRASHDIR "$CRASHDIR" "$CRASHDIR"/starts/snapshot_init.sh
|
||||
sed -i "s#^CRASHDIR=.*#CRASHDIR=$CRASHDIR#" "$CRASHDIR"/starts/snapshot_init.sh
|
||||
mv -f "$CRASHDIR"/starts/snapshot_init.sh "$path"
|
||||
[ ! -f /data/auto_start.sh ] && echo '#用于自定义需要开机启动的功能或者命令,会在开机后自动运行' > /data/auto_start.sh
|
||||
else
|
||||
|
||||
@@ -47,8 +47,8 @@ start)
|
||||
/etc/init.d/shellcrash start
|
||||
elif [ "$USER" = "root" ] && grep -q 'systemd' /proc/1/comm; then
|
||||
FragmentPath=$(systemctl show -p FragmentPath shellcrash | sed 's/FragmentPath=//')
|
||||
[ -f $FragmentPath ] && {
|
||||
setconfig ExecStart "$COMMAND >/dev/null" "$FragmentPath"
|
||||
[ -f "$FragmentPath" ] && {
|
||||
sed -i "s#^ExecStart=.*#ExecStart=$COMMAND >/dev/null#" "$FragmentPath"
|
||||
systemctl daemon-reload
|
||||
}
|
||||
systemctl start shellcrash.service || . "$CRASHDIR"/starts/start_error.sh
|
||||
|
||||
Reference in New Issue
Block a user