mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 21:50:52 +07:00
sspatch: cleanup
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
174ddc9d0c
commit
6dce716f00
BIN
sspatch/all/addons/sspatch-openvino.tgz
Normal file
BIN
sspatch/all/addons/sspatch-openvino.tgz
Normal file
Binary file not shown.
BIN
sspatch/all/addons/sspatch.tgz
Normal file
BIN
sspatch/all/addons/sspatch.tgz
Normal file
Binary file not shown.
Binary file not shown.
@ -1,81 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium>
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the MIT License.
|
|
||||||
# See /LICENSE for more information.
|
|
||||||
#
|
|
||||||
|
|
||||||
if [ -d /var/packages/SurveillanceStation ]; then
|
|
||||||
# Define the entries to be added
|
|
||||||
ENTRIES=("0.0.0.0 synosurveillance.synology.com")
|
|
||||||
|
|
||||||
# Loop over each entry
|
|
||||||
for ENTRY in "${ENTRIES[@]}"
|
|
||||||
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
|
|
||||||
|
|
||||||
SSPATH="/var/packages/SurveillanceStation"
|
|
||||||
|
|
||||||
SO_FILE="${SSPATH}/target/lib/libssutils.so"
|
|
||||||
ORG_FILE="${SSPATH}/target/lib/libssutils.org.so"
|
|
||||||
MITM_FILE="${SSPATH}/target/lib/libssutils.mitm.so"
|
|
||||||
JS_FILE="${SSPATH}/target/ui/sds.js"
|
|
||||||
if [ ! -f "${SO_FILE}" ]; then
|
|
||||||
echo "SSPatch: ${SO_FILE} does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
/usr/syno/bin/synopkg stop SurveillanceStation
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
# Check Sha256sum (DVA 92a8c8c75446daa7328a34acc67172e1f9f3af8229558766dbe5804a86c08a5e)
|
|
||||||
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: ${SO_FILE} is patched"
|
|
||||||
else
|
|
||||||
if [ -f "${ORG_FILE}" ]; then
|
|
||||||
echo "SSPatch: ${SO_FILE} is already patched"
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "SSPatch: version not supported"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# Change owner and permissions
|
|
||||||
chown SurveillanceStation:SurveillanceStation "${SO_FILE}"
|
|
||||||
chmod 0644 "${SO_FILE}"
|
|
||||||
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}
|
|
||||||
#echo -e "SSPatch: sds.js patched"
|
|
||||||
|
|
||||||
sleep 5
|
|
||||||
/usr/syno/bin/synopkg start SurveillanceStation
|
|
||||||
echo -e "SSPatch: Successfull!"
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "SSPatch: SurveillanceStation not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
Binary file not shown.
@ -1,45 +1,67 @@
|
|||||||
#!/usr/bin/env ash
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
function copy_file() {
|
||||||
|
local target="${1}"
|
||||||
|
local file="${2}"
|
||||||
|
local input="${3}"
|
||||||
|
local mode="${4}"
|
||||||
|
|
||||||
|
mv -f "${target}/${file}" "${target}/${file}".bak
|
||||||
|
cp -f "${input}/${file}" "${target}/${file}"
|
||||||
|
chown SurveillanceStation:SurveillanceStation "${target}/${file}"
|
||||||
|
chmod "${mode}" "${target}/${file}"
|
||||||
|
}
|
||||||
|
|
||||||
if [ "${1}" = "late" ]; then
|
if [ "${1}" = "late" ]; 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/"
|
||||||
|
|
||||||
cp -vf /usr/bin/sspatch.sh /tmpRoot/usr/bin/sspatch.sh
|
SSPATH="/tmpRoot/var/packages/SurveillanceStation/target"
|
||||||
cp -vf /usr/bin/patchelf /tmpRoot/usr/bin/patchelf
|
INPUTPATH="/usr/arc/addons"
|
||||||
cp -vf /usr/lib/libssutils.mitm.so /tmpRoot/usr/lib/libssutils.mitm.so
|
ADDONSPATH="/tmpRoot/usr/arc/addons"
|
||||||
|
if [ -d "${SSPATH}" ]; then
|
||||||
SED_PATH='/tmpRoot/usr/bin/sed'
|
# Define the hosts entries to be added
|
||||||
${SED_PATH} -i '/synopkg restart SurveillanceStation/d' /tmpRoot/etc/crontab
|
ENTRIES=("0.0.0.0 synosurveillance.synology.com")
|
||||||
# Add line to crontab, execute each minute
|
for ENTRY in "${ENTRIES[@]}"
|
||||||
echo "5 0 * * * root synopkg restart SurveillanceStation #arc sspatch addon" >>/tmpRoot/etc/crontab
|
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
|
||||||
|
|
||||||
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
# Check Sha256sum for Patch
|
||||||
DEST="/tmpRoot/usr/lib/systemd/system/sspatch.service"
|
if [ "$(sha256sum ${SSPATH}/lib/libssutils.so | cut -d' ' -f1)" = "b0fafefe820aa8ecd577313dff2ae22cf41a6ddf44051f01670c3b92ee04224d" ]; then
|
||||||
cat << EOF > ${DEST}
|
tar -zxf "${INPUTPATH}/sspatch.tgz" -C "${ADDONSPATH}/"
|
||||||
[Unit]
|
copy_file ${SSPATH}/lib libssutils.so ${ADDONSPATH}/ 0644
|
||||||
Description=addon sspatch
|
copy_file ${SSPATH}/sbin sscmshostd ${ADDONSPATH}/ 0755
|
||||||
DefaultDependencies=no
|
copy_file ${SSPATH}/sbin sscored ${ADDONSPATH}/ 0755
|
||||||
IgnoreOnIsolate=true
|
copy_file ${SSPATH}/sbin ssdaemonmonitord ${ADDONSPATH}/ 0755
|
||||||
After=multi-user.target
|
copy_file ${SSPATH}/sbin ssexechelperd ${ADDONSPATH}/ 0755
|
||||||
|
copy_file ${SSPATH}/sbin ssroutined ${ADDONSPATH}/ 0755
|
||||||
[Service]
|
copy_file ${SSPATH}/sbin ssrtmpclientd ${ADDONSPATH}/ 0755
|
||||||
User=root
|
fi
|
||||||
Type=simple
|
fi
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=5s
|
|
||||||
ExecStart=/usr/bin/sspatch.sh
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
|
||||||
[X-Synology]
|
|
||||||
Author=Virtualization Team
|
|
||||||
EOF
|
|
||||||
|
|
||||||
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
|
||||||
ln -vsf /usr/lib/systemd/system/sspatch.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/sspatch.service
|
|
||||||
fi
|
|
||||||
elif [ "${1}" = "uninstall" ]; then
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
echo "Installing addon sspatch - ${1}"
|
echo "Installing addon sspatch - ${1}"
|
||||||
# To-Do
|
# To-Do
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
version: 1
|
version: 1
|
||||||
name: sspatch
|
name: sspatch
|
||||||
description: "Dynamic 50 License Patch for SS 9.2.0-11289 (Non DVA)"
|
description: "Dynamic License Patch for SS 9.2.0-11289 (Non DVA)"
|
||||||
system: false
|
system: false
|
||||||
beta: true
|
beta: true
|
||||||
all:
|
all:
|
||||||
|
Loading…
Reference in New Issue
Block a user