-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy-dev.sh
36 lines (21 loc) · 1.49 KB
/
deploy-dev.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
if [ "$BRANCH" = "dev" ]; then
echo "Deploying dev branch..."
echo ""
echo "Waiting for deployment to unlock..."
. ./detect-deployment-details.sh
sshpass -p $INSTALL_SSH_PASSWORD ssh -o "StrictHostKeyChecking no" $INSTALL_SSH_USERNAME@$INSTALL_HOST "cd /usr/local/GrowSense/Index && bash wait-for-unlock.sh" || echo "Failed to wait for unlock. Script likely doesn't exist because it hasn't been installed."
echo ""
echo "Uninstalling GrowSense plug and play on remote computer..."
sshpass -p $DEV_INSTALL_SSH_PASSWORD ssh -o "StrictHostKeyChecking no" $DEV_INSTALL_SSH_USERNAME@$DEV_INSTALL_HOST "wget -q --no-cache -O - https://raw.githubusercontent.com/GrowSense/Index/$BRANCH/scripts-web/uninstall-plug-and-play-from-web.sh | bash -s -- $BRANCH" || exit 1
echo ""
echo "Installing GrowSense plug and play on remote computer..."
sshpass -p $DEV_INSTALL_SSH_PASSWORD ssh -o "StrictHostKeyChecking no" $DEV_INSTALL_SSH_USERNAME@$DEV_INSTALL_HOST "wget -q --no-cache -O - https://raw.githubusercontent.com/GrowSense/Index/$BRANCH/scripts-web/install-plug-and-play-from-web.sh | bash -s -- $BRANCH ? $WIFI_NAME $WIFI_PASSWORD $DEV_MQTT_HOST $DEV_MQTT_USERNAME $DEV_MQTT_PASSWORD $DEV_MQTT_PORT $SMTP_SERVER $EMAIL_ADDRESS" || exit 1
echo ""
echo "Checking deployment..."
bash check-deployment.sh || exit 1
echo ""
echo "Finished deployment."
else
echo "You're not in the dev branch. Skipping dev deployment."
fi