swupdate

embedded script

software =
{
    version = "1.0";
    description = "Firmware update with pre-check";

    embedded-script = "function preinst()
        local hw_rev = swupdate.get_hw_revision()
        if hw_rev ~= '1.2' then
            print('Incompatible hardware revision!')
            return false, 'Hardware mismatch'
        end
        return true
    end";

    images: (
        {
            filename = "rootfs.ext4";
            device = "/dev/mmcblk0p2";
        }
    );
}