#!/bin/bash

[ "$UID" == "0" ] || exec echo "Error: You must have root premission to write into /etc/rc.local"

grep -q "Change CPU frequency" /etc/rc.local && exec echo "Already added."
sed -n '/# Change CPU frequency/,99p' $(dirname $0)/maximize_cpu_frequency >> /etc/rc.local \
&& echo "CPU frequency will automatically maximize on next boot."
