Since, I've become ready to deploy my solution for OpenWrt/Rutos device, I've got two issues related to creating production package:
I've got couple of external packages which are needed to be installed before my software can be used - libmosquitto, libmodbus, libconfig, etc. At this moment I install it manually using opkg install command. Can I somehow install them together when I install my package?
Installer moves built binaries to indicated place and that's it, while the software needs some additional text files to work. Is it possible copy those configuration files during package install?
To fulfil dependency package manager installed latest libconfig package which is a totally new version of it - libconfig11 - version 1.7.2, while I'm using original libconfig 1.5.1. And obviously my program does not work on the newer libraries. Is there a way to explicitly define which package is needed?
OK, For some reason I had a makefile for 1.5 version in my SDK. Probably because the newest deb package for libconfig is 1.5 and I'm using it for development. I've replaced Makefile and it works fine, thanks.
You could populate those files in your firmware through your package Makefile. An alternative is to place those files in your <buildroot>/files for example:
Post installation actions to be executed by the package manager after install can be defined in the postinstall section of the Makefile:
define Package/mypackage/postinst
#!/bin/sh
echo "This is a postinstall action"
if [ -n "$${IPKG_INSTROOT}" ]; then
echo "I am executing on the build system"
else
echo "I am executing on the target system"
fi
endef
Thanks, one short question - is it possible to include condition, that installer will copy additional (config) files only if they do not exist on target filesystem?
The thing is, that I'm copying basic config files and the scripts are doing the rest of configuration by writing additional lines to the config file. This includes authentication code, which can be downloaded only once unless unlocked in the database.
In case of totally fresh installation I'd like to have all the files copied and script run, otherwise I'd like to have only binaries updated. I've tried to change the version of the package and run update, but it does exactly the same thing as in case of fresh installation.
Sure, it's a normal shell script. However opkg also will take care of this if the file is properly marked as conffile. In this case opkg will not overwrite it but place the defualt copy with a backup extension next to it, similar to dpkg.