Evolution config-sources ignore environment variables

I tried to use the mechanism described at Apps/Evolution/AutoconfigSources - GNOME Wiki! to create an onboarding script for newly set up desktop clients.
Initially I tried with version 3.36.5-0ubuntu1 shipped with Zorin 16.2. There I finally realized that the evolution-source-registry component is ignoring the environment variables that I set, like $REALNAME.

export IMAP_HOST=imap.mail.mymailprovider.com
export EMAIL=john.doe@example.com
export DAV_URL="davs://$USER@groupware.example.com/egroupware/webdav.php/home"
export FULLNAME="John Doe"
gio mount -l|grep "$DAV_URL" || \
nautilus davs://$USER@groupware.example.com/egroupware/webdav.php/home

gsettings set org.gnome.evolution-data-server autoconfig-directory '/etc/evolution-templates'

evolution

So the evolution master process spawned the evolution-source-registry, but when I had a look at /proc/<PID_OF_EVOLUTION_DATA_SERVER>/environ, the environment variables that I set in my onboarding script were not there.

I then tried to launch /usr/libexec/evolution-source-registry in the background before starting evolution, and that workaround fixed the issue.

I then tried with version 3.46.4-2 which is shipped with Debian Bookworm, as I am planning to move the company Laptops to that eventually, but there the same workaround did not work.
I also tried the following:

gsettings set org.gnome.evolution-data-server autoconfig-variables "['IMAP_HOST=imap.mail.mymailprovider.com', 'EMAIL=john.doe@example.com', 'FULLNAME=John Doe']"

But it didn’t work either. BTW, that part in the wiki is very unclear - did i get the format of the value for the gsettings key right?

So the evolution master process spawned the evolution-source-
registry, but when I had a look at
/proc/<PID_OF_EVOLUTION_DATA_SERVER>/environ, the environment
variables that I set in my onboarding script were not there.

Hi,

it’s because the evolution-source-registry process is not started by
the evolution (or other process) directly, but through D-Bus, as a
service, which means the environment variables in the terminal you run
Evolution from do not influence the process, which take care of
starting the D-Bus services on demand.

It means setting the environment variables is tricky, to say the least.

I then tried to launch /usr/libexec/evolution-source-registry in the
background before starting evolution, and that workaround fixed the
issue.
I then tried with version 3.46.4-2 which is shipped with Debian
Bookworm, as I am planning to move the company Laptops to that
eventually, but there the same workaround did not work.

It can be some other process (like GNOME Shell’s calendar server or
evolution-alarm-notify) started the source registry process for you,
before your script had been started. Starting the source registry
process manually should replace any already running process, with the
environment variables being set from the terminal you’d start it with.
The 3.46.x surely replaces already running process. You can verify it
with ps ax | grep evolution, the PIDs should change. Note it’s tricky
to do it, because any clients of it need to reconnect to the new
process.

I also tried the following:
gsettings set org.gnome.evolution-data-server autoconfig-variables
“[‘IMAP_HOST=imap.mail.mymailprovider.com’,
‘EMAIL=john.doe@example.com’, ‘FULLNAME=John Doe’]”

But it didn’t work either.

The autoconfig is executed only on start of the evolution-source-
registry process. Try to start it as:

ESR_DEBUG=1 /usr/libexec/evolution-source-registry

and it’ll print some information, including from the autoconfig part.
I’m not sure whether the 3.46.x is as detailed as the 3.48.x version in
this regard, I’m sorry.

You might be able to do in your script:

  1. setup variables/gsettings
  2. run: evolution --force-shutdown
    or kill all ps ax | grep evolution processes, but it’s tricky,
    because some clients like GNOME Shell can autostart them when lost,
    thus the order in which they are stopped matters
  3. run: evolution
    or other client, which will start the source registry, which will
    do the autoconfig with the changes from the step 1) (especially
    when the Revision key changes in the .source files).

BTW, that part in the wiki is very unclear - did i get the format of
the value for the gsettings key right?

I believe you did get it right. The format specifier is more tricky
from the command line, it’s simpler to set with the dconf-editor or
similar GUI tool.

I do not know what account types you plan to autoconfig, but being it
about mail account, you can create an autoconfig file on the server [1]
and it’ll be checked when the users will allow to Lookup for the
configuration, or when using File->New->Collection Account. With a
correct setup users can fill the accounts when entering only the email
address and then do just few clicks. The collection account can handle
anything, not only mails. The advantage is that such setups can work
more than just with Evolution. It’s not that great as having accounts
created just after machine boot, without any user interaction.

Bye,
Milan

[1] Apps/Evolution/Autoconfig - GNOME Wiki!

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.