tis-terminator

1.3-18
Terminator is an open-source terminal emulator programmed in Java
3890 downloads
Download
See build result See VirusTotal scan
tis-terminator icon
  • package : tis-terminator
  • name : Terminator
  • version : 1.3-18
  • categories : Utilities,System and network
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
  • editor : Phil Norman, Elliott Hughes, Martin Dorey
  • licence : GPLv2
  • locale : all
  • target_os : windows
  • impacted_process :
  • architecture : all
  • signature_date : 2023-11-11 15:00
  • size : 47.02 Ko
  • homepage : https://code.google.com/archive/p/jessies/wikis/Terminator.wiki
  • depends :
package           : tis-terminator
version           : 1.3-18
architecture      : all
section           : base
priority          : optional
name              : Terminator
categories        : Utilities,System and network
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ
description       : Terminator is an open-source terminal emulator programmed in Java
depends           : tis-vcxsrv,tis-wsl-debian
conflicts         : 
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 2.2.1
sources           : 
installed_size    : 
impacted_process  : 
description_fr    : Terminator est un émulateur de terminal open-source programmé en Java
description_pl    : Terminator jest emulatorem terminala typu open-source, zaprogramowanym w Javie
description_de    : Terminator ist ein Open-Source-Terminalemulator, der in Java programmiert ist
description_es    : Terminator es un emulador de terminal de código abierto programado en Java
description_pt    : Terminator é um emulador de terminal de código aberto programado em Java
description_it    : Terminator è un emulatore di terminale open source programmato in Java
description_nl    : Terminator is een open-source terminal emulator geprogrammeerd in Java
description_ru    : Terminator - это эмулятор терминала с открытым исходным кодом, запрограммированный на Java
audit_schedule    : 
editor            : Phil Norman, Elliott Hughes, Martin Dorey
keywords          : 
licence           : GPLv2
homepage          : https://code.google.com/archive/p/jessies/wikis/Terminator.wiki
package_uuid      : 1fa37077-2202-4d84-84c0-c69d2d99164c
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 10.0
max_os_version    : 
icon_sha256sum    : 9b8fb723c31aef25de2a5ea9268c44e1a7f346f12538a0bb7201062de90d776b
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : x0LobJGhSNG9sROCIwkWXAhln0rfqGO9pnBx6CLSln9Ozb+Q2ykXMZPtX4k0PzKoYVpSTwZoGFb+oDJHa2EKbNhwY3ZNNzlXJglHgiieRfPgclAGcFQqDuPOaBL53KOialxmeKJMb5c2NOZIi8L915cwvj3qa7gt6CnOzvlUzkKn4NfXBjSLhqKOG6gAvOEwTbGqqrhvBsTh9SxDO211IzaqVfBJlSPIWrHpHF+ramHS6H9obP49PhUslRWVjtuuCvR5on8EffitYEJGW7vgTXAsYuQLTCsLOOChc27D02tW5YsNHQaXK20FALFQa7G2x7O8QlqVhI5b3DMbZLWOMA==
signature_date    : 2023-11-11T15:00:15.038330
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
# -*- coding: utf-8 -*-
from setuphelpers import *
import time
import psutil
import win32api
import win32con
import waptguihelper
import tempfile

try:
    from waptenterprise.waptservice.enterprise import get_active_sessions, start_interactive_process
except:
    from waptservice.enterprise import get_active_sessions, start_interactive_process

from setupdevhelpers import get_proxies_from_wapt_console

# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
terminator_path = makepath(programfiles, "Terminator")
terminator_ico = "terminator.ico"
launch_script = "start_terminator.vbs"
wscript = makepath(system32(), "wscript.exe")
arg = makepath(terminator_path, launch_script)
icon = makepath(terminator_path, terminator_ico)
app_name = "Terminator"


def install():
    mkdirs(terminator_path)
    filecopyto(launch_script, terminator_path)
    filecopyto(terminator_ico, terminator_path)


def uninstall():
    remove_desktop_shortcut(app_name)
    remove_tree(terminator_path)


def session_setup():
    print("Configuring Terminator for user Debian WSL")
    # Declaring local variables
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_reg_path = r"SOFTWARE\WAPT\Terminator"
    start_menu_path = makepath(winshell.programs(0), "StartUp")
    my_username = get_current_user()

    # Skip Luti
    if params.get("install_with_luti", False):
        return "OK"

    def is_term_to_install():
        return registry_readstring(HKEY_CURRENT_USER, app_reg_path, "Install")

    def is_term_configured():
        return registry_readstring(HKEY_CURRENT_USER, app_reg_path, "Configured")

    def is_debian_configured():
        return registry_readstring(HKEY_CURRENT_USER, app_reg_path, "Debian Configured")

    first_install = False
    user_debian_path = makepath(user_local_appdata, "Microsoft", "WindowsApps", "debian.exe")
    vcxsrv_path = installed_softwares("VcXsrv")[0]["uninstall_string"].replace("uninstall.exe", "vcxsrv.exe").split('"')[1]
    vcxsrv_start_cmd = r":0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl -dpi auto"
    debian_proxy_conf = "/etc/apt/apt.conf.d/proxy.conf"

    # Asking if Terminator have to be installed on this user profile
    if is_term_to_install() == "" or force:
        if messagebox("Configuring Terminator", "Do you want to install Terminator on this user account?", style=win32con.MB_YESNOCANCEL) == 6:
            registry_setstring(HKEY_CURRENT_USER, app_reg_path, "Install", "Yes", type=REG_SZ)
            first_install = True
        else:
            registry_setstring(HKEY_CURRENT_USER, app_reg_path, "Install", "No", type=REG_SZ)

    if is_term_to_install() == "No":
        return "OK"

    # Asking if debian have already been launch once and that the defines username is the same than Windows
    if is_debian_configured() == "No" or is_debian_configured() == "" or force:
        if (
            messagebox(
                "Configuring Terminator",
                "Have you already run WSL Debian once and configured the username? Please verify!",
                style=win32con.MB_YESNOCANCEL,
            )
            == 6
        ):
            registry_setstring(HKEY_CURRENT_USER, app_reg_path, "Debian Configured", "Yes", type=REG_SZ)
        else:
            registry_setstring(HKEY_CURRENT_USER, app_reg_path, "Debian Configured", "No", type=REG_SZ)
            print(
                "If your Debian username is NOT %s, we do recommend you to uninstall Debian then reintalling it with: wapt-get session-setup tis-wsl-debian -f"
                % my_username
            )
            # print("If reinstalling your Debian is not desirable for you, you may configure the Debian requirements manually")
            return "OK"

    # Checking if Terminator is configured on this user profile
    try:
        if "terminator" in run('bash -c "dpkg -l | grep terminator"'):
            registry_setstring(HKEY_CURRENT_USER, app_reg_path, "Configured", "Yes", type=REG_SZ)
    except:
        registry_setstring(HKEY_CURRENT_USER, app_reg_path, "Configured", "No", type=REG_SZ)

    # Configuring Terminator on this user profile
    if is_term_configured() == "No" or is_term_configured() == "" or force:
        if proxies:
            is_using_proxy = True
            user_http_proxy = proxies["http"]
            user_https_proxy = proxies["http"]
        else:
            is_using_proxy = False
        prompt_proxy = ""
        if not proxies:
            prompt_proxy = waptguihelper.input_dialog(
                "Configuring Terminator", "Please provide your proxy if needed (example: http://srvproxy.mydomain.lan:3128)", ""
            )
        if prompt_proxy:
            is_using_proxy = True
            user_http_proxy = prompt_proxy
            user_https_proxy = prompt_proxy

        # wsl_username = run_powershell("wsl --exec whoami")
        wsl_username = waptguihelper.input_dialog("Configuring Terminator", "Please provide your WSL Debian username", my_username)
        try:
            print("## Set default bash user as root to perform install")
            run('"%s" config --default-user root' % user_debian_path)
            if is_using_proxy:
                print("## Set APT Proxy")
                proxy_temp_file = makepath(tempfile.gettempdir(), "proxy.conf")
                run('''echo Acquire::http::Proxy "%s"; > "%s"''' % (user_http_proxy, proxy_temp_file))
                run('''echo Acquire::http::Proxy "%s"; >> "%s"''' % (user_https_proxy, proxy_temp_file))
                run('''start bash.exe -c -l "cp "/mnt/c/%s" "%s""''' % (proxy_temp_file.replace("\\", "/").split(":", 1)[-1], debian_proxy_conf))
                remove_file(proxy_temp_file)
            print("## Install Terminator and Dbus-x11")
            run('start bash.exe -c -l "apt-get update"')
            time.sleep(5)
            run('start bash.exe -c -l "apt-get install dbus-x11 terminator -y"')
            print("## Restore current user as default bash user")
            run_notfatal('"%s" config --default-user %s' % (user_debian_path, wsl_username))
        except:
            print("ERROR: Terminator configuration failed")

    # Adding Terminator Sortcuts
    # C:\Windows\System32\wscript.exe "C:\Program Files\Terminator\start_terminator.vbs"
    create_user_desktop_shortcut("Terminator", wscript, '"%s"' % arg, r"%USERPROFILE%", icon)
    create_user_programs_menu_shortcut("Terminator", wscript, '"%s"' % arg, r"%USERPROFILE%", icon)

    # Starting VcXsrv at user session startup
    vcxsrv_startup_shortcut = makepath(start_menu_path, "VcXsrv.lnk")
    vcxsrv_menu_shortcut = makepath(application_data, r"Microsoft\Windows\Start Menu\Programs", "VcXsrv.lnk")

    create_shortcut(vcxsrv_startup_shortcut, vcxsrv_path, vcxsrv_start_cmd)
    create_shortcut(vcxsrv_menu_shortcut, vcxsrv_path, vcxsrv_start_cmd)

    if not isrunning("vcxsrv.exe"):
        try:
            vcx_process_list = []
            vcx_process_list.append(vcxsrv_path)
            vcx_process_list.extend(vcxsrv_start_cmd.split(" "))
            psutil.Popen(vcx_process_list)
            # run(app_exe, wait=False)
        except:
            print("Restart session for using Terminator, or launch VcXsrv manually")

    if first_install:
        messagebox("Terminator", "Installation of Terminator done, the shortcut is available on user desktop")


def update_package():
    control.set_software_version(control.get_software_version())
    control.save_control_to_wapt()


def messagebox(title, msg, style=win32con.MB_ICONINFORMATION):
    r"""Open a message box to interact with the end user

    Args:
        title (str): Title of the message box
        msg (str): Text contained in the message box
        style (win32con): Format of the message box, usable values:
                    MB_OK
                    MB_ICONINFORMATION
                    MB_OKCANCEL
                    MB_YESNOCANCEL
                    MB_YESNO

    Returns:
        ID_OK = 0
        ID_CANCEL = 2
        ID_ABORT = 3
        ID_YES = 6
        ID_NO = 7

    """

    return win32api.MessageBox(0, ensure_unicode(msg), ensure_unicode(title), style)
171141ea509403a20c3f458b8650c98ad7fd359e7a6219cde36f0c4938e061d7 : setup.py
 : __pycache__
8accf0ea151e3a8b383e70261b4185206a2b84d9c862af064f4de2094b2d5bc7 : terminator.ico
9b8fb723c31aef25de2a5ea9268c44e1a7f346f12538a0bb7201062de90d776b : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
33c4217571ca2e3236ac91ab4967af661b7b191f64212d395cf517ad4c0dd0c2 : start_terminator.vbs
13aacd4eda09be0cbb8122c0faa0ad83a4935b7780c7cbe1c0ea5aadfa08830b : luti.json
19cde4f7222981e156b7b8e4b8b01a1410a33598dea2d91544d5941097fef10f : WAPT/control