Skip to content

Commit 03ac205

Browse files
author
Daniel Graziotin
committed
Added Gentoo support and enhanced README.md
2 parents 37847f3 + a895bff commit 03ac205

File tree

6 files changed

+113
-39
lines changed

6 files changed

+113
-39
lines changed

AUTHORS

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
MAINTAINERS AND CONTRIBUTORS
2-
----------------------------
1+
AUTHORS, CONTRIBUTORS, MAINTAINERS
2+
----------------------------------
33

44
Daniel Graziotin <dgraziotin AT task3 DOT cc>
55
Ismail Khatib <ikhatib AT gmail DOT com>
6-
Trevor Joynson
6+
Trevor Joynson
7+
Magnus Stubman <magnus AT stubman DOT eu>
8+
79

810
ORIGINARY AUTHORS
911
-----------------
10-
1112
Allan McRae mbpfan <http://allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon>
1213
rvega <https://github.com/rvega/Fan-Control-Daemon>

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ install:
7878
@echo " sudo make tests"
7979
@echo ""
8080
rebuild: clean all
81-
#rebuild is not entirely correct
81+
#rebuild is not entirely correct

README.md

+79-24
Original file line numberDiff line numberDiff line change
@@ -17,41 +17,77 @@ This enhanced version assumes any number of processors and fans (max. 10).
1717
* Users can configure it using the file /etc/mbpfan.conf
1818

1919

20+
Supported GNU/Linux Distributions
21+
---------------------------------
22+
We provide scripts to to load mbpfan daemon at system boot for many distros.
23+
Please note that the support is provided by volunteers. mbpfan needs test and bug reports.
24+
25+
Supported distributions:
26+
27+
- Ubuntu
28+
- Debian
29+
- Fedora
30+
- RedHat
31+
- CentOS
32+
- Gentoo
33+
34+
35+
Tested Macbook Models
36+
---------------------
37+
- MacBook Pro 8.1 13" (Intel i7 - Linux 3.2)
38+
- MacBook Pro 6,2 15" (Intel i7 - Linux 3.2)
39+
- MacBook Pro 2,2 15" (Intel Core 2 Duo - Linux 3.4.4)
40+
41+
42+
Warning
43+
-------
44+
Be sure to load the kernel modules **applesmc** and **coretemp**.
45+
46+
2047
Compile Instructions
2148
---------------------
2249
Compile with
23-
make
50+
51+
make
2452

2553
Manually compile with
26-
gcc -o bin/mbpfan src/mbpfan.c -lm
54+
55+
gcc -o bin/mbpfan src/mbpfan.c -lm
2756

2857

2958
Install Instructions
3059
--------------------
3160
Install with
32-
sudo make install
61+
62+
sudo make install
3363

3464
It copies mbpfan to /usr/sbin and mbpfan.conf to /etc
3565

3666

3767
Run The Tests (Recommended)
3868
---------------------------
3969
It is recommended to run the tests after installing the program
40-
sudo ./bin/mbpfan -t
70+
71+
sudo ./bin/mbpfan -t
72+
4173
or
42-
sudo make tests
74+
75+
sudo make tests
4376

4477

4578
Run Instructions
4679
----------------
4780
If not installed, run with
48-
sudo bin/mbpfan
81+
82+
sudo bin/mbpfan
4983

5084
If installed, manually run with
51-
sudo mbpfan
85+
86+
sudo mbpfan
5287

5388
If installed and using the init file, run with (Ubuntu example)
54-
sudo service mbpfan start
89+
90+
sudo service mbpfan start
5591

5692

5793
Starting at boot
@@ -60,43 +96,62 @@ Starting at boot
6096
For upstart based init systems (Ubuntu), an example upstart job has been
6197
provided for use in place of the LSB-style init script.
6298
To use, execute:
63-
sudo cp mbpfan.upstart /etc/init/mbpfan.conf
64-
sudo start mbpfan
99+
100+
sudo cp mbpfan.upstart /etc/init/mbpfan.conf
101+
sudo start mbpfan
65102

66103
**Debian**
67104
An init file suitable for /lib/lsb/init-functions (Debian)
68105
is located in the main folder of the source files, called mbpfan.init.debian
69106
Rename it to mbpfan, give it execution permissions (chmod +x mbpfan)
70107
and move it to /etc/init.d
71-
Then, add it to the default runlevels with sudo update-rc.d mbpfan defaults
108+
Then, add it to the default runlevels with (as root):
109+
110+
sudo update-rc.d mbpfan defaults
72111

