summarylogtreecommitdiffstats
path: root/gnunet.install
blob: feb95762e093e13615ec4b5df4b5c2ef269752cc (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
_gnunet_setuid() {
	getent group gnunetdns > /dev/null || groupadd -r gnunetdns
	getent passwd gnunet > /dev/null || useradd -r -U -l -d /var/lib/gnunet -s /bin/sh -c "GNUnet" gnunet
	local GNUNETDNS_GROUP="$(getent group gnunetdns | cut -d: -f3)"
	chown root:root /usr/lib/gnunet/libexec/gnunet-helper-vpn
	chmod u+s /usr/lib/gnunet/libexec/gnunet-helper-vpn
	# chown root:root /usr/lib/gnunet/libexec/gnunet-helper-transport-wlan
	# chmod u+s /usr/lib/gnunet/libexec/gnunet-helper-transport-wlan
	# chown root:root /usr/lib/gnunet/libexec/gnunet-helper-transport-bluetooth
	# chmod u+s /usr/lib/gnunet/libexec/gnunet-helper-transport-bluetooth
	chown root /usr/lib/gnunet/libexec/gnunet-helper-dns
	chgrp "${GNUNETDNS_GROUP}" /usr/lib/gnunet/libexec/gnunet-helper-dns
	chmod 4750 /usr/lib/gnunet/libexec/gnunet-helper-dns
	chgrp "${GNUNETDNS_GROUP}" /usr/lib/gnunet/libexec/gnunet-helper-dns
	chown gnunet:"${GNUNETDNS_GROUP}" /usr/lib/gnunet/libexec/gnunet-helper-dns
	chmod 2750 /usr/lib/gnunet/libexec/gnunet-helper-dns
	chown root:root /usr/lib/gnunet/libexec/gnunet-helper-exit
	chmod u+s /usr/lib/gnunet/libexec/gnunet-helper-exit
	chown root:root /usr/lib/gnunet/libexec/gnunet-helper-nat-server
	chown root:root /usr/lib/gnunet/libexec/gnunet-helper-nat-client
	chmod u+s /usr/lib/gnunet/libexec/gnunet-helper-nat-server
	chmod u+s /usr/lib/gnunet/libexec/gnunet-helper-nat-client
}

post_install() {
	echo '  -> Setting `setuid` permissions...'
	_gnunet_setuid
}

post_upgrade() {
	echo '  -> Updating `setuid` permissions...'
	_gnunet_setuid
}

post_remove() {
	getent passwd gnunet > /dev/null && userdel gnunet
	getent group gnunet > /dev/null && groupdel gnunet
	getent group gnunetdns > /dev/null && groupdel gnunetdns
}