Skip to content

Commit

Permalink
dkms and arch PKGBUILD inital try
Browse files Browse the repository at this point in the history
  • Loading branch information
daringer committed Aug 22, 2015
1 parent b75a683 commit 52a731d
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Makefile.dkms
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
modname := asus_fan
DKMS := dkms
modver := $(shell awk -F'"' '/define *ASUS_FAN_VERSION/{print $$2}' < asus-fan.c)

# directory in which generated files are stored
DKMS_DEST := /usr/src/$(modname)-$(modver)

all: install

src_install:
mkdir -p '$(DKMS_DEST)'
cp Makefile asus-fan.c '$(DKMS_DEST)'
sed 's/#MODULE_VERSION#/$(modver)/' dkms/dkms.conf > '$(DKMS_DEST)/dkms.conf'

build: src_install
$(DKMS) build -m asus-fan -v $(modver)

install: build
$(DKMS) install -m asus-fan -v $(modver)

uninstall:
$(DKMS) remove -m asus-fan -v $(modver) --all

.PHONY: all src_install build install uninstall
2 changes: 2 additions & 0 deletions asus_fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ MODULE_LICENSE("GPL");
(container_of((pdrv), struct asus_fan_driver, platform_driver))

#define DRIVER_NAME "asus_fan"
#define ASUS_FAN_VERSION "0.4"

#define TEMP1_CRIT 105
#define TEMP1_LABEL "gfx_temp"

Expand Down
7 changes: 7 additions & 0 deletions dkms/dkms.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PACKAGE_NAME="asus-fan"
PACKAGE_VERSION="#MODULE_VERSION#"
MAKE[0]="make KVERSION=$kernelver"
CLEAN="make clean"
BUILT_MODULE_NAME[0]="asus_fan"
DEST_MODULE_LOCATION[0]="/kernel/drivers/acpi"
AUTOINSTALL="yes"
28 changes: 28 additions & 0 deletions misc/buildscripts/archlinux/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Maintainer: Markus Meissner <coder@safemailbox.de>

pkgname=asus-fan-dkms
pkgver=0.9
pkgrel=1
_realname=asus-fan
pkgdesc="Kernel module allowing to controll (both) fan inside various asus laptops"
arch=('i686' 'x86_64')
url=("http://github.com/daringer/asus-fan")
license=('GPL')
depends=('dkms')
install=asus-fan-dkms.install
source=("https://github.com/daringer/asus-fan/archive/v${pkgver}.tar.gz")

build() {
cd ${srcdir}/${_realname}-${pkgver}

_kernver="$(uname -r)"

make KDIR=/lib/modules/${_kernver}/build
}

package() {
cd ${srcdir}/${_realname}-${pkgver}

make install
gzip "${pkgdir}/usr/lib/modules/${_extramodules}/bbswitch.ko"
}
15 changes: 15 additions & 0 deletions misc/buildscripts/archlinux/asus-fan-dkms.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
post_install() {
dkms install -m asus-fan -v ${1%%-*}
}
pre_upgrade() {
local curver=${2%%-*}
# $2 is unset due to a bug. Query current version using pacman as fallback
[ -n "$curver" ] || curver=$(pacman -Qi asus-fan-dkms | awk '/^Version/{print $3}')
pre_remove $curver
}
post_upgrade() {
post_install ${1%%-*}
}
pre_remove() {
dkms remove -m asus-fan -v ${1%%-*} --all
}

0 comments on commit 52a731d

Please sign in to comment.