Skip to content

Commit

Permalink
packagekit: Add OS package update support
Browse files Browse the repository at this point in the history
Add a "Software Updates" page for classic dnf/yum/apt based systems,
to complement what "ostree" provides on Atomic. This uses the PackageKit
API for platform independence.

Set priority 0 to hide behind ostree if it is installed (which has
default priority 1), so that we don't try to mess around with packages
on OSTree/Atomic. Ship it in a new cockpit-packagekit rpm/deb as we
don't want to pull in the packagekit dependency in cockpit-system (at
least just yet).

Don't ship this on Ubuntu 16.04, as a PackageKit crash there
(https://launchpad.net/bugs/1689820) makes this functionality mostly
useless.

Specification:
https://github.com/cockpit-project/cockpit/wiki/Feature:-System-Updates-for-dnf,-yum,-apt-hosts

Closes #6724
  • Loading branch information
martinpitt committed Jun 13, 2017
1 parent b50d60a commit cab23fd
Show file tree
Hide file tree
Showing 14 changed files with 1,286 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ WEBPACK_PACKAGES = \
networkmanager \
ostree \
pcp \
packagekit \
playground \
realmd \
selinux \
Expand Down
1 change: 1 addition & 0 deletions doc/guide/Makefile-guide.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ GUIDE_INCLUDES = \
doc/guide/feature-machines.xml \
doc/guide/feature-networkmanager.xml \
doc/guide/feature-ostree.xml \
doc/guide/feature-packagekit.xml \
doc/guide/feature-pcp.xml \
doc/guide/feature-realmd.xml \
doc/guide/feature-selinux.xml \
Expand Down
1 change: 1 addition & 0 deletions doc/guide/cockpit-guide.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<xi:include href="feature-tuned.xml"/>
<xi:include href="feature-sosreport.xml"/>
<xi:include href="feature-ostree.xml"/>
<xi:include href="feature-packagekit.xml"/>
</part>

<part id="development">
Expand Down
44 changes: 44 additions & 0 deletions doc/guide/feature-packagekit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<chapter id="feature-packagekit">
<title>Package Updates</title>

<para>Cockpit uses the <ulink url="https://www.freedesktop.org/software/PackageKit/gtk-doc/api-reference.html">PackageKit</ulink>
D-Bus API to get information about available package updates and to apply them, in an Operating System independent manner.</para>

<para>To perform similar tasks from the command line, use the
<ulink url="https://www.freedesktop.org/software/PackageKit/pk-using.html">pkcon</ulink> command:</para>

<programlisting>
$ <command>pkcon refresh</command>

$ <command>pkcon get-updates</command>
Available sudo-1.8.20p2-1.fc26.x86_64 (updates-testing)
Allows restricted root access for specified users
Available vim-filesystem-2:8.0.617-1.fc26.x86_64 (updates-testing)
VIM filesystem layout
Available vim-minimal-2:8.0.617-1.fc26.x86_64 (updates-testing)
A minimal version of the VIM editor

$ <command>pkcon get-update-detail sudo</command>
Details about the update:6.x86_64 [fedora]
Package: sudo-1.8.20p2-1.fc26.x86_64
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1452941
Update text: - update to 1.8.20p2
- added sudo package to dnf/yum protected packages

$ <command>pkcon update</command>
The following packages have to be updated:
sudo-1.8.20p2-1.fc26.x86_64 Allows restricted root access for specified users
vim-filesystem-2:8.0.617-1.fc26.x86_64 VIM filesystem layout
vim-minimal-2:8.0.617-1.fc26.x86_64 A minimal version of the VIM editor
Proceed with changes? [N/y] y
[...]
</programlisting>

<para>Of course you can also use your Operating System specific commands for that, such as
<command>dnf updateinfo info</command> on Fedora or
<command>sudo apt upgrade</command> on Debian.</para>

</chapter>
37 changes: 37 additions & 0 deletions pkg/packagekit/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<!--
This file is part of Cockpit.
Copyright (C) 2017 Red Hat, Inc.
Cockpit is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Cockpit is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
-->
<html>

<head>
<title translate>Software Updates</title>
<meta charset="utf-8">

<link href="../base1/patternfly.css" type="text/css" rel="stylesheet">
<link href="updates.css" rel="stylesheet">

<script src="../base1/cockpit.js"></script>
<script src="updates.js"></script>
<script src="../*/po.js"></script>
</head>
<body>
<div id="app"></div>
</body>

</html>
15 changes: 15 additions & 0 deletions pkg/packagekit/manifest.json.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "@VERSION@",
"name": "updates",
"priority": 0,
"requires": {
"cockpit": "138"
},

"tools": {
"updates": {
"label": "Software Updates",
"path": "index.html"
}
}
}
84 changes: 84 additions & 0 deletions pkg/packagekit/updates.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* override default cockpit CSS, as this doesn't fit our table */
table.listing-ct thead th:last-child {
text-align: left;
}

tr.listing-ct-item td:last-child {
text-align: left;
}

tr.listing-ct-item th {
vertical-align: top;
}

tr.listing-ct-item td {
vertical-align: top;
}

tr.listing-ct-item td.narrow {
max-width: 18ex;
word-wrap: break-word;
}

tr.listing-ct-item td.changelog {
white-space: pre-wrap;
}

tr.security {
background-color: #fbf0f0;
}

.security-label {
color: darkred;
}

.security-label-text {
color: darkred;
font-weight: 600;
}

/* don't let the install progress bar get too wide */
.progress {
max-width: 60rem;
}

/* stolen from pkg/systemd/host.css */
.content-header-extra {
background: #f5f5f5;
border-bottom: 1px solid #ddd;
padding: 10px 20px;
width: 100%;
position: fixed;
z-index: 900;
top: 0;
}

.container-fluid {
margin-top: 5em;
}

/* http://www.patternfly.org/pattern-library/communication/empty-state/ has a
* gray background which we don't want here */

.blank-slate-pf {
background: inherit;
border: none;
}

/* Layout fix for tooltip arrows.
*
* Sometimes when there are non-integer coordinates involved
* somewhere, rounding seems to make it so that there is a visible one
* pixel gap between tooltip-inner and tooltip-arrow. We avoid that
* gap by letting the arrow and inner parts overlap by one pixel.
*
* This happens within the caption of the content listing.
*/

.tooltip.top .tooltip-arrow {
bottom: 1px;
}

.tooltip.bottom .tooltip-arrow {
top: 1px;
}
Loading

0 comments on commit cab23fd

Please sign in to comment.