tis-nomachine-client icon

NoMachine Client

Silent install package for NoMachine Client

8.14.2-25

  • package: tis-nomachine-client
  • name: NoMachine Client
  • version: 8.14.2-25
  • categories: Utilities
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ
  • editor: NoMachine S.à r.l.
  • licence: proprietary_free,wapt_public
  • locale: all
  • target_os: darwin
  • impacted_process: nxagent,nxauth,nxd,nxdisplay,nxdx32,nxdx64,nxexec,nxfs,nxfsserver,nxkb,nxkeygen,nxlocate,nxlpd,nxnode,nxplayer,nxpost,nxrunner,nxserver,nxservice32,nxservice64,nxsh,nxssh-add,nxssh-agent,nxssh-pkcs11,nxssh,nxupdatecli,nxcodec.bin,nxnode.bin,nxplayer.bin,nxrunner.bin,nxserver.bin
  • architecture: all
  • signature_date:
  • size: 83.45 Mo
  • installed_size: 201.43 Mo
  • homepage : https://www.nomachine.com/
  • conflicts :

package           : tis-nomachine-client
version           : 8.14.2-25
architecture      : all
section           : base
priority          : optional
name              : NoMachine Client
categories        : Utilities
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ
description       : NoMachine is a cross-platform remote desktop program developed by NoMachine S.à r.l. The software provides access to remote desktops and applications running on Linux, Windows, Mac and Linux ARM devices
depends           : 
conflicts         : tis-nomachine,tis-nomachine-server
maturity          : PROD
locale            : all
target_os         : darwin
min_wapt_version  : 2.3
sources           : https://www.nomachine.com/download
installed_size    : 201432744
impacted_process  : nxagent,nxauth,nxd,nxdisplay,nxdx32,nxdx64,nxexec,nxfs,nxfsserver,nxkb,nxkeygen,nxlocate,nxlpd,nxnode,nxplayer,nxpost,nxrunner,nxserver,nxservice32,nxservice64,nxsh,nxssh-add,nxssh-agent,nxssh-pkcs11,nxssh,nxupdatecli,nxcodec.bin,nxnode.bin,nxplayer.bin,nxrunner.bin,nxserver.bin
description_fr    : NoMachine est un programme de bureau à distance multiplateforme développé par NoMachine S.à r.l. Le logiciel permet d'accéder à des bureaux et des applications à distance fonctionnant sur des appareils Linux, Windows, Mac et Linux ARM
description_pl    : NoMachine to wieloplatformowy program zdalnego pulpitu stworzony przez NoMachine S.à r.l. Oprogramowanie zapewnia dostęp do zdalnych pulpitów i aplikacji działających na urządzeniach Linux, Windows, Mac i Linux ARM
description_de    : NoMachine ist ein plattformübergreifendes Remote-Desktop-Programm, das von NoMachine S.à r.l. entwickelt wurde. Die Software ermöglicht den Zugriff auf Remote-Desktops und Anwendungen, die auf Linux-, Windows-, Mac- und Linux ARM-Geräten laufen
description_es    : NoMachine es un programa de escritorio remoto multiplataforma desarrollado por NoMachine S.à r.l. El software proporciona acceso a escritorios y aplicaciones remotas que se ejecutan en dispositivos Linux, Windows, Mac y Linux ARM
description_pt    : NoMachine é um programa de desktop remoto multiplataforma desenvolvido pela NoMachine S.à r.l. O software fornece acesso a desktops remotos e aplicações que funcionam em dispositivos Linux, Windows, Mac e Linux ARM
description_it    : NoMachine è un programma di desktop remoto multipiattaforma sviluppato da NoMachine S.à r.l. Il software fornisce l'accesso a desktop remoti e ad applicazioni in esecuzione su dispositivi Linux, Windows, Mac e Linux ARM
description_nl    : NoMachine is een cross-platform remote desktop programma ontwikkeld door NoMachine S.à r.l. De software biedt toegang tot remote desktops en applicaties die draaien op Linux, Windows, Mac en Linux ARM apparaten
description_ru    : NoMachine - это кроссплатформенная программа удаленного рабочего стола, разработанная компанией NoMachine S.à r.l. Программа обеспечивает доступ к удаленным рабочим столам и приложениям, работающим на устройствах Linux, Windows, Mac и Linux ARM
audit_schedule    : 
editor            : NoMachine S.à r.l.
keywords          : 
licence           : proprietary_free,wapt_public
homepage          : https://www.nomachine.com/
package_uuid      : 40968fb2-ac88-40ec-8e67-52419100c448
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://www.nomachine.com/softwareupdates
min_os_version    : 
max_os_version    : 
icon_sha256sum    : f3d96ea16ef4efbfd6be94984d46d706001c18a3c5458fac257651825f89cc6e
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2024-12-04T19:21:49.000000
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
signature         : pCdoljTiDLdlRBIdZ7ISqSfFsCThQPAjkwJ2aKStwM5rcQQZ59wTnNZSkSlUqSa8xy4kiLViMi3VWayi2RiorsWA9cS4B4c88QNw7Yyep8k3FVCbJLU2BYEBaaGuTXSKv/RAK0z7n8NvCPWUk0lGfy3W1TTkKrvzCMtJiBRxMH29ltA5UnTw+d5h1fk4RUBzI8jtzcaVUbhcPH4VVJwY0CigGRl19G02czWUZLn6sqgIgTND0NHK6zFJtKXBliTnRXaCi/HS6EIjVTAAqQmOAIAfNySgGewqi+rw39XuKpY2G1C1rt02ieCgyvvLqqMiL3o53yr6MvjhnA8k3dsOfw==

