summaryrefslogtreecommitdiffstats
path: root/cmodprobe
blob: 4ff786483bcdcd1988718a96ed62b9023a5f4fd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/zsh
exec &>>~/logs/cmod.log
export HHOME="/home/raghavendra"
modname=$1
mprobe="/sbin/modprobe"

typeset -A module_table
module_table=(
nvidia nvidia
ip_set ipset
xt_set ipset
setx   ipset
vbox   vboxdrv
)

prefix="$HHOME/Arch/Build/external"

$mprobe  "[email protected]"



if [[ $? != 0 ]];then
        echo "Kernel module [email protected] is not there"
        echo "Brewing  $modname module......."
        export PATH="/usr/bin/vendor_perl:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib/perl5/vendor_perl/bin:/usr/bin/core_perl:/opt/plan9/bin"
        # Optional
        #unset CFLAGS CXXFLAGS LDFLAGS
        #export EXTRA_LDFLAGS=" -s "
        pushd $prefix || exit 1
        for key in ${(k)module_table};do
            if [[ $modname == *$key* ]];then 
                file=$module_table[$key]
                if [[ -n $file ]];then
                    ./$file
                    /sbin/depmod
                    $mprobe $file
                else
                    exit 1
                fi
            fi
        done
fi