diff options
| author | Noriko Hosoi <nhosoi@redhat.com> | 2007-08-29 23:10:22 +0000 |
|---|---|---|
| committer | Noriko Hosoi <nhosoi@redhat.com> | 2007-08-29 23:10:22 +0000 |
| commit | f02c1e31978b7828e38b9be3c88b7f08b7959c07 (patch) | |
| tree | 1509f01e7d969a57b5752a22ab21ed5fc91af33b /ldap/admin/src/scripts | |
| parent | a37d2807f559f1ccbe5923a2c7e4f5efae0dc8f1 (diff) | |
| download | ds-f02c1e31978b7828e38b9be3c88b7f08b7959c07.tar.gz ds-f02c1e31978b7828e38b9be3c88b7f08b7959c07.tar.xz ds-f02c1e31978b7828e38b9be3c88b7f08b7959c07.zip | |
Resolves: #260341
Summary: Migration script references a non-existing directory (comment #5,#7)
Description: 3 more fixes for the with-fhs-opt case
Diffstat (limited to 'ldap/admin/src/scripts')
| -rw-r--r-- | ldap/admin/src/scripts/DSMigration.pm.in | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/ldap/admin/src/scripts/DSMigration.pm.in b/ldap/admin/src/scripts/DSMigration.pm.in index 325aa903..a0488e13 100644 --- a/ldap/admin/src/scripts/DSMigration.pm.in +++ b/ldap/admin/src/scripts/DSMigration.pm.in @@ -128,12 +128,22 @@ sub getNewDbDir { 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 getNewDbDir { 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 @@ sub migrateDatabases { 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 @@ sub migrateDatabases { 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 { |