# -*- coding: utf-8 -*-
from setuphelpers import *

r""" 
https://kb.nomachine.com/AR02N00877

The server.cfg and/or node.cfg files are placed in :

/usr/NX/etc/on Linux

C:\Program files\NoMachine\etc\server.cfg for 64bit packages on 64bit systems
and C:\Program files (x86)\NoMachine\etc\server.cfg for 32bit packages on Windows 64bit systems

/Applications/NoMachine.app/Contents/Frameworks/etc/server.cfg on macOS.

"""


def get_nomachine_dir():
    if get_os_name() == "Windows":
        app_dir = makepath(programfiles, "NoMachine")
    elif get_os_name() == "Linux":
        app_dir = "/usr/NX"
    elif get_os_name() == "Darwin":
        app_dir = "/Applications/NoMachine.app/Contents/Frameworks"
    else:
        error("os not detected")
    return app_dir


server_cfg_path = makepath(get_nomachine_dir(), "etc", "server.cfg")
node_cfg_path = makepath(get_nomachine_dir(), "etc", "node.cfg")

library_nomachine = "/Library/Application Support/NoMachine"
nxuninstall_script = makepath(library_nomachine, "nxuninstall.sh")


def install():
    bin_name = glob.glob("nomachine_*.dmg")[0]

    for service in ['localnxserver', 'nxserver']:
        run_notfatal(f"launchctl stop com.nomachine.{service}")

    remove_script_interactivity()

    install_dmg(
        bin_name,
        key="/Applications/NoMachine.app",
        min_version=control.get_software_version()
    )

    uninstallkey.clear()

    remove_script_interactivity()

    # Configuring server.cfg default preferences
    config_dict = {
        "#UpdateFrequency": "UpdateFrequency 0",
        "UpdateFrequency": "UpdateFrequency 0",
        "#StartNXDaemon": "StartNXDaemon 0",
        "StartNXDaemon": "StartNXDaemon 0",
        "#PhysicalDesktopSharing": "PhysicalDesktopSharing 0",
        "PhysicalDesktopSharing": "PhysicalDesktopSharing 0",
        "#PhysicalDesktopSharing": "PhysicalDesktopSharing 0",
        "#EnableNetworkBroadcast": "EnableNetworkBroadcast 0",
        "#VirtualDesktopAccess": "VirtualDesktopAccess none",
        "VirtualDesktopAccess": "VirtualDesktopAccess none",
        "#PhysicalDesktopAccess": "PhysicalDesktopAccess none",
        "PhysicalDesktopAccess": "PhysicalDesktopAccess none",
        "#PhysicalDesktopAccessNoAcceptance": "PhysicalDesktopAccessNoAcceptance none",
        "PhysicalDesktopAccessNoAcceptance": "PhysicalDesktopAccessNoAcceptance none",
        "#LoginScreenAccess": "LoginScreenAccess 0",
        "LoginScreenAccess": "LoginScreenAccess 0",
        "#PhysicalDesktopMode": "LoginScreenAccess 0",
        "LoginScreenAccess": "LoginScreenAccess 0",
    }
    edit_config_raw_file(server_cfg_path, config_dict)

    # Configuring node.cfg default preferences
    config_dict = {
        "#EnableDiskSharing": "EnableDiskSharing none",
        "EnableDiskSharing": "EnableDiskSharing none",
        "#EnablePrinterSharing": "EnablePrinterSharing none",
        "EnablePrinterSharing": "EnablePrinterSharing none",
        "#EnableUSBSharing": "EnableUSBSharing none",
        "EnableUSBSharing": "EnableUSBSharing none",
        "#EnableNetworkSharing": "EnableNetworkSharing none",
        "EnableNetworkSharing": "EnableNetworkSharing none",
        "#EnableSmartcardSharing": "EnableSmartcardSharing 0",
        "EnableSmartcardSharing": "EnableSmartcardSharing 0",
        "#AudioInterface": "AudioInterface disabled",
        "AudioInterface": "AudioInterface disabled",
        "#DisplayMonitorIcon": "DisplayMonitorIcon 0",
        "DisplayMonitorIcon": "DisplayMonitorIcon 0",
    }
    edit_config_raw_file(node_cfg_path, config_dict)


