Пример #1
0
def distro():

    """This function check what is the distro you are on"""

    if check.prg("aptitude"):
        distro = "Debian"
    elif check.prg("dnf"):
        distro = "Fedora"
    elif check.prg("pacman"):
        distro = "Arch Linux"
    else:
        distro = "GNU/Linux"

    return(distro)
Пример #2
0
 def do_install(self, line):
     """Check if BE::Shell is installed on your system, and if not, install it"""
     if check.prg('be.shell'):
         print('BE::Shell is already installed, nothing to do.')
     else:
         beshell.Cmd.clone()
         beshell.Cmd.install()
Пример #3
0
def update(pm):

    """"""

    if pm == "aptitude":
        command_line = "aptitude search ~U"
    elif pm == "dnf":
        command_line = "dnf check-update"
    elif pm == "pacman":
        command_line = "checkupdates"
        command_line_a = "cower --color=never -uq"
    else:
        print("Error: unknown package manager")

    update = methods.call_command(command_line).split('\n')
    repo = len(update) - 1

    if check.prg("cower"):
        update_aur = []
        for line in methods.call_command(command_line_a).split():
            if line.startswith("error"):
                pass
            else:
                update_aur.append(line)
        aur = len(update_aur)

    return(str(repo), str(aur))
Пример #4
0
 def do_update(self, line):
     """Check if there are some updates for BE::Shell, and if there are proceed to install them"""
     if check.prg('be.shell'):
         print('BE::Shell is correctly installed, checking update(s)..\nSearching for local be.shell git repo..\nCheck for updates')
         beshell.Cmd.up()
     else:
         print("BE::Shell isn't installed, you want to install it? [yes/no]")
         if input() == "yes":
             beshell.Cmd.clone()
             beshell.Cmd.install()
         elif input() == "no":
             print('Installation aborted by user, nothing to do.')