summaryrefslogtreecommitdiffstats
path: root/ldap/admin/src/scripts/remove-ds.pl.in
diff options
context:
space:
mode:
Diffstat (limited to 'ldap/admin/src/scripts/remove-ds.pl.in')
-rwxr-xr-xldap/admin/src/scripts/remove-ds.pl.in28
1 files changed, 12 insertions, 16 deletions
diff --git a/ldap/admin/src/scripts/remove-ds.pl.in b/ldap/admin/src/scripts/remove-ds.pl.in
index 1d10a91a..5eee37da 100755
--- a/ldap/admin/src/scripts/remove-ds.pl.in
+++ b/ldap/admin/src/scripts/remove-ds.pl.in
@@ -23,10 +23,14 @@ use strict;
use File::Basename;
use File::Path;
+use Getopt::Long;
use DSUtil;
use Resource;
use DSCreate qw(removeDSInstance);
+# process command line options
+Getopt::Long::Configure(qw(bundling)); # bundling allows -ddddd
+
my $res = new Resource("@propertydir@/setup-ds.res");
sub usage {
@@ -36,24 +40,16 @@ sub usage {
print(STDERR " -d - turn on debugging output\n");
}
-my $i = 0;
my $force = "";
my $instname = "";
+my $initconfig_dir = "";
-# load args from the command line
-while ($i <= $#ARGV) {
- if ( "$ARGV[$i]" eq "-f" ) {
- $force = 1;
- } elsif ("$ARGV[$i]" eq "-i") {
- $i++;
- $instname = $ARGV[$i];
- } elsif ("$ARGV[$i]" eq "-d") {
- $DSUtil::debuglevel++;
- } else {
- &usage; exit(1);
- }
- $i++;
-}
+GetOptions('help|h|?' => sub { &usage; exit(1); },
+ 'debug|d+' => \$DSUtil::debuglevel,
+ 'instance|i=s' => \$instname,
+ 'initconfig_dir|c=s' => \$initconfig_dir,
+ 'force|f' => \$force
+ );
# Make sure the instance name option was provided.
unless ($instname) {
@@ -67,7 +63,7 @@ unless ($inst) {
exit 1;
}
-my @errs = removeDSInstance($inst, $force);
+my @errs = removeDSInstance($inst, $force, $initconfig_dir);
if (@errs) {
print STDERR "The following errors occurred during removal:\n";
for (@errs) {