2024-05-05 06:16:56 +07:00
|
|
|
#!/usr/bin/env ash
|
|
|
|
#
|
2024-06-29 22:08:40 +07:00
|
|
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium>
|
2024-05-05 06:16:56 +07:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the MIT License.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ "${1}" = "late" ]; then
|
|
|
|
echo "Installing addon remotefs - ${1}"
|
2024-05-07 14:20:11 +07:00
|
|
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
|
|
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
2024-05-05 06:16:56 +07:00
|
|
|
|
2024-06-29 22:08:40 +07:00
|
|
|
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"
|
|
|
|
PatchELFSharp "${SO_FILE}" "SYNOFSIsRemoteFS" "B8 00 00 00 00 C3"
|
|
|
|
else
|
|
|
|
echo "libsynosdk.so.7 not found"
|
|
|
|
fi
|
2024-08-02 23:11:02 +07:00
|
|
|
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
|
2024-05-05 06:16:56 +07:00
|
|
|
elif [ "${1}" = "uninstall" ]; then
|
|
|
|
echo "Installing addon remotefs - ${1}"
|
|
|
|
|
2024-06-29 22:08:40 +07:00
|
|
|
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
|
2024-08-02 23:11:02 +07:00
|
|
|
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
|
2024-05-19 21:40:09 +07:00
|
|
|
fi
|