summaryrefslogtreecommitdiffstats
path: root/ldap/admin/src/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'ldap/admin/src/scripts')
-rw-r--r--ldap/admin/src/scripts/DSMigration.pm.in17
-rw-r--r--ldap/admin/src/scripts/migrate-ds.res5
2 files changed, 13 insertions, 9 deletions
diff --git a/ldap/admin/src/scripts/DSMigration.pm.in b/ldap/admin/src/scripts/DSMigration.pm.in
index a0488e13..ff701d44 100644
--- a/ldap/admin/src/scripts/DSMigration.pm.in
+++ b/ldap/admin/src/scripts/DSMigration.pm.in
@@ -152,8 +152,8 @@ sub getNewDbDir {
sub migrateCredentials {
my ($ent, $attr, $mig, $inst) = @_;
my $oldval = $ent->getValues($attr);
- 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, "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;
}
@@ -235,18 +235,15 @@ sub migrateDatabases {
my $olddefault = "$mig->{actualsroot}/$inst/db"; # old default db home directory
my @errs;
+ # the ldif2db command will be in nsslapd-instancedir
+ my $cfgent = $dest->search("cn=config", "base", "(objectclass=*)");
+ my $inst_dir = $cfgent->getValues('nsslapd-instancedir');
# first, look for an LDIF file in that directory with the same name as the
# database
my $foundldif;
for (glob("$mig->{oldsroot}/$inst/db/*.ldif")) {
my $dbname = basename($_, '.ldif');
- my $cmd = "";
- if ("@with_fhs_opt@") {
- $cmd = "/opt/@PACKAGE_NAME@/$inst/ldif2db -n \"$dbname\" -i \"$_\"";
- } else {
- $cmd = "@serverdir@/$inst/ldif2db -n \"$dbname\" -i \"$_\"";
- }
-
+ my $cmd = "$inst_dir/ldif2db -n \"$dbname\" -i \"$_\"";
debug(1, "migrateDatabases: executing command $cmd\n");
$? = 0; # clear error condition
my $output = `$cmd 2>&1`;
@@ -259,6 +256,8 @@ sub migrateDatabases {
if ($foundldif) {
return (); # done - can do nothing else for cross-platform
+ } elsif ($mig->{crossplatform}) { # cross platform requires LDIF files
+ return ('ldif_required_for_cross_platform', "$mig->{oldsroot}/$inst/db");
}
# if no LDIF files, just copy over the database directories
diff --git a/ldap/admin/src/scripts/migrate-ds.res b/ldap/admin/src/scripts/migrate-ds.res
index 9629e9bd..05d1677d 100644
--- a/ldap/admin/src/scripts/migrate-ds.res
+++ b/ldap/admin/src/scripts/migrate-ds.res
@@ -17,3 +17,8 @@ error_copying_keydb = Could not copy the private key database file '%s' to '%s'.
error_copying_secmoddb = Could not copy the security module database file '%s' to '%s'. Error: %s\n
error_copying_pinfile = Could not copy the key database PIN file '%s' to '%s'. Error: %s\n
error_copying_certmap = Could not copy the client certificate mapping file '%s' to '%s'. Error: %s\n
+ldif_required_for_cross_platform = No LDIF files were found in %s.\n
+LDIF files are required in order to do cross platform migration. The\
+database files are not binary compatible, and the new databases must\
+be initialized from an LDIF export of the old databases. Please refer\
+to the migration instructions for help with how to do this.\n\n