summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 }