tis-seadrive icon

SeaDrive

Silent install package for SeaDrive

3.0.19-51
Utilities
Utilities

Preprod packages are packages built on LUTI. They remain in PREPROD usually for 5 days, after which a second VirusTotal scan is performed to verify that the status has not changed.
If the package passes this last check, it is promoted to PROD and published on the store.

  • package: tis-seadrive
  • name: SeaDrive
  • version: 3.0.19-51
  • categories: Utilities
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ
  • editor: Seafile Ltd.
  • licence: opensource_free,cpe:/a:gnu:gpl_v2,wapt_public
  • locale: all
  • target_os: windows
  • impacted_process: seadrive,seadrive-gui
  • architecture: x64,arm64
  • signature_date:
  • size: 125.56 Mo
  • installed_size: 279.15 Mo
  • homepage : https://www.seafile.com/
  • depends:

package           : tis-seadrive
version           : 3.0.19-51
architecture      : x64,arm64
section           : base
priority          : optional
name              : SeaDrive
categories        : Utilities
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ
description       : SeaDrive enables you to access files on the server without syncing to local disk. It works like a network drive
depends           : tis-vcredist
conflicts         : 
maturity          : PREPROD
locale            : all
target_os         : windows
min_wapt_version  : 2.3
sources           : https://www.seafile.com/en/download/
installed_size    : 279148952
impacted_process  : seadrive,seadrive-gui
description_fr    : SeaDrive vous permet d'accéder aux fichiers sur le serveur sans synchronisation avec le disque local. Il fonctionne comme un lecteur réseau
description_pl    : SeaDrive umożliwia dostęp do plików na serwerze bez konieczności synchronizacji na dysku lokalnym. Działa jak dysk sieciowy
description_de    : Mit SeaDrive können Sie auf Dateien auf dem Server zugreifen, ohne sie mit der lokalen Festplatte zu synchronisieren. Es funktioniert wie ein Netzlaufwerk
description_es    : SeaDrive permite acceder a los archivos del servidor sin necesidad de sincronizarlos con el disco local. Funciona como una unidad de red
description_pt    : SeaDrive permite o acesso a ficheiros no servidor sem sincronização com o disco local. Funciona como uma unidade de rede
description_it    : SeaDrive consente di accedere ai file sul server senza sincronizzare il disco locale. Funziona come un'unità di rete
description_nl    : Met SeaDrive hebt u toegang tot bestanden op de server zonder ze naar de lokale schijf te synchroniseren. Het werkt als een netwerkschijf
description_ru    : SeaDrive позволяет получить доступ к файлам на сервере без синхронизации с локальным диском. Он работает как сетевой диск
audit_schedule    : 
editor            : Seafile Ltd.
keywords          : sharing,file,seafile,drive,sea
licence           : opensource_free,cpe:/a:gnu:gpl_v2,wapt_public
homepage          : https://www.seafile.com/
package_uuid      : 551b9a68-479b-4e09-90e4-d4bc6270635a
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://manual.seafile.com/changelog/drive-client-changelog/
min_os_version    : 10.0
max_os_version    : 
icon_sha256sum    : 095bf254df112880418ca67754fab61e3d80467a8218bf911530a9a9aeade66b
signer            : test
signer_fingerprint: b82fc8ef4a4475c0f69ac168176c2bfc58f572eb716c4eadd65e4785c155dd8e
signature_date    : 2026-01-23T15:40:27.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         : A/+7f7MoCm2LaE91OQ/SBEaShZFKhLuRevgEZ/QcNJoX4cSL550ORT/X8VwKlb06oc5WjzgqXZ2fdoEtNztTVmQuscjLh9jitsgeeL00ytL8jlwJ+C6ot1kY4u8RzB6g0aUmuHm054Dfe5V2KcDtfswQ1Sb7W0gUJ8bKrsMspMNxjtOHvmcPzcwZHHKE1XSKv0okSFP/nIgNpgyx3Ex2N/WdXOpovgcWpil7jsePF61n5k7J5kqHfKRc56Uk7140H1UgEEyZ72pOyDAzREd9/Tzte1eNyaIQhQa9IBEA/p4Ygg9e60MPXWvxCqM07p5qPhEfzpAOPLaNiNQne/SDPQ==

# -*- coding: utf-8 -*-
from setuphelpers import *
import psutil
import time
import threading

"""
  {
   "key":"{ce044972-8c61-4a19-8f29-08e5c75f2674}",
   "name":"SeaDrive 1.0.12",
   "version":"1.0.12",
   "install_date":"",
   "install_location":"",
   "uninstall_string":"\"C:\\ProgramData\\Package Cache\\{ce044972-8c61-4a19-8f29-08e5c75f2674}\\seadrive.exe\"  /uninstall",
   "publisher":"Seafile ltd.",
   "system_component":0,
   "win64":false
  }
  }
   "key":"{7FD14F30-762C-48CF-830B-063CD4F99188}",
   "name":"SeaDrive 3.0.8",
   "version":"3.0.8",
   "install_date":"2024-03-18 00:00:00",
   "install_location":"",
   "uninstall_string":"MsiExec.exe /X{7FD14F30-762C-48CF-830B-063CD4F99188}",
   "publisher":"HaiWenHuZhi ltd.",
   "system_component":0,
   "win64":true
  }
"""
# seadriveRoot
# old=C:\Users\username\seadrive\data
# new=C:/Users/username/seadrive_root

impacted_process = ['seadrive', 'seadrive-gui']


def install():
    bin_name = glob.glob("seadrive-*.msi")[0]
    uninstall_seadrive_v1()
    install_msi_if_needed(
        bin_name,
        min_version=control.get_software_version(),
        timeout=600,
    )

    # Clear the uninstallkeys to avoid the no-code audit and uninstall
    uninstallkey.clear()


