From d1d15d506874dd0ba3b2dbcbef81a7016eb398eb Mon Sep 17 00:00:00 2001 From: nils olav Date: Wed, 6 Jan 2021 16:36:40 +0100 Subject: [PATCH] Possible to have custom filenames for deployed files. Changelog: Now it is possible to to select a custom filename for the deployed files by using a DEPLOY_IMAGE_NAME string in the config file. Signed-off-by: nils olav --- configs/mender_convert_config | 6 ++++++ mender-convert-package | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/configs/mender_convert_config b/configs/mender_convert_config index 10c3783..d4c3d25 100644 --- a/configs/mender_convert_config +++ b/configs/mender_convert_config @@ -78,6 +78,12 @@ MENDER_DATA_PART_GROWFS=y # input disk image MENDER_DEVICE_TYPE="" +# A string that defines the filenames of the deployed files.This is optional. +# If no DEPLOY_IMAGE_NAME is defined the filenames will be a combination off +# the date and the names of all DEVICE_TYPES. +# These will be seperated with a +. +DEPLOY_IMAGE_NAME="" + # The partition scheme to use for the converted image. # To override set this to "gpt" or "dos" (the scheme names used by fdisk and partx). # By default mender-convert will use the partition scheme from the input image. diff --git a/mender-convert-package b/mender-convert-package index a797bca..70c8b6f 100755 --- a/mender-convert-package +++ b/mender-convert-package @@ -149,12 +149,18 @@ artifact_name=$(cat work/rootfs/etc/mender/artifact_info | sed 's/[^=]*=//') # Get the name from the input disk_image temp_img_name=$(basename "$disk_image") +# Check if user has chooses custom filename +if [ -z "${DEPLOY_IMAGE_NAME}" ]; then # Strip the image suffix from temp_img_name and set the original image name as # the output image name -image_name="${temp_img_name%.*}" + 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" +# Add device types to the filename and replaces whitespace with + to seperate device types. + image_name="${image_name}-$(sed 's| |+|g' <<< $device_type)-mender" +else + # User has choosen custom filename in config file + image_name=$DEPLOY_IMAGE_NAME +fi actual_rootfs_size=$(sudo du -s --block-size=512 work/rootfs | cut -f 1)