Added use of PERL5LIB in SYSV script and in systemd unit file.#24
Added use of PERL5LIB in SYSV script and in systemd unit file.#24mherger merged 1 commit intoLMS-Community:public/8.2from JohanSaaw:public/8.2
Conversation
michaelherger
left a comment
There was a problem hiding this comment.
I like the more generic approach instead of hacking for specific systems.
Please see my comments about adding vs. replacing the library path.
| # package drops the Slim perl modules. Setting PERL5LIB to this location will | ||
| # make sure that the squeezebox server executable looks here before it scans the | ||
| # directories in the perl @INC array. | ||
| export PERL5LIB="/usr/lib/perl5/vendor_perl" |
There was a problem hiding this comment.
Shouldn't you add this path to PERL5LIB, rather than replace it completely? The user could potentially have it set for good reasons.
| # package drops the Slim perl modules. Setting PERL5LIB to this location will | ||
| # make sure that the squeezebox server executable looks here before it scans the | ||
| # directories in the perl @INC array. | ||
| Environment="PERL5LIB=/usr/lib/perl5/vendor_perl" |
There was a problem hiding this comment.
Hi,
I actually did think about this too. The setting of this variable the way I have done will only have an impact for the process running squeezeboxserver, it will not change the value globally. But even so, it will of course have an impact if someone have set PERL5LIB with the direct intent to add or change something to the squeezeboxserver process
It is absolutely no problem at all to change the SYSV script to use:
export PERL5LIB="/usr/lib/perl5/vendor_perl;$PERL5LIB"
For the systemd unit file it is, unfortunately more complex. By default the systemd unit files will not pick up any environment variables (the systems I work with in my day job only pick up PATH and LANG in systemd). It is thus not possible to have a statement like:
Environment="PERL5LIB=/usr/lib/perl5/vendor_perl;$PERL5LIB"
in the unit file. It will just evaluate to /usr/lib/perl5/vendor_perl. This is also the reason why the SQUEEZEBOX_ARGS variable from the file /etc/sysconfig/squeezeboxserver can't be used in the systemd unit file.
If someone has set the PERL5LIB variable in order to change something for squeezeboxserver, then they will have to use a drop-in file in /etc/systemd/system/squeezeboxserver.service.d. This is, unfortunately, how systemd is designed.
The systemd is in many ways different to how people are used to how Linux works. Another example is that systemd does not respect the ulimits set in /etc/security/limits.conf. Instead systemd uses it own default values. These default values can be changed system wide by editing /etc/systemd/system.conf. This can actually lead to some strange effects in some specific cases if default values are changed for a unit running as a specific user, but the values in the normal limits.conf for that user are left unchanged.
To summarise,
- SYSV init file: I am happy to change the init file. How do I do that? By creating a new pull request?
- systemd unit file: I wouldn't know how to do this.
Please let me know what you think.
Regards, Johan
There was a problem hiding this comment.
Thanks for the explanation! Sounds good to me.
By setting PERL5LIB in the SYSV init script and in the systemd unit file we will work around the different values of the perl @inc array in the different distributions. With PERL5LIB set to /usr/lib/perl5/vendor_perl, the squeezebox server executable will search for modules in that directory before it searches any of the directories in the @inc array.
As result it is no longer needed to create a symbolic link pointing to /usr/lib/perl5/vendor_perl from a directory present in @inc on any of the RPM based distributions.