summarylogtreecommitdiffstats
path: root/dkms-frandom.install
blob: 18ba932f418cff41fe29e05e895cce2f5a5e2d9f (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
post_install (){
    DKMS=$(which dkms)

    $DKMS add -m frandom -v 1.1
    $DKMS build -m frandom -v 1.1
    $DKMS install -m frandom -v 1.1
    /usr/bin/depmod -a
}

pre_upgrade(){
    pre_remove
}

post_upgrade(){
    post_install
}

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

    DKMS=$(which dkms)

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

post_remove () {
    /usr/bin/depmod -a
}

op=$1
shift
$op $*