diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2004-10-05 08:00:17 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2004-10-05 08:00:17 +0000 |
commit | f264e5e3a0c08ff0958f3f41b3be9a082d58988b (patch) | |
tree | 9bf789b70d9df8833ba9057fcea16febedb9a1a9 | |
parent | dd803c550a86c68ae14c0da7ac385a98c6d2e4a7 (diff) | |
download | drakx-f264e5e3a0c08ff0958f3f41b3be9a082d58988b.tar drakx-f264e5e3a0c08ff0958f3f41b3be9a082d58988b.tar.gz drakx-f264e5e3a0c08ff0958f3f41b3be9a082d58988b.tar.bz2 drakx-f264e5e3a0c08ff0958f3f41b3be9a082d58988b.tar.xz drakx-f264e5e3a0c08ff0958f3f41b3be9a082d58988b.zip |
write config in pure wizard mode
-rwxr-xr-x | perl-install/standalone/drakups | 14 |
1 files changed, 11 insertions, 3 deletions
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); } |