Exemple #1
0
def _git_config():
    text_helper.print_header('Vamos a configurar git...')
    text_helper.new_line()

    email = input('Ingresa el mail de Widergy: ')
    while email == '':
        email = input(
            'No tenes mail? Anda a hablar con el Commander, volve y lo escribis: '
        )

    name = input('Tu nombre completo: ')
    while name == '':
        name = input('No tenes nombre? Quien sos? El innombrable?: ')

    username = input('Tu usuario de git: ')
    while username == '':
        username = input('Pone algo fiera: ')

    password = input('Y ahora tu contraseña: ')
    while password == '':
        password = input(
            'Ah segurisima tu contraseña eh, dale, ponela posta: ')

    git_credentials_file = open(
        '/home/' + os.environ['USER'] + '/' + '.git-credentials', 'w+')
    git_credentials_file.write('https://' + username + ':' + password +
                               '@github.com')
    git_credentials_file.close()

    if git_helper.git_set_credentials(
            password, username) and git_helper.git_set_email_and_name(
                email, name):
        return True
    else:
        return False
def pacman_install(pkgs):
    text_helper.print_header('[PACMAN] Instalando: ' + " ".join(pkgs))
    try:
        sh.contrib.sudo.pacman('-S', '--noconfirm', " ".join(pkgs))
    except:
        text_helper.print_error('[PACMAN] Hubo un error en la instalacion')
        return False
    text_helper.new_line()
    return True
def pacman_upgrade(pkgs):
    text_helper.print_header('[PACMAN] Actualizando: ' + " ".join(pkgs))
    try:
        sh.contrib.sudo.pacman('-U', '--noconfirm', " ".join(pkgs))
    except:
        text_helper.print_error('[PACMAN] Hubo un error en la actualizacion')
        return False
    text_helper.new_line()
    return True
def yay_get_upgradable():
    text_helper.print_header('[YAY] Obteniendo paquetes actualizables')
    try:
        pkg_list = sh.yay('-Qu')
    except sh.exit_code != 0:
        text_helper.print_error(
            '[YAY] Hubo un error al obtener la lista de paquetes actualizables')
        return False
    text_helper.new_line()
    return pkg_list
def yay_get_installed():
    text_helper.print_header('[YAY] Obteniendo paquetes instalados')
    try:
        pkg_list = sh.yay('-Q')
    except sh.exit_code != 0:
        text_helper.print_error(
            '[YAY] Hubo un error al obtener la lista de paquetes instalados')
        return False
    text_helper.new_line()
    return pkg_list
def yay_upgrade(pkgs):
    text_helper.print_header('[YAY] Actualizando: ' + " ".join(pkgs))
    try:
        sh.yay('-U', '--noconfirm', " ".join(pkgs))
    except:
        text_helper.print_error('[YAY] Hubo un error en la actualizacion')
        return False
    
    text_helper.new_line()
    return True
def yay_install(pkgs):
    text_helper.print_header('[YAY] Instalando: ' + " ".join(pkgs))
    try:
        sh.yay('-S', '--noconfirm', " ".join(pkgs))
    except sh.exit_code != 0:
        text_helper.print_error(
            '[YAY] Hubo un error en la instalacion de los paquetes')
        return False
    text_helper.new_line()
    return True
def pacman_get_upgradable():
    text_helper.print_header('[PACMAN] Obteniendo paquetes actualizables')
    try:
        pkg_list = sh.pacman('-Qu')
    except:
        text_helper.print_error(
            '[PACMAN] Hubo un error al obtener la lista de paquetes actualizables')
        return False
    text_helper.new_line()
    return pkg_list
def pacman_get_installed():
    text_helper.print_header('[PACMAN] Obteniendo paquetes instalados')
    try:
        pkg_list = sh.pacman('-Q')
    except:
        text_helper.print_error(
            '[PACMAN] Hubo un error al obtener la lista de paquetes instalados')
        return False
    text_helper.new_line()
    return pkg_list
Exemple #10
0
def execute_config(config):
    if (utils.yes_no_query('Configuramos git?')):
        if _git_config():
            text_helper.print_success('Listo! Git configurado')
        else:
            text_helper.print_error('Hubo un error al configurar git')
            if not utils.yes_no_query('Seguimos?'):
                exit()

    if not pkg_manager_helper.pacman_install(['yay']):
        text_helper.print_error(
            'Yay no pudo ser instalado... Saliendo del configurador...')
        exit()

    text_helper.print_header('Chequeando paquetes...')

    filtered_packages = utils.filter_packages(config['apps'])

    if filtered_packages['upgradable']:
        text_helper.print_header('Paquetes actualizables: ' +
                                 " ".join(filtered_packages['upgradable']))
        if utils.yes_no_query('Actualizar paquetes?'):
            pkg_manager_helper.yay_upgrade(filtered_packages['upgradable'])
    else:
        text_helper.print_info(
            'No hay paquetes con actualizaciones disponibles')

    if filtered_packages['installed']:
        text_helper.print_info(
            'Los siguientes paquetes estan instalados y actualizados, se omitiran: '
            + " ".join(filtered_packages['installed']))

    if filtered_packages['to_install']:
        if not pkg_manager_helper.yay_install(filtered_packages['to_install']):
            exit()
    else:
        text_helper.print_info('No hay paquetes para instalar')
Exemple #11
0
from colorama import init
import text_helper
import utils
import configurator

init()

text_helper.print_header('Bienvenido al configurador automatico de Manjaro!')
text_helper.new_line()

config = utils.build_config()

text_helper.print_header('Selecciona la configuracion:')

utils.print_config_list(config)

selected_config = input()

configurator.execute_config(config[int(selected_config)])