# Author: Stunts <f.pinamartins@gmail.com>
# Contibutor: ianux <ianux@free.fr>
pkgname=r592-driver
pkgver=20110105
pkgrel=1
pkgdesc="A driver for the Ricoh r592 Memory Stick reader"
arch=(i686 x86_64)
license=('GPLv2')
depends=('kernel26')
makedepends=('git')
url="http://gitorious.org/ricoh-kernel/ricoh-kernel/trees/master"
source=()
install=${pkgname}.install
_gitroot=git://gitorious.org/ricoh-kernel/memstick/ricoh-kernel.git
_gitname=ricoh-kernel
build() {
cd ${srcdir}
msg "Connecting to gitorious.org GIT server..."
if [ -d ${_gitname} ] ; then
pushd ${_gitname} && git pull origin && popd
msg "The local files are updated."
else
git clone ${_gitroot}
fi
msg "GIT checkout done or server timeout"
msg "Starting make..."
[ -d ${_gitname}-build ] && rm -rf ${_gitname}-build
cp -r ${_gitname} ${_gitname}-build
cd ${_gitname}-build/memstick
make
}
package() {
install -d ${pkgdir}/lib/modules/$(uname -r)/updates
install -m644 ${srcdir}/${_gitname}-build/memstick/core/{memstick.ko,mspro_block.ko} ${pkgdir}/lib/modules/$(uname -r)/updates/
install -Dm644 ${srcdir}/${_gitname}-build/memstick/core/ms_block.ko ${pkgdir}/lib/modules/$(uname -r)/kernel/drivers/memstick/core/ms_block.ko
install -Dm644 ${srcdir}/${_gitname}-build/memstick/host/r592.ko ${pkgdir}/lib/modules/$(uname -r)/kernel/drivers/memstick/host/r592.ko
install -Dm644 ${srcdir}/${_gitname}-build/user/95-udisks-cardreader.rules ${pkgdir}/etc/udev/rules.d/95-udisks-ms.rules
}