sspatch: finalize dynamic patch

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-08-21 23:35:12 +02:00
parent f180619154
commit 4b64ba15ac

View File

@ -38,8 +38,8 @@ if [ -d /var/packages/SurveillanceStation ]; then
ORG_FILE="${SSPATH}/target/lib/libssutils.so"
MITM_FILE="${SSPATH}/target/lib/libssutils.mitm.so"
JS_FILE="${SSPATH}/target/ui/sds.js"
if [ ! -f "${SO_FILE}.so" ]; then
echo "SSPatch: libssutils.so does not exist"
if [ ! -f "${SO_FILE}" ]; then
echo "SSPatch: ${SO_FILE} does not exist"
exit 1
fi
@ -47,15 +47,15 @@ if [ -d /var/packages/SurveillanceStation ]; then
sleep 5
# Check Sha256sum (DVA 92a8c8c75446daa7328a34acc67172e1f9f3af8229558766dbe5804a86c08a5e)
if [ "$(sha256sum "${SO_FILE}" | cut -d' ' -f1)" = "b0fafefe820aa8ecd577313dff2ae22cf41a6ddf44051f01670c3b92ee04224d" ]; then
if [ "$(sha256sum ${SO_FILE} | cut -d' ' -f1)" = "b0fafefe820aa8ecd577313dff2ae22cf41a6ddf44051f01670c3b92ee04224d" ]; then
mv -f "${SO_FILE}" "${ORG_FILE}"
cp -f "/usr/lib/libssutils.mitm.so" "${MITM_FILE}"
patchelf --add-needed ${ORG_FILE} ${MITM_FILE}
mv -f "${MITM_FILE}" "${SO_FILE}"
echo "SSPatch: libssutils.so is patched"
echo "SSPatch: ${SO_FILE} is patched"
else
if [ -f "${ORG_FILE}" ]; then
echo "SSPatch: libssutils.so is already patched"
echo "SSPatch: ${SO_FILE} is already patched"
exit 0
else
echo "SSPatch: version not supported"
@ -65,7 +65,7 @@ if [ -d /var/packages/SurveillanceStation ]; then
# Change owner and permissions
chown SurveillanceStation:SurveillanceStation "${SO_FILE}"
chmod 0644 "${SO_FILE}"
echo -e "SSPatch: libssutils.so permissions set"
echo -e "SSPatch: ${SO_FILE} permissions set"
# Remove warning message
sed -i 's/SYNO.API.RedirectToDSMByErrorCode=function(c){alert(SYNO.API.getErrorString(c));/SYNO.API.RedirectToDSMByErrorCode = () => { };/g' ${JS_FILE}