diff options
Diffstat (limited to 'dumpdistribconf')
-rwxr-xr-x | dumpdistribconf | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/dumpdistribconf b/dumpdistribconf index 7652adc..5ea82b2 100755 --- a/dumpdistribconf +++ b/dumpdistribconf @@ -4,10 +4,10 @@ use strict; use Getopt::Long; -use Distribconf; +use Distribconf::Build; sub usage { - print STDERR <<EOF + print STDERR <<EOF; $0 -h|-m [options] path1 [path2 ...] Dump Mandriva Linux distrib configuration. @@ -15,34 +15,30 @@ Dump Mandriva Linux distrib configuration. -m output an media.cfg file -d write the directly into the dedicated location EOF -; + exit 1; }; -my ($out, $outputtype) = (\*STDOUT); - +my ($out, $outputtype) = (\*STDOUT, 'm'); GetOptions( - 'h' => sub { $outputtype = 'h' }, - 'm' => sub { $outputtype = 'm' }, - 'd' => sub { $out = undef; }, + h => sub { $outputtype = 'h' }, + m => sub { $outputtype = 'm' }, + d => sub { undef $out }, ); -defined($outputtype) && @ARGV or do { - usage; - exit 1; -}; +@ARGV or usage; foreach (@ARGV) { - print STDERR "$_\n"; - my $d = Distribconf->new($_); + print "Using root $_...\n"; + my $d = Distribconf::Build->new($_); $d->load and do { - warn "Can't load configuration from $_\n"; - next; + warn "Can't load configuration from $_\n"; + next; }; if ($outputtype eq 'h') { - $d->write_hdlists($out) or warn "Can't write hdlists file\n"; + $d->write_hdlists($out) or warn "Can't write hdlists file\n"; } else { - $d->write_mediacfg($out) or warn "Can't write media.cfg file\n"; + $d->write_mediacfg($out) or warn "Can't write media.cfg file\n"; } } - +__END__ |