Browse Source

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 <a.podogrocki@gmail.com>
1.0.x
Adam Podogrocki 6 years ago
committed by Adam Podogrocki
parent
commit
779e79d41e
  1. 3
      files/variables.template
  2. 31
      mender-convert-functions.sh
  3. 10
      mender-convert.sh

3
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"

31
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
}

10
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
}

Loading…
Cancel
Save