# https://kb.nomachine.com/AR12K00767
def uninstall():
    killalltasks(ensure_list(control.impacted_process))

    remove_script_interactivity()

    uninstall_app("NoMachine")

    # We run the uninstallation script if it still exist
    if isfile(nxuninstall_script):
        run_notfatal(f"'{nxuninstall_script}'")
        remove_tree(library_nomachine, ignore_errors=True)


def remove_script_interactivity():
    if isfile(nxuninstall_script):
        run(f"sed -i '' '/^ *osascript /d' '{nxuninstall_script}'")

def edit_config_raw_file(conf_path, config_dict, base_file=None, encoding=None):
    r"""
    Edits a configuration file at the given path.
    This function allows you to edit INI files with incorrect format, flat files, dirty JSON, etc.

    Args:
        conf_path (str): The path to the configuration file.
        config_dict (dict): A dictionary containing key-value pairs to be updated or added in the configuration file.
            The key is the string at the beginning of the line you are trying to edit.
            The value is the new replacing line.
            (Note: take care of spaces and tabs (\t), but line return (\n) will be added automatically.)
        base_file (str or None, optional): The base file content to be used if the configuration file doesn't exist.
            It can be either a string representing the base content or a file path. Defaults to None.
        encoding (str, optional): The encoding of the configuration file. If not specified, the function attempts to detect it. Defaults to None.

    Returns:
        (dict or list): The dictionary with the previous line as the key and the new line as the value for edited lines. The list of written lines.

    Example:
    >>> edit_config_raw_file(user_conf_path, config_dict, encoding="UTF-8-SIG")
    {'Language=en-US\n': 'Language=fr-FR\n', 'Destinations=Picker\n': 'Destinations=Editor\n',
    'CaptureMousepointer=True\n': 'CaptureMousepointer=False\n'}
    >>> edit_config_raw_file(server_cfg_path, config_dict))
    ['UpdateFrequency 0\n']

    """
    result_dict = {}
    new_lines = []

    if not encoding and os.path.isfile(conf_path):
        encoding = detect_file_encoding(conf_path)
    else:
        encoding = "UTF-8"

    if not os.path.isfile(conf_path):
        if base_file is None:
            print(f'"{conf_path}" file does not exist, and you did not provide a base_file. Writing values of config_dict line by line.')
            new_lines = set()
            for key, value in config_dict.items():
                new_line = value + "\n"
                new_lines.add(new_line)
            new_lines = list(new_lines)
        else:
            if isfile(base_file):
                # encoding = detect_file_encoding(base_file)
                with open(conf_path, "r", encoding=encoding) as f:
                    new_lines = f.readlines()
            else:
                new_lines = base_file.splitlines()
    else:
        with open(conf_path, "r", encoding=encoding) as f:
            for line in f:
                line_edited = False
                old_line = line
                line = line.rstrip("\n")
                for key, value in config_dict.items():
                    if line.startswith(key):
                        line = value
                        line_edited = True
                        break
                new_line = line + "\n"
                new_lines.append(new_line)
            if line_edited:
                result_dict[old_line] = new_line

    with open(conf_path, "w", encoding=encoding) as f:
        f.writelines(new_lines)

    if result_dict:
        return result_dict
    else:
        return new_lines


