View previous topic :: View next topic |
Author |
Message |
spica Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 04 Jun 2021 Posts: 315
|
Posted: Fri Aug 16, 2024 11:06 pm Post subject: Help to design an arbitrary ebuild signature |
|
|
Please help me to design a user interface for a fork of `net-wireless/wireless-regdb` that will allow users to provide parameters in an arbitrary form. Users need to be able to modify band settings per particular country code and band.
Example: A user needs to change
FROM `(5150 - 5250 @ 80), (20)`
TO `(5150 - 5250 @ 80), (36)`
FOR `country US`
`5150 - 5250` is a band - this is a key
`80` - channel width - this is a value
`36` - is a power of radiation - this is a value
How users to provide this information to portage?
this is an example of the file to be modified:
Code: | country US: DFS-FCC
# S1G Channel 1-3
(902 - 904 @ 2), (30)
# S1G Channel 5-35
(904 - 920 @ 16), (30)
# S1G Channel 37-51
(920 - 928 @ 8), (30)
(2400 - 2472 @ 40), (30)
# 5.15 ~ 5.25 GHz: 30 dBm for master mode, 23 dBm for clients
(5150 - 5250 @ 80), (20)
(5250 - 5350 @ 80), (20)
|
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
flexibeast Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 04 Apr 2022 Posts: 382 Location: Naarm/Melbourne, Australia
|
Posted: Fri Aug 16, 2024 11:38 pm Post subject: |
|
|
Off the top of my head, and from a purely technical point of view, you could possibly prompt for user input during the `configure` phase, via the `read` shell builtin - presumably doing validation to only accept valid inputs - and during that same phase, use sed(1) to make the appropriate changes to the relevant source file. (And are there formally 'valid' inputs that might nevertheless cause certain hardware to break?)
The wisdom and/or legality of doing this is another matter. ![Smile :-)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 22392
|
Posted: Sat Aug 17, 2024 12:18 am Post subject: |
|
|
If the format of the input is not constrained, I suggest using /etc/portage/patches to apply a unified diff to the data file(s). This avoids the need to write a new interface and its parser, and delegates the work back to patch, which is a well understood format with good tooling support. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Genone Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/21004157514287ab2b29021.jpg)
Joined: 14 Mar 2003 Posts: 9592 Location: beyond the rim
|
Posted: Sat Aug 17, 2024 8:11 am Post subject: |
|
|
What is the purpose of this interface? As this is a regulatory database it doesn't look right to allow the user to make arbitrary changes.
Also any changes would break the signature verification of the database, is that what your title is about?
Quote: | Off the top of my head, and from a purely technical point of view, you could possibly prompt for user input during the `configure` phase, via the `read` shell builtin - presumably doing validation to only accept valid inputs - and during that same phase, use sed(1) to make the appropriate changes to the relevant source file. (And are there formally 'valid' inputs that might nevertheless cause certain hardware to break?)
The wisdom and/or legality of doing this is another matter. ![Smile :-)](images/smiles/icon_smile.gif) |
It is a bad idea, ebuilds should not be interactive unless absolutely necessary (e.g. upstream nonsense) for many reasons.
If you really need the user to provide input for the build phase, just use variables to do so. If the OPs wants the user to make multiple changes to the database then things get really messy though. Doing this via ebuild simply is the wrong approach. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
spica Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 04 Jun 2021 Posts: 315
|
Posted: Sat Aug 17, 2024 3:03 pm Post subject: |
|
|
Hu wrote: | If the format of the input is not constrained, I suggest using /etc/portage/patches to apply a unified diff to the data file(s). This avoids the need to write a new interface and its parser, and delegates the work back to patch, which is a well understood format with good tooling support. |
This is the easiest approach, and it seems a way to go. Thanks
Genone wrote: | Also any changes would break the signature verification of the database, is that what your title is about? |
The topic of verification does not raise a question; if someone is interested, the verification certificates are under net/wireless/certs directory |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|