From 3d84db11d5fe3c80db7a3b01f1d80dc4476c4abf Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Mon, 5 Dec 2011 23:59:47 +0000 Subject: can use YAML for config too --- BCD/Common.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'BCD') diff --git a/BCD/Common.pm b/BCD/Common.pm index 5b6e538..ac91081 100644 --- a/BCD/Common.pm +++ b/BCD/Common.pm @@ -2,10 +2,12 @@ package BCD::Common; use strict; use XML::Simple; +use YAML; use MDK::Common; use Term::ANSIColor; use File::Copy::Recursive qw(dircopy pathrm); use File::Glob ':glob'; +use File::basename use BCD::Bcd qw(:DEFAULT); @@ -34,8 +36,17 @@ if (!$ARGV[0]) { print_color("###\nstagex isolinux clean media gendistrib rpmcheck list mediarepo checkrepo all\nmd5 resign clean doble nodoble kernel info iso verbose\n###", $color); whereisthedoc; } + our $conf_file = $ARGV[0]; -our $isoconf = XMLin($conf_file, keyattr => ['']); +our $isoconf = undef; + +if ($conf_file =~ /\.xml$/i) { + $isoconf = XMLin($conf_file, keyattr => ['']); +} elsif ($file =~ /\.yaml$/i) { + $isoconf = YAML::LoadFile($conf_file); +} else { + print_color("You must provide an XML or YAML config file", $color) and exit 1; +} our $DISTRIB = $isoconf->{theme}{name}; our $THEME = $isoconf->{theme}{theme}; -- cgit v1.2.1