diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/network/tools.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/network/tools.pm b/lib/network/tools.pm index 951b445..c80c269 100644 --- a/lib/network/tools.pm +++ b/lib/network/tools.pm @@ -21,8 +21,14 @@ sub passwd_by_login { sub run_interface_command { my ($action, $intf, $detach) = @_; + my $have_perms = !$>; + if (!$have_perms) { + my $xxnet = {}; + network::network::read_net_conf($xxnet); + $have_perms = text2bool($xxnet->{ifcfg}{$intf}{USERCTL}); + } my @command = - !$> || system("/usr/sbin/usernetctl $intf report") == 0 ? + $have_perms ? ('/usr/sbin/if' . $action, $intf, if_(!$::isInstall, "daemon")) : ('/usr/bin/pkexec', '/usr/sbin/if' . $action, $intf); run_program::raw({ detach => $detach, root => $::prefix }, @command); |