Install fan script

For the fan, you can use this topic : Controlling a CPU/case fan with GPIO PWM based on CPU temperature