#!/bin/sh

set -e

BINFMT_TARGETS= # list of architectures is autogenerated from debian/rules

if [ configure = "$1" ] && [ -x /usr/sbin/update-binfmts ]; then
	for target in $BINFMT_TARGETS ; do
		if [ -f /var/lib/binfmts/qemu-$target ]; then
			# remove format, in case the current version no longer supports it.
			update-binfmts --package qemu-user-static --remove qemu-$target /usr/bin/qemu-$target-static
		fi
		if [ -f /usr/share/binfmts/qemu-$target ]; then
			# install currently supported format.
			update-binfmts --import qemu-$target
		fi
	done
fi

#DEBHELPER#
