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

swiftly installer change default bin to /usr/local/bin #49

Closed
wants to merge 2 commits into from

Conversation

MahdiBM
Copy link
Contributor

@MahdiBM MahdiBM commented Apr 7, 2023

Using the changes in this PR, swiftly and its installer will default to /usr/local/bin instead of $HOME/.local/bin.

I was initially going to do this, but ended up doing this after some more research.

I personally checked 6 different OS instances, (my MacBook + Ubuntu 22.04 & 18.04 & amazonlinux on Docker + Ubuntu 22.04 on 2 vps, one with root and one with a default user). None of them actually had $HOME/.local/bin in their PATH and all of them had /usr/local/bin (Not even the 2 non-root-user OS: my MacBook and a vps).

I did find this Github Issue that mentions there should be a $HOME/.local/bin, but I just don't see it. Overall i'm a little bit confused of the PATH situation, but I think /usr/local/bin should solve the problem anyway.

The bash docs says this about PATH:

.B PATH
indicates the current directory.
A null directory name may appear as two adjacent colons, or as an initial
or trailing colon.
The default path is system-dependent,
and is set by the administrator who installs
.BR bash .
A common value is
.na
.if t \f(CW/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin\fP.
.if n ``/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin''.

This, plus my own observations, makes me think we can put some trust in /usr/local/bin.

Solves #48.

@patrickfreed
Copy link
Contributor

Thanks for making this PR, but unfortunately I don't necessarily think this is the direction we want to go. See my comment on #48 for a bit more context.

Regarding ~/.local/bin not being on the PATH, that is a bit surprising, since it is used by lots of different things for storing executables due to its definition in the base directory specification. Ubuntu 20.04 at least adds it to the PATH by default if it exists in the .profile file shipped with it:

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

@MahdiBM MahdiBM closed this Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants