Seafile pour Linux

Questions about WAPT Packaging / Requêtes et aides autour des paquets Wapt.
Règles du forum
Règles du forum communautaire
* English support on www.reddit.com/r/wapt
* Le support communautaire en français se fait sur ce forum
* Merci de préfixer le titre du topic par [RESOLU] s'il est résolu.
* Merci de ne pas modifier un topic qui est taggé [RESOLU]. Ouvrez un nouveau topic en référençant l'ancien
* Préciser version de WAPT installée, version complète ET numéro de build (2.2.1.11957 / 2.2.2.12337 / etc.) AINSI QUE l'édition Enterprise / Discovery
* Les versions 1.8.2 et antérieures ne sont plus maintenues. Les seules questions acceptées vis à vis de la version 1.8.2 sont liés à la mise à jour vers une version supportée (2.1, 2.2, etc.)
* Préciser OS du serveur (Linux / Windows) et version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019)
* Préciser OS de la machine d'administration/création des paquets et de la machine avec l'agent qui pose problème le cas échéant (Windows 7 / 10 / 11 / Debian 11 / etc.)
* Eviter de poser plusieurs questions lors de l'ouverture de topic, sinon il risque d'être ignorer. Si plusieurs sujet, ouvrir plusieurs topic, et de préférence les uns après les autres et pas tous en même temps (ie ne pas spammer le forum).
* Inclure directement les morceaux de code, les captures d'écran et autres images directement dans le post. Les liens vers les pastebin, les bitly et autres sites tierces seront systématiquement supprimés.
* Comme tout forum communautaire, le support est fait bénévolement par les membres. Si vous avez besoin d'un support commercial, vous pouvez contacter le service commercial Tranquil IT au 02.40.97.57.55
jmorillo
Messages : 3
Inscription : 16 oct. 2024 - 15:26

02 déc. 2025 - 16:15

Hello à tous !

