aboutsummaryrefslogtreecommitdiffstats
path: root/BCD
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-12-05 23:59:47 +0000
committerRomain d'Alverny <rda@mageia.org>2011-12-05 23:59:47 +0000
commit3d84db11d5fe3c80db7a3b01f1d80dc4476c4abf (patch)
tree939c7a1e68d56c654075ee70695eaf37df53d855 /BCD
parentba4b09cd99276aa8cc27316a38f85eb2c6754f1b (diff)
downloadbcd-3d84db11d5fe3c80db7a3b01f1d80dc4476c4abf.tar
bcd-3d84db11d5fe3c80db7a3b01f1d80dc4476c4abf.tar.gz
bcd-3d84db11d5fe3c80db7a3b01f1d80dc4476c4abf.tar.bz2
bcd-3d84db11d5fe3c80db7a3b01f1d80dc4476c4abf.tar.xz
bcd-3d84db11d5fe3c80db7a3b01f1d80dc4476c4abf.zip
can use YAML for config too
Diffstat (limited to 'BCD')
-rw-r--r--BCD/Common.pm13
1 files changed, 12 insertions, 1 deletions
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};