Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions MerlinAU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ _Unmount_WebUI_()
}

##----------------------------------------##
## Modified by Martinski W. [2025-Jan-05] ##
## Modified by Martinski W. [2025-Jan-12] ##
##----------------------------------------##
_AutoStartupHook_()
{
Expand All @@ -1825,24 +1825,28 @@ _AutoStartupHook_()
fi
else
{
echo "#!/bin/sh" ; echo
echo '[ -x '"$theScriptFilePath"' ] && '"$theScriptFilePath"' startup "$@" & '"$theScriptNameTag"
echo
echo "#!/bin/sh" ; echo
echo '[ -x '"$theScriptFilePath"' ] && '"$theScriptFilePath"' startup "$@" & '"$theScriptNameTag"
echo
} > "$theHookScriptFile"
fi
chmod 755 "$theHookScriptFile"
;;
delete)
if [ -f "$theHookScriptFile" ] && grep -q "$theScriptNameTag" "$theHookScriptFile"
if [ -f "$theHookScriptFile" ] && \
{ grep -q "$theScriptNameTag" "$theHookScriptFile" || \
grep -q "$theScriptFilePath" "$theHookScriptFile" ; }
then
theFixedPath="$(echo "$theScriptFilePath" | sed 's/[\/.]/\\&/g')"
sed -i "/${theScriptNameTag}/d" "$theHookScriptFile"
sed -i "/$theFixedPath startup/d" "$theHookScriptFile"
fi
;;
esac
}

##----------------------------------------##
## Modified by Martinski W. [2025-Jan-05] ##
## Modified by Martinski W. [2025-Jan-12] ##
##----------------------------------------##
_AutoServiceEvent_()
{
Expand Down Expand Up @@ -1871,14 +1875,19 @@ _AutoServiceEvent_()
{
echo "#!/bin/sh" ; echo
echo 'if echo "$2" | /bin/grep -q "'"$SCRIPT_NAME"'" ; then { '"$theScriptFilePath"' service_event "$@" & }; fi '"$theScriptNameTag"
} >> "$theHookScriptFile"
echo
} > "$theHookScriptFile"
fi
chmod 755 "$theHookScriptFile"
;;
delete)
if [ -f "$theHookScriptFile" ] && grep -q "$theScriptNameTag" "$theHookScriptFile"
if [ -f "$theHookScriptFile" ] && \
{ grep -q "$theScriptNameTag" "$theHookScriptFile" || \
grep -q "$theScriptFilePath" "$theHookScriptFile" ; }
then
theFixedPath="$(echo "$theScriptFilePath" | sed 's/[\/.]/\\&/g')"
sed -i "/${theScriptNameTag}/d" "$theHookScriptFile"
sed -i "/$theFixedPath service_event/d" "$theHookScriptFile"
fi
;;
esac
Expand Down
Loading