source git-annex-install so it it can add git-annex to PATH

This commit was sponsored by Jack Hill on Patreon.
This commit is contained in:
Joey Hess 2018-10-22 13:22:10 -04:00
parent ff9ba1f4d3
commit ba0bbced51
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 20 additions and 10 deletions

View file

@ -14,7 +14,7 @@ to install it. Paste these commands into Termux:
pkg install wget
wget https://git-annex.branchable.com/install/Android/git-annex-install
sh git-annex-install
source git-annex-install
## Starting git-annex

View file

@ -88,3 +88,5 @@ git: 'annex' is not a git command. See 'git --help'.
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Yes, lots of luck over the years :-) This is the final little tweak required to get it working for me on Android.
> [[fixed|done]] --[[Joey]]

View file

@ -3,14 +3,15 @@
subject="""comment 1"""
date="2018-10-22T17:04:18Z"
content="""
runshell contains code that puts it in PATH when run on termux.
That relies on termux's `uname -o` reporting "Android".
Running on Android.. Adding git-annex to PATH for you, and tuning for optimal behavior.
I'm fairly sure I tested that code when I added it, and it worked at the
time.
[[!commit d14983ee68ac553f3a49e9148ed193fbae722bb8]] may be related,
but I don't think so.
That means it should have updated ~/.profile to set PATH appropriate.
It should not be hard to debug
git-annex.linux/runshell, since it's a shell script and you can run it `set -x`
"""]]
The problem is the new git-annex-install script, when it exits, dumps the
user back into the shell they were in before, and that shell has not gotten
its path updated. And without sourcing the download script into the current
shell, it has no way to update the path.
I suppose the best thing is to ask the user to source the script, and then
the script can set PATH. Which I've now done.
""]]

View file

@ -5,6 +5,9 @@
# This is only a convenience script to avoid the user needing to type much
# in termux. The standalone tarball automatically adapts itself to the termux
# environment, so this script should stay as mininal as possible.
#
# This script needs to be sourced into the current termux shell, rather
# than run with a new shell, so it can set the PATH to include git-annex.
set -e
@ -45,4 +48,8 @@ echo "git-annex is successfully installed."
echo "Now running termux-setup-storage, to let git-annex access system storage."
termux-setup-storage
# Add to PATH of shell that sourced this, so the user can immediately
# start using git-annex.
PATH="$PATH:`pwd`/git-annex.linux"
echo "Installation complete."