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-09-19 22:26:10 +07:00
|
|
|
cat <<EOF >${DEST}
|
2024-08-18 02:13:35 +07:00
|
|
|
[Unit]
|
|
|
|
Description=addon amepatch
|
2024-11-08 01:15:46 +07:00
|
|
|
After=syno-volume.target syno-space.target
|
2024-08-18 02:13:35 +07:00
|
|
|
|
|
|
|
[Service]
|
2024-11-08 01:15:46 +07:00
|
|
|
Type=oneshot
|
|
|
|
RemainAfterExit=yes
|
2024-08-23 04:34:35 +07:00
|
|
|
ExecStart=/usr/bin/amepatch.sh
|
2024-08-18 02:13:35 +07:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
EOF
|
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
|