Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please write environment variable configuration to ~/.pam_environent and ~/.profile, or /etc/profile.d instead of ~/.bashrc #13

Open
scratch-er opened this issue Feb 25, 2021 · 7 comments · May be fixed by #14 or #20

Comments

@scratch-er
Copy link

This script write environment variable configuration to ~/.bashrc, which means that this configuration will only take effect in an interactive bash session. However, users may want to launch the IDE under a graphical environment, or they may wish to use a different shell, e.g. zsh.
So the configuration should be writen to ~/.pam_environment and ~/.profile instead. Alternatively, if the configuration needs to take effect for all users, the script should create a new file in /etc/profile.d and write the configuration there.

@scratch-er scratch-er changed the title Please write environment variable configuration to ~/.pam_environent and ~/.profile instead of ~/.bashrc, or /etc/profile.d Please write environment variable configuration to ~/.pam_environent and ~/.profile, or /etc/profile.d instead of ~/.bashrc Feb 25, 2021
@lurch
Copy link
Contributor

lurch commented Feb 25, 2021

ping @XECDesign @liamfraser Would changing https://github.com/raspberrypi/pico-setup/blob/master/pico_setup.sh#L71 to write to ~/.profile instead of ~/.bashrc be a good solution? I have to confess I've never heard of ~/.pam_environment - how does that differ from ~/.profile ?

Although bear in mind I'm not sure how much support we should give to non-standard setups...

@XECDesign
Copy link

Can't find anything about ~/.pam_environment either. Since the script installs the SDK into the user's home directory, ~/.profile seems appropriate. For the deb package (when that existed), I was using /etc/profile.d/, which is the system-wide equivalent

lurch added a commit to lurch/pico-setup that referenced this issue Feb 26, 2021
@lurch lurch linked a pull request Feb 26, 2021 that will close this issue
@bablokb
Copy link

bablokb commented Mar 12, 2021

Your patch suffers from the same problem as the original script, i.e. if ~/.profile does not end with a new line, you create garbage. See issue #12

@michaelstoops
Copy link

I agree that ~/.bashrc is not the ideal place for these. I think ~/.profile works for the Bourne family of shells. For zsh, you need ~/.zprofile. See http://zsh.sourceforge.net/Guide/zshguide02.html, section 2.2.

I don't think that installing to a global location (/etc/profile) is a good idea. Besides file permissions, etc, build dirs are by nature stateful, and you generally don't want others messing with the state of your build dir. If you want something to be shared across the system, install the build products to proper global locations.

@lurch
Copy link
Contributor

lurch commented Apr 1, 2021

@michaelstoops See the proposed fix in #14
This script was only written to run on up-to-date installations of Raspberry Pi OS running on a Raspberry Pi, with "out of the box" settings, and therefore it only supports bash and not zsh.

@michaelstoops michaelstoops linked a pull request Apr 3, 2021 that will close this issue
@aallan aallan linked a pull request Apr 6, 2021 that will close this issue
@theAkito
Copy link

theAkito commented Apr 18, 2021

I see no point in supporting such weird exceptions. This script runs on most target platforms, i.e. works with ~/.bashrc.

I also never heard of ~/.pam_environment before and I've never really seen ~/.profile being used at all. Not sure, if this would even work as expected on most operatings systems. ~/.bashrc is the in my opinion best way to handle this. All the rare exceptions may be handled exclusively, by e.g. adjusting the installation script, through e.g. making it possible to provide a variable alternative to ~/.bashrc as a command line option to the script. However, I would oppose changing the default. ~/.bashrc is the best default for almost all users. The remaining users may customize the setup script.

@aallan
Copy link

aallan commented Apr 18, 2021

I also never heard of ~/.pam_environment before and I've never really seen ~/.profile being used at all. Not sure, if this would even work as expected on most operatings systems. ~/.bashrc is the in my opinion best way to handle this. All the rare exceptions may be handled exclusively, by e.g. adjusting the installation script, through e.g. making it possible to provide a variable alternative to ~/.bashrc as a command line option to the script. However, I would oppose changing the default. ~/.bashrc is the best default for almost all users.

Depends on your platform, macOS uses .bash_profile for instance, not .bashrc.

The remaining users may customize the setup script.

That's the whole point of #20. The original script worked just fine for Raspberry Pi OS on a Pi 4. It worked less well for other users on other platforms. So there is an ongoing PR process to improve the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants