From 41ca53236f5c0a3989ee832da915e8ed611d7b70 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Thu, 7 Nov 2024 19:15:46 +0100 Subject: [PATCH] tree: rework Signed-off-by: AuxXxilium --- amepatch/install.sh | 7 +-- codecpatch/install.sh | 2 +- hdddb/install.sh | 2 +- misc/install.sh | 4 +- nvmesystem/all/usr/bin/nvmesystem.sh | 2 + nvmevolume/install.sh | 4 +- .../all/usr/bin/photosfacepatch.sh | 62 +++++-------------- photosfacepatch/install.sh | 2 +- remotefs/install.sh | 30 ++------- ups/install.sh | 31 +++++++++- 10 files changed, 62 insertions(+), 84 deletions(-) diff --git a/amepatch/install.sh b/amepatch/install.sh index 2eef883..14cc970 100755 --- a/amepatch/install.sh +++ b/amepatch/install.sh @@ -17,12 +17,11 @@ if [ "${1}" = "late" ]; then cat <${DEST} [Unit] Description=addon amepatch -After=multi-user.target +After=syno-volume.target syno-space.target [Service] -Type=simple -Restart=on-failure -RestartSec=10 +Type=oneshot +RemainAfterExit=yes ExecStart=/usr/bin/amepatch.sh [Install] diff --git a/codecpatch/install.sh b/codecpatch/install.sh index 74925db..f881d3e 100755 --- a/codecpatch/install.sh +++ b/codecpatch/install.sh @@ -18,7 +18,7 @@ if [ "${1}" = "late" ]; then cat <${DEST} [Unit] Description=addon codecpatch -After=multi-user.target +echo "After=syno-volume.target syno-space.target" [Service] Type=oneshot diff --git a/hdddb/install.sh b/hdddb/install.sh index 107f7c9..7bac0e5 100755 --- a/hdddb/install.sh +++ b/hdddb/install.sh @@ -24,7 +24,7 @@ After=smpkg-custom-install.service [Service] Type=oneshot RemainAfterExit=yes -ExecStart=/usr/bin/hdddb.sh -nfreS +ExecStart=/usr/bin/hdddb.sh -nrwpeS [Install] WantedBy=multi-user.target diff --git a/misc/install.sh b/misc/install.sh index f1d92fe..846d465 100755 --- a/misc/install.sh +++ b/misc/install.sh @@ -94,11 +94,11 @@ MSG="\${MSG}\n" MSG="\${MSG}Warning: Data should only be stored in shared folders. Data stored elsewhere\n" MSG="\${MSG}may be deleted when the system is updated/restarted.\n" MSG="\${MSG}\n" +MSG="\${MSG}'System partition(/dev/md0) mounted to': /tmpRoot\n" MSG="\${MSG}To 'Force re-install DSM': http://:5000/web_install.html\n" MSG="\${MSG}To 'Reboot to Config Mode': http://:5000/webman/reboot_to_loader.cgi\n" MSG="\${MSG}To 'Show Boot Log': http://:5000/webman/get_logs.cgi\n" MSG="\${MSG}To 'Reboot Loader' : exec reboot\n" -MSG="\${MSG}To 'Modify system files' : mount /dev/md0\n" echo -e "\${MSG}" > /etc/motd /usr/bin/killall ttyd 2>/dev/null || true @@ -110,6 +110,8 @@ echo "Starting dufs ..." cp -f /usr/syno/web/web_index.html /usr/syno/web/web_install.html cp -f /addons/web_index.html /usr/syno/web/web_index.html +mkdir -p /tmpRoot +mount /dev/md0 /tmpRoot echo "Arc Recovery mode is ready" EOF chmod +x /usr/syno/web/webman/recovery.cgi diff --git a/nvmesystem/all/usr/bin/nvmesystem.sh b/nvmesystem/all/usr/bin/nvmesystem.sh index 1e2ffd5..07a3396 100755 --- a/nvmesystem/all/usr/bin/nvmesystem.sh +++ b/nvmesystem/all/usr/bin/nvmesystem.sh @@ -30,6 +30,8 @@ fi gzip -dc "${FILE_GZ}" >"${FILE_JS}" sed -i "s/e.portType||e.isCacheTray()/e.portType||false/" "${FILE_JS}" +sed -i 's/notSupportM2Pool_addOnCard:this.T("disk_info","disk_reason_m2_add_on_card"),//g' "${FILE_JS}" +sed -i 's/},{isConditionInvalid:0"${FILE_GZ}" exit 0 \ No newline at end of file diff --git a/nvmevolume/install.sh b/nvmevolume/install.sh index 1da8ba0..6c48916 100755 --- a/nvmevolume/install.sh +++ b/nvmevolume/install.sh @@ -20,7 +20,9 @@ if [ "${1}" = "late" ]; then [ ! -f "${SO_FILE}.bak" ] && cp -vf "${SO_FILE}" "${SO_FILE}.bak" cp -f "${SO_FILE}" "${SO_FILE}.tmp" - xxd -c $(xxd -p "${SO_FILE}.tmp" | wc -c) -p "${SO_FILE}.tmp" | sed "s/803e00b801000000752.488b/803e00b8010000009090488b/" | xxd -r -p > "${SO_FILE}" + xxd -c $(xxd -p "${SO_FILE}.tmp" 2>/dev/null | wc -c) -p "${SO_FILE}.tmp" 2>/dev/null | + sed "s/803e00b801000000752.488b/803e00b8010000009090488b/" + | xxd -r -p > "${SO_FILE}" 2>/dev/null rm -f "${SO_FILE}.tmp" elif [ "${1}" = "uninstall" ]; then echo "Installing addon nvmevolume - ${1}" diff --git a/photosfacepatch/all/usr/bin/photosfacepatch.sh b/photosfacepatch/all/usr/bin/photosfacepatch.sh index dc98865..0b0c8f8 100755 --- a/photosfacepatch/all/usr/bin/photosfacepatch.sh +++ b/photosfacepatch/all/usr/bin/photosfacepatch.sh @@ -1,58 +1,28 @@ #!/usr/bin/env bash # -# Copyright (C) 2024 AuxXxilium +# Copyright (C) 2024 AuxXxilium and Ing # # This is free software, licensed under the MIT License. # See /LICENSE for more information. # -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 not installed -> Exit" +SO_FILE=$(find / -name "libsynophoto-plugin-platform.so.1.0" 2>/dev/null | head -1) + +if [ -z "${SO_FILE}" ] || [ ! -f "${SO_FILE}" ]; then + echo "SynologyPhotos not install" exit fi -if [ -f "${SO_FILE1}" ]; then - if [ "${1}" = "-r" ]; then - if [ -f "${SO_FILE1}.bak" ]; then - mv -f "${SO_FILE1}.bak" "${SO_FILE1}" - fi - exit - fi - - if [ ! -f "${SO_FILE1}.bak" ]; then - echo "Backup ${SO_FILE1}" - cp -vfp "${SO_FILE1}" "${SO_FILE1}.bak" - fi - - echo "Patching ${SO_FILE1}" - # support face and concept - PatchELFSharp "${SO_FILE1}" "_ZN9synophoto6plugin8platform20IsSupportedIENetworkEv" "B8 00 00 00 00 C3" - # force to support concept - PatchELFSharp "${SO_FILE1}" "_ZN9synophoto6plugin8platform18IsSupportedConceptEv" "B8 01 00 00 00 C3" - # force no Gpu - PatchELFSharp "${SO_FILE1}" "_ZN9synophoto6plugin8platform23IsSupportedIENetworkGpuEv" "B8 00 00 00 00 C3" +if [ "${1}" = "-r" ]; then + [ -f "${SO_FILE}.bak" ] && mv -f "${SO_FILE}.bak" "${SO_FILE}" + exit fi -if [ -f "${SO_FILE2}" ]; then - if [ "${1}" = "-r" ]; then - if [ -f "${SO_FILE2}.bak" ]; then - mv -f "${SO_FILE2}.bak" "${SO_FILE2}" - fi - exit - fi - - if [ ! -f "${SO_FILE2}.bak" ]; then - echo "Backup ${SO_FILE2}" - cp -vfp "${SO_FILE2}" "${SO_FILE2}.bak" - fi - - echo "Patching ${SO_FILE2}" - # support face and concept - PatchELFSharp "${SO_FILE2}" "_ZN9synophoto6plugin8platform20IsSupportedIENetworkEv" "B8 00 00 00 00 C3" - # force to support concept - PatchELFSharp "${SO_FILE2}" "_ZN9synophoto6plugin8platform18IsSupportedConceptEv" "B8 01 00 00 00 C3" - # force no Gpu - PatchELFSharp "${SO_FILE2}" "_ZN9synophoto6plugin8platform23IsSupportedIENetworkGpuEv" "B8 00 00 00 00 C3" -fi \ No newline at end of file +echo "Patching ${SO_FILE}" +[ ! -f "${SO_FILE}.bak" ] && cp -f "${SO_FILE}" "${SO_FILE}.bak" +# support face and concept +PatchELFSharp "${SO_FILE}" "_ZN9synophoto6plugin8platform20IsSupportedIENetworkEv" "B8 00 00 00 00 C3" +# force to support concept +PatchELFSharp "${SO_FILE}" "_ZN9synophoto6plugin8platform18IsSupportedConceptEv" "B8 01 00 00 00 C3" +# force no Gpu +PatchELFSharp "${SO_FILE}" "_ZN9synophoto6plugin8platform23IsSupportedIENetworkGpuEv" "B8 00 00 00 00 C3" \ No newline at end of file diff --git a/photosfacepatch/install.sh b/photosfacepatch/install.sh index 01c7878..10d16ab 100755 --- a/photosfacepatch/install.sh +++ b/photosfacepatch/install.sh @@ -19,7 +19,7 @@ if [ "${1}" = "late" ]; then cat <${DEST} [Unit] Description=Enable face recognition in Synology Photos -After=multi-user.target +After=syno-volume.target syno-space.target [Service] Type=oneshot diff --git a/remotefs/install.sh b/remotefs/install.sh index 2e7a869..459427b 100755 --- a/remotefs/install.sh +++ b/remotefs/install.sh @@ -1,6 +1,6 @@ #!/usr/bin/env ash # -# Copyright (C) 2023 AuxXxilium +# Copyright (C) 2024 AuxXxilium and Ing # # This is free software, licensed under the MIT License. # See /LICENSE for more information. @@ -13,38 +13,16 @@ if [ "${1}" = "late" ]; then SO_FILE="/tmpRoot/usr/lib/libsynosdk.so.7" if [ -f "${SO_FILE}" ]; then - if [ ! -f "${SO_FILE}.bak" ]; then - echo "Backup ${SO_FILE}" - cp -vfp "${SO_FILE}" "${SO_FILE}.bak" - fi echo "Patching libsynosdk.so.7" + [ ! -f "${SO_FILE}.bak" ] && cp -f "${SO_FILE}" "${SO_FILE}.bak" + # force to support remote fs PatchELFSharp "${SO_FILE}" "SYNOFSIsRemoteFS" "B8 00 00 00 00 C3" else echo "libsynosdk.so.7 not found" fi - SO_FILE="/tmpRoot/usr/lib/libmediaindex.so" - if [ -f "${SO_FILE}" ]; then - if [ ! -f "${SO_FILE}.bak" ]; then - echo "Backup ${SO_FILE}" - cp -vfp "${SO_FILE}" "${SO_FILE}.bak" - fi - echo "Patching libmediaindex.so" - PatchELFSharp "${SO_FILE}" "IndexIsPathRemoteMount" "B8 00 00 00 00 C3" - PatchELFSharp "${SO_FILE}" "IndexIsPathRemoteOrImageMount" "B8 00 00 00 00 C3" - else - echo "libmediaindex.so not found" - fi elif [ "${1}" = "uninstall" ]; then echo "Installing addon remotefs - ${1}" SO_FILE="/tmpRoot/usr/lib/libsynosdk.so.7" - if [ -f "${SO_FILE}.bak" ]; then - echo "Restore ${SO_FILE}" - mv -f "${SO_FILE}.bak" "${SO_FILE}" - fi - SO_FILE="/tmpRoot/usr/lib/libmediaindex.so" - if [ -f "${SO_FILE}.bak" ]; then - echo "Restore ${SO_FILE}" - mv -f "${SO_FILE}.bak" "${SO_FILE}" - fi + [ -f "${SO_FILE}.bak" ] && mv -f "${SO_FILE}.bak" "${SO_FILE}" fi \ No newline at end of file diff --git a/ups/install.sh b/ups/install.sh index d9c4c1f..7503754 100755 --- a/ups/install.sh +++ b/ups/install.sh @@ -1,6 +1,6 @@ #!/usr/bin/env ash # -# Copyright (C) 2023 AuxXxilium and Ing +# Copyright (C) 2024 AuxXxilium and Ing # # This is free software, licensed under the MIT License. # See /LICENSE for more information. @@ -14,11 +14,36 @@ if [ "${1}" = "late" ]; then FILE="/tmpRoot/usr/syno/bin/synoups" [ ! -f "${FILE}.bak" ] && cp -f "${FILE}" "${FILE}.bak" - sed -i 's|/usr/syno/sbin/synopoweroff.*$|/usr/syno/sbin/synopoweroff|g' "${FILE}" - + cp -f "${FILE}.bak" "${FILE}" + if [ -z "${2}" ] || [ "${2}" = "-f" ]; then + sed -i "s|/usr/syno/sbin/synopoweroff.*$|/usr/syno/sbin/synopoweroff|g" "${FILE}" + fi + if [ "${2}" = "-e" ] || [ "${2}" = "-f" ]; then + EVENT_POWEROFF="/usr/syno/sbin/esynoscheduler --fireEvent event=shutdown" + if ! grep -q "${EVENT_POWEROFF}" "${FILE}"; then + sed -i "/\/usr\/syno\/sbin\/synopoweroff/i\ \ \ \ ${EVENT_POWEROFF}" "${FILE}" + fi + echo "insert start/stop ScsiTarget task to esynoscheduler.db" + export LD_LIBRARY_PATH=/tmpRoot/bin:/tmpRoot/lib + /tmpRoot/bin/sqlite3 /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db <