Skip to content

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

Open

Description

@scratch-er

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.

Activity

  1. 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[/+] on Feb 25, 2021
  2. lurch commented on Feb 25, 2021

    @lurch
    Contributor

    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...

  3. XECDesign commented on Feb 25, 2021

    @XECDesign

    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

  4. added a commit that references this issue on Feb 26, 2021
    692ec39
  5. bablokb commented on Mar 12, 2021

    @bablokb

    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

  6. michaelstoops commented on Apr 1, 2021

    @michaelstoops

    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.

  7. lurch commented on Apr 1, 2021

    @lurch
    Contributor

    @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.

  8. linked a pull request that will close this issueMajor rewrite of pico_setup.sh #20on Apr 6, 2021
  9. theAkito commented on Apr 18, 2021

    @theAkito

    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.

  10. aallan commented on Apr 18, 2021

    @aallan

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions