Merge commit 'cc09f10e84d5' into kernel
[kernel/swap-modules.git] / driver / insmod.sh
1 #!/bin/sh
2
3 module=$1
4
5 DEBUG_OFF=1
6
7 debug(){
8     if [ $DEBUG_OFF -eq 0 ];then
9        echo $1
10     fi
11 }
12
13 debug ">insmod with patch"
14
15 par1=`echo $@ | awk '{print $1}'`
16 add_params=${@#*$par1}
17
18 if [ -f ${module} ];then
19     tmp_ver=`mktemp`
20     tmp_mod=`mktemp`
21
22     version=`uname -r`
23
24     echo "$version" > $tmp_ver
25     debug "<`cat $tmp_ver`>"
26     debug "./bin/patchko.sh -p <$module> <$tmp_mod> <$tmp_ver>"
27     ./bin/patchko.sh -p $module $tmp_mod $tmp_ver
28     chmod 644 $tmp_mod
29     debug "insmod $tmp_mod $add_params"
30     insmod $tmp_mod $add_params
31     rm $tmp_mod
32     rm $tmp_ver
33 fi