Script to compile any version of OpenWrt using ImageBuilder

Hi everybody,

I need help with a script that I am developing, to compile any version using the imagebuilder.

The file is located at: Compiler_scripts
It's called:

#! /bin/sh

# generate build path
export BPATH=$(pwd)/build

# choose: openwrt or lede
export SYSTEM_NAME=openwrt
#export SYSTEM_NAME=lede

# version of openwrt or lede
export VERSION=18.06.2
#export VERSION=17.01.6

# choose target ar71xx or other
export TARGET=ar71xx
#export TARGET=bcm53xx

# choose generic, mikrotik, nand, tiny
export TARGET_TYPE=tiny
#export TARGET_TYPE=generic

# choose Image Builder router profile
export ROUTER_PROFILE=tl-wr841-v9
#export ROUTER_PROFILE=tenda-ac9

export PACKAGES_LUCI_MINIMAL="uhttpd uhttpd-mod-ubus libiwinfo-lua luci-base luci-app-firewall luci-mod-admin-full luci-theme-bootstrap"
export PACKAGES_ADDITIONAL="luci-app-upnp luci-proto-ppp ppp kmod-pppoe ppp-mod-pppoe"
export PACKAGES_DISABLED="-opkg -luci-proto-ipv6 -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables -odhcpd-ipv6only -kmod-nf-conntrack6 -kmod-nf-ipt6 -libip6tc"

# install dependencies required by Image Builder
apt-get -y install build-essential libncurses5-dev zlib1g-dev gawk git gettext libssl-dev xsltproc wget unzip python

# clean out any files from previous runs of this script
rm -rf build
mkdir build
cd build

# Download Image Builder
wget --ca-directory=/etc/ssl/certs/ -r -np -nd --accept=$SYSTEM_NAME-imagebuilder-$VERSION-$TARGET*.Linux-x86_64.tar.xz$VERSION/targets/$TARGET/$TARGET_TYPE/

# Extract packages
tar -xvf $SYSTEM_NAME-imagebuilder-$VERSION-$TARGET*.Linux-x86_64.tar.xz

cd $SYSTEM_NAME-imagebuilder-$VERSION-$TARGET*

#prevents any issues before compiling
make clean

# verify if $PACKAGES_ADDITIONAL variable, is empty or not and execute required make command
      echo "\$PACKAGES_ADDITIONAL is NOT empty"
      echo "\$PACKAGES_ADDITIONAL is empty"

make clean

echo "build is finished, please open the build folder"

The script works as follows:

  1. install the necessary dependencies, so that the compilation has no problems
  2. Download the compressed file from ImageBuilder, of the indicated version (for example 18.06.2)
  3. Finally, the compilation is done successfully

I need help with the last part of the script.

I wish that when the image finishes compiling successfully, show the file path. (for example: /home/build/tl-wr2543-v1-squashfs-factory.bin)

Thanks in advance