From 90b95e6d2e9d82984eaf5a20ad4262b78fb0f155 Mon Sep 17 00:00:00 2001 From: computermouth Date: Mon, 31 Oct 2016 13:29:58 -0700 Subject: [PATCH] Add build number specifier --- chip-update-firmware.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/chip-update-firmware.sh b/chip-update-firmware.sh index cbceddd..4b69dd6 100755 --- a/chip-update-firmware.sh +++ b/chip-update-firmware.sh @@ -25,7 +25,7 @@ UBI_PREFIX="chip" UBI_SUFFIX="ubi.sparse" UBI_TYPE="400000-4000" -while getopts "sgpbhB:" opt; do +while getopts "sgpbhB:N:" opt; do case $opt in s) echo "== Server selected ==" @@ -47,6 +47,10 @@ while getopts "sgpbhB:" opt; do BRANCH="$OPTARG" echo "== ${BRANCH} branch selected ==" ;; + N) + CACHENUM="$OPTARG" + echo "== Build number ${CACHENUM} selected ==" + ;; h) echo "" echo "== help ==" @@ -75,8 +79,10 @@ function require_directory { function dl_probe { - CACHENUM=$(curl -s $DL_URL/$BRANCH/$FLAVOR/latest) - + if [ -z $CACHENUM ]; then + CACHENUM=$(curl -s $DL_URL/$BRANCH/$FLAVOR/latest) + fi + if [[ ! -d "$DL_DIR/$BRANCH-$FLAVOR-b${CACHENUM}" ]]; then echo "== New image available =="