build.sh: allow overriding image name and version with env vars

This commit is contained in:
Calin Crisan 2018-03-11 22:58:44 +02:00
parent 9d871ba6dc
commit 95b057a259
2 changed files with 21 additions and 3 deletions

View File

@ -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"

View File

@ -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