From 779e79d41e765dc659e50118d36d4642227a7d6c Mon Sep 17 00:00:00 2001 From: Adam Podogrocki Date: Tue, 2 Oct 2018 14:48:25 +0200 Subject: [PATCH] Update test configuration file fields during convert stages Some tests' related variables can be discovered in specific convert stages, like installing Mender client or bootloader. Issues: MEN-2102 Changelog: None Signed-off-by: Adam Podogrocki --- files/variables.template | 3 +-- mender-convert-functions.sh | 31 +++++++++++++++++++++++++++++++ mender-convert.sh | 10 ++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/files/variables.template b/files/variables.template index 45989d6..2e1b764 100644 --- a/files/variables.template +++ b/files/variables.template @@ -2,8 +2,7 @@ MENDER_BOOT_PART="/dev/mmcblk0p1" MENDER_BOOT_PART_DEFAULT="/dev/mmcblk0p1" MENDER_BOOT_PART_FSTYPE="auto" MENDER_BOOT_PART_FSTYPE_DEFAULT="auto" -MENDER_BOOT_PART_MOUNT_LOCATION="/uboot" -MENDER_BOOT_PART_MOUNT_LOCATION_mender-image-uefi="" +MENDER_BOOT_PART_MOUNT_LOCATION="" MENDER_BOOT_PART_SIZE_MB="16" MENDER_BOOT_PART_SIZE_MB_DEFAULT="16" MENDER_DATA_PART_DEFAULT="/dev/mmcblk0p4" diff --git a/mender-convert-functions.sh b/mender-convert-functions.sh index a4f1136..b311a6b 100755 --- a/mender-convert-functions.sh +++ b/mender-convert-functions.sh @@ -657,3 +657,34 @@ create_test_config_file() { sed -i '/^MENDER_MACHINE/s/=.*$/="'${device_type}'"/' ${files_dir}/${device_type}_variables.cfg } +# Takes following arguments +# +# $1 - device type +# $2 - parameter name to change +# $3 - parameter value +update_test_config_file() { + local device_type=$1 + + [ ! -f "${files_dir}/${device_type}_variables.cfg" ] && \ + { echo "Error: test configuration file '${device_type}_variables.cfg' not found. Aborting."; return 1; } + + shift + + while test ${#} -gt 0 + do + case "$1" in + "artifact-name") + sed -i '/^MENDER_ARTIFACT_NAME/s/=.*$/="'${2}'"/' ${files_dir}/${device_type}_variables.cfg + ;; + "distro-feature") + sed -i '/^DISTRO_FEATURES/s/=.*$/="'${2}'"/' ${files_dir}/${device_type}_variables.cfg + ;; + "mount-location") + sed -i '/^MENDER_BOOT_PART_MOUNT_LOCATION/s/=.*$/="'${2}'"/' ${files_dir}/${device_type}_variables.cfg + ;; + esac + shift 2 + done + + return 0 +} diff --git a/mender-convert.sh b/mender-convert.sh index 687a831..364924d 100755 --- a/mender-convert.sh +++ b/mender-convert.sh @@ -370,6 +370,9 @@ do_install_mender() { export -f detach_device_maps ${tool_dir}/convert-stage-4.sh ${stage_4_args} + + # Update test configuration file + update_test_config_file $device_type artifact-name $artifact } do_install_bootloader() { @@ -386,6 +389,10 @@ do_install_bootloader() { export -f create_device_maps export -f detach_device_maps ${tool_dir}/bbb-convert-stage-5.sh ${stage_5_args} + + # Update test configuration file + update_test_config_file $device_type distro-feature "mender-grub" \ + mount-location "\/boot\/efi" ;; "raspberrypi3") stage_5_args="-i $menderimage -d $device_type -t ${toolchain} $keep" @@ -394,6 +401,9 @@ do_install_bootloader() { export -f detach_device_maps export -f mount_sdimg ${tool_dir}/rpi3-convert-stage-5.sh ${stage_5_args} + + # Update test configuration file + update_test_config_file $device_type mount-location "\/uboot" ;; esac }