ivan-hc / AM

AppImage package manager to install, update (for real) and manage ALL of them (system-wide or locally) thanks to its ever-growing AUR-inspired database listing 2000+ portable apps and programs for GNU/Linux. The first, real centralized repository to manage your AppImages with the ease of APT and the power of PacMan.
https://portable-linux-apps.github.io
GNU General Public License v3.0
441 stars 31 forks source link

Option to skip _patch_bashrc_and_profile #705 #706

Closed Samueru-sama closed 2 months ago

Samueru-sama commented 2 months ago

I would love an option to have the APP-MANAGER script skip the function _patch_bashrc_and_profile where the script writes the following to ~/.bashrc (and other dotfiles):

export PATH=$(echo $PATH | tr ":" "\n" | grep -v "/.local/bin" | tr "\n" ":" | sed s/.$//)
export PATH=$PATH:$HOME/.local/bin

Personally, I don't like anything touching my bash dotfiles and prefer to manage my PATH manually via my own dotfiles.

Any option to disable that would be great. I don't know if you'd prefer an environment variable to control it like [[ -z "${APPMAN_SKIP_PATCH_BASHRC_AND_PROFILE:-} ]] && _patch_bashrc_and_profile or a value in the appman-config config file.


Unrelated to this, I just want to say I love appman. I had ignored AppImages due to the lack of a package management command line tool. Thank you so much for this. This plus AppImaGen and ArchImage are great. I very much appreciate it.

Originally posted by @rvenutolo in https://github.com/ivan-hc/AM/discussions/705

Samueru-sama commented 2 months ago

I think the default behavior should be like this:

if ! echo "$PATH" | grep ".local/bin"; then
    function_to_patch
fi

Also do we have to patch the bashrc? I'm a zsh user, on zsh you only have to add $HOME/.local/bin to zprofile, adding it to zshrc would cause $HOME/.local/bin to repeat in PATH the second time you open a terminal window.

Samueru-sama commented 2 months ago

Also worth mentioning that adding $HOME/.local/bin to PATH is job of the distribution as detailed in the XDG Base Dir specification:

User-specific executable files may be stored in $HOME/.local/bin. Distributions should ensure this directory shows up in the UNIX $PATH environment variable, at an appropriate place.

So yeah I think we should just give a warning and ask the user if they want to patch their .profile/.bash_profile.

EDIT: I changed it instead to just patch if we detect that $HOME/.local/bin isn't part of PATH.

ivan-hc commented 2 months ago

@Samueru-sama I think you are absolutely right.

I would like to stop patching configuration files, and I would like to delegate everything to the README. It's not "AppMan" who should handle them.

I want to disable the function, or at least I would like an option that can solve the problems.

Samueru-sama commented 2 months ago

@Samueru-sama I think you are absolutely right.

I would like to stop patching configuration files, and I would like to delegate everything to the README. It's not "AppMan" who should handle them.

I want to disable the function, or at least I would like an option that can solve the problems.

In that case we simply issue a warning and ask if the user would like that appman patches their .bash_profile or .profile

edit: adding the question part right now

ivan-hc commented 2 months ago

@Samueru-sama we must go talk at https://github.com/ivan-hc/AM/pull/707

Samueru-sama commented 2 months ago

@rvenutolo let us know if this works for you.

rvenutolo commented 2 months ago

This should work for me. Thanks very much.