Opkg Operations¶
- Manage packages on OpenWrt using opkg
- update- update local copy of package information
- packages- install and remove packages
 
see https://openwrt.org/docs/guide-user/additional-software/opkg
OpenWrt recommends against upgrading all packages  thus there is no opkg.upgrade function
Facts used in these operations: opkg.OpkgPackages.
opkg.packages¶
Add/remove/update opkg packages.
opkg.packages(
    packages: typing.Union[str, typing.List[str]]="", present: <class 'bool'>=True,
    latest: <class 'bool'>=False, update: <class 'bool'>=True, **kwargs,
)
- packages: package or list of packages to that must/must not be present 
- present: whether the package(s) should be installed (default True) or removed 
- latest: whether to attempt to upgrade the specified package(s) (default False) 
- update: run - opkg updatebefore installing packages (default True)
- Not Supported:
- Opkg does not support version pinning, i.e. - <pkg>=<version>is not allowed and will cause an exception.
Examples:
# Ensure packages are installed∂ (will not force package upgrade)
opkg.packages(['asterisk', 'vim'], name="Install Asterisk and Vim")
# Install the latest versions of packages (always check)
opkg.packages(
    'vim',
    latest=True,
    name="Ensure we have the latest version of Vim"
)
- Note:
- This operation also inherits all global arguments. 
opkg.update¶
Stateless operation
This operation will always execute commands and is not idempotent.
Update the local opkg information.
opkg.update(**kwargs)
- Note:
- This operation also inherits all global arguments. 
 pyinfra 3.x
            pyinfra 3.x