diff --git a/.gitignore b/.gitignore index be018dc..8b2889a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ input work rootfs_overlay_demo/* tests +mender_local_config diff --git a/configs/beaglebone_black_debian_emmc_config b/configs/beaglebone_black_debian_emmc_config new file mode 100644 index 0000000..0e8b3b3 --- /dev/null +++ b/configs/beaglebone_black_debian_emmc_config @@ -0,0 +1,9 @@ +# Binaries generated with the following script: +# +# https://github.com/drewmoseley/mender-convert-integration-scripts/blob/master/build-uboot-bbb.sh +# +BEAGLEBONE_BLACK_BINARIES="beaglebone-black-integration-debian-emmc-2018.07.004.tar" +source configs/beaglebone_black_base_config +MENDER_STORAGE_TOTAL_SIZE_MB="3648" +MENDER_DEVICE_TYPE="beaglebone-emmc" +MENDER_STORAGE_DEVICE="/dev/mmcblk1p" diff --git a/configs/beaglebone_black_debian_sdcard_config b/configs/beaglebone_black_debian_sdcard_config index 67a0b0d..7965557 100644 --- a/configs/beaglebone_black_debian_sdcard_config +++ b/configs/beaglebone_black_debian_sdcard_config @@ -2,5 +2,7 @@ # # https://github.com/drewmoseley/mender-convert-integration-scripts/blob/master/build-uboot-bbb.sh # -BEAGLEBONE_BLACK_BINARIES="beaglebone-black-integration-debian-2018.07.002.tar" +BEAGLEBONE_BLACK_BINARIES="beaglebone-black-integration-debian-sdcard-2018.07.004.tar" source configs/beaglebone_black_base_config +MENDER_DEVICE_TYPE="beaglebone-sdcard" +MENDER_STORAGE_DEVICE="/dev/mmcblk0p" diff --git a/mender-convert-extract b/mender-convert-extract index 708d745..7713b41 100755 --- a/mender-convert-extract +++ b/mender-convert-extract @@ -19,6 +19,8 @@ echo "Running $(basename $0): $@" source modules/bootstrap.sh source modules/disk.sh +declare -a configs + disk_image="" while (( "$#" )); do case "$1" in @@ -27,7 +29,7 @@ while (( "$#" )); do shift 2 ;; -c | --config) - configs+="${2}" + configs+=("${2}") shift 2 ;; -d | --disk-image) @@ -50,7 +52,11 @@ if [ ! -e ${disk_image} ]; then log_fatal "File not found: ${disk_image}" fi -source modules/config.sh "${configs[@]}" +# Note the use of %q formatting here. This is a bash feature to add +# proper quoting to the strings so that spaces and special characters +# will be treated properly. Primarily for supporting spaces in +# pathnames and avoid splitting those into multiple parameters. +source modules/config.sh $(printf "%q " "${configs[@]}") MKFS_VFAT="/usr/bin/mkfs.vfat" if [ ! -f ${MKFS_VFAT} ]; then diff --git a/mender-convert-modify b/mender-convert-modify index 0ca16e7..b352e81 100755 --- a/mender-convert-modify +++ b/mender-convert-modify @@ -39,6 +39,8 @@ source modules/bootstrap.sh source modules/disk.sh source modules/probe.sh +declare -a configs + while (( "$#" )); do case "$1" in -o | --overlay) @@ -46,7 +48,7 @@ while (( "$#" )); do shift 2 ;; -c | --config) - configs+="${2}" + configs+=("${2}") shift 2 ;; -d | --disk-image) @@ -59,7 +61,11 @@ while (( "$#" )); do esac done -source modules/config.sh "${configs[@]}" +# Note the use of %q formatting here. This is a bash feature to add +# proper quoting to the strings so that spaces and special characters +# will be treated properly. Primarily for supporting spaces in +# pathnames and avoid splitting those into multiple parameters. +source modules/config.sh $(printf "%q " "${configs[@]}") boot_part=$(disk_boot_part) root_part=$(disk_root_part) diff --git a/mender-convert-package b/mender-convert-package index f8e968e..9d3489f 100755 --- a/mender-convert-package +++ b/mender-convert-package @@ -38,6 +38,8 @@ echo "Running $(basename $0): $@" source modules/bootstrap.sh source modules/disk.sh +declare -a configs + while (( "$#" )); do case "$1" in -o | --overlay) @@ -45,7 +47,7 @@ while (( "$#" )); do shift 2 ;; -c | --config) - configs+="${2}" + configs+=("${2}") shift 2 ;; -d | --disk-image) @@ -58,7 +60,11 @@ while (( "$#" )); do esac done -source modules/config.sh "${configs[@]}" +# Note the use of %q formatting here. This is a bash feature to add +# proper quoting to the strings so that spaces and special characters +# will be treated properly. Primarily for supporting spaces in +# pathnames and avoid splitting those into multiple parameters. +source modules/config.sh $(printf "%q " "${configs[@]}") PARTED="/usr/bin/parted" if [ ! -f ${PARTED} ]; then diff --git a/modules/config.sh b/modules/config.sh index 82e6c5e..ea653cb 100644 --- a/modules/config.sh +++ b/modules/config.sh @@ -14,7 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -for config in configs/mender_convert_config "$@"; do - log_info "Using configuration file: ${config}" - source ${config} +# Read in the array of config files to process +read -a configs <<< "${@}" +configs=( "configs/mender_convert_config" "${configs[@]}" ) +for config in "${configs[@]}"; do + log_info "Using configuration file: ${config}" + source "${config}" done