mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 21:50:52 +07:00
da37d00e4e
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
45 lines
1.5 KiB
Bash
Executable File
45 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env ash
|
|
#
|
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium>
|
|
#
|
|
# This is free software, licensed under the MIT License.
|
|
# See /LICENSE for more information.
|
|
#
|
|
|
|
if [ "${1}" = "late" ]; then
|
|
echo "Installing cpufreqscalingscaling - ${1}"
|
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
|
|
|
cp -vf "/usr/sbin/scaling.sh" "/tmpRoot/usr/sbin/scaling.sh"
|
|
[ ! -f "/tmpRoot/usr/bin/echo" ] && cp -vf /usr/bin/echo /tmpRoot/usr/bin/echo || true
|
|
cp -f "/usr/lib/modules/acpi_cpufreq.ko" "/tmpRoot/usr/lib/modules/acpi_cpufreq.ko"
|
|
[ "${2}" != "schedutil" ] && cp -vf "/usr/lib/modules/cpufreq_${2}.ko" "/tmpRoot/usr/lib/modules/cpufreq_${2}.ko"
|
|
|
|
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
|
DEST="/tmpRoot/usr/lib/systemd/system/cpufreqscaling.service"
|
|
cat <<EOF >${DEST}
|
|
[Unit]
|
|
Description=Enable CPU Freq scaling
|
|
After=udevrules.service
|
|
|
|
[Service]
|
|
User=root
|
|
Type=simple
|
|
Restart=on-failure
|
|
RestartSec=10
|
|
ExecStart=/usr/sbin/scaling.sh ${2}
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
|
ln -vsf /usr/lib/systemd/system/cpufreqscaling.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/cpufreqscaling.service
|
|
elif [ "${1}" = "uninstall" ]; then
|
|
echo "Installing cpufreqscalingscaling - ${1}"
|
|
|
|
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/cpufreqscaling.service"
|
|
rm -f "/tmpRoot/usr/lib/systemd/system/cpufreqscaling.service"
|
|
|
|
rm -f /tmpRoot/usr/sbin/scaling.sh
|
|
fi |