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/80upgradednformat.pl (renamed from ldap/admin/src/scripts/91upgradednformat.pl)41
-rw-r--r--ldap/admin/src/scripts/90subtreerename.pl6
2 files changed, 36 insertions, 11 deletions
diff --git a/ldap/admin/src/scripts/91upgradednformat.pl b/ldap/admin/src/scripts/80upgradednformat.pl
index 611f1e0d..cb44b852 100644
--- a/ldap/admin/src/scripts/91upgradednformat.pl
+++ b/ldap/admin/src/scripts/80upgradednformat.pl
@@ -15,15 +15,21 @@ use File::Copy;
sub runinst {
my ($inf, $inst, $dseldif, $conn) = @_;
- # First, check if the server is up or down.
- if ($conn->isa("Mozilla::LDAP::Conn")) {
- # The server is up, we do nothing.
- return ();
- }
-
my @errs;
my $config = "cn=config";
+ my $config_entry = $conn->search($config, "base", "(cn=*)");
+ if (!$config_entry) {
+ return ("error_no_configuration_entry", $!);
+ }
+ # First, check if the server is up or down.
+ my $rundir = $config_entry->getValues('nsslapd-rundir');
+
+ # Check if the server is up or not
+ my $pidfile = $rundir . "/" . $inst . ".pid";
+ if (-e $pidfile) {
+ return (); # server is running; do nothing.
+ }
my $mappingtree = "cn=mapping tree,cn=config";
my $ldbmbase = "cn=ldbm database,cn=plugins,cn=config";
@@ -33,6 +39,22 @@ sub runinst {
return ("error_no_mapping_tree_entries", $!);
}
+ my $db_config_entry =
+ $conn->search("cn=config,cn=ldbm database,cn=plugins,cn=config",
+ "base", "(objectclass=*)");
+ if (!$db_config_entry) {
+ return ('error_finding_config_entry',
+ 'cn=config,cn=ldbm database,cn=plugins,cn=config',
+ $conn->getErrorString());
+ }
+ # If subtree rename swich is not found in the config file,
+ # set off to the switch and upgrade dn format using entrydn.
+ my $switch = $db_config_entry->getValues('nsslapd-subtree-rename-switch');
+ if ("" eq $switch) {
+ $db_config_entry->addValue('nsslapd-subtree-rename-switch', "off");
+ $conn->update($db_config_entry);
+ }
+
# If a suffix in the mapping tree is doube-quoted and
# the cn value has only the double-quoted value, e.g.
# dn: cn="dc=example,dc=com",cn=mapping tree,cn=config
@@ -62,10 +84,6 @@ sub runinst {
$mtentry = $conn->nextEntry();
}
- my $config_entry = $conn->search($config, "base", "(cn=*)", 0, ("nsslapd-instancedir"));
- if (!$config_entry) {
- return ("error_no_configuration_entry", $!);
- }
my $instancedir = $config_entry->{"nsslapd-instancedir"}[0];
my $upgradednformat = $instancedir . "/upgradednformat";
@@ -107,7 +125,8 @@ sub runinst {
my $rc = 0;
if (system("cd $pdbdir; tar cf - db/DBVERSION | (cd $dbinstdir; tar xf -)") ||
- system("cd $pdbdir; tar cf - db/$instname/{DBVERSION,*.db4} | (cd $dbinstdir; tar xf -)")) {
+ system("cd $pdbdir; tar cf - db/$instname/DBVERSION | (cd $dbinstdir; tar xf -)") ||
+ system("cd $pdbdir; tar cf - db/$instname/*.db4 | (cd $dbinstdir; tar xf -)")) {
push @errs, ["error_cant_backup_db", $backend, $!];
return @errs;
}
diff --git a/ldap/admin/src/scripts/90subtreerename.pl b/ldap/admin/src/scripts/90subtreerename.pl
index e4746d7b..d9e1d37a 100644
--- a/ldap/admin/src/scripts/90subtreerename.pl
+++ b/ldap/admin/src/scripts/90subtreerename.pl
@@ -37,6 +37,7 @@ sub runinst {
} elsif ("off" eq $switch || "OFF" eq $switch) {
$ent1->setValues('nsslapd-subtree-rename-switch', "on");
$need_update = 1;
+ $conn->update($ent1);
}
if (1 == $need_update) {
@@ -46,6 +47,11 @@ sub runinst {
my $prog = $instdir . "/dn2rdn";
my $output = `$prog 2>&1`;
my $stat = $?;
+
+ if (0 != $stat) {
+ $ent1->setValues('nsslapd-subtree-rename-switch', "off");
+ $conn->update($ent1);
+ }
}
return ();