summarylogtreecommitdiffstats
path: root/trueport-install.sh
blob: 38a5b4805171ebd3737ad1b540be67aecee94802 (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
post_upgrade() {
  set -u
  systemctl daemon-reload
  # Handle the module update if DKMS doesn't
  if [ ! -d /usr/src/trueport-*/ ]; then
    depmod -a
    if systemctl -q is-enabled 'trueport.service'; then
      systemctl start 'trueport.service'
    fi
  fi
  #echo 'Perle TruePort (ptyx) startup scripts updated or installed'
  set +u
}

post_install() {
  set -u
  local _tp_configps
  local _tp_config
  for _tp_configps in /etc/trueport/*.pacsave; do
    _tp_config="${_tp_configps%\.pacsave}"
    if [ ! -s "${_tp_config}" ]; then
      mv "${_tp_configps}" "${_tp_config}"
    fi
  done
  set +u
  post_upgrade
}

pre_upgrade() {
  set -u
  if [ ! -d /usr/src/trueport-*/ ]; then
    systemctl stop 'trueport.service' # also rmmod the module
    killall 'trueportd' # the service doesn't stop trueportd started manually
  fi
  set +u
}

pre_remove() {
  pre_upgrade
}

post_remove() {
  set -u
  systemctl daemon-reload
  #echo 'Perle TruePort (ptyx) startup scripts removed'
  set +u
}