tis-waptconsole-repos icon

WAPT Console Repos

Paquet d’installation silencieuse pour WAPT Console Repos

1-7

  • package: tis-waptconsole-repos
  • name: WAPT Console Repos
  • version: 1-7
  • categories: Configuration
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ
  • licence: wapt_public
  • locale: all
  • target_os: all
  • architecture: all
  • signature_date:
  • size: 7.02 Ko

package           : tis-waptconsole-repos
version           : 1-7
architecture      : all
section           : base
priority          : optional
name              : WAPT Console Repos
categories        : Configuration
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ
description       : Adds the "wapt-testing" and "wapt-archive" repositories to the WAPT Console in the "Import from internet" menu
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : all
min_wapt_version  : 2.3
sources           : 
installed_size    : 
impacted_process  : 
description_fr    : Ajoute les dépôts "wapt-testing" et "wapt-archive" à la Console WAPT dans le menu "Importer depuis internet"
description_pl    : Dodaje repozytoria "wapt-testing" i "wapt-archive" do konsoli WAPT w menu "Importuj z internetu"
description_de    : Fügt die Repositories "wapt-testing" und "wapt-archive" der WAPT-Konsole im Menü "Aus dem internet importieren" hinzu
description_es    : Añade los repositorios "wapt-testing" y "wapt-archive" a la Consola WAPT en el menú "Importar desde internet"
description_pt    : Adiciona os repositórios "wapt-testing" e "wapt-archive" à consola WAPT no menu "Importar da internet"
description_it    : Aggiunge i repository "wapt-testing" e "wapt-archive" alla Console WAPT nel menu "Importa da internet"
description_nl    : Voegt de "wapt-testing" en "wapt-archive" opslagplaatsen toe aan de WAPT Console in het menu "Importeren van internet"
description_ru    : Добавляет репозитории "wapt-testing" и "wapt-archive" в WAPT Console в меню "Import from internet"
audit_schedule    : 
editor            : 
keywords          : 
licence           : wapt_public
homepage          : 
package_uuid      : 157d6ded-cee9-4e40-9527-98c6adfa8a30
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 7891f1ca19ac8a9e41cb2963c0833bb3424a1dcc3f89e6ae484b1841a67063b2
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : hkOnHNA1ifzdznpdUpxm3NMW5zuEms3xu0vugNPMDIcEbGwOQzWJl1nS/Bkt9oTpBaFMouAJfr2M4QeJEaOTBSZYQbEotJhQjddqrTmxLd9MFjfDFfP4g3hVhY0dWG/UhEAiAnJuMF97bwZORgWSU4s+5mh/SsfVNTWCdSqC9wt0ZJcGDUdgelHQm24SzzLHmJM1G6XuHSohJIhGsHOUlWu7yr2x6eLDqp/t1Zyi5tej0DmpSSHMghjTyg6PtrSNWT3gqltky0IlSrN4WU4l81gGizhbv4WELsx6Pfxp+yr1iIHvc2DU2a/secyAPIKEZsCDOzR+labGtlkEun4ZHw==
signature_date    : 2024-02-14T16:01:17.396830
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 configparser


repos_to_remove = []


def install():
    if not isdir(get_public_persistent_dir()):
        mkdirs(get_public_persistent_dir())
    filecopyto(makepath("WAPT", "public_persistent", "waptconsole.ini"), get_public_persistent_dir())


def uninstall():
    remove_file(get_public_persistent_file("waptconsole.ini"))


def session_setup():
    user_local_waptconsole_ini = makepath(user_local_appdata(), "waptconsole", "waptconsole.ini")
    new_local_waptconsole_ini = get_public_persistent_file("waptconsole.ini")

    mkdirs(makepath(user_local_appdata(), "waptconsole"))
    if not isfile(user_local_waptconsole_ini):
        inifile_writestring(user_local_waptconsole_ini, "wapt-templates", "repo_url", "https://store.wapt.fr/wapt")

    new_inifile = configparser.RawConfigParser()
    new_inifile.read(new_local_waptconsole_ini)

    user_inifile = configparser.RawConfigParser()
    user_inifile.read(user_local_waptconsole_ini)

    # Comparing ini files
    sections_updated = False
    for section in new_inifile.sections():
        if section not in ["global", "waptwua"] and section not in user_inifile.sections():
            print(f"[{section}] added")
            sections_updated = True
            if not user_inifile.has_section(section):
                user_inifile.add_section(section)
            user_inifile.set(section, "repo_url", new_inifile[section]["repo_url"])
            user_inifile.set(section, "public_certs_dir", makepath(WAPT.wapt_base_dir, "trusted_external_certs"))
    for section in user_inifile.sections():
        if section in repos_to_remove:
            print(f"[{section}] removed")
            sections_updated = True
            user_inifile.remove_section(section)
    if sections_updated:
        print("WAPT repos updated in WAPT Console")
        user_inifile.write(open(user_local_waptconsole_ini, "w"))


def get_public_persistent_dir():
    """
    Get the path to the public persistent directory.

    Returns:
        str: Path to the public persistent directory.
    """
    try:
        return makepath(WAPT.wapt_base_dir, "public", "persistent")
    except Exception:
        if get_os_name() == "Windows":
            try:
                return makepath(installed_softwares(uninstallkey="WAPT_is1")[0]["install_location"], "public", "persistent")
            except Exception:
                return makepath(programfiles32, "wapt", "public", "persistent")
        else:
            return "/opt/wapt/public/persistent"


def get_public_persistent_file(file_name):
    """
    Get the path to a file in the public persistent directory.

    Args:
        fname (str): Filename.

    Returns:
        str: Path to the file in the public persistent directory.
    """
    file_name = os.path.basename(file_name)
    return makepath(get_public_persistent_dir(), file_name)

990fb493c3b990aa1b01fcd1bfb5d687a36edd454d9730e33cfec32bbb32cfda : setup.py
7891f1ca19ac8a9e41cb2963c0833bb3424a1dcc3f89e6ae484b1841a67063b2 : WAPT/icon.png
c6de3943307d34a1cf293fb6f2085b2e5c45ebab7b55152fb043d4feedc4fd15 : WAPT/public_persistent/waptconsole.ini
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
bd64adebae4367cca016b81e431c624685d90e2590777d83ca3223321cfd1b59 : luti.json
81b207ee0c0baf798232ee37d28f32aebdbc6acae977ac7252850b7713804881 : WAPT/control