45 lines
1.4 KiB
Django/Jinja
45 lines
1.4 KiB
Django/Jinja
#!/bin/bash
|
|
|
|
cpu_gov=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
|
cpupower frequency-info | grep "current policy:" -A 2
|
|
echo "cpu frequency governor is: ${cpu_gov}"
|
|
|
|
restore_cpufreq() {
|
|
cpupower frequency-set -g ${cpu_gov}
|
|
#cpupower frequency-info | grep "current policy:" -A 2
|
|
#echo "cpu frequency governor set to: ${cpu_gov}"
|
|
}
|
|
trap restore_cpufreq EXIT
|
|
|
|
docker pull ghcr.io/esphome/esphome
|
|
|
|
if [[ -b "/dev/ttyUSB0" ]]; then
|
|
DEVICE_ARG="--device=/dev/ttyUSB0"
|
|
elif [[ -b "/dev/ttyACM2" ]]; then
|
|
DEVICE_ARG="--device=/dev/ttyACM2"
|
|
else
|
|
DEVICE_ARG=""
|
|
fi
|
|
|
|
# set to perforamnce to compile faster, gets restored on exit
|
|
echo "setting cpu frequency governor to: performance"
|
|
cpupower frequency-set -g performance
|
|
cpupower frequency-info | grep "current policy:" -A 2
|
|
|
|
set -x
|
|
docker run \
|
|
--rm \
|
|
--dns {{ docker_container_dns_servers | join(",") }} \
|
|
--name esphome \
|
|
--privileged \
|
|
-v "{{ systemuserlist.hass.home }}/esphome/builds:/config/.esphome" \
|
|
-v "{{ systemuserlist.hass.home }}/esphome/cache:/root/.cache" \
|
|
-v "{{ systemuserlist.hass.home }}/esphome/local:/root/.local" \
|
|
-v "{{ systemuserlist.hass.home }}/esphome/platformio:/root/.platformio" \
|
|
-v "{{ systemuserlist.hass.home }}/esphome/config:/config" \
|
|
$DEVICE_ARG \
|
|
-it \
|
|
ghcr.io/esphome/esphome \
|
|
$@
|
|
|