diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-02-25 17:02:56 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-02-25 17:02:56 +0000 |
commit | 69cf8dea911b627e07125bd3f9787b77e99a0edf (patch) | |
tree | ab3b158f07d3321fae7fd2b29a48326678f9aa4d /perl-install/network/tools.pm | |
parent | 10cf26f329bfd5f2b2f921fcb1794ff1e4de62a5 (diff) | |
download | drakx-backup-do-not-use-69cf8dea911b627e07125bd3f9787b77e99a0edf.tar drakx-backup-do-not-use-69cf8dea911b627e07125bd3f9787b77e99a0edf.tar.gz drakx-backup-do-not-use-69cf8dea911b627e07125bd3f9787b77e99a0edf.tar.bz2 drakx-backup-do-not-use-69cf8dea911b627e07125bd3f9787b77e99a0edf.tar.xz drakx-backup-do-not-use-69cf8dea911b627e07125bd3f9787b77e99a0edf.zip |
do not ask for root password if interface allows USERCTL
Diffstat (limited to 'perl-install/network/tools.pm')
-rw-r--r-- | perl-install/network/tools.pm | 13 |
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 } |