#! /bin/sh

set -e

if [ -n "$DEB_MAINT_PARAMS" ]; then
    eval set -- "$DEB_MAINT_PARAMS"
    if [ -z "$1" ] || [ "$1" != "configure" ]; then
	exit 0;
    fi
fi

# copy rk3399-rockpro64.dtb to /media/boot/ in case it exists
if [ -f /boot/rk3399-rockpro64.dtb ]; then
	if [ -d /media/boot ]; then
		cp /boot/rk3399-rockpro64.dtb /media/boot/
	fi
fi

if [ -f /media/boot/rk3399-rockpro64.dtb ]; then
	cp /media/boot/rk3399-rockpro64.dtb /media/boot/dtb
fi