73112
**Redhat, CentOS, Fedora**
74113
An init file suitable for /etc/rc.d/init.d/functions
75114
(RHEL/CentOS & Fedora) is also located at the same place, this file is called
76115
mbpfan.init.redhat. Also rename it to mbpfan, give it execution permissions
77116
and move it to /etc/init.d
78117
To add the script to the default runlevels, run the following as root:
79-
chkconfig --level 2345 mbpfan on && chkconfig --level 016 mbpfan off
118+
119+
chkconfig --level 2345 mbpfan on && chkconfig --level 016 mbpfan off
120+
121+
**Gentoo**
122+
An init file is available for gentoo users: mbpfan.init.gentoo
123+
To install, run as root:
124+
125+
cp mbpfan.init.gentoo /etc/init.d/mbpfan
126+
127+
To automatically run mbpfan at boot, run as root:
128+
129+
rc-update add mbpfan default
130+
80131

81132
**systemd**
82133
As a special bonus, a service file for systemd is also included. To use it,
83-
execute the following as root:
84-
sudo cp mbpfan.service /usr/lib/systemd/system
85-
sudo ln -s /usr/lib/systemd/system/mbpfan.service /etc/systemd/system/mbpfan.service
86-
sudo systemctl daemon-reload
87-
sudo systemctl start mbpfan.service
134+
execute the following (as root):
135+
136+
sudo cp mbpfan.service /usr/lib/systemd/system
137+
sudo ln -s /usr/lib/systemd/system/mbpfan.service /etc/systemd/system/mbpfan.service
138+
sudo systemctl daemon-reload
139+
sudo systemctl start mbpfan.service
88140

89141
To start the service automatically at boot, also execute the following:
90-
sudo systemctl enable mbpfan.service
142+
143+
sudo systemctl enable mbpfan.service
91144

92145

93146
Usage
94147
-------
95-
Usage: ./mbpfan OPTION(S)
96-
-h Show the help screen
97-
-f Run in foreground
98-
-t Run the tests
99-
-v Be (a lot) verbose
148+
149+
Usage: ./mbpfan OPTION(S)
150+
151+
-h Show the help screen
152+
-f Run in foreground
153+
-t Run the tests
154+
-v Be (a lot) verbose
100155

101156

102157
License
@@ -110,4 +165,4 @@ Based On
110165
* http://allanmcrae.com/2011/08/mbp-fan-daemon-update/
111166
* https://launchpad.net/macfanctld
112167
* http://paste2.org/p/862259
113-
* http://www.lobotomo.com/products/FanControl/
168+
* http://www.lobotomo.com/products/FanControl/

mbpfan.init.gentoo

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/sbin/runscript
2+
3+
depend() {
4+
use logger
5+
}
6+
7+
start() {
8+
ebegin "Starting mbpfan"
9+
start-stop-daemon --start --quiet --exec /usr/sbin/mbpfan
10+
eend $?
11+
}
12+
13+
stop() {
14+
ebegin "Stopping mbpfan"
15+
start-stop-daemon --stop --quiet --exec /usr/sbin/mbpfan
16+
eend $?
17+
}
18+

src/minunit.c

-10
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@
1010
int tests_run = 0;
1111

1212

13-
struct s_sensors {
14-
char* path;
15-
char* fan_output_path;
16-
char* fan_manual_path;
17-
unsigned int temperature;
18-
struct s_sensors *next;
19-
};
20-
typedef s_sensors t_sensors;
21-
22-
2313
static char *test_sensor_paths()
2414
{
2515
t_sensors* sensors = retrieve_sensors();

src/minunit.h

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
#define mu_run_test(test) do { char *message = test(); tests_run++; \
66
if (message) return message; } while (0)
77

8+
struct s_sensors {
9+
char* path;
10+
char* fan_output_path;
11+
char* fan_manual_path;
12+
unsigned int temperature;
13+
struct s_sensors *next;
14+
};
15+
typedef s_sensors t_sensors;
16+
17+
818
extern int tests_run;
919

1020
static char *test_sensor_paths();

0 commit comments

Comments
 (0)