2 # Copyright (C) 2019-2020 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # xcpdb: Xapian copy database, a wrapper around Xapian's copydatabase(1)
5 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
6 use PublicInbox::InboxWritable;
7 use PublicInbox::Xapcmd;
8 use PublicInbox::Admin;
9 PublicInbox::Admin::require_or_die('-search');
10 my $usage = "Usage: public-inbox-xcpdb [--compact] INBOX_DIR\n";
12 my @opt = (qw(compact reshard|R=i), @PublicInbox::Xapcmd::COMPACT_OPT);
13 GetOptions($opt, @opt) or die "bad command-line args\n$usage";
14 my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV) or die $usage;
16 my $ibx = PublicInbox::InboxWritable->new($_);
17 # we rely on --no-renumber to keep docids synched to NNTP
18 PublicInbox::Xapcmd::run($ibx, 'cpdb', $opt);