flash_uboot() {
  dev="/dev/mmcblk1"

  echo "A new U-Boot version needs to be flashed onto ${dev}."
  echo "Do you want to do this now? [y|N]"
  read -r shouldwe
  if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
    dd if=/boot/flash-image.bin of=${dev} seek=4096 conv=fdatasync,notrunc
  else
    echo "You can do this later by reinstalling the package."
  fi
}

post_install() {
  flash_uboot
}

post_upgrade() {
  flash_uboot
}
