summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-02-25 17:02:56 +0000
committerOlivier Blin <oblin@mandriva.org>2005-02-25 17:02:56 +0000
commit69cf8dea911b627e07125bd3f9787b77e99a0edf (patch)
treeab3b158f07d3321fae7fd2b29a48326678f9aa4d /perl-install
parent10cf26f329bfd5f2b2f921fcb1794ff1e4de62a5 (diff)
downloaddrakx-69cf8dea911b627e07125bd3f9787b77e99a0edf.tar
drakx-69cf8dea911b627e07125bd3f9787b77e99a0edf.tar.gz
drakx-69cf8dea911b627e07125bd3f9787b77e99a0edf.tar.bz2
drakx-69cf8dea911b627e07125bd3f9787b77e99a0edf.tar.xz
drakx-69cf8dea911b627e07125bd3f9787b77e99a0edf.zip
do not ask for root password if interface allows USERCTL
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/network/tools.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index 052b0d430..92fe5f1f6 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -73,14 +73,23 @@ sub bg_command_as_root {
}
}
+sub user_run_interface_command {
+ my ($command, $intf) = @_;
+ if (system("usernetctl $intf report") == 0) {
+ run_program::run("$command $intf &");
+ } else {
+ bg_command_as_root($command, $intf);
+ }
+}
+
sub start_interface {
my ($intf) = @_;
- bg_command_as_root('/sbin/ifup', $intf);
+ user_run_interface_command('/sbin/ifup', $intf);
}
sub stop_interface {
my ($intf) = @_;
- bg_command_as_root('/sbin/ifdown', $intf);
+ user_run_interface_command('/sbin/ifdown', $intf);
}
sub connected() { gethostbyname("mandrakesoft.com") ? 1 : 0 }