photosfacepatch: simplify code

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-10-29 16:54:59 +01:00
parent b768e5d467
commit 077e3cfb3d
2 changed files with 20 additions and 26 deletions

View File

@ -8,56 +8,51 @@
SO_FILE1="/var/packages/SynologyPhotos/target/usr/lib/libsynophoto-plugin-platform.so"
SO_FILE2="/var/packages/SynologyPhotos/target/usr/lib/libsynophoto-plugin-platform.so.1.0"
if [ -f "${SO_FILE1}" ] || [ -f "${SO_FILE2}" ]; then
echo "SynologyPhotos installed -> Patching"
else
if [ ! -f "${SO_FILE1}" ] && [ ! -f "${SO_FILE2}" ]; then
echo "SynologyPhotos not installed -> Exit"
exit
fi
if [ -f "${SO_FILE1}" ]; then
SO_FILE="${SO_FILE1}"
if [ "${1}" = "-r" ]; then
if [ -f "${SO_FILE}.bak" ]; then
mv -f "${SO_FILE}.bak" "${SO_FILE}"
if [ -f "${SO_FILE1}.bak" ]; then
mv -f "${SO_FILE1}.bak" "${SO_FILE1}"
fi
exit
fi
if [ ! -f "${SO_FILE}.bak" ]; then
echo "Backup ${SO_FILE}"
cp -vfp "${SO_FILE}" "${SO_FILE}.bak"
if [ ! -f "${SO_FILE1}.bak" ]; then
echo "Backup ${SO_FILE1}"
cp -vfp "${SO_FILE1}" "${SO_FILE1}.bak"
fi
echo "Patching ${SO_FILE}"
echo "Patching ${SO_FILE1}"
# support face and concept
PatchELFSharp "${SO_FILE}" "_ZN9synophoto6plugin8platform20IsSupportedIENetworkEv" "B8 00 00 00 00 C3"
PatchELFSharp "${SO_FILE1}" "_ZN9synophoto6plugin8platform20IsSupportedIENetworkEv" "B8 00 00 00 00 C3"
# force to support concept
PatchELFSharp "${SO_FILE}" "_ZN9synophoto6plugin8platform18IsSupportedConceptEv" "B8 01 00 00 00 C3"
PatchELFSharp "${SO_FILE1}" "_ZN9synophoto6plugin8platform18IsSupportedConceptEv" "B8 01 00 00 00 C3"
# force no Gpu
PatchELFSharp "${SO_FILE}" "_ZN9synophoto6plugin8platform23IsSupportedIENetworkGpuEv" "B8 00 00 00 00 C3"
PatchELFSharp "${SO_FILE1}" "_ZN9synophoto6plugin8platform23IsSupportedIENetworkGpuEv" "B8 00 00 00 00 C3"
fi
if [ -f "${SO_FILE2}" ]; then
SO_FILE="${SO_FILE2}"
if [ -f "${SO_FILE2}" ]; then
if [ "${1}" = "-r" ]; then
if [ -f "${SO_FILE}.bak" ]; then
mv -f "${SO_FILE}.bak" "${SO_FILE}"
if [ -f "${SO_FILE2}.bak" ]; then
mv -f "${SO_FILE2}.bak" "${SO_FILE2}"
fi
exit
fi
if [ ! -f "${SO_FILE}.bak" ]; then
echo "Backup ${SO_FILE}"
cp -vfp "${SO_FILE}" "${SO_FILE}.bak"
if [ ! -f "${SO_FILE2}.bak" ]; then
echo "Backup ${SO_FILE2}"
cp -vfp "${SO_FILE2}" "${SO_FILE2}.bak"
fi
echo "Patching ${SO_FILE}"
echo "Patching ${SO_FILE2}"
# support face and concept
PatchELFSharp "${SO_FILE}" "_ZN9synophoto6plugin8platform20IsSupportedIENetworkEv" "B8 00 00 00 00 C3"
PatchELFSharp "${SO_FILE2}" "_ZN9synophoto6plugin8platform20IsSupportedIENetworkEv" "B8 00 00 00 00 C3"
# force to support concept
PatchELFSharp "${SO_FILE}" "_ZN9synophoto6plugin8platform18IsSupportedConceptEv" "B8 01 00 00 00 C3"
PatchELFSharp "${SO_FILE2}" "_ZN9synophoto6plugin8platform18IsSupportedConceptEv" "B8 01 00 00 00 C3"
# force no Gpu
PatchELFSharp "${SO_FILE}" "_ZN9synophoto6plugin8platform23IsSupportedIENetworkGpuEv" "B8 00 00 00 00 C3"
PatchELFSharp "${SO_FILE2}" "_ZN9synophoto6plugin8platform23IsSupportedIENetworkGpuEv" "B8 00 00 00 00 C3"
fi

View File

@ -23,7 +23,6 @@ Wants=smpkg-custom-install.service pkgctl-StorageManager.service
After=smpkg-custom-install.service
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/photosfacepatch.sh