summaryrefslogtreecommitdiffstats
path: root/draklive
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-10-28 20:19:41 +0000
committerOlivier Blin <oblin@mandriva.com>2008-10-28 20:19:41 +0000
commite40ef60401883d797a8772911bb0af92f17ff3ff (patch)
treed1cd938705aaa6e2d1dc535995b813fc3c1ebf56 /draklive
parent96b292695b3793e20ffc642c7cefa67cd3128448 (diff)
downloaddrakiso-e40ef60401883d797a8772911bb0af92f17ff3ff.tar
drakiso-e40ef60401883d797a8772911bb0af92f17ff3ff.tar.gz
drakiso-e40ef60401883d797a8772911bb0af92f17ff3ff.tar.bz2
drakiso-e40ef60401883d797a8772911bb0af92f17ff3ff.tar.xz
drakiso-e40ef60401883d797a8772911bb0af92f17ff3ff.zip
add MDV::Draklive::Live object and use it
Diffstat (limited to 'draklive')
-rwxr-xr-xdraklive26
1 files changed, 14 insertions, 12 deletions
diff --git a/draklive b/draklive
index e70115d..547206f 100755
--- a/draklive
+++ b/draklive
@@ -37,6 +37,7 @@ use IPC::Open3;
use IO::Select;
use IO::Handle;
use MDV::Draklive::Utils;
+use MDV::Draklive::Live;
my $dir_distrib_sqfs = {
mountpoint => '/distrib',
@@ -1959,39 +1960,40 @@ my @all = qw(install boot loop master image replicator);
die "you must be root to run this program\n" if $>;
-my (%live, %opts);
+my $live_object = 'MDV::Draklive::Live'->new;
+my %opts;
my $config_root = '/etc/draklive';
my $config_path = 'config/live.cfg';
my $settings_path = 'config/settings.cfg';
GetOptions(
"help" => sub { Pod::Usage::pod2usage('-verbose' => 1) },
- "copy-wizard" => \$live{copy_wizard},
+ "copy-wizard" => \$live_object->{copy_wizard},
"boot-only" => \$opts{boot_only},
"boot-image=s" => sub { $opts{boot} = $_[1]; $opts{boot_only} = 1 },
"all" => sub { $_->{to_run} = 1 foreach grep { member($_->{name}, @all) } @actions },
(map { $_->{name} => \$_->{to_run} } @actions),
"device=s" => sub { $opts{device} = $_[1] },
- "all-regions" => sub { $live{all_regions} = 1 },
+ "all-regions" => sub { $live_object->{all_regions} = 1 },
"config-root=s" => \$config_root,
"config=s" => \$config_path,
"settings=s" => \$settings_path,
- "define=s" => \%{$live{settings}},
+ "define=s" => \%{$live_object->{settings}},
) or Pod::Usage::pod2usage();
require standalone;
-if ($live{copy_wizard}) {
- copy_wizard(\%live);
+if ($live_object->{copy_wizard}) {
+ copy_wizard($live_object);
} else {
every { !$_->{to_run} } @actions and Pod::Usage::pod2usage();
- read_config(\%live, $config_root, $config_path, $settings_path);
- check_config(\%live);
- complete_config(\%live);
- foreach my $region ($live{all_regions} ? sort(keys %{$live{regions}}) : $live{settings}{region}) {
+ read_config($live_object, $config_root, $config_path, $settings_path);
+ check_config($live_object);
+ complete_config($live_object);
+ foreach my $region ($live_object->{all_regions} ? sort(keys %{$live_object->{regions}}) : $live_object->{settings}{region}) {
$region and print qq(=== proceeding with region "$region"\n);
- $live{settings}{region} = $region;
+ $live_object->{settings}{region} = $region;
foreach (grep { $_->{to_run} } @actions) {
print qq(* entering step "$_->{name}"\n);
- $_->{do}->(\%live, \%opts);
+ $_->{do}->($live_object, \%opts);
print qq(* step "$_->{name}" done\n);
}
}