Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: add image customization generation script #3358

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maurerle
Copy link
Member

this script creates the helper lua from the openwrt toh to be included in the image-customization.lua

waiting for #3148

closes #3316
supersedes #3143

Eventually, this should stay in community-packages or something less official, though I like that this properly depends on the wiki as well, making it easier to correct things for anyone.

I was made aware of the toh.json through this TOH viewer for Openwrt: https://github.com/soif/OpenWrtTOH/

this script creates the helper lua from the openwrt toh to be included in the image-customization.lua
@T-X
Copy link
Contributor

T-X commented Oct 28, 2024

Interesting. Do you have an example regarding how you use the image-customization-helper.lua in a site's image-customization.lua?

Could this toh.json also be used to simplify package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua?

If this were added to the main repository would refreshing of the image-customization-helper.lua also need to be added to the device integration checklist?

I'm also wondering if it were possible to avoid having to refresh and recommit the image-customization-helper.lua. (maybe just generate image-customization-helper.lua during a "make update" and don't add it to Git? Write it to ./gluon/tmp/ or ./gluon/output/? Or at least somewhere that's in a .gitignore. And make the result available to image-customization.lua that doesn't require explicitly including the helper file?)

@maurerle
Copy link
Member Author

Hi @T-X,
thanks for your comment! :)

Interesting. Do you have an example regarding how you use the image-customization-helper.lua in a site's image-customization.lua?

my current (but untested) commit to this is ffac/site@89d627d which makes the idea clear.

Could this toh.json also be used to simplify package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua?

as said by @neocturne the platform.lua uses a different format (for example requires to have ubnt instead of ubiquity and uses commas instead).

Furthermore, my current approach using the device id fails for some devices as well (for example for the unifi_outdoorplus and the ubiquiti-unifi-swiss-army-knife-ultra (which is weird, as there is no occurance of swiss in the toh.json). So we should make sure that all devices in the toh are matched by the correct identifier.

If this were added to the main repository would refreshing of the image-customization-helper.lua also need to be added to the device integration checklist?

yes, that would be the case (and making sure that the data is correct in the toh, which is cumbersome, as I heard that the openwrt wiki was separated from the development by intention, so I don't think it is helpful to tie these together here.
That's also why it is helpful to have this in community-packages instead, depending on general willingness of having this here.. :)

I'm also wondering if it were possible to avoid having to refresh and recommit the image-customization-helper.lua. (maybe just generate image-customization-helper.lua during a "make update" and don't add it to Git? Write it to ./gluon/tmp/ or ./gluon/output/? Or at least somewhere that's in a .gitignore. And make the result available to image-customization.lua that doesn't require explicitly including the helper file?)

automatic generation adds a side effect to the build process which might cause weird problems "package x does not include y anymore" - "oh someone edited the wiki" or "build failed, openwrt was down" and especially for building older releases it is required to have the matching helper.lua at hand, so I am quite sure this should be added to the VCS and updated manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

image-customization: add is_cellular_device and is_outdoor_device
2 participants