scripts/copy_output.sh: add support for "extra" images

The new extra_image command allows to copy additional images that don't
fall into the sysupgrade or factory categories to the output directory.
These images will be placed in the "other" subdirectory.

The extra_image command takes 3 arguments: in_suffix (suffix in OpenWrt
bin directory), out_suffix (suffix in Gluon output directory) and ext (file
extension). Example:

  extra_image '-tftp' '-tftp' '.bin'

The ext argument can be omitted to control the whole filename suffix
including the extension from in_suffix and out_suffix. Multiple extra_image
commands can be used for a single device; aliases work as usual.

Based-on-patch-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
Matthias Schiffer 2018-07-14 18:33:37 +02:00
parent e8cb34bae2
commit 7460431faa
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
2 changed files with 27 additions and 1 deletions

View File

@ -38,6 +38,10 @@ sysupgrade() {
: :
} }
extra_image() {
:
}
no_opkg() { no_opkg() {
: :
} }

View File

@ -9,6 +9,7 @@ default_factory_ext='.bin'
default_factory_suffix='-squashfs-factory' default_factory_suffix='-squashfs-factory'
default_sysupgrade_ext='.bin' default_sysupgrade_ext='.bin'
default_sysupgrade_suffix='-squashfs-sysupgrade' default_sysupgrade_suffix='-squashfs-sysupgrade'
default_extra_images=
output= output=
profile= profile=
@ -18,11 +19,12 @@ factory_ext=
factory_suffix= factory_suffix=
sysupgrade_ext= sysupgrade_ext=
sysupgrade_suffix= sysupgrade_suffix=
extra_images=
no_opkg= no_opkg=
mkdir -p "${GLUON_IMAGEDIR}/factory" "${GLUON_IMAGEDIR}/sysupgrade" mkdir -p "${GLUON_IMAGEDIR}/factory" "${GLUON_IMAGEDIR}/sysupgrade" "${GLUON_IMAGEDIR}/other"
if [ "$(expr match "$OPENWRT_TARGET" '.*-.*')" -gt 0 ]; then if [ "$(expr match "$OPENWRT_TARGET" '.*-.*')" -gt 0 ]; then
OPENWRT_BINDIR="${OPENWRT_TARGET//-/\/}" OPENWRT_BINDIR="${OPENWRT_TARGET//-/\/}"
@ -76,6 +78,10 @@ copy() {
[ -z "$factory_ext" ] || do_copy 'factory' "$factory_suffix" '' "$factory_ext" "$aliases" [ -z "$factory_ext" ] || do_copy 'factory' "$factory_suffix" '' "$factory_ext" "$aliases"
[ -z "$sysupgrade_ext" ] || do_copy 'sysupgrade' "$sysupgrade_suffix" '-sysupgrade' "$sysupgrade_ext" "$aliases" [ -z "$sysupgrade_ext" ] || do_copy 'sysupgrade' "$sysupgrade_suffix" '-sysupgrade' "$sysupgrade_ext" "$aliases"
echo -n "$extra_images" | while read in_suffix && read out_suffix && read ext; do
do_copy 'other' "$in_suffix" "$out_suffix" "$ext" "$aliases"
done
} }
@ -92,6 +98,7 @@ device() {
factory_suffix="$default_factory_suffix" factory_suffix="$default_factory_suffix"
sysupgrade_ext="$default_sysupgrade_ext" sysupgrade_ext="$default_sysupgrade_ext"
sysupgrade_suffix="$default_sysupgrade_suffix" sysupgrade_suffix="$default_sysupgrade_suffix"
extra_images="$default_extra_images"
} }
factory_image() { factory_image() {
@ -164,6 +171,21 @@ sysupgrade() {
fi fi
} }
extra_image() {
local in_suffix="$1"
local out_suffix="$2"
local ext="$3"
extra_images="$in_suffix
$out_suffix
$ext
$extra_images"
if [ -z "$output" ]; then
default_extra_images="$extra_images"
fi
}
no_opkg() { no_opkg() {
no_opkg=1 no_opkg=1
} }