mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 21:50:52 +07:00
sspatch: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
f43c00682d
commit
6e5d8be845
@ -1,67 +1,71 @@
|
|||||||
#!/usr/bin/env ash
|
#!/usr/bin/env ash
|
||||||
|
|
||||||
if [ "${1}" = "late" ]; then
|
if [ "${1}" = "late" ]; then
|
||||||
if [ -d /tmpRoot/var/packages/SurveillanceStation ]; then
|
if [ -d /tmpRoot/var/packages/SurveillanceStation ]; then
|
||||||
echo "Installing addon sspatch - ${1}"
|
echo "Installing addon sspatch - ${1}"
|
||||||
mkdir -p "/tmpRoot/usr/arc/addons/"
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
# Define the entries to be added
|
SO_FILE="/tmpRoot/var/packages/SurveillanceStation/target/lib/libssutils.so"
|
||||||
ENTRIES=("0.0.0.0 synosurveillance.synology.com")
|
if [ ! -f "${SO_FILE}" ]; then
|
||||||
|
echo "SSPatch: libssutils.so does not exist"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Loop over each entry
|
# Define the entries to be added
|
||||||
for ENTRY in "${ENTRIES[@]}"
|
ENTRIES=("0.0.0.0 synosurveillance.synology.com")
|
||||||
do
|
|
||||||
if [ -f /tmpRoot/etc/hosts ]; then
|
|
||||||
# Check if the entry is already in the file
|
|
||||||
if grep -Fxq "$ENTRY" /tmpRoot/etc/hosts; then
|
|
||||||
echo "Entry $ENTRY already exists"
|
|
||||||
else
|
|
||||||
echo "Entry $ENTRY does not exist, adding now"
|
|
||||||
echo "$ENTRY" >> /tmpRoot/etc/hosts
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -f /tmpRoot/etc.defaults/hosts ]; then
|
|
||||||
if grep -Fxq "$ENTRY" /tmpRoot/etc.defaults/hosts; then
|
|
||||||
echo "Entry $ENTRY already exists"
|
|
||||||
else
|
|
||||||
echo "Entry $ENTRY does not exist, adding now"
|
|
||||||
echo "$ENTRY" >> /tmpRoot/etc.defaults/hosts
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SO_FILE="/tmpRoot/usr/lib/libssutils.so"
|
|
||||||
[ ! -f "${SO_FILE}" ] && echo "SSPatch: libssutils.so does not exist" && exit 0
|
|
||||||
|
|
||||||
# Check Sha256sum
|
# Loop over each entry
|
||||||
if [ "$(sha256sum "${SO_FILE}" | cut -d' ' -f1)" = "81b64d65f4a2a65626f9280ba43ea43f031a239af3152b859b79e1b5124cc6e3" ]; then
|
for ENTRY in "${ENTRIES[@]}"
|
||||||
PATCH="8548ffffff41be43000000e93dffffff/8548ffffff41be7b000000e93dffffff"
|
do
|
||||||
cp -vf "${SO_FILE}" "${SO_FILE}.bak"
|
if [ -f /tmpRoot/etc/hosts ]; then
|
||||||
cp -f "${SO_FILE}" "${SO_FILE}.tmp"
|
# Check if the entry is already in the file
|
||||||
xxd -c $(xxd -p "${SO_FILE}.tmp" 2>/dev/null | wc -c) -p "${SO_FILE}.tmp" 2>/dev/null |
|
if grep -Fxq "$ENTRY" /tmpRoot/etc/hosts; then
|
||||||
sed "s/${PATCH}/" |
|
echo "Entry $ENTRY already exists"
|
||||||
xxd -r -p >"${SO_FILE}" 2>/dev/null
|
else
|
||||||
rm -f "${SO_FILE}.tmp"
|
echo "Entry $ENTRY does not exist, adding now"
|
||||||
echo "SSPatch: libssutils.so is patched"
|
echo "$ENTRY" >> /tmpRoot/etc/hosts
|
||||||
elif [ "$(sha256sum "${SO_FILE}" | cut -d' ' -f1)" = "b0fafefe820aa8ecd577313dff2ae22cf41a6ddf44051f01670c3b92ee04224d" ]; then
|
fi
|
||||||
PATCH="850b010000e8b684e5ff83f80141bc43/850b010000e8b684e5ff83f80141bc7b"
|
fi
|
||||||
cp -vf "${SO_FILE}" "${SO_FILE}.bak"
|
if [ -f /tmpRoot/etc.defaults/hosts ]; then
|
||||||
cp -f "${SO_FILE}" "${SO_FILE}.tmp"
|
if grep -Fxq "$ENTRY" /tmpRoot/etc.defaults/hosts; then
|
||||||
xxd -c $(xxd -p "${SO_FILE}.tmp" 2>/dev/null | wc -c) -p "${SO_FILE}.tmp" 2>/dev/null |
|
echo "Entry $ENTRY already exists"
|
||||||
sed "s/${PATCH}/" |
|
else
|
||||||
xxd -r -p >"${SO_FILE}" 2>/dev/null
|
echo "Entry $ENTRY does not exist, adding now"
|
||||||
rm -f "${SO_FILE}.tmp"
|
echo "$ENTRY" >> /tmpRoot/etc.defaults/hosts
|
||||||
echo "SSPatch: libssutils.so is patched"
|
fi
|
||||||
else
|
fi
|
||||||
if [ -f "${SO_FILE}.bak" ]; then
|
done
|
||||||
echo "SSPatch: libssutils.so is already patched"
|
|
||||||
|
# Check Sha256sum
|
||||||
|
if [ "$(sha256sum "${SO_FILE}" | cut -d' ' -f1)" = "81b64d65f4a2a65626f9280ba43ea43f031a239af3152b859b79e1b5124cc6e3" ]; then
|
||||||
|
PATCH="8548ffffff41be43000000e93dffffff/8548ffffff41be7b000000e93dffffff"
|
||||||
|
cp -vf "${SO_FILE}" "${SO_FILE}.bak"
|
||||||
|
cp -f "${SO_FILE}" "${SO_FILE}.tmp"
|
||||||
|
xxd -c $(xxd -p "${SO_FILE}.tmp" 2>/dev/null | wc -c) -p "${SO_FILE}.tmp" 2>/dev/null |
|
||||||
|
sed "s/${PATCH}/" |
|
||||||
|
xxd -r -p >"${SO_FILE}" 2>/dev/null
|
||||||
|
rm -f "${SO_FILE}.tmp"
|
||||||
|
echo "SSPatch: libssutils.so is patched"
|
||||||
|
elif [ "$(sha256sum "${SO_FILE}" | cut -d' ' -f1)" = "b0fafefe820aa8ecd577313dff2ae22cf41a6ddf44051f01670c3b92ee04224d" ]; then
|
||||||
|
PATCH="850b010000e8b684e5ff83f80141bc43/850b010000e8b684e5ff83f80141bc7b"
|
||||||
|
cp -vf "${SO_FILE}" "${SO_FILE}.bak"
|
||||||
|
cp -f "${SO_FILE}" "${SO_FILE}.tmp"
|
||||||
|
xxd -c $(xxd -p "${SO_FILE}.tmp" 2>/dev/null | wc -c) -p "${SO_FILE}.tmp" 2>/dev/null |
|
||||||
|
sed "s/${PATCH}/" |
|
||||||
|
xxd -r -p >"${SO_FILE}" 2>/dev/null
|
||||||
|
rm -f "${SO_FILE}.tmp"
|
||||||
|
echo "SSPatch: libssutils.so is patched"
|
||||||
else
|
else
|
||||||
echo "SSPatch: version not supported"
|
if [ -f "${SO_FILE}.bak" ]; then
|
||||||
|
echo "SSPatch: libssutils.so is already patched"
|
||||||
|
else
|
||||||
|
echo "SSPatch: version not supported"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
cp -vf /usr/bin/license.sh /tmpRoot/usr/bin/license.sh
|
||||||
|
cp -vf /usr/bin/S82surveillance.sh /tmpRoot/usr/bin/S82surveillance.sh
|
||||||
fi
|
fi
|
||||||
cp -vf /usr/bin/license.sh /tmpRoot/usr/bin/license.sh
|
|
||||||
cp -vf /usr/bin/S82surveillance.sh /tmpRoot/usr/bin/S82surveillance.sh
|
|
||||||
fi
|
|
||||||
elif [ "${1}" = "uninstall" ]; then
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
echo "Installing addon sspatch - ${1}"
|
echo "Installing addon sspatch - ${1}"
|
||||||
# To-Do
|
# To-Do
|
||||||
|
Loading…
Reference in New Issue
Block a user