Firefox/Thunderbird addon: install/session_setup order

Share your tips or issues concerning the WAPT Console or WAPT Agent here
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
User avatar
Aguay
Messages: 27
Registration: May 22, 2015 - 4:20 p.m.

July 18, 2017 - 5:08 PM

Good morning,

Among the packages offered by TIS there is a package that allows you to install an ad blocker in Firefox.
After reading the package I see that there is an "install" function and a "session_setup" function.

Code: Select all

def install():
    extension_directory=os.path.join(programfiles32,'thunderbird-extension','ublock')
    if not os.path.exists(extension_directory):
        os.makedirs(extension_directory)
    copytree2('mozprofile',os.path.join(extension_directory,'mozprofile'))
    copytree2('manifestparser',os.path.join(extension_directory,'manifestparser'))
    ....

def session_setup():
    extension_directory=os.path.join(programfiles32,'thunderbird-extension','ublock')
    sys.path.append(extension_directory)
    from mozprofile import FirefoxProfile
    from mozprofile import addons
    from mozprofile import profile
    from mozprofile import FirefoxProfi
 .....
    
I wanted to be sure about how Wapt worked.
When the "wapt-get" command is called, does the argument passed to it correspond to one of the functions present in the package?

Let's admit

Code: Select all

wapt-get install tis-paquet1
This means it will call the install function of the package "tis-package1".

Therefore, to use the "session_setup" function, you need to run:

Code: Select all

wapt-get session-setup tis-paquet1
Is that correct?
Is there no implicit default call that launches session-setup if the function exists in the package?

A kind of "install -> If session_setup is defined then session_setup else next"?

Because if that's the case, it means that to install this kind of package you absolutely have to run both commands rather than putting it as a dependency on a package and letting the installation happen automatically?

Thank you for your answers :)
User avatar
agauvrit
WAPT Expert
Messages: 238
Registration: Nov 17, 2016 - 10:25
Location: Nantes
Contact :

July 19, 2017 - 09:48

Hello Aguay,

Indeed, the install and session-setup commands call upon the functions defined in the setup.py file of each package.

These functions have a distinct mode of operation:
  • install is intended for installation; it runs in a system account via the wapt service, with maximum rights for installation.
  • session-setup is intended for customization in user context (typically adding an extension to the Moz/Thun profile), it runs in user context, therefore theoretically with restricted rights on the machine.
One cannot call the other; they are never called in the same context!

The session-setup function is called only once at startup per package version: https://www.wapt.fr/fr/doc/CreationPaqu ... index.html

Hoping this has shed some light on the matter,

Alexander
User avatar
Aguay
Messages: 27
Registration: May 22, 2015 - 4:20 p.m.

July 19, 2017 - 09:56

Hello,

thank you for your quick reply! It really cleared things up for me!

Aguay
Locked