summaryrefslogtreecommitdiffstats
path: root/abs/core/gnupg/install
blob: 95cb351edc4d7c69875a330c433fead1b453efd7 (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
_global_units() {
	_units=(dirmngr.socket gpg-agent.socket gpg-agent-{browser,extra,ssh}.socket)
	_dir=/etc/systemd/user/sockets.target.wants

	case $1 in
		enable)
			mkdir -p $_dir
			for _u in "${_units[@]}"; do
				ln -sf /usr/lib/systemd/user/$_u $_dir/$_u
			done
			;;
		disable)
			for _u in "${_units[@]}"; do
				rm -f $_dir/$_u
			done
			rmdir -p --ignore-fail-on-non-empty $_dir
			;;
	esac
}

post_install() {
	# See FS#42798 and FS#47371
	dirmngr </dev/null &>/dev/null

	# Let systemd supervise daemons by default
	_global_units enable
}

post_upgrade() {
	if (( $(vercmp $2 2.1.13-1) < 0 )); then
		echo "==> Please kill running gpg-agent and dirmngr processes before using this release."
	fi

	if (( $(vercmp $2 2.1.21-3) < 0 )); then
		_global_units enable
	fi
}

pre_remove() {
	_global_units disable
}