summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2011-08-17 10:48:28 +0000
committerMarc Espie <espie@cvs.openbsd.org>2011-08-17 10:48:28 +0000
commit0f58bb6791a096e040f8a455f1f3c77e0eef48e4 (patch)
tree0d06ef30f91f03c07a67a266744332001f76b43f
parent8e8e4f68cb4922034eb5d30ef54008b95078dc76 (diff)
pkg_add and pkg_delete will now syslog activity by default.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/AddDelete.pm17
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgAdd.pm3
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgDelete.pm3
-rw-r--r--usr.sbin/pkg_add/pkg.conf.517
-rw-r--r--usr.sbin/pkg_add/pkg_add.113
-rw-r--r--usr.sbin/pkg_add/pkg_delete.113
6 files changed, 57 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
index 3883ad6dd09..6661bc40201 100644
--- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: AddDelete.pm,v 1.51 2011/07/17 13:16:15 espie Exp $
+# $OpenBSD: AddDelete.pm,v 1.52 2011/08/17 10:48:27 espie Exp $
#
# Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org>
#
@@ -190,10 +190,25 @@ sub init
$self->{recorder} = OpenBSD::SharedItemsRecorder->new;
$self->{v} = 0;
$self->{wantntogo} = $self->config->istrue("ntogo");
+ if ($self->{not}) {
+ $self->{loglevel} = 0;
+ }
+ $self->{loglevel} //= $self->config->value("loglevel") // 1;
+ if ($self->{loglevel}) {
+ require Sys::Syslog;
+ Sys::Syslog::openlog($self->{cmd}, "nofatal");
+ }
$self->SUPER::init(@_);
$self->{export_level}++;
}
+sub syslog
+{
+ my $self = shift;
+ return unless $self->{loglevel};
+ Sys::Syslog::syslog('info', $self->f(@_));
+}
+
sub ntogo
{
my ($self, $offset) = @_;
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
index d66bc44efa5..06a6ea24e12 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgAdd.pm,v 1.30 2011/07/23 15:04:27 espie Exp $
+# $OpenBSD: PkgAdd.pm,v 1.31 2011/08/17 10:48:27 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -837,6 +837,7 @@ sub really_add
$set->{solver}->repair_dependencies($state);
}
delete $state->{delete_first};
+ $state->syslog("Added #1", $set->print);
}
sub newer_has_errors
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm b/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm
index b846384a3ca..a5b86ae391d 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgDelete.pm,v 1.20 2011/07/19 05:58:33 espie Exp $
+# $OpenBSD: PkgDelete.pm,v 1.21 2011/08/17 10:48:27 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -253,6 +253,7 @@ sub really_remove
OpenBSD::Delete::delete_package($pkgname, $state);
}
$state->progress->next($state->ntogo);
+ $state->syslog("Removed #1", $set->print);
}
sub delete_dependencies
diff --git a/usr.sbin/pkg_add/pkg.conf.5 b/usr.sbin/pkg_add/pkg.conf.5
index 199665f3df7..d607c707770 100644
--- a/usr.sbin/pkg_add/pkg.conf.5
+++ b/usr.sbin/pkg_add/pkg.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pkg.conf.5,v 1.3 2010/10/25 21:04:49 espie Exp $
+.\" $OpenBSD: pkg.conf.5,v 1.4 2011/08/17 10:48:27 espie Exp $
.\"
.\" Copyright (c) 2010 Marc Espie
.\"
@@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 25 2010 $
+.Dd $Mdocdate: August 17 2011 $
.Dt PKG.CONF 5
.Os
.Sh NAME
@@ -52,6 +52,19 @@ Currently defined options are as follows:
Set to
.Ar yes
if you really want to use the full width of the terminal for the progressmeter.
+.It Ar loglevel
+.Xr pkg_add 1
+and
+.Xr pkg_delete 1
+will
+.Xr syslog 3
+installations, updates and deletions by default.
+Set to
+.Ar 0
+to avoid logging entirely.
+Levels higher than
+.Ar 1
+may log more information in the future.
.It Ar installpath
URL to package repository updated during installation.
Used for accessing packages if the environment variable
diff --git a/usr.sbin/pkg_add/pkg_add.1 b/usr.sbin/pkg_add/pkg_add.1
index 4bc394d60da..cf6326974a0 100644
--- a/usr.sbin/pkg_add/pkg_add.1
+++ b/usr.sbin/pkg_add/pkg_add.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pkg_add.1,v 1.109 2011/07/20 14:30:45 espie Exp $
+.\" $OpenBSD: pkg_add.1,v 1.110 2011/08/17 10:48:27 espie Exp $
.\"
.\" Documentation and design originally from FreeBSD. All the code has
.\" been rewritten since. We keep the documentation's notice:
@@ -15,7 +15,7 @@
.\" Jordan K. Hubbard
.\"
.\"
-.Dd $Mdocdate: July 20 2011 $
+.Dd $Mdocdate: August 17 2011 $
.Dt PKG_ADD 1
.Os
.Sh NAME
@@ -72,6 +72,15 @@ option
Details of packing-list internals are documented in
.Xr pkg_create 1 .
.Pp
+.Nm
+will
+.Xr syslog 3
+installations and updates by default
+.Po
+but see
+.Xr pkg.conf 5
+.Pc .
+.Pp
If a package is digitally signed:
.Bl -bullet
.It
diff --git a/usr.sbin/pkg_add/pkg_delete.1 b/usr.sbin/pkg_add/pkg_delete.1
index ec818c1c7e0..8f41eb941f8 100644
--- a/usr.sbin/pkg_add/pkg_delete.1
+++ b/usr.sbin/pkg_add/pkg_delete.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pkg_delete.1,v 1.40 2011/07/18 19:19:08 espie Exp $
+.\" $OpenBSD: pkg_delete.1,v 1.41 2011/08/17 10:48:27 espie Exp $
.\"
.\" Documentation and design originally from FreeBSD. All the code has
.\" been rewritten since. We keep the documentation's notice:
@@ -15,7 +15,7 @@
.\" Jordan K. Hubbard
.\"
.\"
-.Dd $Mdocdate: July 18 2011 $
+.Dd $Mdocdate: August 17 2011 $
.Dt PKG_DELETE 1
.Os
.Sh NAME
@@ -49,6 +49,15 @@ see
.Pc
can be omitted, unless the resulting specification is ambiguous.
.Pp
+.Nm
+will
+.Xr syslog 3
+deletions by default
+.Po
+but see
+.Xr pkg.conf 5
+.Pc .
+.Pp
The options are as follows:
.Bl -tag -width BB-pkg-destdir
.It Fl a