tree: rework

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-11-07 19:15:46 +01:00
parent efb4f03d47
commit 41ca53236f
10 changed files with 62 additions and 84 deletions

View File

@ -17,12 +17,11 @@ if [ "${1}" = "late" ]; then
cat <<EOF >${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]

View File

@ -18,7 +18,7 @@ if [ "${1}" = "late" ]; then
cat <<EOF >${DEST}
[Unit]
Description=addon codecpatch
After=multi-user.target
echo "After=syno-volume.target syno-space.target"
[Service]
Type=oneshot

View File

@ -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

View File

@ -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://<ip>:5000/web_install.html\n"
MSG="\${MSG}To 'Reboot to Config Mode': http://<ip>:5000/webman/reboot_to_loader.cgi\n"
MSG="\${MSG}To 'Show Boot Log': http://<ip>: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

View File

@ -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<this.pciSlot,invalidReason:"notSupportM2Pool_addOnCard"//g' "${FILE_JS}"
gzip -c "${FILE_JS}" >"${FILE_GZ}"
exit 0

View File

@ -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}"

View File

@ -1,58 +1,28 @@
#!/usr/bin/env bash
#
# Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium>
# Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
#
# 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
if [ "${1}" = "-r" ]; then
[ -f "${SO_FILE}.bak" ] && mv -f "${SO_FILE}.bak" "${SO_FILE}"
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"
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
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"

View File

@ -19,7 +19,7 @@ if [ "${1}" = "late" ]; then
cat <<EOF >${DEST}
[Unit]
Description=Enable face recognition in Synology Photos
After=multi-user.target
After=syno-volume.target syno-space.target
[Service]
Type=oneshot

View File

@ -1,6 +1,6 @@
#!/usr/bin/env ash
#
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium>
# Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
#
# 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

View File

@ -1,6 +1,6 @@
#!/usr/bin/env ash
#
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
# Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
#
# 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 <<EOF
DELETE FROM task WHERE task_name LIKE 'StartScsiTarget';
INSERT INTO task VALUES('StartScsiTarget', '', 'bootup', '', 1, 0, 0, 0, '', 0, "synopkg start ScsiTarget", 'script', '{}', '', '', '{}', '{}');
DELETE FROM task WHERE task_name LIKE 'StopScsiTarget';
INSERT INTO task VALUES('StopScsiTarget', '', 'shutdown', '', 1, 0, 0, 0, '', 0, "synopkg stop ScsiTarget", 'script', '{}', '', '', '{}', '{}');
EOF
fi
elif [ "${1}" = "uninstall" ]; then
echo "Installing addon ups - ${1}"
FILE="/tmpRoot/usr/syno/bin/synoups"
[ -f "${FILE}.bak" ] && mv -f "${FILE}.bak" "${FILE}"
if [ -f /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db ]; then
echo "delete synoconfbkp task from esynoscheduler.db"
export LD_LIBRARY_PATH=/tmpRoot/bin:/tmpRoot/lib
/tmpRoot/bin/sqlite3 /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db <<EOF
DELETE FROM task WHERE task_name LIKE 'StartScsiTarget';
DELETE FROM task WHERE task_name LIKE 'StopScsiTarget';
EOF
fi
fi