sspatch: cleanup

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-11-01 11:44:27 +01:00
parent 2302c49968
commit 083097737a
8 changed files with 19 additions and 36 deletions

View File

@ -13,7 +13,6 @@ function copy_file() {
local mode="${4}"
if [ -f "${input}/${file}" ]; then
echo "sspatch: Copying ${file} to ${target}"
mv -vf "${target}/${file}" "${target}/${file}".bak
cp -vf "${input}/${file}" "${target}/${file}"
chown SurveillanceStation:SurveillanceStation "${target}/${file}"
chmod "${mode}" "${target}/${file}"
@ -22,25 +21,13 @@ function copy_file() {
SSPATH="/var/packages/SurveillanceStation/target"
PATCHPATH="/usr/arc"
PATCHPATHSS="/usr/arc/ss"
if [ -d "${SSPATH}" ]; then
echo "sspatch: SurveillanceStation found"
/usr/syno/bin/synopkg stop SurveillanceStation
sleep 5
echo "sspatch: Checking for SurveillanceStation Backup"
if [ -f "${SSPATH}/lib/libssutils.so.bak" ]; then
echo "sspatch: SurveillanceStation Backup found"
cp -vf "${SSPATH}/lib/libssutils.so.bak" "${SSPATH}/lib/libssutils.so"
[ -f "${SSPATH}/sbin/sscmshostd.bak" ] && cp -vf "${SSPATH}/sbin/sscmshostd.bak" "${SSPATH}/sbin/sscmshostd"
[ -f "${SSPATH}/sbin/sscored.bak" ] && cp -vf "${SSPATH}/sbin/sscored.bak" "${SSPATH}/sbin/sscored"
[ -f "${SSPATH}/sbin/ssdaemonmonitord.bak" ] && cp -vf "${SSPATH}/sbin/ssdaemonmonitord.bak" "${SSPATH}/sbin/ssdaemonmonitord"
[ -f "${SSPATH}/sbin/ssexechelperd.bak" ] && cp -vf "${SSPATH}/sbin/ssexechelperd.bak" "${SSPATH}/sbin/ssexechelperd"
[ -f "${SSPATH}/sbin/ssroutined.bak" ] && cp -vf "${SSPATH}/sbin/ssroutined.bak" "${SSPATH}/sbin/ssroutined"
[ -f "${SSPATH}/sbin/ssmessaged.bak" ] && cp -vf "${SSPATH}/sbin/ssmessaged.bak" "${SSPATH}/sbin/ssmessaged"
[ -f "${SSPATH}/sbin/ssrtmpclientd.bak" ] && cp -vf "${SSPATH}/sbin/ssrtmpclientd.bak" "${SSPATH}/sbin/ssrtmpclientd"
fi
# Define the hosts entries to be added
echo "sspatch: Adding hosts entries"
ENTRIES=("0.0.0.0 synosurveillance.synology.com")
@ -66,20 +53,21 @@ if [ -d "${SSPATH}" ]; then
done
# Check Sha256sum for Patch
[ -f "${SSPATH}/lib/libssutils.org.so" ] && CHECKSUM="$(sha256sum ${SSPATH}/lib/libssutils.org.so | cut -d' ' -f1)" || CHECKSUM="$(sha256sum ${SSPATH}/lib/libssutils.so | cut -d' ' -f1)"
[ ! -f "${SSPATH}/lib/libssutils.org.so" ] && cp -vf "${SSPATH}/lib/libssutils.so" "${SSPATH}/lib/libssutils.org.so" || echo "sspatch: libssutils.org.so already exists"
CHECKSUM="$(sha256sum ${SSPATH}/lib/libssutils.so | cut -d' ' -f1)"
SSPATCH="false"
rm -rf "${PATCHPATHSS}"
mkdir -p "${PATCHPATHSS}"
if [ "${CHECKSUM}" = "b0fafefe820aa8ecd577313dff2ae22cf41a6ddf44051f01670c3b92ee04224d" ]; then
echo "sspatch: SurveillanceStation 9.2.0-11289"
tar -zxf "${PATCHPATH}/sspatch.tgz" -C "${PATCHPATH}/"
tar -zxf "${PATCHPATH}/sspatch.tgz" -C "${PATCHPATHSS}/"
SSPATCH="true"
elif [ "${CHECKSUM}" = "92a8c8c75446daa7328a34acc67172e1f9f3af8229558766dbe5804a86c08a5e" ]; then
if [ -d "/var/packages/NVIDIARuntimeLibrary" ]; then
echo "sspatch: SurveillanceStation DVA3221 9.2.0-11289"
tar -zxf "${PATCHPATH}/sspatch-3221.tgz" -C "${PATCHPATH}/"
tar -zxf "${PATCHPATH}/sspatch-3221.tgz" -C "${PATCHPATHSS}/"
else
echo "sspatch: SurveillanceStation Openvino 9.2.0-11289"
tar -zxf "${PATCHPATH}/sspatch-openvino.tgz" -C "${PATCHPATH}/"
tar -zxf "${PATCHPATH}/sspatch-openvino.tgz" -C "${PATCHPATHSS}/"
fi
SSPATCH="true"
else
@ -87,14 +75,14 @@ if [ -d "${SSPATH}" ]; then
fi
if [ "${SSPATCH}" == "true" ]; then
copy_file ${SSPATH}/lib libssutils.so ${PATCHPATH} 0644
copy_file ${SSPATH}/sbin sscmshostd ${PATCHPATH} 0755
copy_file ${SSPATH}/sbin sscored ${PATCHPATH} 0755
copy_file ${SSPATH}/sbin ssdaemonmonitord ${PATCHPATH} 0755
copy_file ${SSPATH}/sbin ssexechelperd ${PATCHPATH} 0755
copy_file ${SSPATH}/sbin ssroutined ${PATCHPATH} 0755
copy_file ${SSPATH}/sbin ssmessaged ${PATCHPATH} 0755
copy_file ${SSPATH}/sbin ssrtmpclientd ${PATCHPATH} 0755
copy_file ${SSPATH}/lib libssutils.so ${PATCHPATHSS} 0644
copy_file ${SSPATH}/sbin sscmshostd ${PATCHPATHSS} 0755
copy_file ${SSPATH}/sbin sscored ${PATCHPATHSS} 0755
copy_file ${SSPATH}/sbin ssdaemonmonitord ${PATCHPATHSS} 0755
copy_file ${SSPATH}/sbin ssexechelperd ${PATCHPATHSS} 0755
copy_file ${SSPATH}/sbin ssroutined ${PATCHPATHSS} 0755
copy_file ${SSPATH}/sbin ssmessaged ${PATCHPATHSS} 0755
copy_file ${SSPATH}/sbin ssrtmpclientd ${PATCHPATHSS} 0755
fi
sleep 5

Binary file not shown.

View File

@ -12,15 +12,10 @@ if [ "${1}" = "late" ]; then
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
cp -vf "/usr/bin/sspatch.sh" "/tmpRoot/usr/bin/sspatch.sh"
if [ "${2}" = "true" ]; then
cp -vf "/usr/lib/sspatch_60.tgz" "/tmpRoot/usr/arc/sspatch.tgz"
cp -vf "/usr/lib/sspatch-openvino_60.tgz" "/tmpRoot/usr/arc/sspatch-openvino.tgz"
cp -vf "/usr/lib/sspatch-3221_60.tgz" "/tmpRoot/usr/arc/sspatch-3221.tgz"
else
cp -vf "/usr/lib/sspatch_32.tgz" "/tmpRoot/usr/arc/sspatch.tgz"
cp -vf "/usr/lib/sspatch-openvino_32.tgz" "/tmpRoot/usr/arc/sspatch-openvino.tgz"
cp -vf "/usr/lib/sspatch-3221_32.tgz" "/tmpRoot/usr/arc/sspatch-3221.tgz"
fi
cp -vf "/usr/lib/sspatch.tgz" "/tmpRoot/usr/arc/sspatch.tgz"
cp -vf "/usr/lib/sspatch-openvino.tgz" "/tmpRoot/usr/arc/sspatch-openvino.tgz"
cp -vf "/usr/lib/sspatch-3221.tgz" "/tmpRoot/usr/arc/sspatch-3221.tgz"
mkdir -p "/tmpRoot/usr/lib/systemd/system"
DEST="/tmpRoot/usr/lib/systemd/system/sspatch.service"