public
Last active

Arch Linux PKGBUILD for tpfanco-svn 89-5

  • Download Gist
PKGBUILD
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
# Contributor: Andreas Wagner <Andreas dot Wagner at em dot uni-frankfurt do de>
 
pkgname=tpfanco-svn
pkgver=89
pkgrel=5
pkgdesc="Monitors temperatures and controls fan speed of IBM/Lenovo ThinkPad notebooks."
replaces=('tpfand')
provides=('tpfanco')
conflicts=('tpfanco' 'tpfand-no-hal' 'tpfand' 'tpfand-profiles' 'tpfan-admin')
depends=('python2-dmidecode-git' 'python2-dbus' 'pygtk' 'python2-rsvg' 'python2-dbus')
makedepends=('subversion')
arch=('i686' 'x86_64')
license=('GPL')
url="http://code.google.com/p/tpfanco"
install=tpfand.install
backup=('etc/tpfand.conf')
source=(tpfand.DAEMON tpfand.PMUTILS tpfand.service pod-utf8.patch sbin-bin.patch)
 
_svntrunk='http://tpfanco.googlecode.com/svn/trunk/'
_svnmod='tpfanco-read-only'
 
build() {
cd $srcdir
 
msg "Connecting to $_svntrunk..."
if [ -d $_svnmod/.svn ]; then
(cd $_svnmod && svn up -r $pkgver)
else
svn co $_svntrunk --config-dir ./ -r $pkgver $_svnmod
fi
 
msg "SVN checkout done or server timeout, creating working copy..."
rm -rf $srcdir/$_svnmod-build
cp -r $_svnmod $_svnmod-build
cd $srcdir/$_svnmod-build
patch -p0 < $srcdir/sbin-bin.patch
patch -p0 < $srcdir/pod-utf8.patch
 
msg "Patching for python2 and Arch-specifics..."
sed -i 's|#! /usr/bin/python|#! /usr/bin/python2|' tpfand/wrappers/tpfand tpfand/src/tpfand/* tpfan-admin/scratch/fan_caching.py tpfan-admin/src/tpfanadmin/* tpfan-admin/wrappers/tpfan-admin
sed -i 's|/usr/share/pyshared|/usr/lib/python2.7/site-packages|' tpfand/wrappers/tpfand tpfand/src/tpfand/* tpfan-admin/scratch/fan_caching.py tpfan-admin/src/tpfanadmin/* tpfand/Makefile tpfan-admin/Makefile
sed -i 's|/var/run/|/run/|' tpfand/src/tpfand/build.py
 
msg "Starting tpfand make..."
cd $srcdir/$_svnmod-build/tpfand
make all
 
msg "Starting tpfan-admin/pofiles make..."
cd $srcdir/$_svnmod-build/tpfan-admin
make all
}
 
 
package() {
msg "Packaging tpfand..."
cd $srcdir/$_svnmod-build/tpfand
make DESTDIR=$pkgdir install
install -d $pkgdir/usr/share/man/man8
install -m644 tpfand.8 $pkgdir/usr/share/man/man8/tpfand.8
install -m644 etc/tpfand.conf $pkgdir/usr/share/tpfand/tpfand.conf.default
 
msg "Packaging tpfan-admin..."
cd $srcdir/$_svnmod-build/tpfan-admin
make DESTDIR=$pkgdir install
install -d $pkgdir/usr/share/man/man1
install -d $pkgdir/usr/share/icons/hicolor/{scalable/apps,128x128/apps,22x22/apps,48x48/apps}
install -m644 tpfan-admin.1 $pkgdir/usr/share/man/man1/tpfan-admin.1
install -m644 art/fanicon.svg $pkgdir/usr/share/icons/hicolor/scalable/apps/fanicon.svg
install -m644 share/tpfan-admin-128x128.png $pkgdir/usr/share/icons/hicolor/128x128/apps/tpfan-admin.png
install -m644 share/tpfan-admin-22x22.png $pkgdir/usr/share/icons/hicolor/22x22/apps/tpfan-admin.png
install -m644 share/tpfan-admin-48x48.png $pkgdir/usr/share/icons/hicolor/48x48/apps/tpfan-admin.png
 
msg "Packaging tpfand-profiles..."
cd $srcdir/$_svnmod-build/tpfand-profiles
make DESTDIR=$pkgdir install
 
msg "Cleaning up superfluous files and directories..."
rm -rf $pkgdir/etc/{acpi,init.d}
 
msg "Packaging this system's /etc/tpfand.conf..."
if [ -e /etc/tpfand.conf ] ; then
install -m644 /etc/tpfand.conf $pkgdir/etc/tpfand.conf
else
install -m644 $srcdir/$_svnmod-build/tpfand/etc/tpfand.conf $pkgdir/etc/tpfand.conf
fi
 
msg "Packaging service files..."
install -D -m755 $srcdir/tpfand.DAEMON $pkgdir/etc/rc.d/tpfand
install -D -m755 $srcdir/tpfand.PMUTILS $pkgdir/etc/pm/sleep.d/09tpfand
install -D -m644 $srcdir/tpfand.service $pkgdir/usr/lib/systemd/system/tpfand.service
}
 
md5sums=('338e8bb6ca2afe95ab7264eb5827c111'
'aa05644ace593d595598666d1513f472'
'92369a2cbf454e9e34588b06a09be0cf'
'f3e42b757fe0cf25535b7c74d0e66273'
'71ec2c6933d3548051efc22b9e10f41d')
sha1sums=('0a25882049e5cfd40c93bbaca86e1d931635816b'
'57f1738c2af173dd99777dbdb3757f395e100aae'
'78dc16ff074525ded712c4a0e2b9a770e63cba9d'
'11db7167be243db004cc3856192b40cb67e0d8be'
'8be68a482ef4dfa8caa726df6dbbf90a63141e5f')
pod-utf8.patch
Diff
1 2 3 4 5 6 7 8 9 10
Index: tpfand/man/tpfand.pod
===================================================================
--- tpfand/man/tpfand.pod (revision 89)
+++ tpfand/man/tpfand.pod (working copy)
@@ -1,3 +1,5 @@
+=encoding utf8
+
=head1 NAME
tpfand - Controls the fan speed of IBM/Lenovo ThinkPad-Notebooks.
sbin-bin.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Index: Makefile
===================================================================
--- tpfand/Makefile (revision 89)
+++ tpfand/Makefile (working copy)
@@ -21,8 +21,8 @@
install -m 644 share/models/generic $(DESTDIR)/usr/share/tpfand/models
install -d $(DESTDIR)/etc/dbus-1/system.d/
install -m 644 etc/dbus-1/system.d/tpfand.conf $(DESTDIR)/etc/dbus-1/system.d/tpfand.conf
- install -d $(DESTDIR)/usr/sbin
- install -m 755 wrappers/tpfand $(DESTDIR)/usr/sbin/
+ install -d $(DESTDIR)/usr/bin
+ install -m 755 wrappers/tpfand $(DESTDIR)/usr/bin/
install -d $(DESTDIR)/etc/init.d
install -m 755 etc/init.d/* $(DESTDIR)/etc/init.d/
install -d $(DESTDIR)/etc/acpi/suspend.d
@@ -36,9 +36,9 @@
echo You still need to create links to the init script.
uninstall:
rm -rf $(DESTDIR)/usr/share/pyshared/tpfand
rm -rf $(DESTDIR)/usr/share/tpfand/
- rm -f $(DESTDIR)/usr/sbin/tpfand
+ rm -f $(DESTDIR)/usr/bin/tpfand
rm -f $(DESTDIR)/etc/init.d/tpfand
rm -f $(DESTDIR)/etc/dbus-1/system.d/tpfand.conf
rm -f $(DESTDIR)/etc/acpi/suspend.d/09-tpfand-stop.sh
tpfand.DAEMON
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#!/bin/bash
 
. /etc/rc.conf
. /etc/rc.d/functions
 
 
case "$1" in
start) stat_busy "Starting ThinkPad fan control daemon"
/usr/sbin/tpfand &>/dev/null
if [ $? -gt 0 ]; then
stat_fail
else
stat_done
fi
;;
stop) stat_busy "Stopping ThinkPad fan control daemon"
PID=`cat /run/tpfand.pid`
kill $PID &>/dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm -f /run/tpfand.pid
stat_done
fi
;;
restart) stat_busy "Restarting ThinkPad fan control daemon"
$0 stop
$0 start
;;
*) echo "Usage: /etc/rc.d/tpfand {start|stop|restart}"
exit 2
;;
esac
exit 0
tpfand.PMUTILS
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/bin/sh
 
# stop tpfand during suspend
case "$1" in
hibernate|suspend)
/etc/rc.d/tpfand stop
;;
thaw|resume)
/etc/rc.d/tpfand start
;;
*) exit $NA
;;
esac
tpfand.install
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
# This is a default template for a post-install scriptlet. You can
# remove any functions you don't need (and this header).
 
# arg 1: the new package version
pre_install() {
/bin/true
}
 
# arg 1: the new package version
post_install() {
# install default config if none exists
if [ ! -e /etc/tpfand.conf ] ; then
echo "Installing default configuration file /etc/tpfand.conf"
cp -f /usr/share/tpfand/tpfand.conf.default /etc/tpfand.conf
fi
echo "tpfand ready to being launched, e.g. in rc.conf"
}
 
# arg 1: the new package version
# arg 2: the old package version
pre_upgrade() {
/bin/true
}
 
# arg 1: the new package version
# arg 2: the old package version
post_upgrade() {
/bin/true
}
 
# arg 1: the old package version
pre_remove() {
/bin/true
}
 
# arg 1: the old package version
post_remove() {
/bin/true
}
 
op=$1
shift
$op $*
tpfand.service
1 2 3 4 5 6 7 8 9 10
[Unit]
Description=ThinkPad Fan Control
 
[Service]
Type=forking
PIDFile=/run/tpfand.pid
ExecStart=/usr/sbin/tpfand
 
[Install]
WantedBy=multi-user.target

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.