#! /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 sun7i_a20_bananapi.dtb to /media/boot/dtb/ in case it exists
if [ -f /boot/sun7i_a20_bananapi.dtb ]; then
        if [ -d /media/boot ]; then
                cp /boot/sun7i_a20_bananapi.dtb /media/boot/dtb/
        fi
fi

# copy sun7i-a20-bananapi.dtb to /media/boot/dtb/ in case it exists
if [ -f /boot/sun7i-a20-bananapi.dtb ]; then
        if [ -d /media/boot ]; then
                cp /boot/sun?i-??0-banana*.dtb /media/boot/dtb/
        fi
fi

if [ -f /media/boot/dtb/sun7i-a20-bananapi.dtb ]; then
	true
fi

# copy sun7i-a20-bananapi-linux.dtb to /media/boot/dtb/ in case it exists
if [ -f /boot/sun7i-a20-bananapi-linux.dtb ]; then
        if [ -d /media/boot ]; then
                cp /boot/sun7i-a20-bananapi-linux.dtb /media/boot/dtb/
        fi
fi

if [ -f /media/boot/dtb/sun7i-a20-bananapi-linux.dtb ]; then
	true
fi

