From d2507ae04229b8302ea24f6a5caebfe200cf268a Mon Sep 17 00:00:00 2001 From: Chanho Park Date: Thu, 25 Jan 2018 13:55:25 +0900 Subject: [PATCH] github_sync: download rootfs tarball from github release This patch is the first github synchronization patch for daily sync-up. We upload the prebuilt rootfs tarball into the github release page and it will be possible to download the rootfs tarball from the github release page. Change-Id: I0d60536fda25c5a53ae8f428ca676223b65c8752 Signed-off-by: Chanho Park --- config/artik10.cfg | 3 ++ config/artik5.cfg | 8 ++- config/artik530.cfg | 6 ++- config/artik530_ubuntu.cfg | 12 +++-- config/artik530s_ubuntu.cfg | 13 +++-- config/artik533s_ubuntu.cfg | 12 +++-- config/artik710.cfg | 6 ++- config/artik710_ubuntu.cfg | 12 +++-- config/artik710s_ubuntu.cfg | 12 +++-- release_rootfs.sh | 100 ++++++++---------------------------- 10 files changed, 78 insertions(+), 106 deletions(-) diff --git a/config/artik10.cfg b/config/artik10.cfg index d01c8f0..8f0613c 100644 --- a/config/artik10.cfg +++ b/config/artik10.cfg @@ -28,8 +28,11 @@ export EMMC_UBOOT_OFFSET=62 export EMMC_TZSW_OFFSET=2110 export EMMC_ENV_OFFSET=4159 +export RELEASE_VER=artik_os_1.1.0 +export ROOTFS_BASE_URL=https://github.com/SamsungARTIK/fedora-spin-kickstarts/releases/download/ export ROOTFS_FILE=fedora-arm-artik-rootfs-20160418194834.tar.gz export ROOTFS_FILE_MD5=b7ced636f0dac7953fc75f5e9617dcad +export ROOTFS_TAG=release/artik1020/${RELEASE_VER} export FEDORA_KICKSTART_FILE=fedora-arm-artik10.ks export FEDORA_PACKAGE_FILE=config/artik10_fedora.package diff --git a/config/artik5.cfg b/config/artik5.cfg index 00290ff..cbc0753 100644 --- a/config/artik5.cfg +++ b/config/artik5.cfg @@ -28,8 +28,12 @@ export EMMC_UBOOT_OFFSET=62 export EMMC_TZSW_OFFSET=2110 export EMMC_ENV_OFFSET=4159 -export ROOTFS_FILE=fedora-arm-artik-rootfs-20160726000129.tar.gz -export ROOTFS_FILE_MD5=d55a9cb486d747f0e409f95f854207c3 +export RELEASE_VER=A520_os_2.0.0 +export ROOTFS_BASE_URL=https://github.com/SamsungARTIK/fedora-spin-kickstarts/releases/download/ +export ROOTFS_FILE=fedora-arm-artik5-rootfs-0520GC0F-3AF-01Q6-20160928.203457-0e632fcf9ee1badf5724751af6bd0670.tar.gz +export ROOTFS_FILE_MD5=0e632fcf9ee1badf5724751af6bd0670 +export ROOTFS_TAG=release/${RELEASE_VER} +export BUILD_VERSION=$RELEASE_VER export FEDORA_KICKSTART_FILE=fedora-arm-artik5.ks export FEDORA_PACKAGE_FILE=config/artik5_fedora.package diff --git a/config/artik530.cfg b/config/artik530.cfg index 8bf97cc..fcbfbbb 100644 --- a/config/artik530.cfg +++ b/config/artik530.cfg @@ -35,7 +35,9 @@ export BLMON_OFFSET=513 export UBOOT_OFFSET=3841 export ENV_OFFSET=5889 -export ROOTFS_FILE=fedora-arm-artik530-rootfs-20160826103255.tar.gz -export ROOTFS_FILE_MD5=d8b7a4137c8fc8c2a5c1f08b16d00001 +export ROOTFS_BASE_URL=https://github.com/SamsungARTIK/fedora-spin-kickstarts/releases/download/ +export ROOTFS_FILE=fedora-arm-artik530-rootfs-0530GC0F-44F-01Q5-20170710.170216-4c0d561a2c008d8ff08a6865fc505df8.tar.gz +export ROOTFS_FILE_MD5=4c0d561a2c008d8ff08a6865fc505df8 +export ROOTFS_TAG=release/${OFFICIAL_VERSION} export FEDORA_PACKAGE_FILE=config/artik530_fedora.package diff --git a/config/artik530_ubuntu.cfg b/config/artik530_ubuntu.cfg index a0b064f..eb1a7c7 100644 --- a/config/artik530_ubuntu.cfg +++ b/config/artik530_ubuntu.cfg @@ -1,6 +1,10 @@ . config/artik530.cfg -OFFICIAL_VERSION=A530_os_3.0.0 -OS_NAME=ubuntu -UBUNTU_MODULE_DEB_DIR=$ARTIK_BUILD_DIR/../ubuntu-build-service/prebuilt/armhf/artik530 -UBUNTU_PACKAGE_FILE=config/artik530_ubuntu.package +export OFFICIAL_VERSION=A530_os_3.0.0 +export ROOTFS_BASE_URL=https://github.com/SamsungARTIK/ubuntu-build-service/releases/download/ +export ROOTFS_FILE=ubuntu-arm-artik530-rootfs-0530GC0F-44U-01Q1-20170824.170641-ea9a114094c13d516370fb6e3bb0412e.tar.gz +export ROOTFS_FILE_MD5=ea9a114094c13d516370fb6e3bb0412e +export ROOTFS_TAG=release/${OFFICIAL_VERSION} +export OS_NAME=ubuntu +export UBUNTU_MODULE_DEB_DIR=$ARTIK_BUILD_DIR/../ubuntu-build-service/prebuilt/armhf/artik530 +export UBUNTU_PACKAGE_FILE=config/artik530_ubuntu.package diff --git a/config/artik530s_ubuntu.cfg b/config/artik530s_ubuntu.cfg index 77ffe5e..5e89ab7 100644 --- a/config/artik530s_ubuntu.cfg +++ b/config/artik530s_ubuntu.cfg @@ -1,6 +1,11 @@ . config/artik530s.cfg -OFFICIAL_VERSION=A530s_os_3.1.0 -OS_NAME=ubuntu -UBUNTU_MODULE_DEB_DIR=$ARTIK_BUILD_DIR/../ubuntu-build-service/prebuilt/armhf/artik530s -UBUNTU_PACKAGE_FILE=config/artik530_ubuntu.package +export OFFICIAL_VERSION=A530s_os_3.1.0 +export OS_NAME=ubuntu +export ROOTFS_BASE_URL=https://github.com/SamsungARTIK/ubuntu-build-service/releases/download/ +export ROOTFS_FILE=ubuntu-arm-artik530s-rootfs-0530GS0F-44U-01Q0-20171011.153556-e387fe4625161763e0e92b8db7f45a07.tar.gz +export ROOTFS_FILE_MD5=e387fe4625161763e0e92b8db7f45a07 +export ROOTFS_TAG=release/A530s_os_3.0.0 +export OS_NAME=ubuntu +export UBUNTU_MODULE_DEB_DIR=$ARTIK_BUILD_DIR/../ubuntu-build-service/prebuilt/armhf/artik530s +export UBUNTU_PACKAGE_FILE=config/artik530_ubuntu.package diff --git a/config/artik533s_ubuntu.cfg b/config/artik533s_ubuntu.cfg index e915620..776ad82 100644 --- a/config/artik533s_ubuntu.cfg +++ b/config/artik533s_ubuntu.cfg @@ -1,6 +1,10 @@ . config/artik533s.cfg -OFFICIAL_VERSION=A533s_os_3.1.0 -OS_NAME=ubuntu -UBUNTU_MODULE_DEB_DIR=$ARTIK_BUILD_DIR/../ubuntu-build-service/prebuilt/armhf/artik533s -UBUNTU_PACKAGE_FILE=config/artik530_ubuntu.package +export OFFICIAL_VERSION=A533s_os_3.1.0 +export ROOTFS_BASE_URL=https://github.com/SamsungARTIK/ubuntu-build-service/releases/download/ +export ROOTFS_FILE=ubuntu-arm-artik533s-rootfs-0533GS0F-44U-01Q0-20171018.050000-818498c5ce842da6e9eb3b960d3778d2.tar.gz +export ROOTFS_FILE_MD5=818498c5ce842da6e9eb3b960d3778d2 +export ROOTFS_TAG=release/A533s_os_3.0.0 +export OS_NAME=ubuntu +export UBUNTU_MODULE_DEB_DIR=$ARTIK_BUILD_DIR/../ubuntu-build-service/prebuilt/armhf/artik533s +export UBUNTU_PACKAGE_FILE=config/artik530_ubuntu.package diff --git a/config/artik710.cfg b/config/artik710.cfg index 5e3f38e..1709d17 100644 --- a/config/artik710.cfg +++ b/config/artik710.cfg @@ -33,8 +33,10 @@ export TZSW_OFFSET=769 export UBOOT_OFFSET=3841 export ENV_OFFSET=5889 -export ROOTFS_FILE=fedora-arm-artik710-rootfs-20160809222105.tar.gz -export ROOTFS_FILE_MD5=ca5e6114ac89bbe266e5706cfb40aef4 +export ROOTFS_BASE_URL=https://github.com/SamsungARTIK/fedora-spin-kickstarts/releases/download/ +export ROOTFS_FILE=fedora-arm-artik710-rootfs-0710GC0F-44F-01QC-20170713.175433-f63a17cbfdaffd3385f23ea12388999a.tar.gz +export ROOTFS_FILE_MD5=f63a17cbfdaffd3385f23ea12388999a +export ROOTFS_TAG=release/${OFFICIAL_VERSION} export FEDORA_PACKAGE_FILE=config/artik710_fedora.package export OTA=true diff --git a/config/artik710_ubuntu.cfg b/config/artik710_ubuntu.cfg index 6e9dd04..676d0d1 100644 --- a/config/artik710_ubuntu.cfg +++ b/config/artik710_ubuntu.cfg @@ -1,6 +1,10 @@ . config/artik710.cfg -OFFICIAL_VERSION=A710_os_3.1.0 -OS_NAME=ubuntu -UBUNTU_MODULE_DEB_DIR=$ARTIK_BUILD_DIR/../ubuntu-build-service/prebuilt/arm64/artik710 -UBUNTU_PACKAGE_FILE=config/artik710_ubuntu.package +export OFFICIAL_VERSION=A710_os_3.1.0 +export ROOTFS_BASE_URL=https://github.com/SamsungARTIK/ubuntu-build-service/releases/download/ +export ROOTFS_FILE=ubuntu-arm-artik710-rootfs-0710GC0F-44U-01Q3-20171113.171659-d159d7ed4107f1a6124c7937c24327aa.tar.gz +export ROOTFS_FILE_MD5=d159d7ed4107f1a6124c7937c24327aa +export ROOTFS_TAG=release/A710_os_3.0.0 +export OS_NAME=ubuntu +export UBUNTU_MODULE_DEB_DIR=$ARTIK_BUILD_DIR/../ubuntu-build-service/prebuilt/arm64/artik710 +export UBUNTU_PACKAGE_FILE=config/artik710_ubuntu.package \ No newline at end of file diff --git a/config/artik710s_ubuntu.cfg b/config/artik710s_ubuntu.cfg index cc94fe2..eedcddb 100644 --- a/config/artik710s_ubuntu.cfg +++ b/config/artik710s_ubuntu.cfg @@ -1,6 +1,10 @@ . config/artik710s.cfg -OFFICIAL_VERSION=A710s_os_3.1.0 -OS_NAME=ubuntu -UBUNTU_MODULE_DEB_DIR=$ARTIK_BUILD_DIR/../ubuntu-build-service/prebuilt/arm64/artik710s -UBUNTU_PACKAGE_FILE=config/artik710_ubuntu.package +export OFFICIAL_VERSION=A710s_os_3.1.0 +export ROOTFS_BASE_URL=https://github.com/SamsungARTIK/ubuntu-build-service/releases/download/ +export ROOTFS_FILE=ubuntu-arm-artik710s-rootfs-0710GS0F-44U-01Q1-20171020.132455-8432425c4f2343159225752b10e4f4fc.tar.gz +export ROOTFS_FILE_MD5=8432425c4f2343159225752b10e4f4fc +export ROOTFS_TAG=release/A710s_os_3.0.0 +export OS_NAME=ubuntu +export UBUNTU_MODULE_DEB_DIR=$ARTIK_BUILD_DIR/../ubuntu-build-service/prebuilt/arm64/artik710s +export UBUNTU_PACKAGE_FILE=config/artik710_ubuntu.package diff --git a/release_rootfs.sh b/release_rootfs.sh index 387c424..30a74c8 100755 --- a/release_rootfs.sh +++ b/release_rootfs.sh @@ -4,98 +4,38 @@ set -e CHECK_COUNT=0 MAX_RETRY=3 -SERVER_URL="http://artik:artik%40iot@agit.artik.io:8080/downloads/artik/fedora/" -DOWNLOAD_DONE=false -print_usage() -{ - echo "-h/--help Show help options" - echo "-b [TARGET_BOARD] Target board ex) -b artik710|artik530|artik5|artik10" - echo "-s [SERVER_URL] Server URL to download the rootfs" - - exit 0 -} - -parse_options() -{ - for opt in "$@" - do - case "$opt" in - -h|--help) - print_usage - shift ;; - -b) - TARGET_BOARD="$2" - shift ;; - -s) - SERVER_URL="$2" - shift ;; - -f) - ROOTFS_FILE="$2" - shift ;; - *) - shift ;; - esac - done -} +test -d ${TARGET_DIR} || mkdir -p ${TARGET_DIR} -die() { - if [ -n "$1" ]; then echo $1; fi - exit 1 +urlencode() { + # urlencode + local length="${#1}" + for (( i = 0; i < length; i++ )); do + local c="${1:i:1}" + case $c in + [a-zA-Z0-9.~_-]) printf "$c" ;; + *) printf '%%%02X' "'$c" + esac + done } -trap 'error ${LINENO} ${?}' ERR -parse_options "$@" +ROOTFS_TAG=$(urlencode "$ROOTFS_TAG") +ROOTFS_FILE=$(urlencode "$ROOTFS_FILE") -SCRIPT_DIR=`dirname "$(readlink -f "$0")"` -if [ "$TARGET_BOARD" == "" ]; then - print_usage -else - if [ "$TARGET_DIR" == "" ]; then - . $SCRIPT_DIR/config/$TARGET_BOARD.cfg - fi +if [ ! -f $PREBUILT_DIR/$ROOTFS_FILE ]; then + echo "Not found rootfs. Download it" + wget ${ROOTFS_BASE_URL}/${ROOTFS_TAG}/${ROOTFS_FILE} -O $PREBUILT_DIR/$ROOTFS_FILE fi -test -d ${TARGET_DIR} || mkdir -p ${TARGET_DIR} - -download_rootfs_file() -{ - if [ "$BUILD_VERSION" != "UNRELEASED" ] ; then - ROOTFS_PREFIX=fedora-arm-$TARGET_BOARD-rootfs-$BUILD_VERSION-$BUILD_DATE - else - ROOTFS_PREFIX=fedora-arm-$TARGET_BOARD-rootfs-latest - fi - - pushd prebuilt - ROOTFS_NAME=`curl -s ${SERVER_URL} --list-only | \ - grep "${ROOTFS_PREFIX}" | sed 's/^.*a href=\"\([^"]*\)".*/\1/'` || true - - if [ "$ROOTFS_NAME" == "" ]; then - ROOTFS_PREFIX=fedora-arm-$TARGET_BOARD-rootfs-latest - ROOTFS_NAME=`curl -s ${SERVER_URL} --list-only | \ - grep "${ROOTFS_PREFIX}" | sed 's/^.*a href=\"\([^"]*\)".*/\1/'` || true - fi - - wget -nc ${SERVER_URL}${ROOTFS_NAME} - - ROOTFS_MD5_PRE="${ROOTFS_NAME#$ROOTFS_PREFIX-*}" - ROOTFS_MD5="${ROOTFS_MD5_PRE%%.tar.gz}" - - MD5_SUM=$(md5sum $ROOTFS_NAME | awk '{print $1}') - if [ "$ROOTFS_MD5" == "$MD5_SUM" ]; then - DOWNLOAD_DONE=true - fi - popd -} - while : do - download_rootfs_file - if $DOWNLOAD_DONE; then + MD5_SUM=$(md5sum $PREBUILT_DIR/$ROOTFS_FILE | awk '{print $1}') + if [ "$ROOTFS_FILE_MD5" == "$MD5_SUM" ]; then break fi echo "Mismatch MD5 hash. Just download again" + wget ${ROOTFS_BASE_URL}/${ROOTFS_TAG}/${ROOTFS_FILE} -O $PREBUILT_DIR/$ROOTFS_FILE CHECK_COUNT=$((CHECK_COUNT + 1)) @@ -104,4 +44,4 @@ do fi done -cp prebuilt/$ROOTFS_NAME $TARGET_DIR/rootfs.tar.gz +cp $PREBUILT_DIR/$ROOTFS_FILE $TARGET_DIR/rootfs.tar.gz