summarylogtreecommitdiffstats
path: root/astrill.install
blob: ceb4de6d868eddd32e3809952f6eb92ec2e9c4c6 (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
astrill_path=/opt/astrill

pre_install() {
  killall -q astrill | true
}

post_install() {
  "${astrill_path}/asproxy" --init
  setcap cap_net_admin,cap_net_raw+ep "${astrill_path}/astrill"

  # Enable reconnecting after hibernate/sleep
  if which systemctl >/dev/null 2>&1; then
  	systemctl enable astrill-reconnect.service
  fi

  # Check if theme engine is installed
  if ! "${astrill_path}/astrill" /gtk2checkengine; then
  	echo 'WARNING: Your system is missing pixbuf theme engine. Please install package gtk2-engines-pixbuf or gtk2-engines'
  fi

  # Reload menus
  if [ -x '`which update-menus 2>/dev/null`' ]; then
    update-menus
  fi

  # Reload icon cache
  if which update-icon-caches >/dev/null 2>&1 ; then
    update-icon-caches /usr/share/icons/hicolor
  fi

  echo 'Please restart your web browser for all changes to take effect'
}

pre_upgrade() {
  pre_install
}

post_upgrade() {
  post_install
}

pre_remove() {
  "${astrill_path}/asproxy" --uninit
  "${astrill_path}/astrill" /uninstall

  if which systemctl >/dev/null 2>&1; then
    systemctl disable astrill-reconnect.service
  fi
}