diff options
author | Joey Hess <joeyh@joeyh.name> | 2018-04-25 13:47:43 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2018-04-25 13:48:37 -0400 |
commit | 118ed8f92b5ae8daf282c3d236e5091137c649c5 (patch) | |
tree | 399b7b6763507e7234033f00393c80be88703e81 /standalone | |
parent | dd7ab91f97547a12420af6cb51e5b60c41c074a5 (diff) |
runshell: hacks for termux; add tip
Added some tweaks to make git-annex work in termux on Android. The regular
arm standalone tarball now works in termux.
I guess the test for "$base/bin/git" is not really necessary, since it
tests for git-annex. Since that gets deleted on android, removed that test.
These are pretty hackish hacks, especially adding it to PATH. The goal is
to make it work well enough out of the box on Android.
This commit was sponsored by Eric Drechsel on Patreon.
Diffstat (limited to 'standalone')
-rwxr-xr-x | standalone/linux/skel/runshell | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell index dc0a2b64fd..13c57a5451 100755 --- a/standalone/linux/skel/runshell +++ b/standalone/linux/skel/runshell @@ -4,6 +4,7 @@ set -e +os="$(uname -o 2>/dev/null || true)" base="$(dirname "$0")" if [ ! -d "$base" ]; then @@ -15,10 +16,6 @@ if [ ! -e "$base/bin/git-annex" ]; then echo "** base directory $base does not contain bin/git-annex" >&2 exit 1 fi -if [ ! -e "$base/bin/git" ]; then - echo "** base directory $base does not contain bin/git" >&2 - exit 1 -fi # Get absolute path to base, to avoid breakage when things change directories. orig="$(pwd)" @@ -152,10 +149,36 @@ for localeenv in "$LANG" "$LANGUAGE" "$LC_CTYPE" "$LC_NUMERIC" "$LC_TIME" \ fi done -# Indicate which variables were exported above and should be cleaned -# when running non-bundled programs. -GIT_ANNEX_STANDLONE_ENV="PATH GCONV_PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR MANPATH LOCPATH" -export GIT_ANNEX_STANDLONE_ENV +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 + # The bundled git does not work well on sdcard, so delete + # it and use termux's git which works better. + cd "$base" + find . | grep git | grep -v git-annex | grep -v git-remote-tor-annex | grep -v git-remote-gcrypt | xargs rm -rf + 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 + fi + fi + + # Store ssh connection caching sockets outside of sdcard. + GIT_ANNEX_TMP_DIR="$TMPDIR" + export GIT_ANNEX_TMP_DIR + + GIT_ANNEX_STANDLONE_ENV="PATH GCONV_PATH MANPATH LOCPATH" + export GIT_ANNEX_STANDLONE_ENV + ;; + *) + # Indicate which variables were exported above and should be cleaned + # when running non-bundled programs. + GIT_ANNEX_STANDLONE_ENV="PATH GCONV_PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR MANPATH LOCPATH" + export GIT_ANNEX_STANDLONE_ENV + ;; +esac if [ "$1" ]; then cmd="$1" |