ldap/admin/src/scripts/DSCreate.pm.in | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
New commits:
commit 56441c31d8709fdd5c9e45a0cfcaa1e9ec88532a
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri Aug 23 12:17:57 2013 -0400
Ticket 47394 - remove-ds.pl should remove /var/lock/dirsrv
Bug Description: Once a DS instance has been created, /var/lock/dirsrv,
/var/lib/dirsrv, and /var/run/dirsrv
are owned by the user that was specified when the instance was
created. Then remove this
single instance, and create a new instance that runs as a different
user. The install will fail.
Fix Description: When removing the last instance on the machine, remove the
/var/lock|run|lib/dirsrv/ directories.
https://fedorahosted.org/389/ticket/47394
Reviewed by: richm(Thanks!)
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in
b/ldap/admin/src/scripts/DSCreate.pm.in
index cc00bb3..7835c41 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -1274,7 +1274,10 @@ sub removeDSInstance {
my @errs;
my $initconfig = "$initconfig_dir/@package_name@-$inst";
-
+ my $pkglockdir = "@localstatedir@/lock/@package_name@";
+ my $pkgrundir = "@localstatedir@/run/@package_name@";
+ my $pkglibdir = "@localstatedir@/lib/@package_name@";
+
# Get the configdir, rundir and product_name from the instance initconfig script.
unless(open(INFILE, $initconfig)) {
return ( [ 'error_no_such_instance', $instname, $! ] );
@@ -1454,7 +1457,14 @@ 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");