From 3ca705e54de65bc4c8cb852b71a73b0c156a6a5d Mon Sep 17 00:00:00 2001
From: Cecil <knoppmyth@gmail.com>
Date: Sun, 22 Apr 2012 03:04:39 -0700
Subject: sapphire:Kernel module version 3.2 for sapphire remote. Initial
 inclusion.

---
 abs/extra/sapphire/PKGBUILD         | 35 +++++++++++++++++++++++++++++++++++
 abs/extra/sapphire/sapphire.install | 26 ++++++++++++++++++++++++++
 abs/extra/sapphire/sapphire.patch   | 24 ++++++++++++++++++++++++
 3 files changed, 85 insertions(+)
 create mode 100644 abs/extra/sapphire/PKGBUILD
 create mode 100644 abs/extra/sapphire/sapphire.install
 create mode 100644 abs/extra/sapphire/sapphire.patch

diff --git a/abs/extra/sapphire/PKGBUILD b/abs/extra/sapphire/PKGBUILD
new file mode 100644
index 0000000..7877f8f
--- /dev/null
+++ b/abs/extra/sapphire/PKGBUILD
@@ -0,0 +1,35 @@
+# Maintainer: Cecil Watson<knoppmyth@gmail.com>
+
+pkgname=sapphire
+_kernver=`uname -r`
+pkgver=3.2
+pkgrel=2
+pkgdesc="Kernel module for Sapphire remote"
+arch=('i686' 'x86_64')
+url="http://rtr.ca/sapphire_remote"
+license=('GPL2')
+depends=('kernel26')
+makedepends=('kernel26-headers')
+options=(!makeflags)
+install=sapphire.install
+source=(http://rtr.ca/sapphire_remote/${pkgname}-${pkgver}.tar.gz sapphire.patch)
+
+build() {
+  cd "${srcdir}/${pkgname}-${pkgver}"
+  patch -p1 < ../sapphire.patch
+}
+
+package() {
+  mkdir -p ${pkgdir}/etc/modprobe.d
+  mkdir -p ${pkgdir}/usr/bin
+  mkdir -p ${pkgdir}/usr/share/doc/sapphire
+  cd "${srcdir}/${pkgname}-${pkgver}"
+  make INSTALL_MOD_PATH=${pkgdir} DESTDIR="${pkgdir}" install
+  install -m 755 sapphire_keymap.sh ${pkgdir}/usr/bin
+  install -m 644 README.txt ${pkgdir}/usr/share/doc/sapphire
+  install -m 644 keymap.default ${pkgdir}/usr/share/doc/sapphire
+  install -m 644 sapphire.c ${pkgdir}/usr/share/doc/sapphire
+  rm -fr ${pkgdir}/lib/modules/$_kernver/modules*
+}
+md5sums=('7379b9dd3283871234cbfb0f61516eae'
+         'db733f5dd3697895062027d7a58a6657')
diff --git a/abs/extra/sapphire/sapphire.install b/abs/extra/sapphire/sapphire.install
new file mode 100644
index 0000000..18150eb
--- /dev/null
+++ b/abs/extra/sapphire/sapphire.install
@@ -0,0 +1,26 @@
+post_install() {
+    echo ">>> Removing duplicate compressed kernel modules..."
+    for file in `find /lib/modules -name "*.ko"`; do if [[ -e $file.gz ]]; then rm "$file.gz"; fi; done
+    echo ">>> Running depmod..."
+    depmod
+    rmmod hid_topseed
+    modprobe sapphire
+    echo "If you wish to make changes to key mapping, read the docs in /usr/share/doc/sapphire."
+    echo "sapphire_keymap.sh is already installed in /usr/bin"
+}
+
+post_upgrade() {
+    echo ">>> Removing duplicate compressed kernel modules..."
+    for file in `find /lib/modules -name "*.ko"`; do if [[ -e $file.gz ]]; then rm "$file.gz"; fi; done
+    echo ">>> Running depmod..."
+    depmod
+    rmmod sapphire
+    modprobe sapphire
+    echo "If you wish to make changes to key mapping, read the docs in /usr/share/doc/sapphire."
+    echo "sapphire_keymap.sh is already installed in /usr/bin"
+}
+
+post_remove() {
+    depmod
+    rmmod sapphire
+}
diff --git a/abs/extra/sapphire/sapphire.patch b/abs/extra/sapphire/sapphire.patch
new file mode 100644
index 0000000..ddd0653
--- /dev/null
+++ b/abs/extra/sapphire/sapphire.patch
@@ -0,0 +1,24 @@
+diff -ruaN sapphire-3.2.orig//Makefile sapphire-3.2/Makefile
+--- sapphire-3.2.orig//Makefile	2012-04-12 18:00:50.000000000 +0000
++++ sapphire-3.2/Makefile	2012-04-22 08:42:19.000000000 +0000
+@@ -4,7 +4,7 @@
+ #
+ MODNAME=sapphire
+ CONFLICTS=hid_topseed
+-BLACKLIST=/etc/modprobe.d/blacklist-$(CONFLICTS).conf
++BLACKLIST=$(DESTDIR)/etc/modprobe.d/blacklist-$(CONFLICTS).conf
+ 
+ ## MODPARMS is not used any more, but we have to nuke old copies to prevent issues:
+ MODPARMS=/etc/modprobe.d/$(MODNAME).conf
+@@ -49,8 +49,8 @@
+ 	depmod
+ 
+ install: $(MODNAME).ko clean_modparms modloader $(BLACKLIST)
+-	cp sapphire_keymap.sh /usr/local/bin/
+-	chmod a+rx /usr/local/bin/sapphire_keymap.sh
+-	sync
++#	cp sapphire_keymap.sh /usr/local/bin/
++#	chmod a+rx /usr/local/bin/sapphire_keymap.sh
++#	sync
+ 
+ all: install
-- 
cgit v0.12