Upgrading ipk without overriding existing config files

Hi all,

I'm looking to upgrade a package on my router while preserving the existing configuration files. However, I've encountered an issue: using opkg install overwrites the config files if they haven't been modified. Additionally, opkg upgrade isn't an option in my case, as I'm upgrading from a local .ipk file, and opkg upgrade only supports upgrading from a feed.

I'm using a separate binary to handle the upgrade process, which downloads the .ipk from a predefined API and installs it using opkg install. Therefore, I can include additional scripts or steps in this process if needed.

Could anyone suggest a flag or a workaround to prevent the existing configuration files from being overwritten during the upgrade?

Thanks!

What package? From which openwrt version to which you are upgrading?

its a custom proprietory agent running on openwrt21,
once we have the new release of the agent , we change the existing api to point to latest version and it gets downloaded and installed by helper , but issue is we configure some configs in the /etc/config/controllermon which gets overridden when package is installed with opkg install

So you need to mark config files as config files in ipk so that new package will install a copy of new config file next to existing one. Probably uci-defaults can be used to migrate things.

1 Like

@brada4 thanks for your help,
i did solve the isue with adding preinst and postinst instructions in makefile to copy the config file before install and then pase again post install

Doc
https://www.debian.org/doc/debian-policy/ch-files.html#configuration-files

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.