Debian Codegraph @

pkgos_postrm

raw
1 #!/bin/sh
2 # -*- mode: shell-script -*-
3
4 # Perform cleanups when removing a package
5 # Prototype: pkgos_postrm <template-prefix-name> <package-name> $@
6 # Example: pkgos_postrm neutron neutron-common $@
7 pkgos_dbc_postrm () {
8 local PKPRM_TEMPLATE_PREFIX PKPRM_PACKAGE_NAME
9
10 PKPRM_TEMPLATE_PREFIX=${1}
11 PKPRM_PACKAGE_NAME=${2}
12 shift
13 shift
14
15 if [ -f /usr/share/debconf/confmodule ] ; then
16 . /usr/share/debconf/confmodule
17 # If the package has the template, then it means we're having a db,
18 # and therefore we can call the dbconfig-common clean function.
19 db_get ${PKPRM_TEMPLATE_PREFIX}/configure_db
20 if [ "$RET" = "true" ] ; then
21 if [ -f /usr/share/dbconfig-common/dpkg/postrm ] ; then
22 . /usr/share/dbconfig-common/dpkg/postrm
23 dbc_go ${PKPRM_PACKAGE_NAME} $@
24 else
25 rm -f /etc/dbconfig-common/${PKPRM_PACKAGE_NAME}.conf
26 if which ucf >/dev/null 2>&1; then
27 ucf --purge /etc/dbconfig-common/${PKPRM_PACKAGE_NAME}.conf
28 ucfr --purge ${PKPRM_PACKAGE_NAME} /etc/dbconfig-common/${PKPRM_PACKAGE_NAME}.conf
29 fi
30 fi
31 fi
32 fi
33
34 rm -rf /var/lib/${PKPRM_TEMPLATE_PREFIX} /var/log/${PKPRM_TEMPLATE_PREFIX} /var/lock/${PKPRM_TEMPLATE_PREFIX}
35 }