debian/postrm
author Paul Crowley <paul@lshift.net>
Wed, 02 Dec 2009 17:46:28 +0000
branchdebian
changeset 228 f98f716b2ae8
parent 224 caf9cb61f856
child 261 b6e65bddda7c
permissions -rw-r--r--
Merge changes into post-tag revision
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
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    24
        else
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    25
            echo -n "Removing hg user..."
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    26
            deluser --quiet --system hg > /dev/null || true
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    27
        fi
116
d99f3169828a Looks like the start of a working Debianization
Paul Crowley <paul@lshift.net>
parents: 97
diff changeset
    28
        delgroup --quiet --system hg > /dev/null || true
224
caf9cb61f856 Purge repositories if debconf says so.
Paul Crowley <paul@lshift.net>
parents: 116
diff changeset
    29
        echo done
116
d99f3169828a Looks like the start of a working Debianization
Paul Crowley <paul@lshift.net>
parents: 97
diff changeset
    30
    ;;
d99f3169828a Looks like the start of a working Debianization
Paul Crowley <paul@lshift.net>
parents: 97
diff changeset
    31
d99f3169828a Looks like the start of a working Debianization
Paul Crowley <paul@lshift.net>
parents: 97
diff changeset
    32
    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
97
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    33
    ;;
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    34
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
        echo "postrm called with unknown argument \`$1'" >&2
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    37
        exit 1
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    38
    ;;
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    39
esac
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
# dh_installdeb will replace this with shell code automatically
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    42
# generated by other debhelper scripts.
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    43
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    44
#DEBHELPER#
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    45
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    46
exit 0
7953788881a4 Start work on Debianization
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    47