def install_process(CFG, q_button_a, q_button_b, q_view, q_label, q_win):
    button_a = q_button_a.get()
    button_b = q_button_b.get()
    view = q_view.get()
    label = q_label.get()
    window = q_win.get()
    p = Particiones()
    metodo = CFG['metodo']
    acciones = CFG['acciones']
    passroot = CFG['passroot1']
    nombre = CFG['nombre']
    usuario = CFG['usuario']
    passuser = CFG['passuser1']
    maquina = CFG['maquina']
    lcl_item = CFG['locale']
    oem = CFG['oem']
    gdm = CFG['gdm']
    mountpoint = '/target'
    LIVE_PATH = get_live_path()
    squashfs = LIVE_PATH + '/live/filesystem.squashfs'
    uninstpkgs = [
        'canaima-instalador', 'live-config', 'live-boot',
        'live-boot-initramfs-tools', 'live-initramfs', 'live-config-sysvinit',
        'live-tools'
        ]
    reconfpkgs = [
        'locales', 'canaima-estilo-visual-gnome', 'canaima-escritorio-gnome',
        'canaima-base', 'tzdata', 'software-center'
        ]
    instpkgs_burg = [
        [LIVE_PATH + '/pool/main/libx/libx86', 'libx86-1'],
        [LIVE_PATH + '/pool/main/s/svgalib', 'libsvga1'],
        [LIVE_PATH + '/pool/main/libs/libsdl1.2', 'libsdl1.2debian'],
        [LIVE_PATH + '/pool/main/g/gettext', 'libasprintf0c2'],
        [LIVE_PATH + '/pool/main/g/gettext', 'gettext-base'],
        [LIVE_PATH + '/pool/main/b/burg-themes', 'burg-themes-common'],
        [LIVE_PATH + '/pool/main/b/burg-themes', 'burg-themes'],
        [LIVE_PATH + '/pool/main/b/burg', 'burg-common'],
        [LIVE_PATH + '/pool/main/b/burg', 'burg-emu'],
        [LIVE_PATH + '/pool/main/b/burg', 'burg-pc'],
        [LIVE_PATH + '/pool/main/b/burg', 'burg']
        ]
    instpkgs_cpp = [[
        LIVE_PATH + '/pool/main/c/canaima-primeros-pasos/',
        'canaima-primeros-pasos'
        ]]
    debconflist = [
        'burg-pc burg/linux_cmdline string quiet splash',
        'burg-pc burg/linux_cmdline_default string quiet splash vga=791',
        'burg-pc burg-pc/install_devices multiselect {0}'.format(
                                                ', '.join(p.lista_discos()))
        ]
    bindlist = [
        ['/dev', mountpoint + '/dev', ''],
        ['/dev/pts', mountpoint + '/dev/pts', ''],
        ['/sys', mountpoint + '/sys', ''],
        ['/proc', mountpoint + '/proc', '']
        ]
    mountlist = []

    # Lista de archivos de configuración que se copiaran al disco
    conffilelist = [
        [SHAREDIR + '/templates/sources.list',
                                        mountpoint + '/etc/apt/sources.list'],
        [SHAREDIR + '/templates/adduser.conf',
                                        mountpoint + '/etc/adduser.conf'],
        # Agregamos mtab para que no falle al instalar Burg
        ['/etc/mtab', mountpoint + '/etc/mtab']
    ]

    if not os.path.isdir(mountpoint):
        os.makedirs(mountpoint)

    #TODO: Esta validación deberia hacerse al inicio de la aplicación y no
    # esperar hasta este punto
    if not os.path.exists(squashfs):
        UserMessageError(_('Not found squashfs image.'),
                         window, bindlist, mountlist)

    if not assisted_umount(sync=True, plist=mounted_targets(mnt=mountpoint)):
        UserMessageError(_('An error occurred unmounting the partitions.'),
                         window, bindlist, mountlist)

    if not assisted_umount(sync=True,
                           plist=mounted_parts(disk=metodo['disco'][0])):
        UserMessageError(_('An error occurred unmounting the partitions.'),
                         window, bindlist, mountlist)

    label.set_text(_('Creating partitions in the disk ...'))
    for a in acciones:
        accion = a[0]
        montaje = a[2]
        inicio = a[3]
        fin = a[4]
        fs = a[5]
        tipo = a[6]
        nuevo_fin = a[7]
        disco = metodo['disco'][0]
        cdroms = lista_cdroms()

        if accion == 'crear':
            if not p.crear_particion(
                drive=disco, start=inicio, end=fin, fs=fs, partype=tipo,
                format=True):
                UserMessageError(_('An error occurred creating a partition.'),
                         window, bindlist, mountlist)
            else:
                if montaje:
                    mountlist.append([
                        p.nombre_particion(disco, tipo, inicio, fin),
                        mountpoint + montaje, fs
                        ])

        elif accion == 'borrar':
            particion = p.nombre_particion(disco, tipo, inicio, fin)
            if not p.borrar_particion(drive=disco, part=particion):
                UserMessageError(_('An error occurred removing a partition.'),
                         window, bindlist, mountlist)
            else:
                for item in mountlist:
                    if item[0] == particion:
                        mountlist.remove(item)

        elif accion == 'redimensionar':
            particion = p.nombre_particion(disco, tipo, inicio, fin)
            if not p.redimensionar_particion(drive=disco, part=particion,
                                             newend=nuevo_fin):
                UserMessageError(_('An error occurred resizing a partition.'),
                         window, bindlist, mountlist)

        elif accion == 'formatear':
            particion = p.nombre_particion(disco, tipo, inicio, fin)
            if not p.formatear_particion(part=particion, fs=fs):
                UserMessageError(_('An error occurred formatting a \
partition.'),
                         window, bindlist, mountlist)
            else:
                if montaje:
                    mountlist.append([
                        p.nombre_particion(disco, tipo, inicio, fin),
                        mountpoint + montaje, fs
                        ])

        elif accion == 'usar':
            if montaje:
                mountlist.append([
                    p.nombre_particion(disco, tipo, inicio, fin),
                    mountpoint + montaje, fs
                    ])

    unset_boot = ''
    for i in p.lista_particiones(metodo['disco'][0]):
        for flag in i[6]:
            if flag == 'boot':
                unset_boot = i[0]

    set_boot = ''
    winpart = get_windows_part_in(metodo['disco'][0])
    if winpart:
        set_boot = winpart
    else:
        for part, mount, fs in mountlist:
            if mount == mountpoint + '/':
                set_boot = part
            elif mount == mountpoint + '/boot':
                set_boot = part

    if unset_boot:
        if not p.remover_bandera(
            drive=metodo['disco'][0], part=unset_boot, flag='boot'
            ):
            UserMessageError(_("An error occurred mounting the filesystem"),
                             window, bindlist, mountlist)

    if set_boot:
        if not p.asignar_bandera(
            drive=metodo['disco'][0], part=set_boot, flag='boot'
            ):
            UserMessageError(_("An error occurred mounting the filesystem"),
                             window, bindlist, mountlist)

    if not activar_swap(plist=mountlist):
        UserMessageError(_("An error occurred activating the swap partition"),
                         window, bindlist, mountlist)

    label.set_text(_("Mounting the filesystem ..."))
    if not assisted_mount(sync=True, bind=False, plist=mountlist):
        UserMessageError(_("An error occurred mounting the filesystem"),
                         window, bindlist, mountlist)

    label.set_text(_("Copying files to disk ..."))
    if ProcessGenerator(
        'unsquashfs -f -n -d {0} {1}'.format(mountpoint, squashfs)
        ).returncode != 0:
        UserMessageError(_("An error occurred copying files to disk."),
                         window, bindlist, mountlist)

    label.set_text(_("Mounting the filesystem ..."))
    if not assisted_mount(sync=True, bind=True, plist=bindlist):
        UserMessageError(_("An error occurred mounting the filesystem"),
                         window, bindlist, mountlist)

    # Configuración de archivos del sistema
    label.set_text(_("Configuring system files ..."))
    if not crear_archivos_config(mnt=mountpoint, conffilelist=conffilelist):
        UserMessageError(_("An error occurred configuring the system files"),
                         window, bindlist, mountlist)
    if not conf_files_install(CFG, mountpoint):
        UserMessageError(_("An error occurred configuring the system files"),
                         window, bindlist, mountlist)

    label.set_text(_("Configuring network interfaces ..."))
    if not crear_etc_hostname(mnt=mountpoint, cfg='/etc/hostname',
                              maq=maquina):
        UserMessageError(_("An error occurred creating file /etc/hostname"),
                         window, bindlist, mountlist)
    if not crear_etc_hosts(mnt=mountpoint, cfg='/etc/hosts', maq=maquina):
        UserMessageError(_("An error occurred creating file /etc/hosts"),
                         window, bindlist, mountlist)
    if not crear_etc_network_interfaces(mnt=mountpoint,
                                        cfg='/etc/network/interfaces'):
        UserMessageError(_("An error occurred creating file \
/etc/network/interfaces"), window, bindlist, mountlist)

    label.set_text(_("Registering partitions in the system ..."))
    if not crear_etc_fstab(mnt=mountpoint, cfg='/etc/fstab',
                           mountlist=mountlist, cdroms=cdroms):
        UserMessageError(_("An error occurred creating file /etc/fstab"),
                         window, bindlist, mountlist)

    # Instalar accesibilidad en el GDM
    if gdm:
        label.set_text(_("Installing accessibility components in GDM ..."))
        if not activar_accesibilidad(mnt=mountpoint):
            UserMessageError(_("An error occurred activating accesibility."),
                         window, bindlist, mountlist)

    # Reconfigurando paquetes del sistema
    label.set_text(_("Configuring additional details on the system ..."))
    if not reconfigurar_paquetes(mnt=mountpoint, plist=reconfpkgs):
        UserMessageError(_("An error occurred reconfiguring a package."),
                         window, bindlist, mountlist)

    # instalación de los paquetes de idiomas
    label.set_text(_("Configuring additional language packages ..."))
    if not install_language_pack(lcl_item.get_locale(), mountpoint):
        print "ADVERTENCIA: No se instalaran los paquetes adicionales del \
idioma"

    # Activa la funcionalidad OEM si ha sido seleccionada por el usuario
    if oem:
        adm_user = '******'
        adm_password = '******'
        nml_user = '******'
        nml_password = '******'
        nml_name = 'Mantenimiento'
        # Instala Canaima Primeros Pasos
        label.set_text(_("Installing OEM characteristics ..."))
        if not instalar_paquetes(mnt=mountpoint, dest='/tmp',
                                 plist=instpkgs_cpp):
            UserMessageError(_("An error occurred installing a package"),
                         window, bindlist, mountlist)
    else:
        adm_user = '******'
        adm_password = passroot
        nml_user = usuario
        nml_password = passuser
        nml_name = nombre

    label.set_text(_("Creating system users ..."))
    if not crear_usuarios(mnt=mountpoint, a_user=adm_user, a_pass=adm_password,
                          n_name=nml_name, n_user=nml_user,
                          n_pass=nml_password):
        UserMessageError(_("An error occurred creating system user"),
                         window, bindlist, mountlist)

    label.set_text(_("Removing temporary data of installation ..."))
    if not desinstalar_paquetes(mnt=mountpoint, plist=uninstpkgs):
        UserMessageError(_("An error occurred removing a package"),
                         window, bindlist, mountlist)

    label.set_text(_("Installing Bootloader ..."))
    if not preseed_debconf_values(mnt=mountpoint, debconflist=debconflist):
        UserMessageError(_("An error occurred preseeding answers in debconf."),
                         window, bindlist, mountlist)
    if not instalar_paquetes(mnt=mountpoint, dest='/tmp', plist=instpkgs_burg):
        UserMessageError(_("An error occurred installing a package."),
                         window, bindlist, mountlist)
    if ProcessGenerator('chroot {0} update-burg'.format(mountpoint)
                        ).returncode != 0:
        UserMessageError(_("An error occurred updating BURG."),
                         window, bindlist, mountlist)

    label.set_text(_("Configuring system boot ..."))
    if ProcessGenerator(
        'chroot {0} /usr/sbin/mkinitramfs -o /boot/{1} {2}'.format(
            mountpoint, 'initrd.img-' + os.uname()[2], os.uname()[2]
            )
        ).returncode != 0:
        UserMessageError(_("An error occurred generating boot image"),
                         window, bindlist, mountlist)
    if ProcessGenerator(
        'chroot {0} update-initramfs -u -t'.format(mountpoint)
        ).returncode != 0:
        UserMessageError(_("An error occurred updating the boot image."),
                         window, bindlist, mountlist)

    # Terminando la instalación
    label.set_text(_("Umounting filesistems ..."))
    if not assisted_umount(sync=True, plist=bindlist):
        UserMessageError(_("An error occurred umounting partitions."),
                         window, bindlist, mountlist)
    if not assisted_umount(sync=True, plist=mountlist):
        UserMessageError(_("An error occurred umounting partitions."),
                         window, bindlist, mountlist)

    button_a.show()
    button_b.show()
    label.get_parent().remove(label)
    view.get_parent().remove(view)
def install_process(CFG, q_button_a, q_button_b, q_view, q_label, q_win):
    button_a = q_button_a.get()
    button_b = q_button_b.get()
    view = q_view.get()
    label = q_label.get()
    window = q_win.get()
    p = Particiones()
    metodo = CFG['metodo']
    acciones = CFG['acciones']
    teclado = CFG['teclado']
    passroot = CFG['passroot1']
    nombre = CFG['nombre']
    usuario = CFG['usuario']
    passuser = CFG['passuser1']
    maquina = CFG['maquina']
    oem = CFG['oem']
    gdm = CFG['gdm']
    mountpoint = '/target'
    squashfs = '/live/image/live/filesystem.squashfs'
    uninstpkgs = [
        'canaima-instalador', 'live-config', 'live-boot',
        'live-boot-initramfs-tools', 'live-initramfs', 'live-config-sysvinit'
        ]
    reconfpkgs = [
        'canaima-estilo-visual-gnome', 'canaima-plymouth',
        'canaima-chat-gnome', 'canaima-bienvenido-gnome',
        'canaima-escritorio-gnome', 'canaima-base'
        ]
    instpkgs_burg = [
        ['/live/image/pool/main/libx/libx86', 'libx86-1'],
        ['/live/image/pool/main/s/svgalib', 'libsvga1'],
        ['/live/image/pool/main/libs/libsdl1.2', 'libsdl1.2debian-alsa'],
        ['/live/image/pool/main/libs/libsdl1.2', 'libsdl1.2debian'],
        ['/live/image/pool/main/g/gettext', 'gettext-base'],
        ['/live/image/pool/main/b/burg-themes', 'burg-themes-common'],
        ['/live/image/pool/main/b/burg-themes', 'burg-themes'],
        ['/live/image/pool/main/b/burg', 'burg-common'],
        ['/live/image/pool/main/b/burg', 'burg-emu'],
        ['/live/image/pool/main/b/burg', 'burg-pc'],
        ['/live/image/pool/main/b/burg', 'burg']
        ]
    instpkgs_cpp = [[
        '/live/image/pool/main/c/canaima-primeros-pasos/',
        'canaima-primeros-pasos'
        ]]
    instpkgs_cagg = [[
        '/live/image/pool/main/c/canaima-accesibilidad-gdm-gnome/',
        'canaima-accesibilidad-gdm-gnome'
        ]]
    debconflist = [
        'burg-pc burg/linux_cmdline string quiet splash',
        'burg-pc burg/linux_cmdline_default string quiet splash vga=791',
        'burg-pc burg-pc/install_devices multiselect {0}'.format(', '.join(p.lista_discos()))
        ]
    bindlist = [
        ['/dev', mountpoint + '/dev', ''],
        ['/dev/pts', mountpoint + '/dev/pts', ''],
        ['/sys', mountpoint + '/sys', ''],
        ['/proc', mountpoint + '/proc', '']
        ]
    mountlist = []

    if not os.path.isdir(mountpoint):
        os.makedirs(mountpoint)

    if not os.path.exists(squashfs):
        UserMessage(
            message='No se encuentra la imagen squashfs.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    if not assisted_umount(sync=True, plist=mounted_targets(mnt=mountpoint)):
        UserMessage(
            message='Ocurrió un error desmontando las particiones.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    if not assisted_umount(
        sync=True, plist=mounted_parts(disk=metodo['disco'][0])
        ):
        UserMessage(
            message='Ocurrió un error desmontando las particiones.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Creando particiones en disco ...')
    for a in acciones:
        accion = a[0]
        montaje = a[2]
        inicio = a[3]
        fin = a[4]
        fs = a[5]
        tipo = a[6]
        nuevo_fin = a[7]
        disco = metodo['disco'][0]
        cdroms = lista_cdroms()

        if accion == 'crear':
            if not p.crear_particion(
                drive=disco, start=inicio, end=fin, fs=fs, partype=tipo, format=True
                ):
                UserMessage(
                    message='Ocurrió un error creando una partición.',
                    title='ERROR',
                    mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
                    c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
                    c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
                    c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
                    c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
                    c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
                    )
            else:
                if montaje:
                    mountlist.append([
                        p.nombre_particion(disco, tipo, inicio, fin),
                        mountpoint + montaje, fs
                        ])

        elif accion == 'borrar':
            particion = p.nombre_particion(disco, tipo, inicio, fin)
            if not p.borrar_particion(drive=disco, part=particion):
                UserMessage(
                    message='Ocurrió un error borrando una partición.',
                    title='ERROR',
                    mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
                    c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
                    c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
                    c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
                    c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
                    c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
                    )
            else:
                for item in mountlist:
                    if item[0] == particion:
                        mountlist.remove(item)

        elif accion == 'redimensionar':
            particion = p.nombre_particion(disco, tipo, inicio, fin)
            if not p.redimensionar_particion(
                drive=disco, part=particion, newend=nuevo_fin
                ):
                UserMessage(
                    message='Ocurrió un error redimensionando una partición.',
                    title='ERROR',
                    mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
                    c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
                    c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
                    c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
                    c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
                    c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
                    )

        elif accion == 'formatear':
            particion = p.nombre_particion(disco, tipo, inicio, fin)
            if not p.formatear_particion(part=particion, fs=fs):
                UserMessage(
                    message='Ocurrió un error formateando una partición.',
                    title='ERROR',
                    mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
                    c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
                    c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
                    c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
                    c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
                    c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
                    )
            else:
                if montaje:
                    mountlist.append([
                        p.nombre_particion(disco, tipo, inicio, fin),
                        mountpoint + montaje, fs
                        ])

        elif accion == 'usar':
            if montaje:
                mountlist.append([
                    p.nombre_particion(disco, tipo, inicio, fin),
                    mountpoint + montaje, fs
                    ])

    unset_boot = ''
    for i in p.lista_particiones(metodo['disco'][0]):
        for flag in i[6]:
            if flag == 'boot':
                unset_boot = i[0]

    set_boot = ''
    winpart = get_windows_part_in(metodo['disco'][0])
    if winpart:
        set_boot = winpart
    else:
        for part, mount, fs in mountlist:
            if mount == mountpoint + '/':
                set_boot = part
            elif mount == mountpoint + '/boot':
                set_boot = part

    if unset_boot:
        if not p.remover_bandera(
            drive=metodo['disco'][0], part=unset_boot, flag='boot'
            ):
            UserMessage(
                message='Ocurrió un error montando los sistemas de archivos.',
                title='ERROR',
                mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
                c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
                c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
                c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
                c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
                c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
                )

    if set_boot:
        if not p.asignar_bandera(
            drive=metodo['disco'][0], part=set_boot, flag='boot'
            ):
            UserMessage(
                message='Ocurrió un error montando los sistemas de archivos.',
                title='ERROR',
                mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
                c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
                c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
                c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
                c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
                c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
                )

    if not activar_swap(plist=mountlist):
        UserMessage(
            message='Ocurrió un error activando la partición swap.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Montando sistemas de archivos ...')
    if not assisted_mount(sync=True, bind=False, plist=mountlist):
        UserMessage(
            message='Ocurrió un error montando los sistemas de archivos.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Copiando archivos en disco ...')
    if ProcessGenerator(
        'unsquashfs -f -n -d {0} {1}'.format(mountpoint, squashfs)
        ).returncode != 0:
        UserMessage(
            message='Ocurrió un error copiando los archivos al disco.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Montando sistema de archivos ...')
    if not assisted_mount(sync=True, bind=True, plist=bindlist):
        UserMessage(
            message='Ocurrió un error montando los sistemas de archivos.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Instalando gestor de arranque ...')

    #Montamos /etc/mtab para que no de errores al intalar burg
    shutil.copy2('/etc/mtab', '{0}/etc/mtab'.format(mountpoint))

    if not preseed_debconf_values(mnt=mountpoint, debconflist=debconflist):
        UserMessage(
            message='Ocurrió un error presembrando las respuestas debconf.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    if not instalar_paquetes(mnt=mountpoint, dest='/tmp', plist=instpkgs_burg):
        UserMessage(
            message='Ocurrió un error instalando un paquete.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    if ProcessGenerator(
        'chroot {0} update-burg'.format(mountpoint)
        ).returncode != 0:
        UserMessage(
            message='Ocurrió un error actualizando burg.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Generando imagen de arranque ...')
    if ProcessGenerator(
        'chroot {0} /usr/sbin/mkinitramfs -o /boot/{1} {2}'.format(
            mountpoint, 'initrd.img-' + os.uname()[2], os.uname()[2]
            )
        ).returncode != 0:
        UserMessage(
            message='Ocurrió un error generando la imagen de arranque.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    if ProcessGenerator(
        'chroot {0} update-initramfs -u -t'.format(mountpoint)
        ).returncode != 0:
        UserMessage(
            message='Ocurrió un error actualizando la imagen de arranque.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Configurando detalles del sistema operativo ...')
    if not reconfigurar_paquetes(mnt=mountpoint, plist=reconfpkgs):
        UserMessage(
            message='Ocurrió un error reconfigurando un paquete.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Configurando interfaces de red ...')
    if not crear_etc_hostname(mnt=mountpoint, cfg='/etc/hostname', maq=maquina):
        UserMessage(
            message='Ocurrió un error creando el archivo /etc/hostname.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    if not crear_etc_hosts(mnt=mountpoint, cfg='/etc/hosts', maq=maquina):
        UserMessage(
            message='Ocurrió un error creando el archivo /etc/hosts.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=sys.exit, p_2=(1,)
            )

    if not crear_etc_network_interfaces(
        mnt=mountpoint, cfg='/etc/network/interfaces'
        ):
        UserMessage(
            message='Ocurrió un error creando el archivo /etc/network/interfaces.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Configurando teclado ...')
    if not crear_etc_default_keyboard(
        mnt=mountpoint, cfg='/etc/canaima-base/alternatives/keyboard',
        key=teclado
        ):
        UserMessage(
            message='Ocurrió un error configurando el teclado.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Configurando particiones en /etc/fstab ...')
    if not crear_etc_fstab(
        mnt=mountpoint, cfg='/etc/fstab',
        mountlist=mountlist, cdroms=cdroms
        ):
        UserMessage(
            message='Ocurrió un error creando el archivo /etc/fstab.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Configurando usuarios y grupos ...')
    if not crear_passwd_group_inittab_mtab(mnt=mountpoint):
        UserMessage(
            message='Ocurrió un error configurando usuarios y grupos.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    if oem:
        adm_user = '******'
        adm_password = '******'
        nml_user = '******'
        nml_password = '******'
        nml_name = 'Mantenimiento'

        if not instalar_paquetes(
            mnt=mountpoint, dest='/tmp', plist=instpkgs_cpp
            ):
            UserMessage(
                message='Ocurrió un error instalando un paquete.',
                title='ERROR',
                mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
                c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
                c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
                c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
                c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
                c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
                )

    else:
        adm_user = '******'
        adm_password = passroot
        nml_user = usuario
        nml_password = passuser
        nml_name = nombre

    if gdm:
        if not instalar_paquetes(
            mnt=mountpoint, dest='/tmp', plist=instpkgs_cagg
            ):
            UserMessage(
                message='Ocurrió un error instalando un paquete.',
                title='ERROR',
                mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
                c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
                c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
                c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
                c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
                c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
                )

    label.set_text('Creando usuarios de sistema ...')
    if not crear_usuarios(
        mnt=mountpoint, a_user=adm_user, a_pass=adm_password,
        n_name=nml_name, n_user=nml_user, n_pass=nml_password
        ):
        UserMessage(
            message='Ocurrió un error creando los usuarios de sistema.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Configurando detalles del sistema operativo ...')
    if not reconfigurar_paquetes(
        mnt=mountpoint, plist=['canaima-escritorio-gnome', 'canaima-base']
        ):
        UserMessage(
            message='Ocurrió un error reconfigurando un paquete.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Removiendo instalador del sistema de archivos ...')
    if not desinstalar_paquetes(mnt=mountpoint, plist=uninstpkgs):
        UserMessage(
            message='Ocurrió un error desinstalando un paquete.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    label.set_text('Desmontando sistema de archivos ...')
    if not assisted_umount(sync=True, plist=bindlist):
        UserMessage(
            message='Ocurrió un error desmontando las particiones.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    if not assisted_umount(sync=True, plist=mountlist):
        UserMessage(
            message='Ocurrió un error desmontando las particiones.',
            title='ERROR',
            mtype=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
            c_1=gtk.RESPONSE_OK, f_1=assisted_umount, p_1=(True, bindlist),
            c_2=gtk.RESPONSE_OK, f_2=assisted_umount, p_2=(True, mountlist),
            c_3=gtk.RESPONSE_OK, f_3=window.destroy, p_3=(),
            c_4=gtk.RESPONSE_OK, f_4=gtk.main_quit, p_4=(),
            c_5=gtk.RESPONSE_OK, f_5=sys.exit, p_5=()
            )

    button_a.show()
    button_b.show()
    label.hide()
    view.hide()