summarylogtreecommitdiffstats
path: root/asix-dkms.install
blob: 3fc8e37a3765bee3562888f70dbd6a2279e5b59d (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
43
44
45
46
47
48
49
50
post_install (){
    DKMS=$(which dkms)

    $DKMS add -m asix -v v4.17.2
    $DKMS build -m asix -v v4.17.2
    $DKMS install -m asix -v v4.17.2
    
    echo " >> "
    echo " >> rmmod asix"
    rmmod asix
    echo " >> depmod -a"
    depmod -a
    echo " >> modprobe asix"
    modprobe asix
    echo " >> done "
    
}

pre_upgrade(){
    pre_remove
}

post_upgrade(){
    post_install
}

pre_remove (){
    _inmemory=$(/usr/bin/lsmod | /usr/bin/grep asix)
    if [ ! -z "$_inmemory" ]; then
        /usr/bin/rmmod asix &> /dev/null
    fi

    DKMS=$(which dkms)

    _line=$($DKMS status -m asix)
    if echo "$_line" | grep -E 'added|built|installed'; then
        version=$(echo "$_line" | sed 's/asix,\([^,]*\)[,:].*/\1/;t;d')
        $DKMS remove -m asix -v $version --all
    fi
    
}

post_remove () {
    /sbin/depmod -a
    modprobe asix
}

op=$1
shift
$op $*