#!/bin/sh # Debian x11-common package post-removal script # Copyright 1998--2001, 2003 Branden Robinson. # Licensed under the GNU General Public License, version 2. See the file # /usr/share/common-licenses/GPL or . # Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava. set -e THIS_PACKAGE=x11-common THIS_SCRIPT=postrm CONFIG_DIR=/etc/X11 XWRAPPER_CONFIG="$CONFIG_DIR/Xwrapper.config" CONFIG_AUX_DIR=/var/lib/x11 XWRAPPER_CONFIG_CHECKSUM="$CONFIG_AUX_DIR/${XWRAPPER_CONFIG##*/}.md5sum" XWRAPPER_CONFIG_ROSTER="$CONFIG_AUX_DIR/${XWRAPPER_CONFIG##*/}.roster" #INCLUDE_SHELL_LIB# # clean up non-conffile configuration files and related materials on purge if [ "$1" = "purge" ]; then # de-register this package as a handler of the X server wrapper config file if [ -e "$XWRAPPER_CONFIG_ROSTER" ]; then # check existing roster file for our package name if fgrep -qx "$THIS_PACKAGE" "$XWRAPPER_CONFIG_ROSTER" 2>/dev/null; then # construct temporary roster file with our package name removed, ignoring # failure fgrep -vx "$THIS_PACKAGE" "$XWRAPPER_CONFIG_ROSTER" > \ "$XWRAPPER_CONFIG_ROSTER.dpkg-tmp" 2>/dev/null || true # is there anything left? if [ -s "$XWRAPPER_CONFIG_ROSTER.dpkg-tmp" ]; then # yes, replace the roster file mv "$XWRAPPER_CONFIG_ROSTER.dpkg-tmp" "$XWRAPPER_CONFIG_ROSTER" else # no; remove both the roster and our temporary copy rm -f "$XWRAPPER_CONFIG_ROSTER" "$XWRAPPER_CONFIG_ROSTER.dpkg-tmp" # remove X server wrapper config file if it was still managed by the # package if [ -e "$XWRAPPER_CONFIG_CHECKSUM" ]; then # does it exist? if [ -e "$XWRAPPER_CONFIG" ]; then # does the current MD5 checksum match the stored checksum? if [ "$(md5sum "$XWRAPPER_CONFIG")" \ = "$(cat "$XWRAPPER_CONFIG_CHECKSUM")" ]; then # yes; remove the config file rm -f "$XWRAPPER_CONFIG" fi fi # remove the checksum file; any remaining X server wrapper config file # still on the system at this point is no longer being managed (local # user customization) rm -f "$XWRAPPER_CONFIG_CHECKSUM" fi fi fi fi for DIR in "$CONFIG_DIR" "$CONFIG_AUX_DIR"; do rmdir "$DIR" 2> /dev/null || true done fi #DEBHELPER# exit 0 # vim:set ai et sts=2 sw=2 tw=80: