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: openwrt-lede_compiler.sh
#! /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
# https://openwrt.org/docs/guide-user/additional-software/saving_space
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 https://downloads.openwrt.org/releases/$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
if [ -n "$PACKAGES_ADDITIONAL" ]
then
echo "\$PACKAGES_ADDITIONAL is NOT empty"
make image PROFILE=$ROUTER_PROFILE PACKAGES="$PACKAGES_LUCI_MINIMAL $PACKAGES_ADDITIONAL $PACKAGES_DISABLED"
else
echo "\$PACKAGES_ADDITIONAL is empty"
make image PROFILE=$ROUTER_PROFILE PACKAGES="$PACKAGES_LUCI_MINIMAL $PACKAGES_DISABLED"
fi
make clean
echo "build is finished, please open the build folder"
The script works as follows:
- install the necessary dependencies, so that the compilation has no problems
- Download the compressed file from ImageBuilder, of the indicated version (for example 18.06.2)
- 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