From f264e5e3a0c08ff0958f3f41b3be9a082d58988b Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 5 Oct 2004 08:00:17 +0000 Subject: write config in pure wizard mode --- perl-install/standalone/drakups | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'perl-install') diff --git a/perl-install/standalone/drakups b/perl-install/standalone/drakups index 30f07ffa4..1e751c4e3 100755 --- a/perl-install/standalone/drakups +++ b/perl-install/standalone/drakups @@ -28,13 +28,19 @@ sub writeconf() { log::explanations("Updating NUT configuration accordingly"); $struct->writeConf($files{devices}); - log::explanations("Updating NUT users configuration accordingly"); - $users->writeConf($files{users}); + if ($users) { + log::explanations("Updating NUT users configuration accordingly"); + $users->writeConf($files{users}); + } require services; services::restart("upsd"); } +sub read_nut_config() { + $struct = Libconf::Glueconf::NUT::Ups_conf->new($files{devices}) +} + sub readDriversList() { my (%ups, @ups); local $_; @@ -251,7 +257,7 @@ my @pages = ( remove => sub { }, }, load => sub { - $struct = Libconf::Glueconf::NUT::Ups_conf->new($files{devices}); + read_nut_config(); map { [ $_, @{$struct->{$_}}{qw(driver port)} ] } keys %$struct; }, id => "ups", @@ -310,7 +316,9 @@ $ugtk2::wm_icon = "drakups"; $in->do_pkgs->ensure_is_installed('nut-server', '/etc/rc.d/init.d/upsd') if !$::testing; if (any { $_ eq '--wizard' } @ARGV) { + read_nut_config(); add_device_wizard($in, $struct); + writeconf(); $in->exit($@ ? 1 : 0); } -- cgit v1.2.1