How do I use PackageKit?

Back to the main page

How do I use PackageKit?

Using the command line

The pkcon text-mode program allows you to interact with PackageKit on the command. For example:

[hughsie@laptop ~]$ pkcon get updates
normal       powertop             i386    1.8-1.fc8       fedora    Power consumption monitor
security     kernel               i386    2.6.23-0.115.rc3.git1.fc8 installed The Linux kernel
security     gtkhtml2             i386    2.19.1-4.fc8    fedora    An HTML widget for GTK+ 2.0
Runtime was 0 seconds

or

[hughsie@laptop ~]$ pkcon search name power
installed    powerman             i386    1.0.25-2.fc7    installed   PowerMan - Power to the Cluster
installed    powertop             i386    1.8-1.fc8       installed   Power consumption monitor
installed    gnome-power-manager  i386    2.20.0-5.fc8    installed   GNOME Power Manager
available    kpowersave           i386    0.7.3-0.2svn20070828.fc8 development KPowersave is the KDE frontend for powermanagement
available    kadu-powerkadu       i386    0.5.0-4.fc8     development Powerkadu module for Kadu
available    powermanga           i386    0.90-1          development Arcade 2D shoot-them-up game
Runtime was 2 seconds

The pkmon program allows you to monitor what PackageKit is doing on the command line and is mainly used for debugging.

Using graphical tools:

gnome-packagekit provides a rich set of GTK tools for automatically updating your computer and installing software. See the screenshots page for more details.

Using libpackagekit:

The libpackagekit gobject library wraps the DBUS interface in a nice glib-style API. This makes designing programs that use libpackagekit can concentrate on core functionality rather that the DBUS and PackageKit internals. PkClient in libpackagekit can be used as easily as:

PkClient *client;
client = pk_client_new ();
pk_client_install_package (client, "openoffice-clipart");
g_object_unref (client);

Using the raw DBUS API:

Using the DBUS methods and signals directly means that no glib or gobject dependency is needed, although this means you will have to manage the transaction_id multiplexing in any client program. This is not difficult, although does require more code than just using libpackagekit. The latest interface is available in the source tree or on-line.

Back to the main page