diff options
author | Olivier Thauvin <nanardon@mandriva.org> | 2005-02-20 21:15:50 +0000 |
---|---|---|
committer | Olivier Thauvin <nanardon@mandriva.org> | 2005-02-20 21:15:50 +0000 |
commit | 3729fdbd4c3a4e7b3eee7701f2bb732b02079e18 (patch) | |
tree | 4710b156a22f0dc642022adcbd7b2ff6a47c4be3 /dumpdistribconf | |
parent | 4272374dd952b9a5ef838789b65e946777e2c47d (diff) | |
download | rpmtools-3729fdbd4c3a4e7b3eee7701f2bb732b02079e18.tar rpmtools-3729fdbd4c3a4e7b3eee7701f2bb732b02079e18.tar.gz rpmtools-3729fdbd4c3a4e7b3eee7701f2bb732b02079e18.tar.bz2 rpmtools-3729fdbd4c3a4e7b3eee7701f2bb732b02079e18.tar.xz rpmtools-3729fdbd4c3a4e7b3eee7701f2bb732b02079e18.zip |
- initials release for managing mandrakelinux distro tree
Diffstat (limited to 'dumpdistribconf')
-rwxr-xr-x | dumpdistribconf | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/dumpdistribconf b/dumpdistribconf new file mode 100755 index 0000000..5161e2e --- /dev/null +++ b/dumpdistribconf @@ -0,0 +1,48 @@ +#!/usr/bin/perl + +# $Id$ + +use strict; +use Getopt::Long; +use Distribconf; + +sub usage { + print STDERR <<EOF +$0 -h|-m [options] path1 [path2 ...] +Dump mandrakelinux distrib configuration. + +-h output an hdlists file +-m output an media.cfg file +-d write the directly into the dedicated location +EOF +; +}; + +my ($out, $outputtype) = (\*STDOUT); + +GetOptions( + 'h' => sub { $outputtype = 'h' }, + 'm' => sub { $outputtype = 'm' }, + 'd' => sub { $out = undef; }, +); + +defined($outputtype) && @ARGV or do { + usage; + exit 1; +}; + +foreach (@ARGV) { + print STDERR "$_\n"; + my $d = Distribconf->new($_); + $d->load and do { + warn "Can't load configuration from $_\n"; + next; + }; + if ($outputtype eq 'h') { + $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"; + } +} + + |