From 6f1ed90759071c111c7540d1e3841cabd4ef78b0 Mon Sep 17 00:00:00 2001 From: htrgouvea Date: Fri, 7 Jun 2024 13:24:57 -0300 Subject: [PATCH] replace commands and start to use the package --- lib/Nipe/Utils/Install.pm | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/Nipe/Utils/Install.pm b/lib/Nipe/Utils/Install.pm index 5fe3eee..59451d7 100644 --- a/lib/Nipe/Utils/Install.pm +++ b/lib/Nipe/Utils/Install.pm @@ -5,7 +5,6 @@ package Nipe::Utils::Install { sub new { my %device = Nipe::Utils::Device -> new(); - my $stopTor = "systemctl stop tor"; my %install = ( "debian" => "apt-get install -y tor iptables", @@ -16,17 +15,15 @@ package Nipe::Utils::Install { "opensuse" => "zypper install -y tor iptables" ); - if ($device{distribution} eq "void") { - $stopTor = "sv stop tor > /dev/null"; - } + system("$install{$device{distribution}}"); - if (-e "/etc/init.d/tor") { - $stopTor = "/etc/init.d/tor stop > /dev/null"; - } + my $stop = Nipe::Engine::Stop -> new(); - system("$install{$device{distribution}} && $stopTor"); + if ($stop) { + return 1; + } - return 1; + return 0; } }