2
# postinst script for buildd
4
# see: dh_installdeb(1)
8
# summary of how this script can be called:
9
# * <postinst> `configure' <most-recently-configured-version>
10
# * <old-postinst> `abort-upgrade' <new version>
11
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
13
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
14
# <failed-install-package> <version> `removing'
15
# <conflicting-package> <version>
16
# for details, see /usr/share/doc/packaging-manual/
18
# quoting from the policy:
19
# Any necessary prompting should almost always be confined to the
20
# post-installation script, and should be protected with a conditional
21
# so that unnecessary prompting doesn't happen if a package's
22
# installation fails and the `postinst' is called with `abort-upgrade',
23
# `abort-remove' or `abort-deconfigure'.
25
# Move a conffile without triggering a dpkg question
30
if [ -e "$OLDCONFFILE" ]; then
31
echo "Preserving user changes to $NEWCONFFILE ..."
32
mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
33
mv -f "$OLDCONFFILE" "$NEWCONFFILE"
40
if dpkg --compare-versions "$2" le "0.58.3-1"; then
41
mv_conffile "/etc/buildd.conf" "/etc/buildd/buildd.conf"
44
if ! getent passwd buildd > /dev/null; then
45
adduser --system --quiet --home /var/lib/buildd --no-create-home \
46
--shell /bin/bash --group --gecos "Debian build daemon" buildd
49
# check validity of buildd user and group
50
if [ "$(id -u buildd)" -eq 0 ]; then
51
echo "The buildd system user must not have uid 0 (root).
52
Please fix this and reinstall this package." >&2
55
if [ "$(id -g buildd)" -eq 0 ]; then
56
echo "The buildd system user must not have root as primary group.
57
Please fix this and reinstall this package." >&2
61
# Home directory ownership
62
chown buildd:buildd /var/lib/buildd
63
chown buildd:buildd /var/lib/buildd/.forward
64
chown buildd:buildd /var/lib/buildd/.ssh
65
chown buildd:buildd /var/lib/buildd/build
66
chown buildd:buildd /var/lib/buildd/logs
67
chown buildd:buildd /var/lib/buildd/mqueue
68
chown buildd:buildd /var/lib/buildd/old-logs
69
chown buildd:buildd /var/lib/buildd/stats
70
chown buildd:buildd /var/lib/buildd/stats/graphs
71
chown buildd:buildd /var/lib/buildd/upload
72
chown buildd:buildd /var/lib/buildd/upload-security
74
# Home directory permissions
75
chmod 2770 /var/lib/buildd
76
chmod 2640 /var/lib/buildd/.forward
77
chmod 2700 /var/lib/buildd/.ssh
78
chmod 2770 /var/lib/buildd/build
79
chmod 2770 /var/lib/buildd/logs
80
chmod 2770 /var/lib/buildd/mqueue
81
chmod 2770 /var/lib/buildd/old-logs
82
chmod 2770 /var/lib/buildd/stats
83
chmod 2770 /var/lib/buildd/stats/graphs
84
chmod 2770 /var/lib/buildd/upload
85
chmod 2770 /var/lib/buildd/upload-security
89
abort-upgrade|abort-remove|abort-deconfigure)
95
echo "postinst called with unknown argument \`$1'" >&2
101
# dh_installdeb will replace this with shell code automatically
102
# generated by other debhelper scripts.