Skip to content

Commit

Permalink
main & install.py updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Aviksaikat committed May 7, 2024
1 parent 021f633 commit ce782a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/nipe_py/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import click
from nipe_py import Stop, Start, Restart
from nipe_py import Status, Install, Status
from nipe_py import Status, Install

@click.group()
def cli():
Expand All @@ -9,7 +9,7 @@ def cli():
@cli.command()
def install():
"""Install dependencies"""
install = Install()
Install()

@cli.command()
def start():
Expand Down
17 changes: 7 additions & 10 deletions src/nipe_py/utils/Install.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@ def __init__(self):

self.install = {
"debian" : "apt-get install -y tor iptables",
"fedora" : "dnf install -y tor iptables",
"centos" : "yum -y install epel-release tor iptables",
"void" : "xbps-install -y tor iptables",
"arch" : "pacman -S --noconfirm tor iptables"
"fedora" : "dnf install -y tor iptables",
"centos" : "yum -y install epel-release tor iptables",
"void" : "xbps-install -y tor iptables",
"arch" : "pacman -S --noconfirm tor iptables"
}

if self.device["distribution"] == "void":
self.stop_tor = "sv stop tor > /dev/null"

if Path("/etc/init.d/tor").exists():
stop_tor = "/etc/init.d/tor stop > /dev/null"

self.stop_tor = "/etc/init.d/tor stop > /dev/null"
try:
subprocess.call(f"{self.install[self.device['distribution']]} && {self.stop_tor}", shell=True)
except Exception as e:
console.log(e)

except Exception:
console.print_exception()

0 comments on commit ce782a0

Please sign in to comment.