#!/bin/sh
#
# pre-removal script for the Debian GNU/Linux ash package
#
# $Id: ash.prerm,v 1.5 2001/06/26 11:34:30 herbert Exp $

set -e

remove_divert() {
	div=$(dpkg-divert --package posh --list $1)
	if [ -n "$div" ] && [ -z "${div%%*by posh}" ]; then
		distrib=${div% by posh}
		distrib=${distrib##* to }
		mv $distrib $1
		dpkg-divert --package posh --remove $1
	fi
}

if [ "$1" = remove ] || [ "$1" = deconfigure ]; then
	remove_divert /bin/sh
	remove_divert /usr/share/man/man1/sh.1.gz
fi
