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

    # Update module dependencies
    depmod $(cat /usr/lib/modules/$_extramodules/version)
}

_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
}