+PublicInbox::Admin::do_chdir(delete $opt->{C});
+
+my $cfg = PublicInbox::Config->new; # Config is loaded by Admin
+$opt->{-use_cwd} = 1;
+my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg);
+PublicInbox::Admin::require_or_die('-index');
+unless (@ibxs) { print STDERR $help; exit 1 }
+
+my (@eidx, %eidx_seen);
+my $update_extindex = $opt->{'update-extindex'};
+if (!scalar(@$update_extindex) && (my $ALL = $cfg->ALL)) {
+ # extindex and normal inboxes may have different owners
+ push(@$update_extindex, 'all') if -w $ALL->{topdir};
+}
+@$update_extindex = () if $opt->{'no-update-extindex'};
+if (scalar @$update_extindex) {
+ PublicInbox::Admin::require_or_die('-search');
+ require PublicInbox::ExtSearchIdx;
+}
+for my $ei_name (@$update_extindex) {
+ my $es = $cfg->lookup_ei($ei_name);
+ my $topdir;
+ if (!$es && -d $ei_name) { # allow dirname or config section name
+ $topdir = $ei_name;
+ } elsif ($es) {
+ $topdir = $es->{topdir};
+ } else {
+ die "extindex `$ei_name' not configured or found\n";
+ }
+ my $o = { %$opt };
+ delete $o->{indexlevel} if ($o->{indexlevel}//'') eq 'basic';
+ $eidx_seen{$topdir} //=
+ push(@eidx, PublicInbox::ExtSearchIdx->new($topdir, $o));
+}