1#!/bin/sh
2
3# Abort on error.
4set -e
5
6symlink_match()
7{
8	local SYMLINK="$1"
9	local SYMLINK_TARGET="$2"
10
11	[ "$(readlink "$SYMLINK")" = "$SYMLINK_TARGET" ] || \
12	[ "$(readlink -f "$SYMLINK")" = "$SYMLINK_TARGET" ]
13}
14
15SYMLINK=/usr/share/doc/comerr-dev
16SYMLINK_TARGET=libcomerr2
17SYMLINK_TARGET2=libcom-err2
18
19if [ "$1" = "install" -o "$1" = "upgrade" ] &&
20   [ -n "$2" ] && [ -h "$SYMLINK" ]
21then
22    if symlink_match "$SYMLINK" "$SYMLINK_TARGET" ||
23       symlink_match "$SYMLINK" "$SYMLINK_TARGET2"
24    then
25	mv -f "$SYMLINK" "${SYMLINK}.dpkg-backup"
26    fi
27fi
28
29#DEBHELPER#
30
31exit 0
32