2024-05-05 06:16:56 +07:00
|
|
|
#!/usr/bin/env ash
|
|
|
|
#
|
|
|
|
# Copyright (C) 2023 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.
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ "${1}" = "late" ]; then
|
|
|
|
echo "Installing addon addincards - ${1}"
|
|
|
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
2024-11-09 01:34:54 +07:00
|
|
|
cp -pf "${0}" "/tmpRoot/usr/arc/addons/"
|
2024-05-05 06:16:56 +07:00
|
|
|
|
|
|
|
MODEL="$(cat /proc/sys/kernel/syno_hw_version)"
|
2024-10-24 23:23:26 +07:00
|
|
|
FILE="/tmpRoot/usr/syno/etc/adapter_cards.conf"
|
2024-05-05 06:16:56 +07:00
|
|
|
|
|
|
|
[ ! -f "${FILE}.bak" ] && cp -f "${FILE}" "${FILE}.bak"
|
2024-11-09 01:34:54 +07:00
|
|
|
cp -pf "${FILE}" "${FILE}.tmp"
|
2024-05-05 06:16:56 +07:00
|
|
|
echo -n "" >"${FILE}"
|
|
|
|
for N in $(cat "${FILE}.tmp" 2>/dev/null | grep '\['); do
|
|
|
|
echo "${N}" >>"${FILE}"
|
|
|
|
echo "${MODEL}=yes" >>"${FILE}"
|
|
|
|
done
|
|
|
|
rm -f "${FILE}.tmp"
|
|
|
|
elif [ "${1}" = "uninstall" ]; then
|
|
|
|
echo "Installing addon addincards - ${1}"
|
|
|
|
|
2024-10-24 23:23:26 +07:00
|
|
|
FILE="/tmpRoot/usr/syno/etc/adapter_cards.conf"
|
2024-05-05 06:16:56 +07:00
|
|
|
[ -f "${FILE}.bak" ] && mv -f "${FILE}.bak" "${FILE}"
|
|
|
|
fi
|