/usr/sbin/remove-ds is in 389-ds-base 1.3.4.9-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #!/usr/bin/env perl
# BEGIN COPYRIGHT BLOCK
# Copyright (C) 2013 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# END COPYRIGHT BLOCK
#
use strict;
use lib qw(/usr/lib/x86_64-linux-gnu/dirsrv/perl);
use Getopt::Long;
use Resource;
use DSCreate qw(removeDSInstance);
# process command line options
Getopt::Long::Configure(qw(bundling)); # bundling allows -ddddd
my $res = new Resource("/usr/share/dirsrv/properties/setup-ds.res");
sub usage {
print(STDERR "Usage: $0 [-a] [-f] [-d -d ... -d] -i instance\n\n");
print(STDERR " Opts: -a - remove all\n");
print(STDERR " -f - force removal\n");
print(STDERR " -i instance - instance name to remove (e.g. - slapd-example)\n");
print(STDERR " -d - turn on debugging output\n");
}
my $force = "";
my $instname = "";
my $initconfig_dir = "";
my $all = "";
GetOptions('help|h|?' => sub { &usage; exit(0); },
'debug|d+' => \$DSUtil::debuglevel,
'instance|i=s' => \$instname,
'initconfig_dir|c=s' => \$initconfig_dir,
'force|f' => \$force,
'all|a' => \$all
);
# Make sure the instance name option was provided.
unless ($instname) {
&usage; exit(1);
}
# Make sure a full instance name was provided.
my ($slapd, $inst) = split(/-/, $instname, 2);
unless ($inst) {
print STDERR "Full instance name must be specified (e.g. - slapd-example)\n";
exit 1;
}
my @errs = removeDSInstance($inst, $force, $all, $initconfig_dir);
if (@errs) {
print STDERR "The following errors occurred during removal:\n";
for (@errs) {
print STDERR $res->getText($_);
}
print STDERR "Error: could not remove directory server $inst\n";
exit 1;
}
# if we got here, report success
print "Instance $instname removed.\n";
exit 0;
# emacs settings
# Local Variables:
# mode:perl
# indent-tabs-mode: nil
# tab-width: 4
# End:
|