What is the best way to get Environment variables setup in my shell script for export PATH?



Please correct me, but I think the system environment set up in Yocto
Linux may not be the same as other distributions. I have a shell
script to set up export PATH and LD_LIBRARY_PATH, I want to avoid
putting full path in ExecStart and all of my shell scripts


I have been thinking of the following options, but I am not sure which
one works, if the syntax is correct or not, which one is the best for
common practice, appreciate your advice.

(1) Setup in all systemd service scripts


Is the syntax above statements in service scripts correct? Will it work?

(2) Add my_export.sh to /etc/profile.d

That one works for Ubuntu, Debian and CentOS, will all Yocto systemd
service scripts pick up environment setup from /etc/profile.d
automatically in Yocto Linux distribution?

(3) Add my_export.sh to /etc/default

Some distributions automatically pick setup from /etc/default, does it
work for Yocto Linux for systemd service scripts to pick up
my_export.sh setup from /etc/default?

Thank you.

Kind regards,

- jupiter

Join {yocto@lists.yoctoproject.org to automatically receive all group messages.