Seafile, depuis la version 9.0.7, ne fournit plus de .deb sur leur repo. De ce fait, la dernière version en date sur leur repo (et donc de wapt) est la 9.0.6.
Ils sont désormais passé à du format AppImage :(
J'ai bricolé vite fait un package qui fonctionne en me basant sur ce qui existait deja, je vous partage donc le code.

control piqué sur la version windows:

Code : Tout sélectionner

package           : tis-seafile
version           : 9.0.15-0
architecture      : x64
section           : base
priority          : optional
name              : Seafile
categories        : Office
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ,Hubert TOUVET,Amelie LE JEUNE
description       : Seafile is an open source file storage and sharing solution
depends           : 
conflicts         : 
maturity          : DEV
locale            : all
target_os         : linux
min_wapt_version  : 2.3
sources           : https://www.seafile.com/en/download/
installed_size    : 282629518
impacted_process  :
description_fr    : Seafile est une solution de stockage et de partage de fichiers open source
description_pl    : Seafile to rozwiązanie open source do przechowywania i udostępniania plików
description_de    : Seafile ist eine Open-Source-Lösung zur Speicherung und gemeinsamen Nutzung von Dateien
description_es    : Seafile es una solución de código abierto para almacenar y compartir archivos
description_pt    : O Seafile é uma solução de armazenamento e partilha de ficheiros de código aberto
description_it    : Seafile è una soluzione open source per l'archiviazione e la condivisione di file
description_nl    : Seafile is een open source oplossing voor het opslaan en delen van bestanden
description_ru    : Seafile - это решение для хранения и обмена файлами с открытым исходным кодом
audit_schedule    : 
editor            : HaiWenHuZhi ltd.
keywords          : seafile,cloud,file,storage,sharing,solution,client
licence           : opensource_free,wapt_public,cpe:/a:gnu:gpl_v2
homepage          : https://www.seafile.com/
setup.py reprit de authme qui sait gérer les appimage

Code : Tout sélectionner

# -*- coding: utf-8 -*-
from setuphelpers import *
from iniparse import ConfigParser
import os


def install():
    # Custom --------------------------
    # Uninstall old Seafile app (.deb)
    appname = control.package.split('-',1)[1]
    for to_uninstall in installed_softwares(name=appname):
        print('Remove package: %s' % to_uninstall["name"])
        uninstall_apt(to_uninstall["name"])    
    if isfile('/etc/apt/sources.list.d/%s.sources' % appname):
        print('Remove %s.sources' % appname)
        remove_file('/etc/apt/sources.list.d/%s.sources' % appname)
    if isfile('/etc/apt/sources.list.d/%s.list' % appname):
        print('Remove %s.list' % appname)
        remove_file('/etc/apt/sources.list.d/%s.list' % appname)

    # libfuse2 needed to play with appimage
    if (get_distrib_linux() == "ubuntu" and Version(get_distrib_version(), 1) >= "24") or (get_distrib_linux() == "debian" and Version(get_distrib_version(), 1) >= "13"):
        install_apt('libfuse2t64')
    else:
        install_apt('libfuse2')

    # set a symlink to avoid ugly warning at start
    if isfile('/usr/lib/x86_64-linux-gnu/libwayland-client.so.0'):
        print('Found libwayland')
        if not isfile('/usr/lib64/libwayland-client.so.0'):
            print('Symlink to libwayland not present, creating symlink')
            os.symlink('/usr/lib/x86_64-linux-gnu/libwayland-client.so.0', '/usr/lib64/libwayland-client.so.0')
    # Custom ------------------------------
    
    install_dir = makepath('/','opt',control.package.split('-',1)[1])
    appimage = glob.glob("*.AppImage")[0]
    install_appimage(appimage,install_dir)

def uninstall():
    install_dir = makepath('/','opt',control.package.split('-',1)[1])
    uninstall_appimage(install_dir)

def install_appimage(appimage,install_dir,binaliasname=None):
    run('chmod a+x ./' + appimage)

    if isdir(install_dir):
        uninstall_appimage(install_dir)

    mkdirs(install_dir)

    name_appimage = appimage.split('/')[-1]
    filecopyto(appimage, makepath(install_dir, name_appimage))
    run('"./%s" --appimage-extract' % appimage)
    

    for desktop in glob.glob(makepath('squashfs-root','*.desktop')):
 
        desktop_cp = ConfigParser()
        desktop_cp.optionxform = str
        desktop_file = open(desktop, encoding="utf-8")
        desktop_cp.readfp(desktop_file)
        bin_path = desktop_cp.get('Desktop Entry',"Exec")

        newbin_path = install_dir + '/' + name_appimage
        if ' %' in bin_path:
            newbin_path = newbin_path + ' %' + bin_path.split(' %',1)[1]

        icon_path = desktop_cp.get('Desktop Entry',"Icon")

        srcicon = makepath('squashfs-root',icon_path +'.svg')
        if not isfile(srcicon):
            srcicon = makepath('squashfs-root',icon_path +'.png')
        new_icon = install_dir + '/' + srcicon.split('/')[-1]
        filecopyto(srcicon,new_icon)

        desktop_cp.set('Desktop Entry',"Exec",newbin_path)
        desktop_cp.set('Desktop Entry',"Icon",new_icon)
        desktop_cp.remove_option('Desktop Entry', 'TryExec') # Default TryExec is misformated, remove it
        desktop_cp.set('Desktop Entry',"TryExec",install_dir + '/' + name_appimage) # Create new TryExec entry
        with open(desktop, 'w', encoding="utf-8") as f:
            desktop_cp.write(f)

        pathdesk = makepath(install_dir,desktop.split('/')[-1])
        filecopyto(desktop, pathdesk)
        run('chown root:root "%s" ' % pathdesk)

    for f in glob.glob(makepath(install_dir,'*.desktop')):
        run('ln -sf "%s" "/usr/share/applications/%s"' % (f,f.split('/')[-1]))
        run('update-desktop-database /usr/share/applications/') # Update launcher

    if binaliasname :
        run(f"ln -sf {install_dir}/{name_appimage} /usr/bin/{binaliasname}")

    remove_tree('squashfs-root')

def uninstall_appimage(install_dir):

    if not glob.glob(makepath(install_dir,'*.desktop')):
        error('.desktop not found')

    for f in glob.glob(makepath(install_dir,'*.desktop')):
        deskfile = f.split('/')[-1]
        system_desktop = makepath("/","usr","share","applications",deskfile)
        if isfile(system_desktop):
            remove_file(system_desktop)
    remove_tree(install_dir)

# Add application Daemon to autostart applications
def session_setup():
    appname = control.package.split('-',1)[1]
    if isfile(makepath("/","home",get_current_user(),".config","autostart","%s.desktop" % appname)):
        print("Autostart already exist")
    else:
        print("Set autostart for user %s" % get_current_user())
        filecopyto(makepath("/","opt","%s","%s.desktop") % (appname,appname), makepath("/","home",get_current_user(),".config","autostart","%s.desktop" % appname))
Et pour finir, le update_package.py reprit du Seafile de windows et très légerement modifié

Code : Tout sélectionner

# -*- 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)
    bs_search = bs_find_all(url, "a", "class", "download-op")[2] # custom
    version = bs_search.text
    download_url = bs_search["href"]
    latest_bin = download_url.split("/")[-1]

    # 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)
        run('chmod +x %s' % latest_bin)
    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)
Bonne journée à tous
Répondre