From a1c26ead6719fbcf7547a4454ec6e0a8634083f2 Mon Sep 17 00:00:00 2001 From: nils olav Date: Wed, 16 Dec 2020 09:44:47 +0100 Subject: [PATCH] MEN-3361: Possible to choose multiple device types in config file Changelog: Now it is possible to write multiple device types in the config file using a space seperated string. Filenames for files in the deploy dir will contain all the device names seperated with +. Signed-off-by: nils olav --- configs/mender_convert_config | 5 +++-- mender-convert-package | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/configs/mender_convert_config b/configs/mender_convert_config index 94386f0..10c3783 100644 --- a/configs/mender_convert_config +++ b/configs/mender_convert_config @@ -227,9 +227,10 @@ source configs/mender_grub_config # You might want to override this to e.g provide state-scripts or providing # a private key to sign your artifact. mender_create_artifact() { - local -r device_type="${1}" + local -r device_types="${1}" local -r artifact_name="${2}" local -r image_name="${3}" + local -r all_device_types="$(for device_type in $device_types; do echo " --device-type $device_type"; done)" mender_artifact=deploy/${image_name}.mender log_info "Writing Mender artifact to: ${mender_artifact}" @@ -240,5 +241,5 @@ mender_create_artifact() { --file work/rootfs.img \ --output-path ${mender_artifact} \ --artifact-name ${artifact_name} \ - --device-type ${device_type}" + ${all_device_types}" } diff --git a/mender-convert-package b/mender-convert-package index 44c7237..a797bca 100755 --- a/mender-convert-package +++ b/mender-convert-package @@ -151,7 +151,10 @@ temp_img_name=$(basename "$disk_image") # Strip the image suffix from temp_img_name and set the original image name as # the output image name -image_name="${temp_img_name%.*}-${device_type}-mender" +image_name="${temp_img_name%.*}" + +#Adds device types to the filename and replaces whitespace with + to seperate device types. +image_name="${image_name}-$(sed 's| |+|g' <<< $device_type)-mender" actual_rootfs_size=$(sudo du -s --block-size=512 work/rootfs | cut -f 1)