aboutsummarylogtreecommitdiffstats
path: root/mpss-modules-dkms.install
blob: cc497e3990a7ca49815e60ea5f525e6cba55297c (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
_my_pkgname=mpss-modules-dkms
_my_kmod=${_my_pkgname%-*}

# version (without -$pkgrel): ${1%%-*}

# arg 1:  the new package version
post_install() {
  local newver=${1%%-*}
  dkms add --force -m $_my_kmod -v $newver
  cat << EOF
==> To build and install your modules run: dkms install -m $_my_kmod -v $newver
==> To do this automatically at startup run: systemctl enable dkms.service
==> To do this automatically while building a new kernel add 'dkms' hook to
    the HOOKS variable in /etc/mkinitcpio.conf
EOF
}

# arg 1:  the old package version
pre_remove() {
  local oldver=${1%%-*}
  # Remove modules using dkms
  [ -n "$oldver" ] && dkms remove -m $_my_kmod -v $oldver --all &>/dev/null || true
}

# arg 1:  the new package version
# arg 2:  the old package version
pre_upgrade() {
  local curver=${2%%-*}
  # $2 might be unset due to a bug. See, https://bugs.archlinux.org/task/32278
  # Query current version using pacman as fallback
  [ -n "$curver" ] || curver=$(pacman -Q $_my_pkgname | cut -d' ' -f2)
  pre_remove "$curver"
}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade() {
  post_install "$1"
}

# vim:set ts=2 sw=2 ft=sh et: