You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1016 B
Python

import os
import subprocess
class Apt:
env = os.environ.copy()
env['DEBIAN_FRONTEND'] = 'noninteractive'
@staticmethod
def install(packages: list):
subprocess.run(
['sudo', 'apt', 'install'] + packages + ['-y'],
env=Apt.env,
check=True
)
@staticmethod
def remove(packages: list):
subprocess.run(
['sudo', 'apt', 'remove'] + packages + ['-y'],
env=Apt.env,
check=True
)
@staticmethod
def purge(packages: list):
subprocess.run(
['sudo', 'apt', 'purge'] + packages + ['-y'],
env=Apt.env,
check=True
)
@staticmethod
def update():
subprocess.run(
['sudo', 'apt', 'update'],
env=Apt.env,
check=True
)
@staticmethod
def upgrade():
subprocess.run(
['sudo', 'apt', 'upgrade', '-y'],
env=Apt.env,
check=True
)