Commit 24fbab1e authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Fixes #3429 Added a -n option to keep ldif files after schema insertion

parent 72c200f8
......@@ -38,6 +38,7 @@ my $pathunset = 1;
my $continue = 0;
my @schemas = ();
my @gen_files = ();
my $delete_ldif = 1;
foreach my $arg ( @ARGV ) {
if (not defined $ldap_host_options) {
$ldap_host_options = $arg;
......@@ -58,6 +59,8 @@ foreach my $arg ( @ARGV ) {
$schemalist = 1;
} elsif ((lc($arg) eq '-o') || (lc($arg) eq '--options')) {
undef $ldap_host_options;
} elsif ((lc($arg) eq '-n') || (lc($arg) eq '--nodelete')) {
$delete_ldif = 0;
} elsif ((lc($arg) eq '-h') || (lc($arg) eq '--help')) {
} elsif ($schemalist) {
......@@ -227,8 +230,10 @@ sub insert_schema
sub remove_ldifs
foreach my $file (@gen_files) {
unlink "$file.ldif" or print "Could not delete $file.ldif\n";
if ($delete_ldif) {
foreach my $file (@gen_files) {
unlink "$file.ldif" or print "Could not delete $file.ldif\n";
......@@ -265,6 +270,7 @@ sub usage
-i, --insert : specify the schemas to insert
-l, --list : list inserted schemas
-m, --modify : modify exising inserted schemas
-n, --nodelete : do not delete generated ldifs at the end
-o, --options : set ldap options used (default is -Y EXTERNAL -H ldapi:///)
-c, --continue : continue on error(s)
......@@ -288,6 +294,7 @@ This program will insert the schema needed by FusionDirectory into the ldap serv
If -i is specified, insert the given list of schemas instead of the default list
If -m is specified, insert the given list of schemas, replacing already inserted versions of those schemas
If -l is specified, list inserted schemas
If -n is specified, generated ldifs file won’t be deleted after execution. Might be useful to understand errors.
If -c is specified, an error won’t stop the command from continuing with other insertions
You can use -o to give specifics options to give to ldap commands such as ldapmodify,
but beware that you won’t be able to see things like password prompts as the output of these commands is piped.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment