aboutsummaryrefslogtreecommitdiff
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
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>
-rwxr-xr-xbless-good.sh45
-rwxr-xr-xfetch-latest.sh35
2 files changed, 80 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!"
diff --git a/fetch-latest.sh b/fetch-latest.sh
new file mode 100755
index 0000000..adb66e5
--- /dev/null
+++ b/fetch-latest.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+SERVER="https://builds.96boards.org"
+FILE_LIST="boot.img.xz cache.img.xz userdata.img.xz"
+LICENCED_FILE_LIST="system.img.xz"
+BOARDS_LIST="hikey hikey960"
+IMG_DIR=imgs
+
+mkdir $IMG_DIR
+cd $IMG_DIR
+for board in $BOARDS_LIST; do
+ mkdir $board
+ cd $board
+ rm -f $FILE_LIST
+
+ # This is a bit gross, but basically grep through the index.html to find the latest numbered snapshot dir
+ LATEST=`wget -O - "$SERVER/snapshots/$board/linaro/aosp-master/" 2>/dev/null | grep "snapshots/$board/linaro/aosp-master/" | head -2 | tail -1`
+ LATEST=`echo $LATEST | sed -e 's/<a href=//' | sed -e 's/^[ \t]*//' | sed -e 's/"//g'`
+ LATEST_URL="$SERVER$LATEST"
+
+ echo "Fetching from: $LATEST_URL"
+ echo "$LATEST_URL" > build-url.txt
+
+ for i in $FILE_LIST; do
+ wget "$LATEST_URL/$i" 2> /dev/null
+ done
+ for i in $LICENCED_FILE_LIST; do
+ # thanks to vishal for this trick!
+ curl --fail --silent -L --show-error -b license_accepted_eee6ac0e05136eb58db516d8c9c80d6b=yes $LATEST_URL/$i > $i
+ done
+
+ cd ..
+done
+cd ..
+