amepatch/sspatch: rework

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-10-05 18:07:45 +02:00
parent 50ef03bf0a
commit a51053f35d
4 changed files with 60 additions and 28 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> # Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium>
# #
# This is free software, licensed under the MIT License. # This is free software, licensed under the MIT License.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -18,6 +18,17 @@ if [ -d "/var/packages/CodecPack" ]; then
so_backup="$ame_path/lib/libsynoame-license.so.orig" so_backup="$ame_path/lib/libsynoame-license.so.orig"
lic="/usr/syno/etc/license/data/ame/offline_license.json" lic="/usr/syno/etc/license/data/ame/offline_license.json"
lic_backup="/usr/syno/etc/license/data/ame/offline_license.json.orig" lic_backup="/usr/syno/etc/license/data/ame/offline_license.json.orig"
lic_patched="/usr/arc/ame_license.patched"
if [ -f "$lic_patched" ]; then
if "$ame_path/bin/synoame-bin-auto-install-needed-codec"; then
echo -e "AME Patch: Already patched! -> Codec downloaded!"
exit 0
else
echo -e "AME Patch: Already patched! -> Codec download failed!"
exit 1
fi
fi
if [ ! -f "$so_backup" ]; then if [ ! -f "$so_backup" ]; then
cp -p "$so" "$so_backup" cp -p "$so" "$so_backup"
@ -38,7 +49,8 @@ if [ -d "/var/packages/CodecPack" ]; then
hex_values=('3718' '60A5' '60D1' '6111' '6137' 'B5F0') hex_values=('3718' '60A5' '60D1' '6111' '6137' 'B5F0')
content='[{"attribute": {"codec": "hevc", "type": "free"}, "status": "valid", "extension_gid": null, "expireTime": 0, "appName": "ame", "follow": ["device"], "duration": 1576800000, "appType": 14, "licenseContent": 1, "registered_at": 1649315995, "server_time": 1685421618, "firstActTime": 1649315995, "licenseCode": "0"}, {"attribute": {"codec": "aac", "type": "free"}, "status": "valid", "extension_gid": null, "expireTime": 0, "appName": "ame", "follow": ["device"], "duration": 1576800000, "appType": 14, "licenseContent": 1, "registered_at": 1649315995, "server_time": 1685421618, "firstActTime": 1649315995, "licenseCode": "0"}]' content='[{"attribute": {"codec": "hevc", "type": "free"}, "status": "valid", "extension_gid": null, "expireTime": 0, "appName": "ame", "follow": ["device"], "duration": 1576800000, "appType": 14, "licenseContent": 1, "registered_at": 1649315995, "server_time": 1685421618, "firstActTime": 1649315995, "licenseCode": "0"}, {"attribute": {"codec": "aac", "type": "free"}, "status": "valid", "extension_gid": null, "expireTime": 0, "appName": "ame", "follow": ["device"], "duration": 1576800000, "appType": 14, "licenseContent": 1, "registered_at": 1649315995, "server_time": 1685421618, "firstActTime": 1649315995, "licenseCode": "0"}]'
else else
echo "MD5 mismatch - Already patched or unsupported version!" echo -e "AME Patch: Unsupported version!"
exit 1
fi fi
for ((i = 0; i < ${#hex_values[@]}; i++)); do for ((i = 0; i < ${#hex_values[@]}; i++)); do
@ -57,11 +69,12 @@ if [ -d "/var/packages/CodecPack" ]; then
if "$ame_path/bin/synoame-bin-check-license"; then if "$ame_path/bin/synoame-bin-check-license"; then
echo -e "AME Patch: Downloading Codec!" echo -e "AME Patch: Downloading Codec!"
echo "true" >"${lic_patched}"
if "$ame_path/bin/synoame-bin-auto-install-needed-codec"; then if "$ame_path/bin/synoame-bin-auto-install-needed-codec"; then
echo -e "AME Patch: Successful!" echo -e "AME Patch: Successful!"
exit 0 exit 0
else else
echo -e "AME Patch: Unsuccessful!" echo -e "AME Patch: Failed!"
exit 1 exit 1
fi fi
else else
@ -71,10 +84,12 @@ if [ -d "/var/packages/CodecPack" ]; then
if [ -f "$lic_backup" ]; then if [ -f "$lic_backup" ]; then
mv -f "$lic_backup" "$lic" mv -f "$lic_backup" "$lic"
fi fi
rm -f "$lic_patched"
echo -e "AME Patch: Backup restored!" echo -e "AME Patch: Backup restored!"
exit 1 exit 1
fi fi
else else
echo -e "AME Patch: CodecPack not found!" echo -e "AME Patch: CodecPack not found!"
rm -f "$lic_patched"
exit 1 exit 1
fi fi

View File

@ -1,6 +1,6 @@
#!/usr/bin/env ash #!/usr/bin/env ash
# #
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> # Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium>
# #
# This is free software, licensed under the MIT License. # This is free software, licensed under the MIT License.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -17,12 +17,13 @@ if [ "${1}" = "late" ]; then
cat <<EOF >${DEST} cat <<EOF >${DEST}
[Unit] [Unit]
Description=addon amepatch Description=addon amepatch
Wants=smpkg-custom-install.service After=multi-user.target
After=smpkg-custom-install.service
[Service] [Service]
Type=oneshot User=root
RemainAfterExit=yes Type=simple
Restart=on-failure
RestartSec=5
ExecStart=/usr/bin/amepatch.sh ExecStart=/usr/bin/amepatch.sh
[Install] [Install]

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> # Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium>
# #
# This is free software, licensed under the MIT License. # This is free software, licensed under the MIT License.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -18,12 +18,20 @@ function copy_file() {
chown SurveillanceStation:SurveillanceStation "${target}/${file}" chown SurveillanceStation:SurveillanceStation "${target}/${file}"
chmod "${mode}" "${target}/${file}" chmod "${mode}" "${target}/${file}"
else else
echo "sspatch: ${file} not found" if [ "${file}" == "ssrtmpclientd" ]; then
echo "sspatch: ${file} not found, skipping"
return 0
else
rm -f "${ss_lic_patched}"
echo "sspatch: ${file} not found, aborting"
exit 1
fi
fi fi
} }
SSPATH="/var/packages/SurveillanceStation/target" SSPATH="/var/packages/SurveillanceStation/target"
PATCHPATH="/usr/arc" PATCHPATH="/usr/arc"
ss_lic_patched="${PATCHPATH}/ss_license.patched"
if [ -d "${SSPATH}" ]; then if [ -d "${SSPATH}" ]; then
echo "sspatch: SurveillanceStation found" echo "sspatch: SurveillanceStation found"
@ -50,6 +58,11 @@ if [ -d "${SSPATH}" ]; then
fi fi
done done
if [ -f "${ss_lic_patched}" ]; then
echo "sspatch: SurveillanceStation already patched"
exit 0
fi
/usr/syno/bin/synopkg stop SurveillanceStation /usr/syno/bin/synopkg stop SurveillanceStation
sleep 5 sleep 5
@ -71,21 +84,25 @@ if [ -d "${SSPATH}" ]; then
SSPATCH="true" SSPATCH="true"
else else
echo "sspatch: SurveillanceStation Version not supported" echo "sspatch: SurveillanceStation Version not supported"
exit 1 exit 0
fi fi
if [ "${SSPATCH}" == "true" ]; then if [ "${SSPATCH}" == "true" ]; then
copy_file ${SSPATH}/lib libssutils.so ${PATCHPATH} 0644 copy_file ${SSPATH}/lib libssutils.so ${PATCHPATH} 0644
copy_file ${SSPATH}/sbin sscmshostd ${PATCHPATH} 0755 copy_file ${SSPATH}/sbin sscmshostd ${PATCHPATH} 0755
copy_file ${SSPATH}/sbin sscored ${PATCHPATH} 0755 copy_file ${SSPATH}/sbin sscored ${PATCHPATH} 0755
copy_file ${SSPATH}/sbin ssdaemonmonitord ${PATCHPATH} 0755 copy_file ${SSPATH}/sbin ssdaemonmonitord ${PATCHPATH} 0755
copy_file ${SSPATH}/sbin ssexechelperd ${PATCHPATH} 0755 copy_file ${SSPATH}/sbin ssexechelperd ${PATCHPATH} 0755
copy_file ${SSPATH}/sbin ssroutined ${PATCHPATH} 0755 copy_file ${SSPATH}/sbin ssroutined ${PATCHPATH} 0755
copy_file ${SSPATH}/sbin ssmessaged ${PATCHPATH} 0755 copy_file ${SSPATH}/sbin ssmessaged ${PATCHPATH} 0755
fi copy_file ${SSPATH}/sbin ssrtmpclientd ${PATCHPATH} 0755
echo "true" >"${ss_lic_patched}"
fi
sleep 5 sleep 5
/usr/syno/bin/synopkg start SurveillanceStation /usr/syno/bin/synopkg start SurveillanceStation
else
rm -f "${ss_lic_patched}"
fi fi
exit 0 exit 0

View File

@ -1,6 +1,6 @@
#!/usr/bin/env ash #!/usr/bin/env ash
# #
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> # Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium>
# #
# This is free software, licensed under the MIT License. # This is free software, licensed under the MIT License.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -21,19 +21,18 @@ if [ "${1}" = "late" ]; then
cat <<EOF >${DEST} cat <<EOF >${DEST}
[Unit] [Unit]
Description=addon sspatch Description=addon sspatch
Wants=smpkg-custom-install.service After=multi-user.target
After=smpkg-custom-install.service After=amepatch.service
[Service] [Service]
Type=oneshot User=root
RemainAfterExit=yes Type=simple
Restart=on-failure
RestartSec=5
ExecStart=/usr/bin/sspatch.sh ExecStart=/usr/bin/sspatch.sh
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
[X-Synology]
Author=Virtualization Team
EOF EOF
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants 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 ln -vsf /usr/lib/systemd/system/sspatch.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/sspatch.service