Script-only (no binary) OpenWrt package

Hello,

quick use case for context: When developing a monitoring and management system, we have decided to go with a shell-based agent to gain greater flexibility and portability. Currently we mark support of OpenWRT-based devices as Experimental and we would like to improve this by (among other things)

  1. Providing package (opkg) - focusing on this now
  2. Building agent UI (next step, another version)

Our shell-based agent is completely self-contained at the moment for OpenWRT devices. Meaning that on first run it detects it is not installed, and copies itself to proper location, hooks into init system etc. While we have done only a brief testing ("Experimental"), after some customization it works and reports back the most important data etc.

My question is, is it somehow possible to build (or prepare in another way than building) the OpenWRT package without installing the toolchain etc. ?

I haven't studied the packaging system yet and my naive idea is to just take some "empty" package, add some script triggered on install (which could actually be directly the agent) and dependency on one other package (we use curl to transfer the data; currently we trigger opkg update and curl package install on first run which would ideally change, letting some dependency definition letting opkg to do the job)

We have absolutely no need (from our point of view) for anything like toolchain or architecture-dependent packages so I am thinking if there is some way how to prepare a script-only opkg with minimal effort, without getting into the real deal of package building - while I can definitely handle that, I would rather use the time for improving the agent functionality itself.

Also, in some modes of operation, we need to put the server certificate file (.pem) inside of the package and that certificate is generated only when the server is deployed, meaning that every deployment must be able to generate (or re-generate) the package on demand.

Thanks for any answers!
Jan
reference: https://mamas.dwarftech.cz

As example of "script-only" package can be watchcat:

Sure, .ipk files are essentially just renamed .tar.gz archives. You can create them with a bit of scripting and tar commands. You just have to ensure to embed a proper CONTROL file with the architecture set to β€œall” instead of e.g. β€œx86_64”. For reference take a look at https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=scripts/ipkg-build;h=122cca2cb4c98cd8370ad1a9a824fcdf8e45d27b;hb=eeba2a67caa2b9b92ffb9d756089408643971a2e

1 Like

Thanks for the link. There's a Makefile. To build - does this needs a OpenWRT package building installed?

I totally forgot an important part of the post - adding rationale - will fix it in a while. The point of asking this is that the package may (under some mode of operation) need to include the server certificate so in some scenarios we need to build that package on the server where the management system is deployed. Which would be a Debian Linux but in general any UN*X-based system managed by the service operator which is an admin, not a developer...

Thanks, looks promising! Going to play with it a little bit.

If your package is architecture-independent, you can grab a pre-compiled SDK for any architecture and quickly build a single package using the SDK instead of toolchain.

1 Like