#!/bin/bash

set -eu -o pipefail

ARCHIVE_DIR="/home/www/html/firmware/gluon/archive"
EXPERIMENTAL_LINK="/home/www/html/firmware/gluon/experimental"
PIPELINE_ID_FILE="/home/www/html/firmware/gluon/.last-downloaded-pipeline-id"
MYDIR=$(readlink -f $(dirname "$0"))

cd "$ARCHIVE_DIR"
"$MYDIR/download-latest-firmware-build.py" --pipeline-id-file "$PIPELINE_ID_FILE" --create-symlink "$EXPERIMENTAL_LINK" --branch experimental
