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

« back to all changes in this revision

Viewing changes to debian/buildd.postrm

  • 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
# postrm script for buildd
 
3
#
 
4
# see: dh_installdeb(1)
 
5
 
 
6
set -e
 
7
 
 
8
# summary of how this script can be called:
 
9
#        * <postrm> `remove'
 
10
#        * <postrm> `purge'
 
11
#        * <old-postrm> `upgrade' <new-version>
 
12
#        * <new-postrm> `failed-upgrade' <old-version>
 
13
#        * <new-postrm> `abort-install'
 
14
#        * <new-postrm> `abort-install' <old-version>
 
15
#        * <new-postrm> `abort-upgrade' <old-version>
 
16
#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
 
17
# for details, see /usr/share/doc/packaging-manual/
 
18
 
 
19
PACKAGE="buildd"
 
20
 
 
21
# Remove a conffile which has been forgotten by dpkg
 
22
# If the file does not exist, or is owned by any package, do not remove it.
 
23
rm_conffile() {
 
24
    CONFFILE="$1"
 
25
 
 
26
    local delete; delete="false"
 
27
 
 
28
    if [ -f "$CONFFILE" ]; then
 
29
        local fpkg; fpkg=""
 
30
        local pkg; pkg=""
 
31
        if fpkg=$(dpkg -S "$CONFFILE" 2>/dev/null); then
 
32
            # Don't delete, but check which package it came from.
 
33
            pkg=$(echo $fpkg | sed -e  's/\(^[[:print:]][[:print:]]*\): .*$/\1/')
 
34
            if [ "$pkg" = "$PACKAGE" ]; then
 
35
                delete="true"
 
36
            fi
 
37
        else
 
38
            rm -f "$CONFFILE"
 
39
            delete="true"
 
40
        fi
 
41
    else
 
42
        delete="true"
 
43
    fi
 
44
 
 
45
    # Remove dpkg cruft
 
46
    if [ "$delete" = "true" ]; then
 
47
        rm -f "${CONFFILE}.dpkg-old"
 
48
        rm -f "${CONFFILE}.dpkg-new"
 
49
        rm -f "${CONFFILE}.dpkg-dist"
 
50
    fi
 
51
}
 
52
 
 
53
case "$1" in
 
54
 
 
55
    remove|upgrade|failed-upgrade|abort-install|abort-upgrade)
 
56
 
 
57
        ;;
 
58
 
 
59
    purge|disappear)
 
60
 
 
61
        if getent group buildd > /dev/null; then
 
62
            deluser --system buildd || true
 
63
        fi
 
64
 
 
65
        rm_conffile "/etc/buildd.conf"
 
66
        rm_conffile "/etc/buildd.conf.local"
 
67
 
 
68
        ;;
 
69
 
 
70
    *)
 
71
 
 
72
        echo "postrm called with unknown argument \`$1'" >&2
 
73
        exit 0
 
74
 
 
75
        ;;
 
76
esac
 
77
 
 
78
# dh_installdeb will replace this with shell code automatically
 
79
# generated by other debhelper scripts.
 
80
 
 
81
#DEBHELPER#
 
82
 
 
83
exit 0