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.
This commit is contained in:
parent
dd7ab91f97
commit
118ed8f92b
4 changed files with 90 additions and 13 deletions
|
@ -14,6 +14,8 @@ git-annex (6.20180410) UNRELEASED; urgency=medium
|
||||||
libraries.
|
libraries.
|
||||||
* runshell: Unset LD_PRELOAD since preloaded libraries from the host
|
* runshell: Unset LD_PRELOAD since preloaded libraries from the host
|
||||||
system may not get along with the bundled linker.
|
system may not get along with the bundled linker.
|
||||||
|
* runshell: Added some tweaks to make git-annex work in termux on
|
||||||
|
Android. The regular arm standalone tarball now works in termux.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 09 Apr 2018 14:03:28 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 09 Apr 2018 14:03:28 -0400
|
||||||
|
|
||||||
|
|
47
doc/tips/install_on_Android_in_Termux.mdwn
Normal file
47
doc/tips/install_on_Android_in_Termux.mdwn
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
[Termux](https://termux.com/) is an Android app that can run some
|
||||||
|
Linux software in a terminal.
|
||||||
|
|
||||||
|
git-annex is not currently part of the Termux distribution, but it's easy
|
||||||
|
to install it. Paste these commands into Termux:
|
||||||
|
|
||||||
|
pkg install git wget tar
|
||||||
|
cd
|
||||||
|
wget https://downloads.kitenet.net/git-annex/linux/current/git-annex-standalone-armel.tar.gz
|
||||||
|
tar zxf git-annex-standalone-armel.tar.gz
|
||||||
|
rm git-annex-standalone-armel.tar.gz
|
||||||
|
git-annex.linux/runshell
|
||||||
|
|
||||||
|
Now you can set up a git-annex repository or two, to manage your
|
||||||
|
Android files. Here we'll make one for camera photos.
|
||||||
|
|
||||||
|
termux-setup-storage
|
||||||
|
cd ~/storage/dcim
|
||||||
|
git init
|
||||||
|
git annex init
|
||||||
|
|
||||||
|
You can run the git-annex assistant in your repository, to automatically
|
||||||
|
notice new and changed files and commit them to the repository:
|
||||||
|
|
||||||
|
cd ~/storage/dcim
|
||||||
|
git annex assistant
|
||||||
|
|
||||||
|
You can set up a ssh remote pointing to a server, and the assistant will
|
||||||
|
automatically sync things up.
|
||||||
|
|
||||||
|
And so on. Most ways you would use git-annex on a Linux system work fairly
|
||||||
|
well in this Termux environment.
|
||||||
|
|
||||||
|
Known limitations:
|
||||||
|
|
||||||
|
* Direct mode
|
||||||
|
|
||||||
|
git-annex will probably default to direct mode due to the
|
||||||
|
limitations of Android's /sdcard. You can get around this using v6
|
||||||
|
unlocked repositories, or by putting the git-annex repository on a better
|
||||||
|
filesystem on the Android device, such as your termux home directory.
|
||||||
|
|
||||||
|
* Webapp
|
||||||
|
|
||||||
|
The webapp doesn't know how to open a web browser on Android. It displays
|
||||||
|
a `file://` url, and if you copy and paste that into a web browser, it
|
||||||
|
will work.
|
|
@ -10,20 +10,25 @@ the termux home directory. Note that only the git bundled with git-annex
|
||||||
has this problem; the termux one works (probably it's patched like I did in
|
has this problem; the termux one works (probably it's patched like I did in
|
||||||
the android git-annex port). Hacking the standalone build to not run the
|
the android git-annex port). Hacking the standalone build to not run the
|
||||||
bundled git should work. This could be done only when uname -o = Android.
|
bundled git should work. This could be done only when uname -o = Android.
|
||||||
|
(Update: Fixed)
|
||||||
|
|
||||||
git annex init fails with a getUserEntryForID exception.
|
git annex init fails with a getUserEntryForID exception.
|
||||||
[[!commit 526243d6f5db6e16c32ed7f835da590b877f78b8]] probably fixed this,
|
[[!commit 526243d6f5db6e16c32ed7f835da590b877f78b8]] probably fixed this,
|
||||||
but not tested yet.
|
but not tested yet. (Update: Fixed)
|
||||||
|
|
||||||
The webapp doesn't know how to open an url, but copy and paste of the
|
The webapp is able to open an url (after I upgraded termux) via xdg-open
|
||||||
url to a web browser works and the webapp mostly works then. It should
|
(alias for termux-open), but when in /sdcard/t2 it opened an url that
|
||||||
be able to use termux-open.
|
chrome was not able to access, apparently a permissions problem. The
|
||||||
|
webapp.html does not add any security on android, since it's not a
|
||||||
|
multiuser unix system, and so it should open the url to the webapp
|
||||||
|
directly.
|
||||||
|
|
||||||
Accessing the sdcard may need termux-setup-storage to be run once,
|
Accessing the sdcard may need termux-setup-storage to be run once,
|
||||||
depending on the version of android. That sets up $HOME/storage.
|
depending on the version of android. That sets up $HOME/storage.
|
||||||
|
The webapp ought to default to making a repository somewhere in there.
|
||||||
|
|
||||||
webbapp won't start on boot, but could be made to using https://wiki.termux.com/wiki/Termux:Boot
|
webbapp won't start on boot, but could be made to using https://wiki.termux.com/wiki/Termux:Boot
|
||||||
|
|
||||||
Apparently termux-exec sets a `LD_PRELOAD` that is not compatible, so
|
Apparently termux-exec sets a `LD_PRELOAD` that is not compatible, so
|
||||||
the wrapper script would need to unset it.
|
the wrapper script would need to unset it. (Done now)
|
||||||
"""]]
|
"""]]
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
os="$(uname -o 2>/dev/null || true)"
|
||||||
base="$(dirname "$0")"
|
base="$(dirname "$0")"
|
||||||
|
|
||||||
if [ ! -d "$base" ]; then
|
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
|
echo "** base directory $base does not contain bin/git-annex" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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.
|
# Get absolute path to base, to avoid breakage when things change directories.
|
||||||
orig="$(pwd)"
|
orig="$(pwd)"
|
||||||
|
@ -152,10 +149,36 @@ for localeenv in "$LANG" "$LANGUAGE" "$LC_CTYPE" "$LC_NUMERIC" "$LC_TIME" \
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
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
|
# Indicate which variables were exported above and should be cleaned
|
||||||
# when running non-bundled programs.
|
# when running non-bundled programs.
|
||||||
GIT_ANNEX_STANDLONE_ENV="PATH GCONV_PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR MANPATH LOCPATH"
|
GIT_ANNEX_STANDLONE_ENV="PATH GCONV_PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR MANPATH LOCPATH"
|
||||||
export GIT_ANNEX_STANDLONE_ENV
|
export GIT_ANNEX_STANDLONE_ENV
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ "$1" ]; then
|
if [ "$1" ]; then
|
||||||
cmd="$1"
|
cmd="$1"
|
||||||
|
|
Loading…
Reference in a new issue