From f2a54e3401f8a9ca15f7e19c2469321fd8982062 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 23 May 2019 13:06:20 -0400 Subject: [PATCH] Android: Improve installation process when the user's login shell is not bash. ~/.profile works for bash, but not all other login shells. This setting PATH is a minor convenience for users, particuarly since typing on android is so much harder. The usual linux standalone bundle just expects the user to know how to add it to PATH. I don't want this code to grow special cases for every possible login shell. So displaying a message to the presumably minority who don't use bash seems like the best choice. Longer term, I'd hope termux gets some way to set an environment variable for all login shells. Systems using PAM can, via ~/.pam_environment. Or alternatively, add a git-annex package to termux, even if just an installer package. I'd rather spend time on either of those than on making this minor thing support more login shells. This commit was sponsored by mo on Patreon. --- CHANGELOG | 2 ++ ...ll_doesn__39__t_permanently_add_to___36__PATH.mdwn | 4 ++++ standalone/linux/skel/runshell | 11 ++++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9718bf95be..430825bf15 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,8 @@ git-annex (7.20190508) UNRELEASED; urgency=medium * init: When the repository already has a description, don't change it. * describe: When run with no description parameter it used to set the description to "", now it will error out. + * Android: Improve installation process when the user's login shell is not + bash. -- Joey Hess Mon, 06 May 2019 13:52:02 -0400 diff --git a/doc/bugs/Android_install_doesn__39__t_permanently_add_to___36__PATH.mdwn b/doc/bugs/Android_install_doesn__39__t_permanently_add_to___36__PATH.mdwn index 5cea6440d4..f4f5e661ee 100644 --- a/doc/bugs/Android_install_doesn__39__t_permanently_add_to___36__PATH.mdwn +++ b/doc/bugs/Android_install_doesn__39__t_permanently_add_to___36__PATH.mdwn @@ -29,3 +29,7 @@ git: 'annex' is not a git command. See 'git --help'. Yes, been using it for many years and couldn't live without it. [[!meta title="termux install adds git-annex only to bash path, not zsh etc"]] + +> made it detect when the login shell is not bash, and rather than add to +> .profile, print out a message letting the user know what they need to +> add to their shell's path [[done]] diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell index 32849e3f8d..0c39199193 100755 --- a/standalone/linux/skel/runshell +++ b/standalone/linux/skel/runshell @@ -185,7 +185,7 @@ case "$os" in # Make this bundle work well on Android. Android) if [ -e "$base/git" ]; then - echo "Running on Android.. Adding git-annex to PATH for you, and tuning for optimal behavior." >&2 + echo "Running on Android.. Tuning for optimal behavior." >&2 # The bundled git does not work well on sdcard, so delete # it and use termux's git which works better. cd "$base" @@ -197,8 +197,13 @@ case "$os" in termux-fix-shebang bin/* runshell git-annex git-annex-shell git-annex-webapp cd "$orig" # Save the poor Android user the typing. - if ! [ -e "$HOME/.profile" ] || ! grep -q "$base" "$HOME/.profile"; then - echo 'PATH=$PATH:'"$base" >> $HOME/.profile + if echo "$SHELL" | grep -q '/bash'; then + if ! [ -e "$HOME/.profile" ] || ! grep -q "$base" "$HOME/.profile"; then + echo "Adding git-annex to PATH for you, in $HOME/.profile" + echo 'PATH=$PATH:'"$base" >> $HOME/.profile + fi + else + echo "To use git-annex, you will need to add $base to your shell's PATH." fi fi