summarylogtreecommitdiffstats
path: root/teamviewer.install
blob: 3252bbff328f9691df15a3f2b314c0c26b893aeb (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
49
50
51
52
53
54
55
56
57
_opt_AutoStart=0

post_install() {
  #systemctl daemon-reload
  if [ "${_opt_AutoStart}" -eq 0 ]; then
    if ! systemctl -q is-active 'teamviewerd.service'; then
      echo "The Teamviewer daemon must be running for Teamviewer to work."
      echo "Execute 'sudo systemctl enable --now teamviewerd' in a terminal."
    fi
  else
    systemctl enable --now 'teamviewerd.service'
  fi
}

post_upgrade() {
  post_install
}

pre_remove() {
  if [ "${_opt_AutoStart}" -ne 0 ]; then
    systemctl disable --now 'teamviewerd.service'
  fi
  rm -f '/etc/teamviewer/global.conf' # line to be removed
}

pre_upgrade() {
  pre_remove
}

post_remove() {
  rm -rf /opt/teamviewer
  rm -rf "/var/log/teamviewer${1%%.*}/"
  set -u
  shopt -s nullglob
  local _homedirs
  readarray -t _homedirs < <(getent passwd | awk -F':' '{if ($3>=1000 && length($6)>1) {print $6;}}')
  local _teamdirs=()
  local _d
  for _d in "${_homedirs[@]}"; do
    _teamdirs+=("${_d}"/.local/share/teamviewer*/)
    _teamdirs+=("${_d}"/.cache/TeamViewer/)
  done
  if [ "${#_teamdirs[@]}" -ne 0 ]; then
    echo 'Teamviewer may be cleanly removed by removing the following user folders'
    printf '  %s\n' "${_teamdirs[@]}"
  fi
  if [ -s '/etc/machine-id' ]; then
    echo 'Additional Teamviewer problems may be solved by removing the following non TeamViewer file and reboot to regenerate.'
    echo '  /etc/machine-id'
  fi
  shopt -u nullglob
  #systemctl daemon-reload
  set +u
}
#post_remove "14.0"

# vim: ts=2 sw=2 et: