Opkg command options

From KoanSoftware Wiki
Jump to: navigation, search

OPKG (short for Open PacKaGe Management) is a leightweight package management system for embedded systems. OPKG is a fork of IPKG.)

The package management in the shell is a powerful tool, and offers many possibilities.

This article explains how to search / install / remove packages and some more interesting commands which offers OPKG. If you want to learn all options of OPKG, enter following command in the Terminal:

opkg

Install packages via internet

To be able to install a package, the feed defined in the /etc/opkg, should be updated. If this is not done, the installation will be terminated with the error message: Unknown package ..... Always enter the following command before installing:

opkg update


Installation

The installation of a package is done with the following command:

opkg install $package_name


Search package

There are different ways to search a package. First of all the package management offers the option search, but unfortunately this option doesn't work quite well.

opkg list | grep search_term


It's also possible to use an asterisk symbol as wildcard in the search term.

opkg list *webadmin*


Deinstallation

Removing a package is done like this:

opkg remove $package_name

Install local packages

Uupdate the package lists, this way the dependencies (if required) for the package will be resolved and installed. The command is:

opkg update


Installation of one package

Use the following command for the installation.

opkg install /tmp/$file_name_of_the_package


Installation of multiple packages

The installation of multiple packages is also easy, once all files are copied with FTP in the directory

opkg install /tmp/*.ipk


Deinstallation

The removal of a package is also done with the package name (without the version and the extention ipk) and the following command:

opkg remove $package_name


Other interesting commands

Update sources

Always update the sources before any package manipulation (e.g. installation, search, download of packages), with the command:

opkg update

Upgrade Firmware

With the following command it's possible to install all available updates for your Dreambox.

opkg upgrade

Chain commands

With two "and" symbols (&&) it's possible to chain commands. This way the second command is executed, as soon as the first is succesfully performed. The following command is very often used, to update the sources and the firmware.

opkg update && opkg upgrade


Install multiple packages from the feeds

opkg install $package_name $package_name $package_name $package_name


Deinstall multiplpe packages

opkg remove $package_name $package_name $package_name $package_name


Show all available packages from the feeds

opkg list


Show all installed packages

opkg list-installed

Show installed package

The following command can be used to search for an installed package. If the package is installed the name is shown with the version number. If no output is displayed, the package is not installed ot the name of the package is wrong.

opkg list-installed $package_name


Show upgradable packages

opkg list-upgradable


Show packages page by page

Packages can be shown with the command more. Use the Template:Taste or Template:Taste to continue.

opkg list | more
opkg list-installed | more
opkg list-upgradable | more


Install packages from a website

Packages can be installed directly from a web adress, e.g. with following command.

opkg install http://www.yyy.com/zzzz/$package_name.ipk


Download package from the feed

opkg download $package_name


Show package information

opkg info $package_name


Show package dependencies

Lists packages which are mandatory for an installation.

opkg depends $package_name


Show packages which require the package as dependency

Shows the packages which have the $package_name as required dependency.

opkg whatdepends $package_name


Simulate package installation

Loads the package and simulates the installation. Ideal to check if an installation would be performed succesfully.

opkg --noaction $package_name


Deinstall package with all dependencies

Removes a package and all installed dependencies.

opkg --autoremove $package_name


Set package on hold

Prevent an update of a package (using the flag hold).

opkg flag hold $package_name


Release package

Release a package which is on hold.

opkg flag user $package_name


List the compatible package architectures

Shows the content of the file /etc/opkg/arch.conf.

opkg print-architecture


Tips and Tricks

Proxy Server

When using a Proxy Server to install packages, edit the configuration file /etc/opkg/opkg.conf. The entries should be self explaining ;)

Unpack IPK packages

Packages can be unpacked on a home computer. With Linux no extra tools are required, for Windows users the programm 7-Zip can be used. And for MAC users BetterZIP.

Write text file with list of installed packages

With following command it's possible to create a list of installed packages, and write the list in a text file.

The list with the name e2plugins can be found in the directory /home/root. This file can be used to show the installed packages, and reinstall the plugins after a new image was flashed. Of course you have to copy the list from the HOST on your computer (e.g. using FTP).

opkg list-installed *extensions* | awk '{ print $1 }' > /home/root/e2plugins

Install the content of the list is possible with following command. Make sure the text file is in the directory /home/root. And of course the packages should be available on the feeds.

opkg update && opkg install $(cat /home/root/e2plugins)

An other method to install multiple packages is described in the chapter other interesting commands. But you need to know the names of the packages.

opkg update && opkg install $packetname $packetname $packetname $packetname