~ubuntu-branches/ubuntu/karmic/sbuild/karmic-proposed

« back to all changes in this revision

Viewing changes to debian/buildd.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Roger Leigh, Roger Leigh
  • Date: 2009-05-17 15:52:53 UTC
  • mfrom: (8.1.7 upstream) (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090517155253-fbxadfsyaf940ete
Tags: 0.58.3-1
[ Roger Leigh ]
* New release.
* debian/control:
  - Update to Standards Version 3.8.1.
  - Add buildd package.
  - Add libsbuild-perl package.
  - All packages depend upon libsbuild-perl.
* Add support for appending a tag to version numbers (Closes: #475777).
  Thanks to Timothy G Abbott for this patch.
* When using the --help or --version options, don't abort if not
  in the sbuild group (Closes: #523670).  Group membership is now
  only performed after options parsing, and only if required.
* Allow config files to use $HOME (Closes: #524564).  Thanks to
  James Vega for this patch.
* Restore buildd package.
* Split common library functions into new libsbuild-perl package.
* debian/sbuild.(preinst|postinst|postrm):
  - Remove special cases for versions older than oldstable.  Update
    addition and removal of sbuild group to use return value of getent
    rather than parsing getent output.
  - Use addgroup/delgroup in place of adduser/deluser.
  - Use --system when adding and deleting group, to ensure creation
    of a system group.  Migrate existing non-system group and group
    members if the system group is not present.
  - Handle removal of 50sbuild setup script.
* debian/buildd.(preinst|postinst|postrm): Add maintainer scripts for
  buildd package.  Move configuration file from /etc/buildd.conf to
  /etc/buildd/buildd.conf if present.  Also create buildd user and
  group for running the buildd daemon.
* Sbuild::Conf: Don't default MAINTAINER_NAME to $DEBEMAIL if unset
  in the configuration file (Closes: #520158).
* /etc/schroot/setup.d/50sbuild: Remove.  The setup tasks performed by
  this script are now handled internally by sbuild.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# postinst script for buildd
 
3
#
 
4
# see: dh_installdeb(1)
 
5
 
 
6
set -e
 
7
 
 
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>
 
12
#          <new-version>
 
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/
 
17
#
 
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'.
 
24
 
 
25
# Move a conffile without triggering a dpkg question
 
26
mv_conffile() {
 
27
    OLDCONFFILE="$1"
 
28
    NEWCONFFILE="$2"
 
29
 
 
30
    if [ -e "$OLDCONFFILE" ]; then
 
31
        echo "Preserving user changes to $NEWCONFFILE ..."
 
32
        mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
 
33
        mv -f "$OLDCONFFILE" "$NEWCONFFILE"
 
34
    fi
 
35
}
 
36
 
 
37
case "$1" in
 
38
    configure)
 
39
 
 
40
        if dpkg --compare-versions "$2" le "0.58.3-1"; then
 
41
            mv_conffile "/etc/buildd.conf" "/etc/buildd/buildd.conf"
 
42
        fi
 
43
 
 
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
 
47
        fi
 
48
 
 
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
 
53
            exit 1
 
54
        fi
 
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
 
58
            exit 1
 
59
        fi
 
60
 
 
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
 
73
 
 
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
 
86
 
 
87
        ;;
 
88
 
 
89
    abort-upgrade|abort-remove|abort-deconfigure)
 
90
 
 
91
        ;;
 
92
 
 
93
    *)
 
94
 
 
95
        echo "postinst called with unknown argument \`$1'" >&2
 
96
        exit 0
 
97
 
 
98
        ;;
 
99
esac
 
100
 
 
101
# dh_installdeb will replace this with shell code automatically
 
102
# generated by other debhelper scripts.
 
103
 
 
104
#DEBHELPER#
 
105
 
 
106
exit 0