summarylogtreecommitdiffstats
path: root/cado-git.install
blob: 5f0c5e8485dd2f5e1ccb92747b182a8cebca2619 (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
bindir="/bin";
libdir="/lib";
DESTDIR="/usr";
SPOOL_DIR="/var/spool/cado";

post_install() {
	# Create user and groups if they don't exist
	if ! getent group _cado > /dev/null 2>&1 ; then
		groupadd --system _cado
	fi
	if ! getent passwd _cado > /dev/null 2>&1 ; then
		useradd --system \
			--home /nonexistent \
			--no-create-home \
			--shell /bin/false \
			-g _cado _cado
	fi

	mkdir -p /var/spool/cado
	chown root:_cado /var/spool/cado
	chmod 4770 /var/spool/cado
	chown :_cado ${bindir}/scado
	chmod g+s ${bindir}/scado
	chown _cado: ${bindir}/cado
	chmod u+s ${bindir}/cado

	# Copy default pam authentication for cado
	cp /etc/pam.d/system-auth /etc/pam.d/cado

	ldconfig ${DESTDIR}${libdir}
	# configure the minimal set of capabilities for cado itself to run
	${bindir}/cado --setcap >/dev/null 2>&1
}

pre_remove() {
	userdel cado || true
	rm -rf ${SPOOL_DIR}
	unlink /etc/pam.d/cado
}