aboutsummaryrefslogtreecommitdiff
path: root/bless-good.sh
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2018-02-26 20:19:49 -0800
committerJohn Stultz <john.stultz@linaro.org>2018-02-26 20:20:41 -0800
commitaa90d9053c5538871d6765629dc62cd1e1fcdfbf (patch)
treea8a1d4ebb58148c0955ba25eea02158addb89726 /bless-good.sh
parent44e3828f7eed321bd031fcd262129438376debf0 (diff)
downloadknown-good-manifests-aa90d9053c5538871d6765629dc62cd1e1fcdfbf.tar.gz
known-good-manifests: Initial commit of helper scripts
Initial commit of helper scripts to fetch and bless manifests Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'bless-good.sh')
-rwxr-xr-xbless-good.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/bless-good.sh b/bless-good.sh
new file mode 100755
index 0000000..fcd01ce
--- /dev/null
+++ b/bless-good.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+DIRPATH=imgs
+MANIFEST=pinned-manifest.xml
+BUILD_URL_FILE=build-url.txt
+BOARD=$1
+
+if [ $# -eq 0 ]; then
+ echo "Error: No arguments"
+ echo "Usage: ./bless-good.sh <valid board name>"
+ exit -1
+fi
+
+echo "Blessing $BOARD"
+
+if [ ! -d "$DIRPATH/$BOARD" ]; then
+ echo "ERROR: No such path: $DIRPATH/$BOARD"
+ exit -1
+fi
+
+pushd $DIRPATH/$BOARD > /dev/null
+
+rm -f pinned-manifest.xml
+
+URL=`cat $BUILD_URL_FILE`
+wget $URL/$MANIFEST 2> /dev/null
+
+RAW_DATE=`stat -c "%y" $MANIFEST`
+DATE_HEADER=`date -u --date="$RAW_DATE" +%F_%T`
+
+NEW_MANIFEST=$DATE_HEADER-$MANIFEST
+echo $NEW_MANIFEST
+mv $MANIFEST $NEW_MANIFEST
+
+NEW_BUILD_URL_FILE="$DATE_HEADER-$BUILD_URL_FILE"
+echo $NEW_BUILD_URL_FILE
+cp $BUILD_URL_FILE $NEW_BUILD_URL_FILE
+
+popd >/dev/null
+
+mkdir -p known-good/$BOARD
+cp $DIRPATH/$BOARD/$NEW_MANIFEST known-good/$BOARD/
+cp $DIRPATH/$BOARD/$NEW_BUILD_URL_FILE known-good/$BOARD/
+
+echo "No don't forget to commit the files!"