Sysupgrade for C api

is there a example about how to call sysupgrade -c bash cmd in C language to start system upgrade?
how to do upgrade in C? I now use system("sysupgrade -c sm.bin"); , but i think it is not very good

Maybe 'system' ?

He just said he used system().

You may be able to use libubus to call sysupgrade via ubus.

root@OpenWrt:~# ubus -v list system
'system' @b5b56299
        "board":{}
        "info":{}
        "reboot":{}
        "watchdog":{"frequency":"Integer","timeout":"Integer","magicclose":"Boolean","stop":"Boolean"}
        "signal":{"pid":"Integer","signum":"Integer"}
        "validate_firmware_image":{"path":"String"}
        "sysupgrade":{"path":"String","force":"Boolean","backup":"String","prefix":"String","command":"String","options":"Table"}

ref: https://git.openwrt.org/?p=project/ubus.git;a=blob;f=cli.c;h=81591ec44d11aa053d3461d774d58e59b0bfbbe0;hb=HEAD

2 Likes

maybe there is a better way

but on some my using openwrt, sysupgrade has no params