summarylogtreecommitdiffstats
path: root/nvidia-beta-all.install
blob: 09ca191966fdadbb0e3293b86169a675b2d0017b (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
_depmod() {
    # This gets auto-updated during build
    _extramodules='extramodules-4.11-ARCH'

    # Update module dependencies for all kernels
    for _kernel in $(cat /usr/lib/modules/extramodules-*/version); do
        depmod $_kernel
    done
}

_rmmod() {
    # Try unloading
    if lsmod | grep -q nvidia; then
        rmmod nvidia
    fi

    # What?
    if [[ $? != 0 ]]; then
        # X running?
        if pidof Xorg >/dev/null; then
            echo ":: Please reboot or exit X first."
        fi
    fi
}

post_install() {
    _depmod

    # X running?
    if pidof Xorg >/dev/null; then
        echo ":: Please reboot or exit X to unload the current module."
    fi
}

post_upgrade() {
    _depmod

    # Not rebuilding?
    if (( $(vercmp $1 $2) != 0 )); then
        _rmmod
    fi
}

post_remove() {
    _depmod

    _rmmod
}