Opkg Operations¶
- Manage packages on OpenWrt using opkg
update
- update local copy of package informationpackages
- install and remove packagessee 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,
)
- 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 update
before 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"
)
opkg.update
¶
Stateless operation
This operation will always execute commands and is not idempotent.
Update the local opkg information.
opkg.update()