Raspberry Pi (1,2,3): init scripts: use uppercase for constants

This commit is contained in:
Calin Crisan 2019-01-12 13:14:45 +02:00
parent 39e10d0eff
commit 0a8edd5a0d
8 changed files with 57 additions and 47 deletions

View File

@ -1,18 +1,19 @@
#!/bin/bash
GOV="ondemand"
CPUFREQDIR="/sys/devices/system/cpu/cpu0/cpufreq"
GOVDIR="/sys/devices/system/cpu/cpufreq/$GOV"
test -n "$os_version" || source /etc/init.d/base
gov="ondemand"
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
govdir="/sys/devices/system/cpu/cpufreq/$gov"
configure() {
echo $gov > $cpufreqdir/scaling_governor
if [[ $gov == "ondemand" ]]; then
echo 50 > $govdir/up_threshold
echo 100000 > $govdir/sampling_rate
echo 50 > $govdir/sampling_down_factor
echo 1 > $govdir/io_is_busy
echo $GOV > $CPUFREQDIR/scaling_governor
if [[ $GOV == "ondemand" ]]; then
echo 50 > $GOVDIR/up_threshold
echo 100000 > $GOVDIR/sampling_rate
echo 50 > $GOVDIR/sampling_down_factor
echo 1 > $GOVDIR/io_is_busy
fi
}

View File

@ -1,6 +1,7 @@
#!/bin/bash
check_interval=30
CHECK_INTERVAL=30
test -n "$os_version" || source /etc/init.d/base
@ -25,7 +26,7 @@ watch_now() {
logger -t throttlewatch -s "currently: $t"
fi
sleep $check_interval
sleep $CHECK_INTERVAL
done
}
@ -37,7 +38,7 @@ watch_since_boot() {
break
fi
sleep $check_interval
sleep $CHECK_INTERVAL
done
}

View File

@ -1,10 +1,11 @@
#!/bin/bash
sys_conf="/etc/bluetooth.conf"
boot_conf="/boot/bluetooth.conf"
conf="/data/etc/bluetooth.conf"
SYS_CONF="/etc/bluetooth.conf"
BOOT_CONF="/boot/bluetooth.conf"
CONF="/data/etc/bluetooth.conf"
test -f $conf || test -f $boot_conf || test -f $sys_conf || exit 0
test -f $CONF || test -f $BOOT_CONF || test -f $SYS_CONF || exit 0
test -d "/proc/device-tree/soc/gpio@7e200000/uart0_pins" || exit 0 # no rpi bluetooth detected

View File

@ -1,18 +1,19 @@
#!/bin/bash
GOV="ondemand"
CPUFREQDIR="/sys/devices/system/cpu/cpu0/cpufreq"
GOVDIR="/sys/devices/system/cpu/cpufreq/$GOV"
test -n "$os_version" || source /etc/init.d/base
gov="ondemand"
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
govdir="/sys/devices/system/cpu/cpufreq/$gov"
configure() {
echo $gov > $cpufreqdir/scaling_governor
if [[ $gov == "ondemand" ]]; then
echo 50 > $govdir/up_threshold
echo 100000 > $govdir/sampling_rate
echo 50 > $govdir/sampling_down_factor
echo 1 > $govdir/io_is_busy
echo $GOV > $CPUFREQDIR/scaling_governor
if [[ $GOV == "ondemand" ]]; then
echo 50 > $GOVDIR/up_threshold
echo 100000 > $GOVDIR/sampling_rate
echo 50 > $GOVDIR/sampling_down_factor
echo 1 > $GOVDIR/io_is_busy
fi
}

View File

@ -1,6 +1,7 @@
#!/bin/bash
check_interval=30
CHECK_INTERVAL=30
test -n "$os_version" || source /etc/init.d/base
@ -25,7 +26,7 @@ watch_now() {
logger -t throttlewatch -s "currently: $t"
fi
sleep $check_interval
sleep $CHECK_INTERVAL
done
}
@ -37,7 +38,7 @@ watch_since_boot() {
break
fi
sleep $check_interval
sleep $CHECK_INTERVAL
done
}

View File

@ -1,18 +1,19 @@
#!/bin/bash
GOV="ondemand"
CPUFREQDIR="/sys/devices/system/cpu/cpu0/cpufreq"
GOVDIR="/sys/devices/system/cpu/cpufreq/$GOV"
test -n "$os_version" || source /etc/init.d/base
gov="ondemand"
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
govdir="/sys/devices/system/cpu/cpufreq/$gov"
configure() {
echo $gov > $cpufreqdir/scaling_governor
if [[ $gov == "ondemand" ]]; then
echo 50 > $govdir/up_threshold
echo 100000 > $govdir/sampling_rate
echo 50 > $govdir/sampling_down_factor
echo 1 > $govdir/io_is_busy
echo $GOV > $CPUFREQDIR/scaling_governor
if [[ $GOV == "ondemand" ]]; then
echo 50 > $GOVDIR/up_threshold
echo 100000 > $GOVDIR/sampling_rate
echo 50 > $GOVDIR/sampling_down_factor
echo 1 > $GOVDIR/io_is_busy
fi
}

View File

@ -1,6 +1,7 @@
#!/bin/bash
check_interval=30
CHECK_INTERVAL=30
test -n "$os_version" || source /etc/init.d/base
@ -25,7 +26,7 @@ watch_now() {
logger -t throttlewatch -s "currently: $t"
fi
sleep $check_interval
sleep $CHECK_INTERVAL
done
}
@ -37,7 +38,7 @@ watch_since_boot() {
break
fi
sleep $check_interval
sleep $CHECK_INTERVAL
done
}

View File

@ -1,10 +1,13 @@
#!/bin/bash
sys_conf="/etc/bluetooth.conf"
boot_conf="/boot/bluetooth.conf"
conf="/data/etc/bluetooth.conf"
SYS_CONF="/etc/bluetooth.conf"
BOOT_CONF="/boot/bluetooth.conf"
CONF="/data/etc/bluetooth.conf"
test -f $conf || test -f $boot_conf || test -f $sys_conf || exit 0
test -f $CONF || test -f $BOOT_CONF || test -f $SYS_CONF || exit 0
test -d "/proc/device-tree/soc/gpio@7e200000/uart0_pins" || exit 0 # no rpi bluetooth detected
test -n "$os_version" || source /etc/init.d/base