updated on Sun Jan 22 16:00:49 UTC 2012
[aur-mirror.git] / cm2020 / install
blobff6a5ca130621b0749d52b04d472f66b3f10f482
1 #!/bin/bash
3 # Install Script for the OMNIKEY Cardman USB Smartcard reader series.
6 rel=`uname -r`
7 min=`uname -r | cut -f2 -d.`
9 moddir=${pkgdir}/lib/modules
10 driver_file=""
12 echo
13 echo Installing OMNIKEY Cardman USB Smartcard reader...
14 echo
16 # setup logfile
18 logfile=install.log
19 if [ -f $logfile ]; then
20 rm -f $logfile
21 touch logfile
24 # check if running as root
26 #if [ `id -u` -ne 0 ]; then
27 # echo You have to run the driver installation as root.
28 # exit
29 #fi
32 # detect pcsc-driver dir
34 pcsc_driverdir=${pkgdir}/usr/lib/pcsc/drivers/
37 # copy the pcsc-shared library to its proper place
39 echo $pcsc_driverdir
40 mkdir -p $pcsc_driverdir &> /dev/null
41 cp -r ifd-cm2020.bundle $pcsc_driverdir
45 # check if module for this Kernel version exists
48 cd ./src/cm2020
49 if [ $min -le 4 ]; then
50 kext=o
51 cp ./makefile.24 ./makefile
52 else
53 kext=ko
54 cp ./makefile.26 ./Makefile
56 if [ ! -f ../../modules/cardman.$rel.$kext ]; then
57 echo "The kernel module for $rel isn't prebuilt!"
58 echo "Try to compile it for you!"
59 make clean 2> /dev/null
60 make 2> /dev/null
61 if [ ! -f ./cardman.$kext ]; then
62 echo "Couldn't build kernel module."
63 echo "Compile it by yourself or"
64 echo "contact OMNIKEY for further details."
65 echo "(e-mail: support.linux@omnikey.com)"
66 exit 1
67 else
68 mv ./cardman.$kext ../../modules/cardman.$rel.$kext
69 /sbin/depmod -ae
72 cd ../../
75 # copy cardman kernel module
78 if [ $min == 2 ]; then
79 mod_min=misc
80 elif [ $min == 4 ]; then
81 mod_min=kernel/drivers/usb
82 elif [ $min -ge 5 ]; then
83 mod_min=kernel/drivers/usb/misc
85 if [ ! -d $moddir/$rel/$mod_min ]; then
86 mkdir $moddir/$rel/$mod_min 2> /dev/null
89 driver_file="$moddir/$rel/$mod_min/cardman.$kext"
90 echo Copy cardman.$kext to $moddir/$rel/$mod_min
91 mkdir -p `dirname $driver_file`
92 cp ./modules/cardman.$rel.$kext $driver_file
93 chmod 644 $driver_file
94 if [ $? == 1 ]; then
95 echo Could not copy cardman-module, exiting
96 exit 0
99 mkdir -p ${pkgdir}/etc/udev/rules.d/
100 cp 10-cardmanusb.rules ${pkgdir}/etc/udev/rules.d/10-cardmanusb.rules
103 # Finally, load the kernel module
105 #echo Attempting to start the cardman kernel module
106 #/sbin/rmmod cardman 2>/dev/null
108 #/sbin/insmod $driver_file 2>/dev/null
110 #echo
111 echo Installation finished