use C shim to start Android app

This should avoid relying on features of the Android builtin shell,
and so hopefully avoid failures like this one
http://git-annex.branchable.com/design/assistant/blog/day_197__template_haskell/#comment-07f90830f78f6495dcbdf90eb8636129

The C shim sets up busybox, and uses its builtin shell to run runshell.

It's important that busybox be configured with
CONFIG_FEATURE_SH_STANDALONE, so that while runshell is running, it
does not rely on either system utilities, or busybox being already
installed.
This commit is contained in:
Joey Hess 2013-02-24 13:25:55 -04:00
parent 920138d5fb
commit ac0292df95
6 changed files with 64 additions and 12 deletions

View file

@ -1,13 +1,10 @@
#!/system/bin/sh
# This is run by the Android app, and runs a shell in an environment
# configured for git-annex.
# This is runs a shell in an environment configured for git-annex.
set -e
prep () {
# I'm installed as lib/lib.runshell.so
orig="$(pwd)"
cd "$0/../.."
# lib.start.so will run us in the root of our app directory
base="$(pwd)"
# Cannot rely on Android providing a sane HOME
@ -57,7 +54,7 @@ buildtree () {
}
install () {
if [ ! -d "$base/bin" ]; then
if [ ! -e "$base/git-annex" ]; then
if ! mkdir -p "$HOME"; then
echo "mkdir of $HOME failed!"
fi