def session_setup():
    print("Disabling: auto-update check and configuring base options")
    registry_setstring(HKEY_CURRENT_USER, r"SOFTWARE\SeaDrive", "ShellExtDisabled", "1")
    registry_setstring(HKEY_CURRENT_USER, r"SOFTWARE\SeaDrive\Seafile Drive Client\Language", "current", "en")
    registry_setstring(HKEY_CURRENT_USER, r"SOFTWARE\SeaDrive\Seafile Drive Client\Misc", "SparkleAlreadyEnableUpdateByDefault", "true")
    registry_setstring(HKEY_CURRENT_USER, r"SOFTWARE\SeaDrive\Seafile Drive Client\WinSparkle", "CheckForUpdates", "0")
    registry_setstring(HKEY_CURRENT_USER, r"Software\SeaDrive\Seafile Drive Client\Behavior", "hideMainWindowWhenStarted", "true")
    #registry_setstring(HKEY_CURRENT_USER, r"SOFTWARE\SeaDrive\Seafile Drive Client\Settings", "diskLetter", "S:")
    
    #Since version 3, there is no more drive letter assigned. Here is how to configure it.
    mount_point = registry_readstring(HKEY_CURRENT_USER, r"SOFTWARE\SeaDrive\Seafile Drive Client\Settings", "seadriveRoot")
    if isdir(mount_point):
        for folder in glob.glob(f'{mount_point}\*\Shared with groups'):
            if isdir(folder):
                registry_setstring(HKEY_CURRENT_USER, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Seadrive_letter" , rf'''C:\Windows\System32\cmd.exe /C "subst S: {folder.split('Shared with groups')[0]}"''')
                #run(f'subst S: {folder.split("Shared with groups")[0]}')
                break
    
    #Seadrive is now installed in programfiles, not programfiles32
    registry_setstring(HKEY_CURRENT_USER, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Seadrive", r"C:\Program Files\SeaDrive\bin\seadrive-gui.exe")


def audit():
    # Declaring local variables
    audit_status = "OK"
    app_check = installed_softwares("SeaDrive")
    if app_check:
        installed_version = app_check[0]["version"]
        control.name = app_check[0]["name"]
    else:
        installed_version = ""
        control.name = control.package.split("-", 1)[-1].replace("-", " ").title()
    audit_version = False

    # Auditing software
    if not installed_version:
        print(f"{control.name} is not installed.")
        audit_status = "ERROR"
    elif audit_version and Version(installed_version, 4) < Version(control.get_software_version(), 4):
        print(f"{control.name} ({installed_version}) installed version should be: {control.get_software_version()}")
        audit_status = "WARNING"
    else:
        print(f"{control.name} is installed." if installed_version in control.name else f"{control.name} ({installed_version})  is installed.")
        audit_status = "OK"

    return audit_status


def uninstall():

    # "C:\Program Files\SeaDrive\bin\seadrive-gui.exe" --remove-user-data
    for to_uninstall  in installed_softwares("SeaDrive"):
        print(f"Removing: {to_uninstall['name']} ({to_uninstall['version']})")
        kill_processes_until_gone(impacted_process) # Temporary fix control.impacted_process does not works
        run(uninstall_cmd(to_uninstall["key"]))
        wait_uninstallkey_absent(to_uninstall["key"])


def uninstall_seadrive_v1():

    # Uninstalling the SeaDrive dependency called Dokan Library
    for to_uninstall in installed_softwares("Dokan Library"):
        print(f"Removing: {to_uninstall['name']} ({to_uninstall['version']})")
        killalltasks(impacted_process) # Temporary fix control.impacted_process does not works
        run(uninstall_cmd(to_uninstall["key"]))
        wait_uninstallkey_absent(to_uninstall["key"])

    # Uninstalling SeaDrive
    for to_uninstall in installed_softwares(name="SeaDrive 1"):
        print(f"Removing: {to_uninstall['name']} ({to_uninstall['version']})")
        kill_processes_until_gone(impacted_process) # Temporary fix control.impacted_process does not works
        run(uninstall_cmd(to_uninstall["key"]))
        wait_uninstallkey_absent(to_uninstall["key"])


def kill_processes_until_gone(process_names: list, max_wait: int = 15):
    def _worker():
        for _ in range(max_wait):
            procs = find_processes_custom(process_names)
            if procs:
                killalltasks(process_names)
            time.sleep(1)
    t = threading.Thread(target=_worker, daemon=True)
    t.start()
    return t


def find_processes_custom(process_names):
    """Return list of Process objects whose names match any of process_names.

    Args:
        process_names (str | list[str] | tuple[str] | set[str]): process name(s) to lookup

    Returns:
        list: list of psutil.Process matching any name or name+'.exe' (case-insensitive)

    >>> [p.pid for p in find_processes(['explorer', 'notepad'])]
    [2756, 4024]
    """

    if isinstance(process_names, str):
        process_names = [process_names]
    
    names = set()
    for name in process_names:
        if not isinstance(name, str) or not name.strip():
            continue
        n = name.lower()
        names.add(n)
        names.add(n + ".exe")

    result = []
    for p in psutil.process_iter():
        try:
            if p.name().lower() in names:
                result.append(p)
        except (psutil.AccessDenied, psutil.NoSuchProcess):
            pass

    return result

# -*- 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()
    url = "https://www.seafile.com/en/download/"

    # Getting latest version from official sources
    print("URL used is: %s" % url)
    for bs_search in bs_find_all(url, "a", "class", "download-op", proxies=proxies):
        if "seadrive-" in bs_search.get("href", ""):
            version = bs_search.text
            download_url = bs_search["href"]
            latest_bin = download_url.split("/")[-1]
            break

    # Downloading latest binaries
    print("Latest %s version is: %s" % (control.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)
    else:
        print("Binary is present: %s" % latest_bin)

    # Deleting outdated binaries
    remove_outdated_binaries(latest_bin)
    # arch_list = ensure_list(control.architecture)
    # remove_outdated_binaries(version, filename_contains=("x64" if "x64" in arch_list else "x86" if "x86" in arch_list else []))

    # Checking version from file
    if get_os_name() == "Windows" and "windows" in control.target_os.lower():
        version_from_file = get_version_from_binary(latest_bin)
        if Version(version_from_file, 4) == Version(version, 4):
            print(f"INFO: Binary file version ({version_from_file}) corresponds to online version ({version})")
        else:
            error(f"ERROR: Binary file version ({version_from_file}) do NOT corresponds to online version ({version})")

    # Changing version of the package
    if Version(version, 4) > Version(control.get_software_version(), 4):
        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()

    # Validating or not update-package-sources
    return package_updated

    # # Changing version of the package and validating update-package-sources
    # return complete_control_version(control, version)

01ca7fe94636e5a08fcb73849d3b5df25d51e2c82f4dd1a08f01798b25899819 : WAPT/certificate.crt
70c994f367246fab2dd55e30564164a7ddaae46353df5f61ca3010b2a23c45b5 : WAPT/control
095bf254df112880418ca67754fab61e3d80467a8218bf911530a9a9aeade66b : WAPT/icon.png
0de0e81eff53d8e00f5e93ea56bb15f91c9b98026c944649f49174d3b66aabe5 : luti.json
0ff6fbd6fdfbaae4623b050a28ea5f3bd12e771a5119519b4ffb0b8caf8df6f6 : seadrive-3.0.19-en.msi
56c8737ebb08bc87bc687c407704b9389cd05c64f3e1aebf70d9543b70e60add : setup.py
b1ade14df81877051a284cf03d6c850a58f30d90ccd9a74216bfd52092f75e1f : update_package.py