def detect_file_encoding(file_path):
    """Detect the encoding of a file."""
    import chardet

    with open(file_path, "rb") as file:
        raw_data = file.read()
        result = chardet.detect(raw_data)
        return result["encoding"]

# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *


def update_package():
    # Declaring local variables
    package_updated = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_name = control.name

    # All URL 
    download_dict = {
        "windows-x64": "https://downloads.nomachine.com/download/?id=8",
        "windows-x86": "https://downloads.nomachine.com/download/?id=9",
        "redhat_based-x64": "https://downloads.nomachine.com/download/?id=2",
        "debian_based-x64": "https://downloads.nomachine.com/download/?id=1",
        "darwin-all": "https://downloads.nomachine.com/download/?id=7",
    }

    url = download_dict[control.target_os + "-" + ensure_list(control.architecture)[0]]

    # Getting latest version from official sources
    print("URL used is: %s" % url)
    for bs_search in bs_find_all(url, "a", "id", "link_download", proxies=proxies):
        if "nomachine_" in bs_search.get("href", ""):
            download_url = bs_search["href"]
            latest_bin = bs_search["href"].rsplit("/", 1)[-1]
            latest_bin_extension = latest_bin.rsplit(".", 1)[-1]
            version = latest_bin.split("_")[1]
            break

    # Downloading latest binaries
    print("Latest %s version is: %s" % (app_name, version))
    print("Download URL is: %s" % download_url)
    if not isfile(latest_bin):
        print("Downloading: %s" % latest_bin)
        wget(download_url, latest_bin, proxies=proxies)
        package_updated = True
    else:
        print("Binary is present: %s" % latest_bin)

    # Changing version of the package
    if Version(version) > Version(control.get_software_version()):
        print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
        package_updated = True
    else:
        print("Software version up-to-date (%s)" % Version(version))

    control.set_software_version(version)
    control.save_control_to_wapt()

    for f in glob.glob(f'*.{latest_bin_extension}'):
        if f != latest_bin:
            remove_file(f)

    # Validating or not update-package-sources
    return package_updated

38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
91fe2d74326c40efa8097a405666a34c69c3e8666355faac84263bc73de16ea0 : WAPT/control
f3d96ea16ef4efbfd6be94984d46d706001c18a3c5458fac257651825f89cc6e : WAPT/icon.png
a9c2ac46382b0ca2251c907d01cb2349599f9e57b6c0ec52b8fc8c83c68c80d6 : luti.json
a35e1d43a4184a84024fb018ee617b09346c54c5940462b2618cbf738339c9f5 : nomachine_8.14.2_4.dmg
444a350f1d14b1c123cec86100655fe25c5cbdcb50504e8646e8d7e7d1fe9aa1 : setup.py
23a09f3d47ccb80a6d93616cdeaa45a111f9ca467313af89c0b644a350b0d042 : update_package.py