diff --git a/scripts/auto-cpufreq-runit b/scripts/auto-cpufreq-runit index bada8062..708ee57c 100755 --- a/scripts/auto-cpufreq-runit +++ b/scripts/auto-cpufreq-runit @@ -1,2 +1,14 @@ #!/bin/sh -exec /usr/local/bin/auto-cpufreq --daemon +# test for update +if git -c advice.detachedHead=false pull -v https://github.com/AdnanHodzic/auto-cpufreq.git | grep -q -v '^\s*\(Updating\|Already up-to-date\|From\s\)\s'; then + exit +else + # install the update + echo "i" | sudo ~/auto-cpufreq/auto-cpufreq-installer && \ + notify-send -a "auto-cpufreq" "Update installed" && \ + # wait a bit to make sure its ready + sleep 1000 +fi + +# run the daemon +exec /usr/bin/auto-cpufreq --daemon 2>&1