Browse Source

Ticket 47913 - remove-ds.pl should not remove /var/lib/dirsrv

Bug Description:  When removing the last instance, the remove-ds.pl
                  script is incorrectly removing the /var/lib/dirsrv
                  directory.

Fix Description:  Only /var/lock/dirsrv & /var/run/dirsrv have their
                  ownership changed during an install, so only these
                  directories need to be removed.  Also, changed this
                  cleanup code to be run only if there are no errors.

https://fedorahosted.org/389/ticket/47913

Reviewed by: nhosoi(Thanks!)
Mark Reynolds 10 years ago
parent
commit
afd7699f13
1 changed files with 5 additions and 7 deletions
  1. 5 7
      ldap/admin/src/scripts/DSCreate.pm.in

+ 5 - 7
ldap/admin/src/scripts/DSCreate.pm.in

@@ -1482,17 +1482,15 @@ sub removeDSInstance {
     # update systemd files
     push @errs, updateSystemD();
     
-    # remove /var/lock/dirsrv & /var/run/dirsrv if this was the last instance
-    if(!<$pkglockdir/*>){
-        rmdir $pkglockdir;
-        rmdir $pkgrundir;
-        rmdir $pkglibdir;
-    }
-    
     # if we got here, report success
     if (@errs) {
         debug(1, "Could not successfully remove $instname\n");
     } else {
+        if (!<$pkglockdir/*>){
+            # If this was the last instance, remove /var/lock/dirsrv & /var/run/dirsrv
+            rmdir $pkglockdir;
+            rmdir $pkgrundir;
+        }
         debug(1, "Instance $instname removed.\n");
     }