Files
ring-mqtt/scripts/update2branch.sh
2022-11-16 21:53:11 -05:00

23 lines
946 B
Bash

#!/usr/bin/env bash
HOME=/app
cd /app
if [ ! -d "/app/ring-mqtt-${BRANCH}" ]; then
echo "Updating ring-mqtt to the ${BRANCH} version..."
if [ "${BRANCH}" = "latest" ]; then
git clone https://github.com/tsightler/ring-mqtt ring-mqtt-latest
else
git clone -b dev https://github.com/tsightler/ring-mqtt ring-mqtt-dev
fi
cd "/app/ring-mqtt-${BRANCH}"
echo "Installing node module dependencies, please wait..."
npm install --no-progress > /dev/null 2>&1
chmod +x ring-mqtt.js scripts/*.sh
# This runs the downloaded version of this script in case there are
# additonal component upgrade actions that need to be performed
exec "/app/ring-mqtt-${BRANCH}/scripts/update2branch.sh"
echo "-------------------------------------------------------"
else
# Branch has already been initialized, run any post-update command here
echo "The ring-mqtt-${BRANCH} branch has been updated."
fi