[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Fedora-directory-commits] ldapserver/ldap/admin/src/scripts DSMigration.pm.in, 1.6, 1.7



Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/admin/src/scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv4362

Modified Files:
	DSMigration.pm.in 
Log Message:
Resolves: #260341
Summary: Migration script references a non-existing directory (comment #5,#7)
Description: 3 more fixes for the with-fhs-opt case



Index: DSMigration.pm.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/DSMigration.pm.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DSMigration.pm.in	29 Aug 2007 16:33:40 -0000	1.6
+++ DSMigration.pm.in	29 Aug 2007 23:10:22 -0000	1.7
@@ -128,12 +128,22 @@
         return $oldval;
     }
     # otherwise, just use the new default locations
-    if ($objclasses{nsbackendinstance}) {
-        $newval = "@localstatedir@/lib/$mig->{pkgname}/$inst/db/$cn";
-    } elsif (lc $cn eq 'config') {
-        $newval = "@localstatedir@/lib/$mig->{pkgname}/$inst/db";
-    } elsif (lc $cn eq 'changelog5') {
-        $newval = "@localstatedir@/lib/$mig->{pkgname}/$inst/changelogdb";
+    if ("@with_fhs_opt@") {
+        if ($objclasses{nsbackendinstance}) {
+            $newval = "@localstatedir@/$mig->{pkgname}/$inst/db/$cn";
+        } elsif (lc $cn eq 'config') {
+            $newval = "@localstatedir@/$mig->{pkgname}/$inst/db";
+        } elsif (lc $cn eq 'changelog5') {
+            $newval = "@localstatedir@/$mig->{pkgname}/$inst/changelogdb";
+        }
+    } else {
+        if ($objclasses{nsbackendinstance}) {
+            $newval = "@localstatedir@/lib/$mig->{pkgname}/$inst/db/$cn";
+        } elsif (lc $cn eq 'config') {
+            $newval = "@localstatedir@/lib/$mig->{pkgname}/$inst/db";
+        } elsif (lc $cn eq 'changelog5') {
+            $newval = "@localstatedir@/lib/$mig->{pkgname}/$inst/changelogdb";
+        }
     }
     debug(2, "New value [$newval] for attr $attr in entry ", $ent->getDN(), "\n");
     return $newval;
@@ -142,8 +152,8 @@
 sub migrateCredentials {
     my ($ent, $attr, $mig, $inst) = @_;
     my $oldval = $ent->getValues($attr);
-    debug(3, "Executing migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c $oldval . . .\n");
-    my $newval = `migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c $oldval`;
+    debug(3, "Executing @bindir@/migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c $oldval . . .\n");
+    my $newval = ` bindir@/migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c $oldval`;
     debug(3, "Converted old value [$oldval] to new value [$newval] for attr $attr in entry ", $ent->getDN(), "\n");
     return $newval;
 }
@@ -230,7 +240,13 @@
     my $foundldif;
     for (glob("$mig->{oldsroot}/$inst/db/*.ldif")) {
         my $dbname = basename($_, '.ldif');
-        my $cmd = "@serverdir@/$inst/ldif2db -n \"$dbname\" -i \"$_\"";
+        my $cmd = "";
+        if ("@with_fhs_opt@") {
+            $cmd = "/opt/@PACKAGE_NAME@/$inst/ldif2db -n \"$dbname\" -i \"$_\"";
+        } else {
+            $cmd = "@serverdir@/$inst/ldif2db -n \"$dbname\" -i \"$_\"";
+        }
+
         debug(1, "migrateDatabases: executing command $cmd\n");
         $? = 0; # clear error condition
         my $output = `$cmd 2>&1`;
@@ -306,8 +322,14 @@
             debug(1, "old instance $cn dbdir $dir\n");
             my $srcdir = $dir || "$olddefault/db/$cn";
             my $newent = $dest->search($ent->getDN(), "base", "(objectclass=*)");
-            my $newdbdir = $newent->getValues('nsslapd-directory') ||
-                "@localstatedir@/lib/$mig->{pkgname}/$inst/db/$cn";
+            my $newdbdir = "";
+            if ("@with_fhs_opt@") {
+                $newdbdir = $newent->getValues('nsslapd-directory') ||
+                    "@localstatedir@/$mig->{pkgname}/$inst/db/$cn";
+            } else {
+                $newdbdir = $newent->getValues('nsslapd-directory') ||
+                    "@localstatedir@/lib/$mig->{pkgname}/$inst/db/$cn";
+            }
             if (-d $srcdir and ($srcdir !~ /^$olddefault/)) {
                 debug(2, "Not copying database indexes from [$srcdir]\n");
             } else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]