#!/bin/bash
logger -s "## postinst_body ##"

## Header postinst
postinst_header=${postinst_header:-"${pkg_upgrades_dir}/postinst_header"}
source ${postinst_header}

echo "upgrading 60" > /tmp/fw_update_status

## FW Image postinst
if [ "${isImage}" == "true" ]; then
    source ${postinst_image}
else
## Container postinst
    source ${postinst_container}
fi

# any upgrade partition is now mounted...
logger -s "sourcing ${upgradePath}/etc/system.conf"
source "${upgradePath}/etc/system.conf" 2>/dev/null
logger -s "sourcing ${upgradePath}/${install_param}"
source "${upgradePath}/${install_param}" 2>/dev/null

echo "upgrading 90" > /tmp/fw_update_status

source ${postinst_all}

## TODO: 
## postinst extensions
## 1. Fix conditional sourcing of extenstions based on named "_suffix" rule.
## 2. Allow overrides for each section.
## [ -f ${postinst_masterpkg}   ] && source ${postinst_masterpkg}

## Footer postinst -> exit
source ${postinst_footer}

