mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 21:50:52 +07:00
41ca53236f
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
32 lines
1.1 KiB
Bash
Executable File
32 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env ash
|
||
#
|
||
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||
#
|
||
# From:https://github.com/007revad/Synology_enable_M2_volume
|
||
# From: https://github.com/PeterSuh-Q3/tcrp-addons/blob/main/nvmevolume-onthefly/src/install.sh
|
||
#
|
||
|
||
if grep -qw "/addons/nvmesystem.sh" "/addons/addons.sh"; then
|
||
echo "nvmevolume is not required if nvmesystem exists!"
|
||
exit 0
|
||
fi
|
||
|
||
if [ "${1}" = "late" ]; then
|
||
echo "Installing addon nvmevolume - ${1}"
|
||
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||
|
||
SO_FILE="/tmpRoot/usr/lib/libhwcontrol.so.1"
|
||
[ ! -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" 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}"
|
||
|
||
SO_FILE="/tmpRoot/usr/lib/libhwcontrol.so.1"
|
||
[ -f "${SO_FILE}.bak" ] && mv -f "${SO_FILE}.bak" "${SO_FILE}"
|
||
fi |