summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_add/pkg_mklocatedb
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2012-05-08 10:54:43 +0000
committerespie <espie@openbsd.org>2012-05-08 10:54:43 +0000
commit2e57bdf9df45519a61abb759571d6fc74f22c797 (patch)
tree9235cbba316bdf636a6fbeaeea3256e9966d1e3a /usr.sbin/pkg_add/pkg_mklocatedb
parentrename espxforms to ipsecxforms for clarity (diff)
downloadwireguard-openbsd-2e57bdf9df45519a61abb759571d6fc74f22c797.tar.xz
wireguard-openbsd-2e57bdf9df45519a61abb759571d6fc74f22c797.zip
add an extra check to avoid out-of-synch
Diffstat (limited to 'usr.sbin/pkg_add/pkg_mklocatedb')
-rw-r--r--usr.sbin/pkg_add/pkg_mklocatedb15
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/pkg_mklocatedb b/usr.sbin/pkg_add/pkg_mklocatedb
index 3a63c13e306..82c0fe7158e 100644
--- a/usr.sbin/pkg_add/pkg_mklocatedb
+++ b/usr.sbin/pkg_add/pkg_mklocatedb
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org>
-# $OpenBSD: pkg_mklocatedb,v 1.33 2012/04/29 08:46:02 espie Exp $
+# $OpenBSD: pkg_mklocatedb,v 1.34 2012/05/08 10:54:43 espie Exp $
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -31,8 +31,8 @@ sub handle_options
{
my $state = shift;
$state->{no_exports} = 1;
- $state->SUPER::handle_options('ad:nqs:x:r:p:P',
- '[-anPq] [-d repository] [-p portsdir] [-r release] [-s src] ',
+ $state->SUPER::handle_options('aCd:nqs:x:r:p:P',
+ '[-aCnPq] [-d repository] [-p portsdir] [-r release] [-s src] ',
'[-x X11src] [pkg-name [...]]');
$state->{srcdir} = $state->opt('s');
$state->{xdir} = $state->opt('x');
@@ -43,6 +43,12 @@ sub handle_options
$state->{pkgpath} = $state->opt('P');
$state->{allinfo} = $state->opt('a');
$state->{nopipe} = $state->opt('n');
+ $state->{check} = $state->opt('C');
+ if ($state->{check}) {
+ unless ($state->{srcdir} or $state->{portsdir}) {
+ $state->usage("-C without -s dir or -x dir");
+ }
+ }
}
@@ -135,6 +141,9 @@ sub do_source
while (my $e = <$l>) {
chomp $e;
$e =~ s/^\.//;
+ if ($state->{check} && !-e $e) {
+ $state->fatal("Couldn't find #1 from set #2:\n\tsrc and installation out of synch ?", $e, $f);
+ }
print {$state->{out}} "$tag:$e\n";
$output = 1;
}