summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2007-03-19 23:01:39 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2007-03-19 23:01:39 +0000
commit3483034ff323c55dc321ae0d63e81f6d2a283e29 (patch)
tree3d46351a1efa7ce2eb0bec0bbe9a7a006481f0e8
parentc61b588e27728e13f8a950783c258605db85989f (diff)
downloadds-3483034ff323c55dc321ae0d63e81f6d2a283e29.tar.gz
ds-3483034ff323c55dc321ae0d63e81f6d2a283e29.tar.xz
ds-3483034ff323c55dc321ae0d63e81f6d2a283e29.zip
Resolves: #233027
Summary: make db2bak.pl & db2ldif.pl user more user-friendly
-rw-r--r--ldap/admin/src/scripts/template-db2bak.pl.in1
-rw-r--r--ldap/admin/src/scripts/template-db2ldif.pl.in20
2 files changed, 18 insertions, 3 deletions
diff --git a/ldap/admin/src/scripts/template-db2bak.pl.in b/ldap/admin/src/scripts/template-db2bak.pl.in
index 1a921f4c..960ed3de 100644
--- a/ldap/admin/src/scripts/template-db2bak.pl.in
+++ b/ldap/admin/src/scripts/template-db2bak.pl.in
@@ -118,6 +118,7 @@ if ($verbose != 0) { $vstr = "-v"; }
$ENV{'PATH'} = "$prefix@ldapsdk_bindir@:$prefix/usr/bin:@ldapsdk_bindir@:/usr/bin";
$ENV{'LD_LIBRARY_PATH'} = "$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib";
$ENV{'SHLIB_PATH'} = "$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib";
+print("Back up directory: $archivedir\n");
open(FOO, "| ldapmodify $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
print(FOO "$entry");
close(FOO);
diff --git a/ldap/admin/src/scripts/template-db2ldif.pl.in b/ldap/admin/src/scripts/template-db2ldif.pl.in
index 15f7bac0..3e3fa4b6 100644
--- a/ldap/admin/src/scripts/template-db2ldif.pl.in
+++ b/ldap/admin/src/scripts/template-db2ldif.pl.in
@@ -195,22 +195,32 @@ if (($instances[0] eq "" && $included[0] eq "") || $rootdn eq "" || $passwd eq "
($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time);
$mn++; $yr += 1900;
$taskname = "export_${yr}_${mn}_${dy}_${h}_${m}_${s}";
-if ($ldiffile eq "") {
- $ldiffile = "${ldifdir}{{SEP}}${servid}-${yr}_${mn}_${dy}_${h}_${m}_${s}.ldif";
-}
$dn = "dn: cn=$taskname, cn=export, cn=tasks, cn=config\n";
$misc = "changetype: add\nobjectclass: top\nobjectclass: extensibleObject\n";
$cn = "cn: $taskname\n";
$i = 0;
+$be = "";
$nsinstance = "";
while ("" ne "$instances[$i]") {
$nsinstance = "${nsinstance}nsInstance: $instances[$i]\n";
+ if ( "" eq "$be" ) {
+ $be = "$instances[$i]";
+ } else {
+ $be = "${be}-$instances[$i]";
+ }
$i++;
}
$i = 0;
$nsincluded = "";
while ("" ne "$included[$i]") {
$nsincluded = "${nsincluded}nsIncludeSuffix: $included[$i]\n";
+ my ($rdn, $rest) = split(/,/, $included[$i]);
+ my ($rest, $tmpbe) = split(/=/, $rdn);
+ if ( "" eq "$be" ) {
+ $be = "$tmpbe";
+ } else {
+ $be = "${be}-$tmpbe";
+ }
$i++;
}
$i = 0;
@@ -219,6 +229,9 @@ while ("" ne "$excluded[$i]") {
$nsexcluded = "${nsexcluded}nsExcludeSuffix: $excluded[$i]\n";
$i++;
}
+if ($ldiffile eq "") {
+ $ldiffile = "${ldifdir}{{SEP}}${servid}-${be}-${yr}_${mn}_${dy}_${h}_${m}_${s}.ldif";
+}
$nsreplica = "";
if ($doreplica != 0) { $nsreplica = "nsExportReplica: true\n"; }
$nsnobase64 = "";
@@ -245,6 +258,7 @@ if ($verbose != 0) { $vstr = "-v"; }
$ENV{'PATH'} = "$prefix@ldapsdk_bindir@:$prefix/usr/bin:@ldapsdk_bindir@:/usr/bin";
$ENV{'LD_LIBRARY_PATH'} = "$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib";
$ENV{'SHLIB_PATH'} = "$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib";
+print("Exported ldif file: ${ldiffile}\n");
open(FOO, "| ldapmodify $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
print(FOO "$entry");
close(FOO);