2024-05-05 06:16:56 +07:00
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
#
|
|
|
|
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
|
|
|
|
#
|
2024-05-14 22:12:48 +07:00
|
|
|
|
# From:https://github.com/007revad/Synology_enable_M2_volume
|
2024-05-05 06:16:56 +07:00
|
|
|
|
# From: https://github.com/PeterSuh-Q3/tcrp-addons/blob/main/nvmevolume-onthefly/src/install.sh
|
|
|
|
|
#
|
|
|
|
|
|
2024-05-14 22:12:48 +07:00
|
|
|
|
if grep -qw "/addons/nvmesystem.sh" "/addons/addons.sh"; then
|
|
|
|
|
echo "nvmevolume is not required if nvmesystem exists!"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
2024-05-05 06:16:56 +07:00
|
|
|
|
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"
|
2024-05-28 00:34:01 +07:00
|
|
|
|
xxd -c $(xxd -p "${SO_FILE}.tmp" | wc -c) -p "${SO_FILE}.tmp" | sed "s/803e00b801000000752.488b/803e00b8010000009090488b/" | xxd -r -p > "${SO_FILE}"
|
2024-05-05 06:16:56 +07:00
|
|
|
|
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}"
|
2024-05-19 21:38:25 +07:00
|
|
|
|
fi
|