From 30d2392b116f6f13ad033150e929de12e0c2b975 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 6 Dec 2014 17:31:49 -0800 Subject: [PATCH] die on checkout failure. pull from remote if dir does not exist. --- build-libbitcoind.sh | 12 ++++++++++-- patch-bitcoin.sh | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/build-libbitcoind.sh b/build-libbitcoind.sh index 3c126c94..713dce1e 100755 --- a/build-libbitcoind.sh +++ b/build-libbitcoind.sh @@ -5,14 +5,22 @@ os_dir=$(dirname "$(./platform/os.sh)") if test -n "$1"; then if test "$1" = 'remote'; then - git clone git://github.com/bitcoin/bitcoin.git || exit 1 - btc_dir="${cur_dir}/bitcoin" + git clone git://github.com/bitcoin/bitcoin.git libbitcoind || exit 1 + btc_dir="${cur_dir}/libbitcoind" else btc_dir=$1 + if ! test -d "$btc_dir"; then + "$0" remote + exit 0 + fi fi shift else btc_dir="${HOME}/bitcoin" + if ! test -d "$btc_dir"; then + "$0" remote + exit 0 + fi fi ./patch-bitcoin.sh "$btc_dir" || exit 1 diff --git a/patch-bitcoin.sh b/patch-bitcoin.sh index a04a75e9..efa92966 100755 --- a/patch-bitcoin.sh +++ b/patch-bitcoin.sh @@ -7,6 +7,11 @@ cd "$dir" || exit 1 if test -e .git; then git checkout 4383319e4e0cb96818d2be734f7280181daac9fa + if test $? -ne 0; then + echo 'Unable to checkout necessary commit.' + echo 'Please pull the latest HEAD from the upstream bitcoin repo.' + exit 1 + fi git checkout -b "libbitcoind-$(date '+%Y.%m.%d')" || exit 1 fi