#!/bin/sh
# build_custom_openwrt_image.sh
# 2022-06-19
# by Gernot WALZL
# https://openwrt.org/docs/guide-user/additional-software/imagebuilder
# "make info" shows a list of available profiles.
# Unfortunately, luci (the web interface) is not part of the default packages.
VERSION=${VERSION:-"21.02.3"}
PROFILE=${PROFILE:-"linksys_wrt3200acm"}
PACKAGES=${PACKAGES:-"luci-ssl ddns-scripts luci-app-ddns iptables-mod-conntrack-extra etherwake luci-app-wol kmod-usb-storage block-mount kmod-fs-ext4 samba4-server luci-app-samba4 openssh-sftp-server"}
set -e
IMAGEBUILDER="openwrt-imagebuilder-${VERSION}-mvebu-cortexa9.Linux-x86_64.tar.xz"
DOWNLOAD="https://downloads.openwrt.org/releases/${VERSION}/targets/mvebu/cortexa9/${IMAGEBUILDER}"
if [ ! -f "$IMAGEBUILDER" ]; then
wget -O "$IMAGEBUILDER" "$DOWNLOAD"
fi
tar xvf "$IMAGEBUILDER"
cd "openwrt-imagebuilder-${VERSION}-mvebu-cortexa9.Linux-x86_64"
make image PROFILE="$PROFILE" PACKAGES="$PACKAGES"
find bin/targets/mvebu/cortexa9/