#!/bin/sh
set -e

USR_MERGE="bin lib lib32 lib64 libo32 lib64 sbin"

if [ "$1" = install ] || [ "$1" = upgrade ]; then
	for d in $USR_MERGE; do
		if [ -d "$DPKG_ROOT/$d" ] && ! [ -h "$DPKG_ROOT/$d" ]; then
			cat <<EOF


******************************************************************************
*
* The base-files package cannot be installed because this system has a
* split /usr.
*
* Please install the usrmerge package to convert this system to merged-/usr.
*
* For more information please read https://wiki.debian.org/UsrMerge.
*
******************************************************************************


EOF
			exit 1
		fi
	done
	for d in $USR_MERGE; do
		# Install DEP17 M4 protective diversions
		dpkg-divert --quiet --package base-files --add --no-rename --divert /$d.usr-is-merged /$d
	done
fi

# Automatically added by dh_installdeb/13.14.1ubuntu5
dpkg-maintscript-helper rm_conffile /etc/default/motd-news 11ubuntu11\~ base-files -- "$@"
# End automatically added section

