blob: 889256013f4a4f0702913349db4c03b590086676 (
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
58
59
60
|
## arg 1: the new package version
pre_install() {
:
}
## arg 1: the new package version
post_install() {
# We start and enable snapd.socket so it immediately is usable and the
# service is started on-demand on future boots. The timer is started so
# that snaps are automatically refreshed (updated) as new versions are
# published in the store.
systemctl enable snapd.refresh.timer
systemctl enable snapd.socket
systemctl start snapd.refresh.timer
systemctl start snapd.socket
}
## arg 1: the new package version
## arg 2: the old package version
pre_upgrade() {
:
}
## arg 1: the new package version
## arg 2: the old package version
post_upgrade() {
# After the new files are in place we let systemd restart the snapd
# service.
systemctl restart snapd
}
## arg 1: the old package version
pre_remove() {
# We stop the socket and disable it to remove the symlink that would start
# it at boot.
systemctl stop snapd.socket
systemctl disable snapd.socket
systemctl stop snapd.refresh.timer
systemctl disable snapd.refresh.timer
}
## arg 1: the old package version
post_remove() {
# We clean up all the snap mounts created by snappy
find /etc/systemd/system -name "snap-*.mount" -delete
find /etc/systemd/system -name "snap*.service" -delete
# As well as their symlinks from the multi-user target
find /etc/systemd/system/multi-user.target.wants -name "snap-*.mount" -delete
find /etc/systemd/system/multi-user.target.wants -name "snap*.service" -delete
# We unmount all currently mounted snaps
if [ -n "$(mount | grep snap | awk '{print $3}')" ]; then
umount $(mount | grep snap | awk '{print $3}')
fi
# We remove the /snap directory as well as state of snappy and its snap cache
rm -rf /snap
rm -rf /var/lib/snapd
}
|