diff --git a/cpufreqscaling/all/usr/sbin/scaling.sh b/cpufreqscaling/all/usr/sbin/scaling.sh index 0a437f5..f3703fa 100755 --- a/cpufreqscaling/all/usr/sbin/scaling.sh +++ b/cpufreqscaling/all/usr/sbin/scaling.sh @@ -12,17 +12,17 @@ set -euo pipefail # Load the correct cpufreq module cerror=0 governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) -if [ "${1}" == "ondemand" ] || [ "${1}" == "conservative" ]; then - insmod /usr/lib/modules/cpufreq_${1}.ko || cerror=1 +if [ "${1}" = "ondemand" ] || [ "${1}" = "conservative" ]; then + insmod "/usr/lib/modules/cpufreq_${1}.ko" || cerror=1 fi # Set correct cpufreq governor to allow frequency scaling if [ "${governor}" != "${1}" ]; then - echo ${1} | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor + echo "${1}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor fi sleep 10 # Check if the governor is set correctly verifygovernor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) -if [ "${verifygovernor}" == "${1}" ]; then +if [ "${verifygovernor}" = "${1}" ]; then echo "CPUFreqScaling: Governor set to ${1}" else echo "CPUFreqScaling: Failed to set governor to ${1}" diff --git a/cpufreqscaling/install.sh b/cpufreqscaling/install.sh index c747917..e0ad1be 100755 --- a/cpufreqscaling/install.sh +++ b/cpufreqscaling/install.sh @@ -13,7 +13,9 @@ if [ "${1}" = "late" ]; then cp -pf "/usr/sbin/scaling.sh" "/tmpRoot/usr/sbin/scaling.sh" [ ! -f "/tmpRoot/usr/bin/echo" ] && cp -pf /usr/bin/echo /tmpRoot/usr/bin/echo || true - cp -pf "/usr/lib/modules/acpi_cpufreq.ko" "/tmpRoot/usr/lib/modules/acpi_cpufreq.ko" + if [ "${2}" = "schedutil" ] || [ "${2}" = "ondemand" ] || [ "${2}" = "conservative" ]; then + cp -pf "/usr/lib/modules/acpi_cpufreq.ko" "/tmpRoot/usr/lib/modules/acpi_cpufreq.ko" + fi [ "${2}" != "schedutil" ] && cp -pf "/usr/lib/modules/cpufreq_${2}.ko" "/tmpRoot/usr/lib/modules/cpufreq_${2}.ko" mkdir -p "/tmpRoot/usr/lib/systemd/system" @@ -21,7 +23,7 @@ if [ "${1}" = "late" ]; then { echo "[Unit]" echo "Description=Enable CPU Freq scaling" - echo "After=syno-volume.target syno-space.target" + echo "After=multi-user.target" echo echo "[Service]" echo "User=root" @@ -35,18 +37,19 @@ if [ "${1}" = "late" ]; then } >"${DEST}" mkdir -p /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 - - if [ ! -f /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db ]; then - echo "copy esynoscheduler.db" - mkdir -p /tmpRoot/usr/syno/etc/esynoscheduler - cp -pf /addons/esynoscheduler.db /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db - fi - echo "insert scaling... task to esynoscheduler.db" - export LD_LIBRARY_PATH=/tmpRoot/bin:/tmpRoot/lib - /tmpRoot/bin/sqlite3 /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db <