/
postinst
executable file
·47 lines (41 loc) · 1.66 KB
/
postinst
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
#!/bin/sh -e
if [ "$1" = configure ]; then
# Make sure the administrative user exists
if ! getent passwd dcache > /dev/null; then
adduser --system --quiet --home /var/lib/dcache --no-create-home \
--shell /bin/bash --group --gecos "dCache administrator" dcache
adduser --quiet dcache ssl-cert
fi
# check validity of dcache user and group
if [ "`id -u dcache`" -eq 0 ]; then
echo "The dcache system user must not have uid 0 (root).
Please fix this and reinstall this package." >&2
exit 1
fi
if [ "`id -g dcache`" -eq 0 ]; then
echo "The dcache system user must not have root as primary group.
Please fix this and reinstall this package." >&2
exit 1
fi
# ensure directory ownership
chown dcache:dcache /var/lib/dcache
chown dcache:dcache /var/lib/dcache/alarms
chown dcache:dcache /var/lib/dcache/config
chown dcache:dcache /var/lib/dcache/billing
chown dcache:dcache /var/lib/dcache/httpd
chown dcache:dcache /var/lib/dcache/plots
chown dcache:dcache /var/lib/dcache/statistics
chown dcache:dcache /var/lib/dcache/credentials
chown dcache:dcache /var/lib/dcache/star
chown dcache:dcache /var/log/dcache
chown dcache:dcache /var/spool/dcache/star
# delegated proxies should not be accessible to anybody else
chmod 700 /var/lib/dcache/credentials
# generate admin door ssh2 server key
if [ ! -f /etc/dcache/admin/ssh_host_dsa_key ]; then
ssh-keygen -q -t dsa -f /etc/dcache/admin/ssh_host_dsa_key -N ""
chmod 640 /etc/dcache/admin/ssh_host_dsa_key
chgrp dcache /etc/dcache/admin/ssh_host_dsa_key
fi
fi
#DEBHELPER#