diff --git a/scripts/install.sh b/scripts/install.sh index 38009e82f..d386b4e1a 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -8,18 +8,29 @@ fi echo "This is the installation script for PhotonVision." echo "Installing curl..." -apt-get install curl +apt-get install --yes curl echo "curl installation complete." echo "Installing avahi-daemon..." -apt-get install avahi-daemon +apt-get install --yes avahi-daemon echo "avahi-daemon installation complete." +echo "Installing cpufrequtils..." +apt-get install --yes cpufrequtils +echo "cpufrequtils installation complete." + +echo "Setting cpufrequtils to performance mode" +if [ -f /etc/default/cpufrequtils ]; then + sed -i -e 's/^#\?GOVERNOR=.*$/GOVERNOR=performance/' /etc/default/cpufrequtils +else + echo 'GOVERNOR=performance' > /etc/default/cpufrequtils +fi + echo "Installing the JDK..." if [ $(dpkg-query -W -f='${Status}' openjdk-11-jdk-headless 2>/dev/null | grep -c "ok installed") -eq 0 ]; then - apt update - apt-get install openjdk-11-jdk-headless; + apt-get update + apt-get install --yes openjdk-11-jdk-headless fi echo "JDK installation complete." @@ -45,14 +56,18 @@ if service --status-all | grep -Fq 'photonvision'; then systemctl reset-failed fi -cd /lib/systemd/system/ -touch photonvision.service -printf \ -"[Unit] +cat > /lib/systemd/system/photonvision.service <> photonvision.service -cp photonvision.service /etc/systemd/system/photonvision.service +WantedBy=multi-user.target +EOF + +cp /lib/systemd/system/photonvision.service /etc/systemd/system/photonvision.service chmod 644 /etc/systemd/system/photonvision.service systemctl daemon-reload systemctl enable photonvision.service