summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-06-05 17:15:33 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-06-05 17:15:33 +0000
commit57616925fbb1f05b1bd1397f3a3f4249c3f3a534 (patch)
tree7fe8f6b9e544cba344f4155c8fae2110b285d051
parent010776e5bc71d23652ec000b88fb812dd478e18e (diff)
move files after a discussion with Theo.
-rw-r--r--usr.sbin/pkg_add/Makefile8
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgCheck.pm (renamed from usr.sbin/pkg_add/OpenBSD/PkgFsck.pm)10
-rw-r--r--usr.sbin/pkg_add/pkg4
-rw-r--r--usr.sbin/pkg_add/pkg.16
-rw-r--r--usr.sbin/pkg_add/pkg_check.892
5 files changed, 106 insertions, 14 deletions
diff --git a/usr.sbin/pkg_add/Makefile b/usr.sbin/pkg_add/Makefile
index 0714ca11abe..a8b8ec0f8e3 100644
--- a/usr.sbin/pkg_add/Makefile
+++ b/usr.sbin/pkg_add/Makefile
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile,v 1.63 2010/06/05 12:30:36 espie Exp $
+# $OpenBSD: Makefile,v 1.64 2010/06/05 17:15:32 espie Exp $
.include <bsd.own.mk>
MAN1=pkg_add.1 pkg_info.1 pkg_create.1 pkg_delete.1 pkg_merge.1 \
pkg.1 pkg_mklocatedb.1
MAN5=package.5
-MAN8=pkg_fsck.8
+MAN8=pkg_check.8
MAN=${MAN1} ${MAN5} ${MAN8}
NOPROG=
@@ -43,10 +43,10 @@ PACKAGES= \
OpenBSD/Paths.pm \
OpenBSD/PkgAdd.pm \
OpenBSD/PkgCfl.pm \
+ OpenBSD/PkgCheck.pm \
OpenBSD/PkgConfig.pm \
OpenBSD/PkgCreate.pm \
OpenBSD/PkgDelete.pm \
- OpenBSD/PkgFsck.pm \
OpenBSD/PkgInfo.pm \
OpenBSD/PkgSpec.pm \
OpenBSD/ProgressMeter/Term.pm \
@@ -77,9 +77,9 @@ SCRIPTS= \
SCRIPTS_LNK = \
pkg pkg_add \
+ pkg pkg_check \
pkg pkg_create \
pkg pkg_delete \
- pkg pkg_fsck \
pkg pkg_info
LIBBASE=/usr/libdata/perl5
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgFsck.pm b/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm
index 7a1dd6ce3d5..854aa447a32 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgFsck.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgFsck.pm,v 1.3 2010/06/05 16:21:35 espie Exp $
+# $OpenBSD: PkgCheck.pm,v 1.1 2010/06/05 17:15:32 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -171,7 +171,7 @@ sub dump
&OpenBSD::Error::delayed_output;
}
-package OpenBSD::PkgFsck::State;
+package OpenBSD::PkgCheck::State;
our @ISA = qw(OpenBSD::AddCreateDelete::State);
sub init
@@ -191,7 +191,7 @@ sub log
}
}
-package OpenBSD::PkgFsck;
+package OpenBSD::PkgCheck;
our @ISA = qw(OpenBSD::AddCreateDelete);
use OpenBSD::PackageInfo;
@@ -401,9 +401,9 @@ sub parse_and_run
{
my $self = shift;
- my $state = OpenBSD::PkgFsck::State->new;
+ my $state = OpenBSD::PkgCheck::State->new;
$self->handle_options('fiq', $state,
- 'pkg_fsck [-fimnqvx] [-B pkg-destdir] [-D value]');
+ 'pkg_check [-fimnqvx] [-B pkg-destdir] [-D value]');
if (@ARGV != 0) {
Usage();
}
diff --git a/usr.sbin/pkg_add/pkg b/usr.sbin/pkg_add/pkg
index 4600086c178..e0cd0d9b57c 100644
--- a/usr.sbin/pkg_add/pkg
+++ b/usr.sbin/pkg_add/pkg
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg,v 1.15 2010/06/05 13:56:06 espie Exp $
+# $OpenBSD: pkg,v 1.16 2010/06/05 17:15:32 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@@ -30,7 +30,7 @@ sub run
$module->parse_and_run;
exit(0);
}
-my @l = qw(add create delete fsck info);
+my @l = qw(add check create delete info);
for my $i (@l) {
if ($0 =~ m/\/?pkg_$i$/) {
diff --git a/usr.sbin/pkg_add/pkg.1 b/usr.sbin/pkg_add/pkg.1
index 5658a08a03d..9a8ec952ce4 100644
--- a/usr.sbin/pkg_add/pkg.1
+++ b/usr.sbin/pkg_add/pkg.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pkg.1,v 1.7 2010/06/05 13:56:06 espie Exp $
+.\" $OpenBSD: pkg.1,v 1.8 2010/06/05 17:15:32 espie Exp $
.\"
.\" Copyright (c) 2010 Marc Espie <espie@openbsd.org>
.\"
@@ -24,9 +24,9 @@
.Nm
is the actual script that starts
.Xr pkg_add 1 ,
+.Xr pkg_check 8 ,
.Xr pkg_create 1 ,
.Xr pkg_delete 1 ,
-.Xr pkg_fsck 8 ,
and
.Xr pkg_info 1 .
.Pp
@@ -44,6 +44,6 @@ Refer to the documentation of those commands for further info.
.Xr pkg_create 1 ,
.Xr pkg_delete 1 ,
.Xr pkg_info 1 ,
-.Xr pkg_fsck 8
+.Xr pkg_check 8
.Sh AUTHORS
This program was written by Marc Espie.
diff --git a/usr.sbin/pkg_add/pkg_check.8 b/usr.sbin/pkg_add/pkg_check.8
new file mode 100644
index 00000000000..be23cb73d1b
--- /dev/null
+++ b/usr.sbin/pkg_add/pkg_check.8
@@ -0,0 +1,92 @@
+.\" $OpenBSD: pkg_check.8,v 1.1 2010/06/05 17:15:32 espie Exp $
+.\"
+.\" Copyright (c) 2010 Marc Espie <espie@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: June 5 2010 $
+.Dt PKG_CHECK 8
+.Os
+.Sh NAME
+.Nm pkg_check
+.Nd check consistency of installed packages
+.Sh SYNOPSIS
+.Nm pkg_check
+.Bk -words
+.Op Fl fimnqvx
+.Oo Fl D Ar name
+.Ns Oo Ns = Ns Ar value
+.Oc
+.Oc
+.Ek
+.Sh DESCRIPTION
+.Nm
+verifies as much information as it can about installed packages.
+.Pp
+.Nm
+is not needed under normal circumstances, but it can be used to recover after
+a catastrophic system failure in the middle of a
+.Xr pkg_add 1
+or
+.Xr pkg_delete 1 .
+.Pp
+.Nm
+performs the following checks:
+.Bl -tag -width small
+.It Packing-list sanity
+Checks that
+.Pa /var/db/pkg
+only contains directories, that each directory holds a packing-list,
+and that said packing-list is an actual packing-list that matches the directory.
+.It Files from packages
+Checks that each file or directory in those packing-lists actually exist,
+and that their checksum matches what's recorded in the packing-list.
+.El
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Xo
+.Fl D
+.Ar name Ns Op = Ns Ar value
+.Xc
+For consistency with other pkg commands.
+No relevant defines so far.
+.It Fl f
+Force the removal of bogus package information.
+.It Fl i
+Ask user whether to irrevocably remove bogus package information.
+.It Fl m
+Causes
+.Nm
+to always display the progress meter in cases it would not do so by default.
+.It Fl n
+Don't actually modify packages, just perform checks.
+.It Fl q
+Don't verify checksums for files, just check for their existence.
+.It Fl v
+Turn on verbose output.
+Several
+.Fl v
+may turn on more verbose output.
+.It Fl x
+Disable progress meter.
+.El
+.Sh SEE ALSO
+.Xr fsck 8
+.Sh AUTHORS
+This program was written by
+.An Marc Espie .
+.Sh BUGS
+Work in progress.
+More checks to be added.
+Use with caution.