diff --git a/Makefile b/Makefile index a67d557..4171f3e 100644 --- a/Makefile +++ b/Makefile @@ -56,11 +56,24 @@ clean: install: cp $(EXE) /usr/sbin @echo "-----------------------------------------------------------------------------" - @echo "An init file suitable for /lib/lsb/init-functions (Debian & Ubuntu fur sure)" - @echo "Is located in the main folder of the source files. It is called mbpfan.init." + @echo "An init file suitable for /lib/lsb/init-functions (Debian) is located in" + @echo "in the main folder of the source files. It is called mbpfan.init." @echo "Rename it to mbpfan, give it execution permissions (chmod +x mbpfan)" @echo "and move it to /etc/init.d" @echo "Then, add it to the default runlevels with sudo update-rc.d mbpfan defaults" + @echo "" + @echo "Additionally, an init file suitable for /etc/rc.d/init.d/functions" + @echo "(RHEL/CentOS & Fedora) is also located at the same place, this file is called" + @echo "mbpfan.init.redhat. Also rename it to mbpfan, give it execution permissions" + @echo "and move it to /etc/init.d" + @echo "To add the script to the default runlevels, run the following as root:" + @echo "chkconfig --level 2345 mbpfan on && chkconfig --level 016 mbpfan off" + @echo "" + @echo "For upstart based init systems (Ubuntu), an example upstart job has been" + @echo "provided for use in place of the LSB-style init script. To use, execute" + @echo "as root:" + @echo "cp mbpfan.upstart /etc/init/mbpfan.conf" + @echo "start mbpfan" @echo "-----------------------------------------------------------------------------" rebuild: clean all diff --git a/mbpfan.upstart b/mbpfan.upstart new file mode 100644 index 0000000..ff2957f --- /dev/null +++ b/mbpfan.upstart @@ -0,0 +1,26 @@ +# mbpfan - A simple daemon to control fan speed on all Macbook/Macbook Pros \ +# (probably all Apple computers) for Linux 3.x.x + +description "mbpfan" + +start on filesystem or runlevel [2345] +stop on runlevel [!2345] + +respawn +respawn limit 10 5 +umask 022 + +console log + +pre-start script + test -x /usr/sbin/mbpfan || { stop; exit 0; } + # A way to turn pidfile writing off would be nice. That or mbpfan + # could check for staleness before refusing to control your fans. + rm -f /var/run/mbpfan.pid +end script + +# Starting mbpfan in the foreground without being in an interactive tty currently +# seems to segfault, so expect forkage. +expect fork +exec /usr/sbin/mbpfan +