aboutsummaryrefslogtreecommitdiff
path: root/system/mbpfan
diff options
context:
space:
mode:
authorJay Lanagan <j@lngn.net>2023-10-07 08:31:07 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2023-10-07 08:31:07 +0700
commit432021f0d5ba40e8498772ac2096273df77490b4 (patch)
treedc674faaa0a9d7aa7df8aa58a814c57170c0f744 /system/mbpfan
parent170d1d514ce4e03f209fcf7df359f5c9a9b42f99 (diff)
system/mbpfan: Added (Fan control daemon).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/mbpfan')
-rw-r--r--system/mbpfan/README15
-rw-r--r--system/mbpfan/doinst.sh11
-rw-r--r--system/mbpfan/mbpfan.SlackBuild112
-rw-r--r--system/mbpfan/mbpfan.info10
-rwxr-xr-xsystem/mbpfan/rc.mbpfan32
-rw-r--r--system/mbpfan/slack-desc19
6 files changed, 199 insertions, 0 deletions
diff --git a/system/mbpfan/README b/system/mbpfan/README
new file mode 100644
index 000000000000..5d097af99f2d
--- /dev/null
+++ b/system/mbpfan/README
@@ -0,0 +1,15 @@
+mbpfan (fan control daemon for Apple MacBookPro machines)
+
+A simple daemon to control fan speed on all MacBook/MacBook Pros
+(probably all Apple computers) for Linux Kernel 3 and newer.
+
+After installation you must add below to /etc/rc.d/rc.local:
+
+if [ -x /etc/rc.d/rc.mbpfan ]; then
+ /etc/rc.d/rc.mbpfan start
+fi
+
+and ensure /etc/rc.d/rc.mbpfan is exec (0755)
+
+Also edit /etc/mbpfan.conf and uncomment min_fan1_speed & max_fan1_speed
+I have found a min of 3000 and max 6200 work well for my mbp.
diff --git a/system/mbpfan/doinst.sh b/system/mbpfan/doinst.sh
new file mode 100644
index 000000000000..a927d07e878e
--- /dev/null
+++ b/system/mbpfan/doinst.sh
@@ -0,0 +1,11 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ rm $NEW
+ fi
+}
+
+config etc/mbpfan.conf.new
diff --git a/system/mbpfan/mbpfan.SlackBuild b/system/mbpfan/mbpfan.SlackBuild
new file mode 100644
index 000000000000..055defacea86
--- /dev/null
+++ b/system/mbpfan/mbpfan.SlackBuild
@@ -0,0 +1,112 @@
+#!/bin/bash
+
+# Slackware build script for mbpfan
+
+# Copyright 2022-23 Jay Lanagan (j@lngn.net), Detroit, MI, USA.
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=mbpfan
+VERSION=${VERSION:-2.4.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+elif [ "$ARCH" = "aarch64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+else
+ SLKCFLAGS="-O2"
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.?z
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# Slackware-ize the makefile
+sed -i -e "/-std=/s,= ,= $SLKCFLAGS ," \
+ -e 's,share/man,man,g' \
+ Makefile
+
+CFLAGS="$SLKCFLAGS" \
+
+make || exit 1
+make install DESTDIR=$PKG || exit 1
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+# rename conf & add rc script
+mv $PKG/etc/mbpfan.conf $PKG/etc/mbpfan.conf.new
+mkdir $PKG/etc/rc.d
+cp $CWD/rc.mbpfan $PKG/etc/rc.d
+
+# cleanup systemd stuff and dupe docs
+rm -r $PKG/lib
+rm -rf $PKG/usr/share
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a AUTHORS COPYING README.md \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/system/mbpfan/mbpfan.info b/system/mbpfan/mbpfan.info
new file mode 100644
index 000000000000..208fad019c1b
--- /dev/null
+++ b/system/mbpfan/mbpfan.info
@@ -0,0 +1,10 @@
+PRGNAM="mbpfan"
+VERSION="2.4.0"
+HOMEPAGE="https://github.com/linux-on-mac/mbpfan/"
+DOWNLOAD="https://github.com/linux-on-mac/mbpfan/archive/v2.4.0/mbpfan-2.4.0.tar.gz"
+MD5SUM="aaa7a3d89f576f18e34fce5f1dda50de"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Jay Lanagan"
+EMAIL="j@lngn.net"
diff --git a/system/mbpfan/rc.mbpfan b/system/mbpfan/rc.mbpfan
new file mode 100755
index 000000000000..457f0de96786
--- /dev/null
+++ b/system/mbpfan/rc.mbpfan
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# /etc/rc.d/rc.mbpfan
+#
+# Start/stop/restart - mbpfan.
+#
+# To make mbpfan start automatically at boot, make this
+# file executable: chmod 755 /etc/rc.d/rc.mbpfan
+#
+# and also you must add this to /etc/rc.d/rc.local to
+# start mbpfan:
+#
+# if [ -x /etc/rc.d/rc.mbpfan ]; then
+# /etc/rc.d/rc.mbpfan start
+# fi
+
+case "$1" in
+ 'start')
+ /usr/sbin/mbpfan -f >/dev/null &
+ ;;
+ 'stop')
+ pkill -f /usr/sbin/mbpfan >/dev/null &
+ rm -f /var/run/mbpfan.pid
+ ;;
+ 'restart')
+ /usr/sbin/mbpfan -f >/dev/null &
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ ;;
+esac
+
diff --git a/system/mbpfan/slack-desc b/system/mbpfan/slack-desc
new file mode 100644
index 000000000000..10e17620f8c5
--- /dev/null
+++ b/system/mbpfan/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+mbpfan: mbpfan (fan control daemon for Apple MacBookPro machines)
+mbpfan:
+mbpfan: A simple daemon to control fan speed on all MacBook/MacBook Pros
+mbpfan: (probably all Apple computers) for Linux Kernel 3 and newer.
+mbpfan:
+mbpfan: Homepage: https://github.com/linux-on-mac/mbpfan
+mbpfan:
+mbpfan:
+mbpfan:
+mbpfan:
+mbpfan: