2024-08-18 02:13:35 +07:00
|
|
|
#!/usr/bin/env ash
|
|
|
|
#
|
2024-10-05 23:07:45 +07:00
|
|
|
# Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium>
|
2024-08-18 02:13:35 +07:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the MIT License.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ "${1}" = "late" ]; then
|
|
|
|
echo "Installing addon amepatch - ${1}"
|
|
|
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
2024-11-09 01:34:54 +07:00
|
|
|
cp -pf "${0}" "/tmpRoot/usr/arc/addons/"
|
|
|
|
|
|
|
|
cp -pf /usr/bin/amepatch.sh /tmpRoot/usr/bin/amepatch.sh
|
2024-08-18 02:13:35 +07:00
|
|
|
|
|
|
|
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
|
|
|
DEST="/tmpRoot/usr/lib/systemd/system/amepatch.service"
|
2024-11-20 16:51:12 +07:00
|
|
|
{
|
|
|
|
echo "[Unit]"
|
|
|
|
echo "Description=addon amepatch"
|
|
|
|
echo "After=syno-volume.target syno-space.target"
|
|
|
|
echo
|
|
|
|
echo "[Service]"
|
|
|
|
echo "Type=oneshot"
|
|
|
|
echo "RemainAfterExit=yes"
|
|
|
|
echo "ExecStart=/usr/bin/amepatch.sh"
|
|
|
|
echo
|
|
|
|
echo "[Install]"
|
|
|
|
echo "WantedBy=multi-user.target"
|
|
|
|
} >"${DEST}"
|
2024-11-09 01:34:54 +07:00
|
|
|
mkdir -p /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
2024-08-18 02:13:35 +07:00
|
|
|
ln -vsf /usr/lib/systemd/system/amepatch.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/amepatch.service
|
|
|
|
elif [ "${1}" = "uninstall" ]; then
|
|
|
|
echo "Installing addon amepatch - ${1}"
|
|
|
|
|
|
|
|
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/amepatch.service"
|
|
|
|
rm -f "/tmpRoot/usr/lib/systemd/system/amepatch.service"
|
|
|
|
rm -f "/tmpRoot/usr/bin/amepatch.sh"
|
|
|
|
|
|
|
|
[ ! -f "/tmpRoot/usr/arc/revert.sh" ] && echo '#!/usr/bin/env bash' >/tmpRoot/usr/arc/revert.sh && chmod +x /tmpRoot/usr/arc/revert.sh
|
|
|
|
echo "rm -f /usr/bin/amepatch.sh" >>/tmpRoot/usr/arc/revert.sh
|
|
|
|
fi
|