summarylogtreecommitdiffstats
path: root/snapd.install
blob: 328fa93b47dba9bace35d20bc430180cb737c627 (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
_set_snap_confine_caps() {
  /usr/bin/setcap -q - /usr/lib/snapd/snap-confine < /usr/lib/snapd/snap-confine.caps
}

post_install() {
  _set_snap_confine_caps
}

pre_remove() {
  /usr/lib/snapd/snap-mgmt --purge || :
}

post_upgrade() {
  # since 2.39+ void permission bits are 111 instead of 000
  chmod 111 /var/lib/snapd/void || true
  # since 2.62, snapd generates cgroup device files under /var/lib/snapd/cgroup/
  # which are needed in order to start any snaps, suggest to restart snapd if
  # we're upgrading from a version older than 2.62
  if (( $(vercmp "$2" '2.62-1') < 0)); then
    echo
    echo ">>> The snapd.service requires a restart for snaps to continue working. "
    echo ">>> Run the following command after the update:"
    echo ">>>    systemctl restart snapd.service"
    echo
  fi

  _set_snap_confine_caps

  if (( $(vercmp "$2" '2.70-1') < 0)); then
    if aa-status --enabled > /dev/null 2>&1; then
      echo
      echo ">>> The AppArmor profiles of snapd-confine needs to be reloaded."
      echo ">>> Run the following command after the update:"
      echo ">>>    systemctl restart apparmor.service"
      echo
    fi
  fi
}

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