Skip to content

images.js: add feature to configure device-specific packages#161

Open
andibraeu wants to merge 1 commit intoopenwrt:mainfrom
andibraeu:feature/device-specific-packages
Open

images.js: add feature to configure device-specific packages#161
andibraeu wants to merge 1 commit intoopenwrt:mainfrom
andibraeu:feature/device-specific-packages

Conversation

@andibraeu
Copy link
Copy Markdown
Contributor

this adds the following feature:

device-specific packages can be configured on the server with a json file like this

{
  "glinet,gl-mt3000": ["luci-app-wireguard", "wireguard-tools"],
  "tplink,archer-c7-v5": ["luci-app-sqm", "sqm-scripts"]
}

@aparcar
Copy link
Copy Markdown
Member

aparcar commented Apr 8, 2026

What is your use case here? openwrt already supports device specific packages. Would a general profile system make more send, like "NAS" installing USB drivers etc, or "VPN" to install wireguard etc?

@andibraeu
Copy link
Copy Markdown
Contributor Author

In freifunk we maintain lists of packages per device, like excluding -ct-drivers and including alternatives, excluding packages for some deivces to save memory (e.g. when partitioning is weird), adding some of our own packages.

In that feature, if you don't provide a file, everything works as before

@aparcar
Copy link
Copy Markdown
Member

aparcar commented Apr 8, 2026

ok thanks for the clarification


const idsToTry = [deviceId];
if (deviceId.includes("_")) {
idsToTry.push(deviceId.replace("_", ","));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this done because the device id format changed during releases?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was unsure about that, but as this is a new feature we can just define one single device id format

@mwarning
Copy link
Copy Markdown
Collaborator

mwarning commented Apr 8, 2026

Wouldn't it be nicer to put the content of device_packages.json of into asu_extra_packages of config.js.

  // Attended Sysupgrade Server support (optional)
  asu_url: "https://sysupgrade.openwrt.org",
  asu_extra_packages: {
     "glinet,gl-mt3000": ["luci-app-wireguard", "wireguard-tools"],
     "tplink,archer-c7-v5": ["luci-app-sqm", "sqm-scripts"]
}

But we would still need to support the array syntax as it is now. For backwards compatibility.

The advantage would be that we have less configuration file clutter and simpler code. But maybe it is not worth it.
@aparcar do you have an opinion here?

@andibraeu
Copy link
Copy Markdown
Contributor Author

But we would still need to support the array syntax as it is now. For backwards compatibility.

The advantage would be that we have less configuration file clutter and simpler code. But maybe it is not worth it.

That's why I thought it may be better to have another place for device specific packages.

I also thought about inlining the config (and fun fact: in between I worked with such a solution), but then I realized that could overload the config.js itself when working with dozens of devices and packages.

@andibraeu andibraeu force-pushed the feature/device-specific-packages branch from 0d85ad7 to 0e03173 Compare April 8, 2026 20:45
Signed-off-by: Andreas Bräu <ab@andi95.de>
@andibraeu andibraeu force-pushed the feature/device-specific-packages branch from 0e03173 to 0d8a447 Compare April 8, 2026 20:47
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.

3 participants