source: trunk/rules/extract_kmodpkg.sh @ 290

Last change on this file since 290 was 290, checked in by amain, 8 years ago

Fix bug #102.

  • extract_kmodpk.sh: only detect if .ko files are already installed
  • Config.in: remove b43 firmware selection ( can still be selected with make openwrt/menuconfig )
  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/bin/bash
2#
3
4if [ "$3" == "" ]; then
5        echo "usage: `basename $0` source-kmod-package.ipk  extract-directory tmp-directory"
6        echo
7        exit 0
8fi
9
10kmodp=$1
11droot=$2
12tmpdir=$3
13
14if [ ! -d "$droot" ]; then $droot is not a directory; exit 1; fi
15if [ ! -d "$tmpdir" ]; then $tmpdir is not a directory; exit 1; fi
16
17[ ! -e $kmodp ] && exit 1
18[ ! -e $kmodp ] && echo "${kmodp} not found" && exit 1
19
20tardir=$tmpdir/.extractkmodpkg.$$
21mkdir -p $tardir
22
23n=`basename $kmodp`
24nn=${n/.ipk/}
25
26# Extra from data.tar.gz only /lib
27tar xzf $kmodp -C $tardir ./data.tar.gz
28tar xzf $tardir/data.tar.gz -C $tardir ./lib
29
30echo "I: Copy kernel modules(s) from $nn..."
31findc=0
32first=1
33for kmod in `find $tardir -type f ! -name "data.tar.gz"`; do
34   kmodf=`basename $kmod`
35
36   # Only copy kernel module files if they do not already exist!
37   if [ ".ko" = "${kmodf/*.ko/.ko}" ]; then
38      findc=$(find $droot -type f -name $kmodf | wc -l) 
39   else
40      findc=0
41   fi
42
43   if [ "$findc" -eq 0 ]; then
44          tokmod=${kmod/$tardir/}
45      todir=`dirname $droot/$tokmod`
46          mkdir -p $todir
47      cp -a $kmod $droot/$tokmod
48      echo "I:    - $kmodf (yes)"
49   else
50      echo "I:    - $kmodf (no)"
51   fi
52done
53
54rm -rf $tardir
55
56exit 0
57
Note: See TracBrowser for help on using the repository browser.