skip downloading the daemon if it exists and the version matches

This commit is contained in:
Jeremy Kauffman 2017-08-15 22:15:03 -04:00
parent 23601a3e48
commit 9b6ae50c51
2 changed files with 12 additions and 3 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@
/app/dist
/app/node_modules
/build/venv
/build/daemon.ver
/lbry-app-venv
/lbry-app
/lbry-venv

View file

@ -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