From 9b6ae50c51b4d7b6c446a768601f9771e0c12673 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Tue, 15 Aug 2017 22:15:03 -0400 Subject: [PATCH] skip downloading the daemon if it exists and the version matches --- .gitignore | 1 + build/build.sh | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index dc61fadfe..00be3730e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ /app/dist /app/node_modules /build/venv +/build/daemon.ver /lbry-app-venv /lbry-app /lbry-venv diff --git a/build/build.sh b/build/build.sh index c0e60e79c..1863a0361 100755 --- a/build/build.sh +++ b/build/build.sh @@ -82,9 +82,17 @@ fi DAEMON_VER=$(node -e "console.log(require(\"$ROOT/app/package.json\").lbrySettings.lbrynetDaemonVersion)") DAEMON_URL_TEMPLATE=$(node -e "console.log(require(\"$ROOT/app/package.json\").lbrySettings.lbrynetDaemonUrlTemplate)") DAEMON_URL=$(echo ${DAEMON_URL_TEMPLATE//DAEMONVER/$DAEMON_VER} | sed "s/OSNAME/$OSNAME/g") -wget --quiet "$DAEMON_URL" -O "$BUILD_DIR/daemon.zip" -unzip "$BUILD_DIR/daemon.zip" -d "$ROOT/app/dist/" -rm "$BUILD_DIR/daemon.zip" +DAEMON_VER_PATH="$BUILD_DIR/daemon.ver" +echo "$DAEMON_VER_PATH" +if [[ ! -f $DAEMON_VER_PATH || ! -f $ROOT/app/dist/lbrynet-daemon || $(< $DAEMON_VER_PATH) != $DAEMON_VER ]]; then + wget --quiet "$DAEMON_URL" -O "$BUILD_DIR/daemon.zip" + unzip "$BUILD_DIR/daemon.zip" -d "$ROOT/app/dist/" + rm "$BUILD_DIR/daemon.zip" + echo "$DAEMON_VER" > "$DAEMON_VER_PATH" +else + echo "Already have daemon version $DAEMON_VER, skipping download" +fi +