diff --git a/.gitignore b/.gitignore
index 3634137..b1cd452 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,6 @@ bin/*
*.exe
*.out
+# Local LLM/agent project memory
+.LLM_Memory/
+
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index f55bd0b..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-dist: xenial
-language: c
-script:
- - make
diff --git a/COPYING.LESSER b/COPYING.LESSER
new file mode 100644
index 0000000..6e4a554
--- /dev/null
+++ b/COPYING.LESSER
@@ -0,0 +1,167 @@
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
diff --git a/Makefile b/Makefile
index ff1b7e6..7d63e82 100644
--- a/Makefile
+++ b/Makefile
@@ -9,8 +9,9 @@ TESTS_BIN = bin/mbpfan-tests
BIN = bin/mbpfan
CONF = mbpfan.conf
DEPEND_MODULE = mbpfan.depend.conf
+INIT = mbpfan.init.gentoo
DOC = README.md
-MAN = mbpfan.8.gz
+MAN = mbpfan.8
COPT =
CC ?= cc
@@ -56,30 +57,34 @@ clang-tidy:
uninstall:
rm /usr/sbin/mbpfan
rm /etc/mbpfan.conf
- rm /lib/modules-load.d/mbpfan.depend.conf
- rm /lib/systemd/system/mbpfan.service
+ rm /etc/init.d/mbpfan
+ rm /etc/modules-load.d/mbpfan.conf
rm /usr/share/man/man8/mbpfan.8.gz
rm -rf /usr/share/doc/mbpfan
install: all
install -d $(DESTDIR)/usr/sbin
install -d $(DESTDIR)/etc
- install -d $(DESTDIR)/lib/systemd/system
+ install -d $(DESTDIR)/etc/init.d
+ install -d $(DESTDIR)/etc/modules-load.d
install -d $(DESTDIR)/usr/share/doc/mbpfan
- install -d $(DESTDIR)/lib/modules-load.d
+ install -d $(DESTDIR)/usr/share/man/man8
install $(BIN) $(DESTDIR)/usr/sbin
install -m644 $(CONF) $(DESTDIR)/etc
- install -m644 $(DEPEND_MODULE) $(DESTDIR)/lib/modules-load.d
+ install -m755 $(INIT) $(DESTDIR)/etc/init.d/mbpfan
+ install -m644 $(DEPEND_MODULE) $(DESTDIR)/etc/modules-load.d/mbpfan.conf
install -m644 $(DOC) $(DESTDIR)/usr/share/doc/mbpfan
- install -d $(DESTDIR)/usr/share/man/man8
- install -m644 $(MAN) $(DESTDIR)/usr/share/man/man8
+ install -m644 COPYING $(DESTDIR)/usr/share/doc/mbpfan
+ install -m644 COPYING.LESSER $(DESTDIR)/usr/share/doc/mbpfan
+ gzip -9 -n -c $(MAN) > $(DESTDIR)/usr/share/man/man8/mbpfan.8.gz
@echo ""
@echo "******************"
@echo "INSTALL COMPLETED"
@echo "******************"
@echo ""
@echo "A configuration file has been copied (might overwrite existing file) to /etc/mbpfan.conf."
- @echo "See README.md file to have mbpfan automatically started at system boot."
+ @echo "To start mbpfan at boot with OpenRC, run:"
+ @echo " rc-update add mbpfan default"
@echo ""
@echo "Please run the tests now with the command"
@echo " sudo make tests"
diff --git a/README.md b/README.md
index 2770693..298165d 100644
--- a/README.md
+++ b/README.md
@@ -1,260 +1,97 @@
-# mbpfan
-
-[](https://travis-ci.org/dgraziotin/mbpfan)
-
-This is an enhanced version of [Allan McRae mbpfan](http://allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon/)
-
-mbpfan is a daemon that uses input from coretemp module and sets the fan speed using the applesmc module.
-This enhanced version assumes any number of processors and fans (max. 10).
-
-* It only uses the temperatures from the processors as input.
-* It requires coretemp and applesmc kernel modules to be loaded.
-* It requires root use
-* It daemonizes or stays in foreground
-* Verbose mode for both syslog and stdout
-* Users can configure it using the file /etc/mbpfan.conf
-
-**Table Of Contents**
-
-- [Supported GNU/Linux Distributions](#supported-gnulinux-distributions)
-- [Tested Mac Models](#tested-mac-models)
-- [Requirements](#requirements)
-- [Installation](#installation)
- - [Arch Linux](#arch-linux)
- - [CRUX Linux](#crux-linux)
- - [Debian](#debian)
- - [Fedora](#fedora)
- - [Gentoo](#gentoo)
- - [Solus](#solus)
- - [Ubuntu](#ubuntu)
- - [Generic Install Instructions (All Other Operating Systems)](#generic-install-instructions-all-other-operating-systems)
-- [Run Instructions](#run-instructions)
-- [Starting at boot](#starting-at-boot)
-- [Usage](#usage)
-- [References](#references)
-- [License](#license)
-- [Credits](#credits)
-
-## Supported GNU/Linux Distributions
-
-We provide scripts to to load mbpfan daemon at system boot for many distros.
-Please note that the support is provided by volunteers. mbpfan needs tests and bug reports.
-
-Supported distributions:
-
-- Ubuntu
-- Debian
-- Archlinux
-- Fedora
-- RedHat
-- CentOS
-- Gentoo
-- Alpine
-- Trisquel
-- Solus
-
-## Tested Mac Models
-
-See https://github.com/linux-on-mac/mbpfan/wiki/Tested-Mac-Models .
+# mbpfan-josie
-## Requirements
-
-Be sure to load the kernel modules **applesmc** and **coretemp**.
-
-These modules are often automatically loaded when booting up GNU/Linux on a MacBook. If that is not the case, you should make sure to load them at system startup.
-
-**How do I know if applesmc and coretemp are loaded?**
+This is my fork of [mbpfan](https://github.com/linux-on-mac/mbpfan), itself an enhanced version of [Allan McRae mbpfan](http://allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon/).
-In most distributions, you can run the following command:
+This fork is focused on **Gentoo Linux on older Intel Macs**. My current machine is a MacBook Pro 11,4 (Retina 15", mid-2015), so that's what I test on. The board is a Mac-06F11FD93F0323C5, the i7 4770HQ/16GB RAM/Intel Iris Pro 5200 one (I swapped out the stock Radeon dGPU one due to issues at the time with older AMD cards on Linux).
-```bash
-lsmod | grep -e applesmc -e coretemp
-```
+Other distributions and Mac models are not supported or tested by this fork. If you need broader support, use [upstream mbpfan](https://github.com/linux-on-mac/mbpfan).
-If you see `coretemp` and `applesmc` listed, you are all set.
+## Requirements
-**If you do not see `coretemp` and `applesmc` listed, you must load them.**
+- Gentoo Linux with OpenRC (the primary target).
+- Kernel modules `applesmc` and `coretemp`.
+- Root privileges to run the daemon.
-This is _usually_ achieved by inserting the following two lines in the file `/etc/modules`
+Load the modules at boot with OpenRC:
+```sh
+# /etc/conf.d/modules
+modules="applesmc coretemp"
```
-coretemp
-applesmc
-```
-
-Please check the relevant documentation of your GNU/Linux distribution.
-## Installation
+If you use systemd on Gentoo instead, the installed
+`/etc/modules-load.d/mbpfan.conf` loads `coretemp`; add `applesmc` there too if
+your kernel does not autoload it.
-### Arch Linux
+## Build
-See [mbpfan-git at AUR](https://aur.archlinux.org/packages/mbpfan-git/).
-Otherwise, please refer to the Generic Instructions.
-
-### CRUX Linux
-
-Follow the instructions on [jolupalabs REPO](https://github.com/jolupa/jolupalabs) for installation.
-
-### Debian
-
-On Debian 10 or later install via:
-
-```
-sudo apt-get install mbpfan
+```sh
+make
```
-### Fedora
+This produces `bin/mbpfan` and `bin/mbpfan-tests`.
-On Fedora 30 or later:
+## Install
-```
-sudo dnf install mbpfan
+```sh
+sudo make install
```
-### Gentoo
+Installs:
-Install the ```mbpfan``` package with:
+- `/usr/sbin/mbpfan`
+- `/etc/mbpfan.conf`
+- `/etc/init.d/mbpfan` (OpenRC)
+- `/etc/modules-load.d/mbpfan.conf`
+- `/usr/share/doc/mbpfan/README.md`
+- `/usr/share/doc/mbpfan/COPYING`
+- `/usr/share/doc/mbpfan/COPYING.LESSER`
+- `/usr/share/man/man8/mbpfan.8.gz`
- sudo emerge -av app-laptop/mbpfan
+## Run
+Foreground:
-### Solus
-
-On Solus, install the package with:
-```
-sudo eopkg install mbpfan
+```sh
+sudo mbpfan -f -v
```
-then enable the service.
-
-
-### Ubuntu
-On Ubuntu 18.04 or later install via:
+As an OpenRC service:
+```sh
+sudo rc-service mbpfan start
+sudo rc-update add mbpfan default
```
-sudo apt-get install mbpfan
-```
-
-### Generic Install Instructions (All Other Operating Systems)
-
-Compile with
-
- make
-
-Install with
-
- sudo make install
-
-It copies mbpfan to /usr/sbin, mbpfan.conf to /etc (and overwrites existing files),
-README.md to /usr/share/doc/mbpfan, and mbpfan.8.gz to /usr/share/man/man8
-
-If you would like to compile with Clang instead of GCC, simply set your system's
-default compiler to be Clang. Tested with Clang 3.8 and 3.9. Tested with Clang
-4.0 along with llvm-lld (The LLVM Linker).
-
-
-Run The Tests (Optional)
-------------------------
-Users may run the tests after building the program. Please run the following command _from within the source directory_.
- sudo make tests
+## Configuration
-Note that this only works on MacBook and not desktop computers due to different environment expectations.
+Edit `/etc/mbpfan.conf`. See the comments in that file for the temperature
+thresholds and fan speed overrides. Send `SIGHUP` to reload the configuration.
+## Tests
-## Run Instructions
-
-If not installed, run with
-
- sudo bin/mbpfan
-
-If installed, manually run with
-
- sudo mbpfan
-
-If installed and using the init file, run with (Ubuntu example)
-
- sudo service mbpfan start
-
-
-## Starting at boot
-
-**Ubuntu**
-
-For systemd based init systems (Ubuntu 16.04+), see the systemd section below.
-
-For upstart based init systems (Ubuntu before 16.04), an example upstart job has been provided.
-For using it, execute:
-
- sudo cp mbpfan.upstart /etc/init/mbpfan.conf
- sudo start mbpfan
-
-**Debian**
-An init file suitable for /lib/lsb/init-functions (Debian)
-is located in the main folder of the source files, called mbpfan.init.debian
-Rename it to mbpfan, give it execution permissions (chmod +x mbpfan)
-and move it to /etc/init.d
-Then, add it to the default runlevels with (as root):
-
- sudo update-rc.d mbpfan defaults
-
-**Redhat, CentOS, Fedora**
-An init file suitable for /etc/rc.d/init.d/functions
-(RHEL/CentOS & Fedora) is also located at the same place, this file is called
-mbpfan.init.redhat. Also rename it to mbpfan, give it execution permissions
-and move it to /etc/init.d
-To add the script to the default runlevels, run the following as root:
-
- chkconfig --level 2345 mbpfan on && chkconfig --level 016 mbpfan off
-
-**Gentoo**
-
-To automatically run mbpfan at boot, run as root:
-
- rc-update add mbpfan default
-
-
-**systemd**
-As a special bonus, a service file for systemd is also included. To use it,
-execute the following (as root):
-
- sudo cp mbpfan.service /etc/systemd/system/
- sudo systemctl enable mbpfan.service
- sudo systemctl daemon-reload
- sudo systemctl start mbpfan.service
-
-**dinit**
-A [dinit](https://github.com/davmac314/dinit) service definition is also included. To use it, execute the following:
-
- sudo cp mbpfan.dinit /etc/dinit.d/mbpfan
- sudo dinitctl enable mbpfan
- sudo dinitctl start mbpfan
-
-## Usage
-
- Usage: ./mbpfan OPTION(S)
-
- -h Show the help screen
- -f Run in foreground
- -v Be (a lot) verbose
-
-## References
+```sh
+sudo make tests
+```
-* [mbpfan on Ask Ubuntu](https://askubuntu.com/search?q=mbpfan+is%3Aquestion)
+The tests read the real `applesmc`/`coretemp` sysfs paths, so they only pass on
+supported Mac hardware.
## License
-GNU General Public License version 3
+GPL-3.0-or-later. See `COPYING`.
+
+Bundled `settings` and `strmap` code is LGPL-3.0-or-later by Per Ola
+Kristensson; see `COPYING.LESSER` and the notices in the source files.
## Credits
-**This Project Is Based On:**
+Based on:
-* http://allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon/
-* http://allanmcrae.com/2011/08/mbp-fan-daemon-update/
-* https://launchpad.net/macfanctld
-* https://www.lobotomo.com/products/FanControl/
+- [linux-on-mac/mbpfan](https://github.com/linux-on-mac/mbpfan)
+- [Allan McRae mbpfan](http://allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon/)
+- [rvega/Fan-Control-Daemon](https://github.com/rvega/Fan-Control-Daemon)
-**This Project uses following library:**
+Uses Per Ola Kristensson's [ANSI C settings/strmap](http://pokristensson.com/settings.html).
-* [ANSI C Application Settings Management](http://pokristensson.com/settings.html) by Per Ola Kristensson.
+AI use: I use LLMs for code generation and troubleshooting. Usually local Qwen instances or DeepSeek via OpenRouter.
diff --git a/mbpfan.8 b/mbpfan.8
new file mode 100644
index 0000000..90fb6bf
--- /dev/null
+++ b/mbpfan.8
@@ -0,0 +1,32 @@
+.\" Process this file with
+.\" groff -man -Tascii mbpfan.1
+.\"
+.TH MBPFAN 8 "User Manuals"
+.SH NAME
+mbpfan \- A simple daemon to control fan speed on Apple computers (Gentoo fork of mbpfan)
+.SH SYNOPSIS
+.B mbpfan [OPTIONS]
+.SH DESCRIPTION
+.B mbpfan
+is a daemon that uses input from coretemp module and sets the fan speed using the applesmc module.
+This fork targets Gentoo Linux on older Intel Macs. It assumes any number of processors and fans (max. 10).
+.SH OPTIONS
+.IP -h
+Show the help screen
+.IP -f
+Run in the foreground
+.IP -v
+Be (alot) verbose
+.SH FILES
+.I /etc/mbpfan.conf
+.RS
+The system wide configuration file.
+.RE
+.SH AUTHOR
+Daniel Graziotin <daniel@ineed.coffee>
+.SH MORE INFO
+https://github.com/cjosie/mbpfan-josie/
+
+https://github.com/linux-on-mac/mbpfan/
+
+http://allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon/
\ No newline at end of file
diff --git a/mbpfan.8.gz b/mbpfan.8.gz
deleted file mode 100644
index 76146d0..0000000
Binary files a/mbpfan.8.gz and /dev/null differ
diff --git a/mbpfan.conf b/mbpfan.conf
index c2a9caf..df299d3 100644
--- a/mbpfan.conf
+++ b/mbpfan.conf
@@ -1,5 +1,5 @@
[general]
-# see https://ineed.coffee/3838/a-beginners-tutorial-for-mbpfan-under-ubuntu for the values
+# See the comments below for guidance on choosing values.
#
# mbpfan will load the max / min speed of from the files produced by the applesmc driver. If these files are not found it will set all fans to the default of min_speed = 2000 and max_speed = 6200
# by setting the values for the speeds in this config it will override whatever it finds in:
diff --git a/mbpfan.conf.test0 b/mbpfan.conf.test0
index 5095078..cd69dda 100644
--- a/mbpfan.conf.test0
+++ b/mbpfan.conf.test0
@@ -1,5 +1,5 @@
[general]
-# see https://ineed.coffee/3838/a-beginners-tutorial-for-mbpfan-under-ubuntu for the values
+# See the comments below for guidance on choosing values.
min_fan1_speed = 2000 # put the *lowest* value of "cat /sys/devices/platform/applesmc.768/fan*_min"
max_fan1_speed = 6200 # put the *highest* value of "cat /sys/devices/platform/applesmc.768/fan*_max"
low_temp = 63 # try ranges 55-63, default is 63
diff --git a/mbpfan.dinit b/mbpfan.dinit
deleted file mode 100644
index cb2c3a7..0000000
--- a/mbpfan.dinit
+++ /dev/null
@@ -1,7 +0,0 @@
-type = bgprocess
-command = /usr/bin/mbpfan
-restart = true
-logfile = /var/log/dinit/mbpfan.log
-waits-for = loginready
-pid-file = /var/run/mbpfan.pid
-
diff --git a/mbpfan.init.debian b/mbpfan.init.debian
deleted file mode 100644
index e279704..0000000
--- a/mbpfan.init.debian
+++ /dev/null
@@ -1,103 +0,0 @@
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides: mbpfan
-# Required-Start: $remote_fs $syslog
-# Required-Stop: $remote_fs $syslog
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: mbpfan initscript
-# Description: Start the mbpfan daemon
-### END INIT INFO
-
-DESC="Start the mbpfan daemon"
-NAME=mbpfan
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DAEMON=/usr/sbin/$NAME
-PIDFILE=/var/run/$NAME.pid
-SCRIPTNAME=/etc/init.d/$NAME
-DAEMON_ARGS=""
-
-# Exit if the package is not installed
-[ -x "$DAEMON" ] || exit 0
-
-# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
-
-# Define LSB log_* functions.
-# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
-. /lib/lsb/init-functions
-
-# Function that starts the daemon/service
-do_start()
-{
- start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
- || return 1
- start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
- $DAEMON_ARGS \
- || return 2
-}
-
-# Function that stops the daemon/service
-do_stop()
-{
- # Return
- start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
- RETVAL="$?"
- [ "$RETVAL" = 2 ] && return 2
- start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
- [ "$?" = 2 ] && return 2
- return "$RETVAL"
-}
-
-# Function that sends a SIGHUP to the daemon/service
-do_reload()
-{
- start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
- return 0
-}
-
-case "$1" in
- start)
- [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
- do_start
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- stop)
- [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- status)
- status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
- ;;
- restart|force-reload)
- log_daemon_msg "Restarting $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1)
- do_start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;; # Old process is still running
- *) log_end_msg 1 ;; # Failed to start
- esac
- ;;
- *)
- # Failed to stop
- log_end_msg 1
- ;;
- esac
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
- exit 3
- ;;
-esac
-
-:
diff --git a/mbpfan.init.redhat b/mbpfan.init.redhat
deleted file mode 100644
index a83765b..0000000
--- a/mbpfan.init.redhat
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/bin/sh
-#
-# mbpfan Start the mbpfan daemon
-#
-# chkconfig: 2 3 4 5 15 85
-# description: Start the mbpfan daemon
-
-### BEGIN INIT INFO
-# Provides: mbpfan
-# Required-Start: $remote_fs $syslog
-# Required-Stop: $remote_fs $syslog
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: mbpfan initscript
-# Description: Start the mbpfan daemon
-### END INIT INFO
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-exec="/usr/sbin/mbpfan"
-prog="mbpfan"
-
-[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
-
-lockfile=/var/lock/subsys/$prog
-
-start() {
- [ -x $exec ] || exit 5
- echo -n $"Starting $prog: "
- daemon $exec
- retval=$?
- echo
- [ $retval -eq 0 ] && touch $lockfile
- return $retval
-}
-
-stop() {
- echo -n $"Stopping $prog: "
- killproc $prog
- retval=$?
- echo
- [ $retval -eq 0 ] && rm -f $lockfile
- return $retval
-}
-
-restart() {
- stop
- start
-}
-
-reload() {
- restart
-}
-
-force_reload() {
- restart
-}
-
-rh_status() {
- # run checks to determine if the service is running or use generic status
- status $prog
-}
-
-rh_status_q() {
- rh_status >/dev/null 2>&1
-}
-
-
-case "$1" in
- start)
- rh_status_q && exit 0
- $1
- ;;
- stop)
- rh_status_q || exit 0
- $1
- ;;
- restart)
- $1
- ;;
- reload)
- rh_status_q || exit 7
- $1
- ;;
- force-reload)
- force_reload
- ;;
- status)
- rh_status
- ;;
- condrestart|try-restart)
- rh_status_q || exit 0
- restart
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
- exit 2
-esac
-exit $?
-
diff --git a/mbpfan.service b/mbpfan.service
deleted file mode 100644
index 5ac729a..0000000
--- a/mbpfan.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=A fan manager daemon for MacBook Pro
-After=syslog.target
-After=sysinit.target
-
-[Service]
-Type=simple
-ExecStart=/usr/sbin/mbpfan -f
-ExecReload=/usr/bin/kill -HUP $MAINPID
-PIDFile=/run/mbpfan.pid
-Restart=always
-RestartSec=1
-
-[Install]
-WantedBy=sysinit.target
diff --git a/mbpfan.spec b/mbpfan.spec
deleted file mode 100644
index 8d1f550..0000000
--- a/mbpfan.spec
+++ /dev/null
@@ -1,65 +0,0 @@
-Name: mbpfan
-URL: https://github.com/dgraziotin/mbpfan
-License: GPLv3
-Group: System Environment/Daemons
-Version: %{SOURCE_VERSION}
-Release: 3
-Summary: A simple daemon to control fan speed on all MacBook/MacBook Pros (probably all Apple computers) for Linux 3.x.x and 4.x.x
-Source: v%{version}.tar.gz
-
-%description
-This is an enhanced version of Allan McRae mbpfan
-
-mbpfan is a daemon that uses input from coretemp module and sets the fan speed using the applesmc module. This enhanced version assumes any number of processors and fans (max. 10).
-
-It only uses the temperatures from the processors as input.
-It requires coretemp and applesmc kernel modules to be loaded.
-It requires root use
-It daemonizes or stays in foreground
-Verbose mode for both syslog and stdout
-Users can configure it using the file /etc/mbpfan.conf
-
-%prep
-%setup -q -n %{name}-%{version}
-
-%build
-make
-
-%install
-install -D -m755 bin/mbpfan $RPM_BUILD_ROOT/usr/sbin/mbpfan
-install -D -m644 mbpfan.conf $RPM_BUILD_ROOT/etc/mbpfan.conf
-install -D -m644 mbpfan.service $RPM_BUILD_ROOT/usr/lib/systemd/system/mbpfan.service
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%post
-%systemd_post mbpfan.service
-echo "mbpfan will auto detect sane values for min and max fan speeds."
-echo "If you want to customize these values please edit:"
-echo "/etc/mbpfan.conf"
-echo "To start the daemon now type:"
-echo "systemctl start mbpfan"
-echo "To run also at boot, type:"
-echo "systemctl enable mbpfan"
-
-%preun
-%systemd_preun mbpfan.service
-
-%postun
-%systemd_postun_with_restart mbpfan.service
-
-%files
-%defattr (-,root,root)
-%doc AUTHORS README.md
-/usr/sbin/mbpfan
-%config /etc/mbpfan.conf
-/usr/lib/systemd/system/mbpfan.service
-
-%changelog
-* Mon Sep 10 2018 Michele Codutti <codutti@gmail.com> - 2.0.2-3
-- Removed autoconfig with suggested procedure because has been integrated on mbpfan.
-
-* Sun Aug 19 2018 Michele Codutti <codutti@gmail.com> - 2.0.2-2
-- Autoconfig with suggested procedure.
-- Initial packaging
diff --git a/mbpfan.upstart b/mbpfan.upstart
deleted file mode 100644
index 7299b4f..0000000
--- a/mbpfan.upstart
+++ /dev/null
@@ -1,14 +0,0 @@
-# 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
-umask 022
-
-console log
-
-exec /usr/sbin/mbpfan -f
diff --git a/src/util.c b/src/util.c
index 25415b9..421b2d7 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1,3 +1,17 @@
+/**
+ * Copyright (C) 2019 Andrew Gaul
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
#include <stdarg.h>
#include <stdio.h>
#define _GNU_SOURCE
diff --git a/src/util.h b/src/util.h
index 7f4a280..73409d3 100644
--- a/src/util.h
+++ b/src/util.h
@@ -1,3 +1,17 @@
+/**
+ * Copyright (C) 2019 Andrew Gaul
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
#ifndef _UTIL_H_
#define _UTIL_H_
Focus the fork on Gentoo/OpenRC and clean up packaging
Remove non-Gentoo init, service, spec, and CI files. Add COPYING.LESSER and GPL headers for util. Keep the man page as plain mbpfan.8 and gzip it at install. Update README and config for the Gentoo-only scope.
41989f2108fc350350dfb929e8109ce205ac3b79
cjosie <administrator@josie-c.com> · 2026-11-10T21:22 ·
browse files at this commit
parents:
64dfd35