try to be more robust and allow the user to see most types of failure

This commit is contained in:
Joey Hess 2013-02-23 01:08:15 -04:00
parent 2d2d27a9d5
commit acc3c8c157

View file

@ -4,6 +4,7 @@
set -e
prep () {
# I'm installed as lib/lib.runshell.so
orig="$(pwd)"
cd "$0/../.."
@ -12,8 +13,9 @@ base="$(pwd)"
# Cannot rely on Android providing a sane HOME
HOME="/sdcard/git-annex.home"
export HOME
}
setup () {
buildtree () {
echo "Installation starting to $base"
cat "$base/lib/lib.version.so"
@ -54,20 +56,23 @@ setup () {
echo "Installation complete"
}
install () {
if [ ! -d "$base/bin" ]; then
if ! mkdir -p "$HOME"; then
echo "mkdir of $HOME failed!"
fi
if ! setup > $HOME/git-annex-install.log 2>&1; then
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 ! setup > $HOME/git-annex-install.log 2>&1; 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
}
run {
# As good a start point as any.
cd "$HOME"
@ -100,3 +105,19 @@ if [ "$1" ]; then
else
sh
fi
}
if ! prep; then
echo "prep failed. Please report a bug."
read line
fi
if ! install; then
echo "install failed. Please report a bug."
read line
fi
if ! run; then
# The shell could exit nonzero after successful use, so
# show no message, but do wait to let the user see
# if it failed to start.
read line
fi