>From df9c1e3ccf533c929f928e9e236586ea19969b9c Mon Sep 17 00:00:00 2001
From: Nathan Kinder <nkinder@redhat.com>
Date: Thu, 29 Oct 2009 15:10:01 -0700
Subject: [PATCH] Make removeds.pl remove instance initconfig script

When removing an instance, we need to be sure to remove the
instance specific initconfig script.
---
 ldap/admin/src/scripts/DSCreate.pm.in |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in
index 43fd1d9..7155908 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -1109,6 +1109,16 @@ sub removeDSInstance {
     # Finally, config dir
     push @errs, remove_tree($entry, "nsslapd-schemadir", $instname, 1, "\.db\$");
 
+    # Remove the instance specific initconfig script
+    if ( -f "@initconfigdir@/@package_name@-$inst" ) {
+        my $rc = unlink("@initconfigdir@/@package_name@-$inst");
+        if ( 0 == $rc )
+        {
+            push @errs, [ 'error_removing_path', "@initconfigdir@/@package_name@-$inst", $! ];
+            debug(1, "Warning: @initconfigdir@/@package_name@-$inst was not removed. Error: $!\n");
+        }
+    }
+
     # remove the selinux label from the ports if needed
     if ("@with_selinux@") {
         foreach my $port (@{$entry->{"nsslapd-port"}}) 
-- 
1.6.2.5

