Skip to content

Commit

Permalink
scripts: target_config_lib: make opkg a device-specific package
Browse files Browse the repository at this point in the history
If a package is installed target-wide, but removed for specific devices
(or through image-customization), it is first installed during target
rootfs generation, and then uninstalled again for the derived device
rootfs.

For packages that are marked as essential, removal of the package will
be refused by default, which is usually the correct thing to do to avoid
building broken images.

For opkg, we know that it is not required for regular operation of
Gluon, and removing it may be desirable for devices with small flash.
By never adding opkg to the target list of packages and instead only
installing it as a device-specific package, the uninstall issue can be
avoided.

Removing opkg saves ~38KiB of the squashfs on mips_24kc. Stripping the
opkg database is not supported however, as there is no device-specific
flag for that.
  • Loading branch information
neocturne committed Nov 4, 2024
1 parent 19cb769 commit bbc32e1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/target_config_lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ lib.include(target)

lib.check_devices()

handle_target_pkgs(concat_list(get_default_pkgs(), lib.target_packages))
-- Hack: opkg is added removed from the target packages and instead added
-- to the devices packages to make it removable via image-customization
local target_packages = concat_list(get_default_pkgs(), lib.target_packages)
target_packages = concat_list(target_packages, {'-opkg'})
handle_target_pkgs(target_packages)

for _, dev in ipairs(lib.devices) do
local device_pkgs = {}
Expand All @@ -187,6 +191,7 @@ for _, dev in ipairs(lib.devices) do
end

handle_pkgs(lib.target_packages)
handle_pkgs({'opkg'})
handle_pkgs(dev.options.packages or {})
handle_pkgs(site_specific_packages(dev))

Expand Down

0 comments on commit bbc32e1

Please sign in to comment.