You are not logged in.

#1 2023-01-28 14:34:07

petervelosy
Member
Registered: 2023-01-28
Posts: 2

Creating a package that permanently sets an environment variable

Dear Community,

I would like to create a package for a MATLAB toolbox. In order for MATLAB to pick it up, some folders of the toolbox need to be added to MATLAB's path. One way to achieve this is by appending them to the MATLABPATH environment variable.

My package writes a shell script into /etc/profile.d that does just that. However, it only gets sourced at the next login or when the user manually sources it. 

Is there any way to make this happen automatically after installing a package? Or is the only possible solution to echo an instruction to the user with the source command that has to be executed?

Thank you!

Offline

#2 2023-01-28 14:44:28

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,318

Re: Creating a package that permanently sets an environment variable

There is no way to set a variable for the current session from a package.

Offline

#3 2023-01-28 15:17:23

progandy
Member
Registered: 2012-05-17
Posts: 5,167

Re: Creating a package that permanently sets an environment variable

Is it not possible to put those files in a path that matlab reads by default?


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2023-01-28 19:42:56

petervelosy
Member
Registered: 2023-01-28
Posts: 2

Re: Creating a package that permanently sets an environment variable

Well, there is matlabrc (https://de.mathworks.com/help/matlab/ref/matlabrc.html), but it is in the MATLAB installation directory, so for that I would need to locate where MATLAB is installed. If it is installed into the directory where the matlab AUR package puts it, or it is on the PATH, it's fine, but it would be nice to have something more generic.

Offline

Board footer

Powered by FluxBB