farmbot_os/scripts/build_release_images.sh

24 lines
1004 B
Bash
Executable File

#!/bin/bash
# Collects all the various images and archives for constructing a release.
SYSTEM=$1
VERSION=$2
export MIX_ENV=prod
export NERVES_TARGET=$SYSTEM
REL_DIR=release-$VERSION
mkdir -p $REL_DIR
FIRM_FILE=apps/farmbot/_images/$SYSTEM/farmbot.fw # the .fw file generated by `mix firmware`
FIRM_FILE_REL=$REL_DIR/farmbot-$SYSTEM-$VERSION.fw # where we want our formatted system
FIRM_FILE_REL_IMG=$REL_DIR/farmbot-$SYSTEM-$VERSION.img # same as the above file, but a .img file
SYSTEM_DIR=apps/NERVES_SYSTEM_$SYSTEM # the NERVES_SYSTEM build dir
SYSTEM_TAR=$SYSTEM_DIR/nerves_system_$SYSTEM.tar.gz # the archive generated by `make system`
SYSTEM_TAR_REL=$REL_DIR/farmbot.rootfs-$SYSTEM-$VERSION.tar.gz # where we want our outputted archive to be
# copy the firmware file to the release file
cp $FIRM_FILE $FIRM_FILE_REL
# build an image from the release firmware
fwup -a -d $FIRM_FILE_REL_IMG -i $FIRM_FILE_REL -t complete
# copy the rootfs archive to the release dir
cp $SYSTEM_TAR $SYSTEM_TAR_REL