diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2012-05-08 10:54:44 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2012-05-08 10:54:44 +0000 |
commit | e431f49d99876a3d64a76ceabc4aaa0239433fb1 (patch) | |
tree | 2f83fef741a76d6f9333ad098a87a1fe9cc11659 /usr.sbin/pkg_add/pkg_mklocatedb | |
parent | c2c8ecf451bc0966d52799e3d7674406d71fcec8 (diff) |
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_mklocatedb | 15 |
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; } |