debian/postrm
author Paul Crowley <paul@lshift.net>
Fri, 24 Aug 2012 13:50:16 +0100
changeset 366 660f5631013e
parent 314 c02eae7665af
permissions -rw-r--r--
Don't use python-support's update-python-modules
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
97
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     1
#!/bin/sh
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     2
# postrm script for mercurial-server
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     3
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     4
set -e
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     5
224
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
     6
# Load debconf
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
     7
. /usr/share/debconf/confmodule
97
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     8
224
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
     9
# Check if the user wants the repositories removed on purging
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    10
remove_repositories_on_purge() {
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    11
  db_get mercurial-server/purge_repositories || RET=false
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    12
  if [ "$RET" = "true" ]; then
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    13
    return 0
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    14
  else
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    15
    return 1
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    16
  fi
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    17
}
97
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    18
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    19
case "$1" in
116
d99f3169828a Looks like the start of a working Debianization
Paul Crowley <paul@lshift.net>
parents: 97
diff changeset
    20
    purge)
224
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    21
        if remove_repositories_on_purge; then
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    22
            echo -n "Removing hg user and purging data..."
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    23
            deluser --remove-home --quiet --system hg > /dev/null || true
261
b6e65bddda7c Fix Debian bug #605584
Paul Crowley <paul@lshift.net>
parents: 224
diff changeset
    24
            delgroup --quiet --system hg > /dev/null || true
b6e65bddda7c Fix Debian bug #605584
Paul Crowley <paul@lshift.net>
parents: 224
diff changeset
    25
            echo done
224
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    26
        fi
116
d99f3169828a Looks like the start of a working Debianization
Paul Crowley <paul@lshift.net>
parents: 97
diff changeset
    27
    ;;
d99f3169828a Looks like the start of a working Debianization
Paul Crowley <paul@lshift.net>
parents: 97
diff changeset
    28
d99f3169828a Looks like the start of a working Debianization
Paul Crowley <paul@lshift.net>
parents: 97
diff changeset
    29
    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
97
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    30
    ;;
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    31
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    32
    *)
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    33
        echo "postrm called with unknown argument \`$1'" >&2
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    34
        exit 1
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    35
    ;;
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    36
esac
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    37
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    38
# dh_installdeb will replace this with shell code automatically
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    39
# generated by other debhelper scripts.
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    40
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    41
#DEBHELPER#
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    42
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    43
exit 0