Commit 0e65a2bf authored by Yadd's avatar Yadd
Browse files

New utility to migrate from <0.9.5 to >=0.9.5

parent 578d0a0d
use strict;
use Getopt::Long;
use Config::IniFiles;
our %opts;
use Lemonldap::NG::Common::Conf::Constants;
$opts{dir} ||= '/etc/lemonldap-ng';
my $old = {storage => $opts{storage} || "$opts{dir}/storage.conf",
apply => $opts{apply} || "$opts{dir}/apply.conf",
my $new = $opts{ini} || "$opts{dir}/lemonldap-ng.ini";
my $datas;
-r $old->{storage} or quit(2,"$old->{storage} is not readeable");
open F, $old->{storage};
next if(/^\s*(?:#.*)?$/);
my($k,$v)=(/^(\w+)\s*=\s*(.*)$/) or quit(3,"bad line in $old->{storage}:$_");
close F;
if(-e $old->{apply}){
open F,$old->{apply};
next if(/^\s*(?:#.*)?$/);
my($k,$v)=(/^([\w\.\-]+)\s+(.*)$/) or quit(3,"bad line in $old->{apply}:$_");
close F;
if(-e $new){
-w $new or quit(4,"$new is not writeable");
my $conf = Config::IniFiles->new(-file=>$new);
sub quit {
print STDERR "$_[1]\n";
exit $_[0];
Supports Markdown
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