From 95b057a2594002664bfc402b023d728d2dd4ed45 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sun, 11 Mar 2018 22:58:44 +0200 Subject: [PATCH] build.sh: allow overriding image name and version with env vars --- board/common/mkimage.sh | 4 +++- build.sh | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/board/common/mkimage.sh b/board/common/mkimage.sh index cf82723b49..0deebb0442 100755 --- a/board/common/mkimage.sh +++ b/board/common/mkimage.sh @@ -36,7 +36,9 @@ ROOT_IMG=$IMG_DIR/root.img ROOT_SIZE="180" # MB DISK_SIZE="220" # MB -OS_NAME=$(source $IMG_DIR/../../../board/common/overlay/etc/version && echo $os_short_name) + +COMMON_DIR=$(cd $IMG_DIR/../../../board/common; pwd) +OS_NAME=$(source $COMMON_DIR/overlay/etc/version && echo $os_short_name) # boot filesystem msg "creating boot loop device" diff --git a/build.sh b/build.sh index c5a0190b0a..52db829859 100755 --- a/build.sh +++ b/build.sh @@ -16,12 +16,28 @@ board=$1 target=${*:2} cd $(dirname $0) basedir=$(pwd) -osname=$(source $basedir/board/common/overlay/etc/version && echo $os_short_name) -osversion=$(source $basedir/board/common/overlay/etc/version && echo $os_version) gzip=$(which pigz || which gzip) +# extra environment from local file test -f $basedir/.build-env && source $basedir/.build-env +# OS name + +if [ -n "$THINGOS_NAME" ]; then + osname=$THINGOS_NAME +else + osname=$(source $basedir/board/common/overlay/etc/version && echo $os_short_name) +fi + +# OS version +if [ -n "$THINGOS_VERSION" ]; then + osversion=$THINGOS_VERSION +else + osversion=$(source $basedir/board/common/overlay/etc/version && echo $os_version) +fi + +# when the special "all" keyword is used for board, +# all boards are processed, in turn if [ "$board" == "all" ]; then boards=$(ls $basedir/configs/*_defconfig | grep -v initramfs | grep -oE '\w+_defconfig$' | cut -d '_' -f 1) for b in $boards; do