Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

differentiate security updates #148

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion man/apt-dater.8
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This manual page documents briefly the
command\&.
.PP
\fBapt\-dater\fR
is a program to manage package updats on a large number of remote hosts using SSH\&.
is a program to manage package updates on a large number of remote hosts using SSH\&.
.SH "OPTIONS"
.PP
\fBapt\-dater\fR
Expand Down
2 changes: 1 addition & 1 deletion man/apt-dater.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>APT-DATER</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="idp37380272"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>apt-dater &#8212; terminal-based remote package update manager</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">apt-dater</code> [<code class="option">[-(c <em class="replaceable"><code>config</code></em>|v|[n]r)]</code>]</p></div></div><div class="refsect1"><a name="idp33592944"></a><h2>DESCRIPTION</h2><p>This manual page documents briefly the
<span class="command"><strong>apt-dater</strong></span> command.</p><p><span class="command"><strong>apt-dater</strong></span> is a program to manage package updats on a large
<span class="command"><strong>apt-dater</strong></span> command.</p><p><span class="command"><strong>apt-dater</strong></span> is a program to manage package updates on a large
number of remote hosts using SSH.</p></div><div class="refsect1"><a name="idp33595904"></a><h2>OPTIONS</h2><p><span class="command"><strong>apt-dater</strong></span> accepts the following command parameters:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-c <em class="replaceable"><code>config</code></em></code></span></dt><dd><p>Use alternative config file. Default is <em class="replaceable"><code>$XDG_CONFIG_HOME/apt-dater/apt-dater.xml</code></em>.</p></dd><dt><span class="term"><code class="option">-v</code></span></dt><dd><p>Show apt-dater version and copyright statement.</p></dd><dt><span class="term"><code class="option">-r</code></span></dt><dd><p>Refresh hosts and create XML report on stdout. apt-dater must be compiled with XMLREPORT feature.</p></dd><dt><span class="term"><code class="option">-n</code></span></dt><dd><p>Prevent hosts to be refreshed before create XML report (useful for cronjobs which do not have access to SSH key(s)).</p></dd></dl></div></div><div class="refsect1"><a name="idp33565952"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">MAINTAINER</code></span></dt><dd><p>The maintainer's name (i.e. used by <span class="command"><strong>debtrack</strong></span>). If not set, the GECOS entry for the current user will be used.
This environment variable could be forwarded to remote hosts with the ssh(1) SendEnv+AcceptEnv options.</p></dd></dl></div></div><div class="refsect1"><a name="idp33569808"></a><h2>FILES</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>~/.config/apt-dater/apt-dater.xml</code></em></span></dt><dd><p>The configuration file of apt-dater</p></dd><dt><span class="term"><em class="replaceable"><code>~/.config/apt-dater/hosts.xml</code></em></span></dt><dd><p>Contains all hosts you would like to manage</p></dd></dl></div></div><div class="refsect1"><a name="idp33423472"></a><h2>SEE ALSO</h2><p>apt-dater.xml(5), apt-get(1), debtrack, ssh(1), <a class="ulink" href="http://www.freedesktop.org/Standards/basedir-spec" target="_top">XDG Base Directory Specification</a>.</p></div></div></body></html>
2 changes: 1 addition & 1 deletion man/apt-dater.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ and docbook-xsl in your Build-Depends control field.
<para>This manual page documents briefly the
<command>&dhpackage;</command> command.</para>

<para><command>&dhpackage;</command> is a program to manage package updats on a large
<para><command>&dhpackage;</command> is a program to manage package updates on a large
number of remote hosts using SSH.</para>

</refsect1>
Expand Down
2 changes: 2 additions & 0 deletions src/apt-dater.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ typedef struct _update {
gchar *version;
gint flag;
gchar *data;
gchar *security_update_version;
} PkgNode;

typedef struct _session {
Expand Down Expand Up @@ -181,6 +182,7 @@ typedef enum {
#ifdef FEAT_CLUSTERS
#define HOST_STATUS_CLUSTERED 512
#endif
#define HOST_STATUS_PKGSECUPDATE 1024

#define HOST_FORBID_REFRESH 1
#define HOST_FORBID_UPGRADE 2
Expand Down
15 changes: 15 additions & 0 deletions src/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ void freePkgNode(PkgNode *n)
g_free(n->version);
if(n->data)
g_free(n->data);
if(n->security_update_version)
g_free(n->security_update_version);
g_free(n);
}
}
Expand Down Expand Up @@ -347,6 +349,19 @@ gboolean getUpdatesFromStat(HostNode *n)
g_strfreev(argv);
continue;
}

if(i > 3) { /* read SecurityUpdateVersion */
switch(argv[3][0]) {
case 's':
pkgnode->security_update_version = g_strdup(&argv[3][2]);
n->status = n->status | HOST_STATUS_PKGSECUPDATE;
pkgnode->flag = pkgnode->flag | HOST_STATUS_PKGSECUPDATE;
break;
default:
/* unknow SecurityUpdateVersion content - ignore */
g_warning("ignoring unknown SecurityUpdateVersion contents '%s'", argv[3]);
}
}
g_strfreev(argv);

n->packages = g_list_insert_sorted(n->packages, pkgnode, cmpPackages);
Expand Down
20 changes: 15 additions & 5 deletions src/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -1469,14 +1469,24 @@ void drawHostEntry (DrawNode *n)
}
}

int snprintf_statusln(char* statusln, char* format, DrawNode *n)
{
return snprintf(statusln, BUF_MAX_LEN, format,
((PkgNode *) n->p)->version,
((PkgNode *) n->p)->data ? ((PkgNode *) n->p)->data : "none",
((PkgNode *) n->p)->security_update_version ? ((PkgNode *) n->p)->security_update_version : "none");
}

void drawPackageEntry (DrawNode *n)
{
char statusln[BUF_MAX_LEN];

attron(n->attrs);
mvremln(n->scrpos, 0, COLS);

if(((PkgNode *) n->p)->flag & HOST_STATUS_PKGUPDATE)
if(((PkgNode *) n->p)->flag & HOST_STATUS_PKGSECUPDATE)
mvaddstr(n->scrpos, 7, "s:");
else if(((PkgNode *) n->p)->flag & HOST_STATUS_PKGUPDATE)
mvaddstr(n->scrpos, 7, "u:");
else if(((PkgNode *) n->p)->flag & HOST_STATUS_PKGKEPTBACK)
mvaddstr(n->scrpos, 7, "h:");
Expand All @@ -1491,13 +1501,13 @@ void drawPackageEntry (DrawNode *n)
attroff(A_BOLD);
attroff(n->attrs);
if(n->selected == TRUE) {
if(((PkgNode *) n->p)->data) {
if((((PkgNode *) n->p)->data) || (((PkgNode *) n->p)->security_update_version)) {
if (((PkgNode *) n->p)->flag & HOST_STATUS_PKGBROKEN)
snprintf(statusln, BUF_MAX_LEN, "%s (%s)", ((PkgNode *) n->p)->version, ((PkgNode *) n->p)->data);
snprintf_statusln(statusln, "%s (%s) (security: %s)", n);
else
snprintf(statusln, BUF_MAX_LEN, "%s -> %s", ((PkgNode *) n->p)->version, ((PkgNode *) n->p)->data);
snprintf_statusln(statusln, "%s -> %s (security: %s)", n);
} else
snprintf(statusln, BUF_MAX_LEN, "%s", ((PkgNode *) n->p)->version);
snprintf_statusln( statusln, "%s", n);
drawMenu(VK_INSTALL);
drawStatus(statusln, TRUE);
}
Expand Down