summarylogtreecommitdiffstats
path: root/comtrol-rocketport-express-infinity-install.sh
blob: 487ce6398730785e1e91b7e31495a28438a6d873 (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
_pkgname='comtrol-rocketport-express-infinity'
_modulename='rocketrp2'
_origmodname='rp2'

post_upgrade() {
  set -u
  systemctl daemon-reload
  if [ ! -d "/usr/src/${_pkgname}"-*/ ]; then
    depmod -a
    if ! lsmod | cut -d' ' -f1 | grep -q "^${_modulename}"'$'; then
      #echo 'Reboot or load now with:'
      #echo "  sudo modprobe '${_modulename}'"
      if [ "${_modulename}" != "${_origmodname}" ]; then
        rmmod "${_origmodname}" 2> /dev/null # blacklisted on boot
      fi
      modprobe "${_modulename}"
    fi
  fi
  set +u
}

post_install() {
  set -u
  post_upgrade
  set +u
}

pre_remove() {
  set -u
  if [ ! -d "/usr/src/${_pkgname}"-*/ ]; then
    rmmod "${_modulename}"
  fi
  set +u
}

post_remove() {
  systemctl daemon-reload
}