try to be more robust and allow the user to see most types of failure
This commit is contained in:
parent
2d2d27a9d5
commit
acc3c8c157
1 changed files with 70 additions and 49 deletions
|
@ -4,16 +4,18 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# I'm installed as lib/lib.runshell.so
|
prep () {
|
||||||
orig="$(pwd)"
|
# I'm installed as lib/lib.runshell.so
|
||||||
cd "$0/../.."
|
orig="$(pwd)"
|
||||||
base="$(pwd)"
|
cd "$0/../.."
|
||||||
|
base="$(pwd)"
|
||||||
|
|
||||||
# Cannot rely on Android providing a sane HOME
|
# Cannot rely on Android providing a sane HOME
|
||||||
HOME="/sdcard/git-annex.home"
|
HOME="/sdcard/git-annex.home"
|
||||||
export HOME
|
export HOME
|
||||||
|
}
|
||||||
|
|
||||||
setup () {
|
buildtree () {
|
||||||
echo "Installation starting to $base"
|
echo "Installation starting to $base"
|
||||||
cat "$base/lib/lib.version.so"
|
cat "$base/lib/lib.version.so"
|
||||||
|
|
||||||
|
@ -54,49 +56,68 @@ setup () {
|
||||||
echo "Installation complete"
|
echo "Installation complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -d "$base/bin" ]; then
|
install () {
|
||||||
if ! mkdir -p "$HOME"; then
|
if [ ! -d "$base/bin" ]; then
|
||||||
echo "mkdir of $HOME failed!"
|
if ! mkdir -p "$HOME"; then
|
||||||
|
echo "mkdir of $HOME failed!"
|
||||||
|
fi
|
||||||
|
if ! buildtree > $HOME/git-annex-install.log 2>&1; then
|
||||||
|
echo "Installation failed! Please report a bug and attach $HOME/git-annex-install.log"
|
||||||
|
sh
|
||||||
|
fi
|
||||||
|
elif [ ! -e "$base/installed-version" ] || ! cmp "$base/installed-version" "$base/lib/lib.version.so" >/dev/null; then
|
||||||
|
if ! buildtree > $HOME/git-annex-install.log 2>&1; then
|
||||||
|
echo "Upgrade failed! Please report a bug and attach $HOME/git-annex-install.log"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if ! setup > $HOME/git-annex-install.log 2>&1; then
|
}
|
||||||
echo "Installation failed! Please report a bug and attach $HOME/git-annex-install.log"
|
|
||||||
|
run {
|
||||||
|
# As good a start point as any.
|
||||||
|
cd "$HOME"
|
||||||
|
|
||||||
|
PATH="$base/bin:$PATH"
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
ORIG_GIT_EXEC_PATH="$GIT_EXEC_PATH"
|
||||||
|
export ORIG_GIT_EXEC_PATH
|
||||||
|
GIT_EXEC_PATH=$base/libexec/git-core
|
||||||
|
export GIT_EXEC_PATH
|
||||||
|
|
||||||
|
ORIG_GIT_TEMPLATE_DIR="$GIT_TEMPLATE_DIR"
|
||||||
|
export ORIG_GIT_TEMPLATE_DIR
|
||||||
|
GIT_TEMPLATE_DIR="$base/templates"
|
||||||
|
export GIT_TEMPLATE_DIR
|
||||||
|
|
||||||
|
# Indicate which variables were exported above.
|
||||||
|
GIT_ANNEX_STANDLONE_ENV="GIT_EXEC_PATH GIT_TEMPLATE_DIR"
|
||||||
|
export GIT_ANNEX_STANDLONE_ENV
|
||||||
|
|
||||||
|
# This is a temporary directory on a non-crippled filesystem.
|
||||||
|
# This needs to be as short a path as possible.
|
||||||
|
GIT_ANNEX_TMP_DIR=$base/tmp
|
||||||
|
export GIT_ANNEX_TMP_DIR
|
||||||
|
|
||||||
|
if [ "$1" ]; then
|
||||||
|
cmd="$1"
|
||||||
|
shift 1
|
||||||
|
exec "$cmd" "$@"
|
||||||
|
else
|
||||||
sh
|
sh
|
||||||
fi
|
fi
|
||||||
elif [ ! -e "$base/installed-version" ] || ! cmp "$base/installed-version" "$base/lib/lib.version.so" >/dev/null; then
|
}
|
||||||
if ! setup > $HOME/git-annex-install.log 2>&1; then
|
|
||||||
echo "Upgrade failed! Please report a bug and attach $HOME/git-annex-install.log"
|
if ! prep; then
|
||||||
fi
|
echo "prep failed. Please report a bug."
|
||||||
|
read line
|
||||||
fi
|
fi
|
||||||
|
if ! install; then
|
||||||
# As good a start point as any.
|
echo "install failed. Please report a bug."
|
||||||
cd "$HOME"
|
read line
|
||||||
|
fi
|
||||||
PATH="$base/bin:$PATH"
|
if ! run; then
|
||||||
export PATH
|
# The shell could exit nonzero after successful use, so
|
||||||
|
# show no message, but do wait to let the user see
|
||||||
ORIG_GIT_EXEC_PATH="$GIT_EXEC_PATH"
|
# if it failed to start.
|
||||||
export ORIG_GIT_EXEC_PATH
|
read line
|
||||||
GIT_EXEC_PATH=$base/libexec/git-core
|
|
||||||
export GIT_EXEC_PATH
|
|
||||||
|
|
||||||
ORIG_GIT_TEMPLATE_DIR="$GIT_TEMPLATE_DIR"
|
|
||||||
export ORIG_GIT_TEMPLATE_DIR
|
|
||||||
GIT_TEMPLATE_DIR="$base/templates"
|
|
||||||
export GIT_TEMPLATE_DIR
|
|
||||||
|
|
||||||
# Indicate which variables were exported above.
|
|
||||||
GIT_ANNEX_STANDLONE_ENV="GIT_EXEC_PATH GIT_TEMPLATE_DIR"
|
|
||||||
export GIT_ANNEX_STANDLONE_ENV
|
|
||||||
|
|
||||||
# This is a temporary directory on a non-crippled filesystem.
|
|
||||||
# This needs to be as short a path as possible.
|
|
||||||
GIT_ANNEX_TMP_DIR=$base/tmp
|
|
||||||
export GIT_ANNEX_TMP_DIR
|
|
||||||
|
|
||||||
if [ "$1" ]; then
|
|
||||||
cmd="$1"
|
|
||||||
shift 1
|
|
||||||
exec "$cmd" "$@"
|
|
||||||
else
|
|
||||||
sh
|
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue