Browse Source

Modify some commands' output to print less info

Issues: MEN-2172

Changelog: None

Signed-off-by: Adam Podogrocki <a.podogrocki@gmail.com>
1.0.x
Adam Podogrocki 6 years ago
parent
commit
b266d69e6b
  1. 4
      bbb-convert-stage-5.sh
  2. 6
      convert-stage-4.sh
  3. 16
      mender-convert
  4. 8
      mender-convert-functions.sh
  5. 4
      rpi3-convert-stage-2.sh
  6. 13
      rpi3-convert-stage-5.sh

4
bbb-convert-stage-5.sh

@ -232,8 +232,8 @@ do_install_bootloader() {
exit 1
fi
if [[ $(which ${bootloader_toolchain}-gcc) = 1 ]]; then
echo "Error: ARM GCC not found in PATH. Aborting."
if ! [ -x "$(command -v ${bootloader_toolchain}-gcc)" ]; then
log "Error: ARM GCC not found in PATH. Aborting."
exit 1
fi

6
convert-stage-4.sh

@ -184,7 +184,7 @@ install_files() {
sudo install -d ${primary_dir}/${sysconfdir}
sudo install -d ${primary_dir}/${sysconfdir}/scripts
sudo ln -s /data/${dataconfdir} ${primary_dir}/${localstatedir}
sudo ln -sf /data/${dataconfdir} ${primary_dir}/${localstatedir}
sudo install -m 0755 ${mender_client} ${primary_dir}/${bindir}/mender
@ -197,7 +197,7 @@ install_files() {
sudo install -m 0644 ${mender_dir}/mender.service ${primary_dir}/${systemd_unitdir}
# Enable menderd service starting on boot.
sudo ln -s /lib/systemd/system/mender.service \
sudo ln -sf /lib/systemd/system/mender.service \
${primary_dir}/etc/systemd/system/multi-user.target.wants/mender.service
sudo install -m 0644 ${mender_dir}/mender.conf ${primary_dir}/${sysconfdir}
@ -209,7 +209,7 @@ install_files() {
sudo install -m 0644 ${mender_dir}/version ${primary_dir}/${sysconfdir}/scripts
if [ -n "${demo_host_ip}" ]; then
echo "$demo_host_ip docker.mender.io s3.docker.mender.io" | sudo tee -a $primary_dir/etc/hosts
sudo sh -c -e "echo '$demo_host_ip docker.mender.io s3.docker.mender.io' >> $primary_dir/etc/hosts";
fi
if [ -n "${server_cert}" ]; then

16
mender-convert

@ -180,7 +180,7 @@ declare -a supported_devices=("beaglebone" "raspberrypi3")
do_raw_disk_image_shrink_rootfs() {
if [ -z "${raw_disk_image}" ]; then
echo "Raw disk image not set. Aborting."
exit 1
return 1
fi
local count=
@ -248,12 +248,12 @@ do_raw_disk_image_create_partitions() {
if [ -z "$raw_disk_image" ] || [ -z "$device_type" ] || \
[ -z "$artifact_name" ]; then
show_help
exit 1
return 1
fi
if [[ ! -f ${raw_disk_image} ]]; then
echo "Raw disk image not found. Aborting."
exit 1
return 1
fi
local supported=$(echo ${supported_devices[@]} | grep -o $device_type | wc -w)
@ -403,7 +403,7 @@ do_install_mender_to_mender_disk_image() {
if [ -z "$mender_disk_image" ] || [ -z "$device_type" ] || \
[ -z "$mender_client" ] || [ -z "$artifact_name" ]; then
show_help
exit 1
return 1
fi
local supported=$(echo ${supported_devices[@]} | grep -o $device_type | wc -w)
@ -451,7 +451,7 @@ do_install_bootloader_to_mender_disk_image() {
if [ -z "$mender_disk_image" ] || [ -z "$device_type" ] || \
[ -z "$bootloader_toolchain" ]; then
show_help
exit 1
return 1
fi
local supported=$(echo ${supported_devices[@]} | grep -o $device_type | wc -w)
@ -490,17 +490,17 @@ do_install_bootloader_to_mender_disk_image() {
do_mender_disk_image_to_artifact() {
if [ -z "${mender_disk_image}" ]; then
echo "Mender disk image not set. Aborting."
exit 1
return 1
fi
if [ -z "${device_type}" ]; then
echo "Target device_type name not set. Aborting."
exit 1
return 1
fi
if [ -z "${artifact_name}" ]; then
echo "Artifact name not set. Aborting."
exit 1
return 1
fi
if [ -z "${rootfs_partition_id}" ]; then

8
mender-convert-functions.sh

@ -618,11 +618,11 @@ set_fstab() {
# $3 - size (in 512 blocks)
extract_file_from_image() {
local cmd="dd if=$1 of=${output_dir}/$4 skip=$2 bs=512 count=$3 status=progress"
local cmd="dd if=$1 of=${output_dir}/$4 skip=$2 bs=512 count=$3"
echo "Running command:"
echo " ${cmd}"
$(${cmd})
echo "Running command:"
echo " ${cmd}"
$(${cmd})
}
# Takes following arguments

4
rpi3-convert-stage-2.sh

@ -7,13 +7,13 @@ boot_mapping=$2
{ echo "Error: extracted boot partition not found. Aborting."; exit 1; }
# Make a copy of Linux kernel arguments and modify.
mcopy -o -i ${output_dir}/boot.vfat -s ::cmdline.txt ${output_dir}/cmdline.txt
mcopy -on -i ${output_dir}/boot.vfat -s ::cmdline.txt ${output_dir}/cmdline.txt
sed -i 's/\b[ ]root=[^ ]*/ root=\/dev\/mmcblk0p2/' ${output_dir}/cmdline.txt
sed -i 's/\b[ ]console=tty1//' ${output_dir}/cmdline.txt
# Update Linux kernel command arguments with our custom configuration
mcopy -o -i ${output_dir}/boot.vfat -s ${output_dir}/cmdline.txt ::cmdline.txt
mcopy -i ${output_dir}/boot.vfat -s ::config.txt ${output_dir}/config.txt
mcopy -on -i ${output_dir}/boot.vfat -s ::config.txt ${output_dir}/config.txt
echo -e '\nenable_uart=1\n' >> ${output_dir}/config.txt
mcopy -o -i ${output_dir}/boot.vfat -s ${output_dir}/config.txt ::config.txt

13
rpi3-convert-stage-5.sh

@ -58,7 +58,7 @@ build_uboot_files() {
make --quiet distclean
make --quiet rpi_3_32b_defconfig && make --quiet
make envtools
make --quiet envtools
cat<<-'EOF' >boot.cmd
fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
@ -98,9 +98,9 @@ install_files() {
#
# But we want it to run on our image as well to resize our data part so in
# case it is missing, add it back to cmdline.txt
if ! grep "init=/usr/lib/raspi-config/init_resize.sh" ${output_dir}/cmdline.txt; then
if ! grep -q "init=/usr/lib/raspi-config/init_resize.sh" ${output_dir}/cmdline.txt; then
cmdline=$(cat ${output_dir}/cmdline.txt)
echo "${cmdline} init=/usr/lib/raspi-config/init_resize.sh" > ${output_dir}/cmdline.txt
sh -c -e "echo '${cmdline} init=/usr/lib/raspi-config/init_resize.sh' >> ${output_dir}/cmdline.txt";
fi
# Update Linux kernel command arguments with our custom configuration
@ -158,8 +158,8 @@ do_install_bootloader() {
exit 1
fi
if [[ $(which ${bootloader_toolchain}-gcc) = 1 ]]; then
echo "Error: ARM GCC not found in PATH. Aborting."
if ! [ -x "$(command -v ${bootloader_toolchain}-gcc)" ]; then
log "Error: ARM GCC not found in PATH. Aborting."
exit 1
fi
@ -189,9 +189,10 @@ do_install_bootloader() {
fi
detach_device_maps ${mender_disk_mappings[@]}
rm -rf $sdimg_base_dir
[[ $keep -eq 0 ]] && { rm -f ${output_dir}/config.txt ${output_dir}/cmdline.txt;
rm -rf $uboot_dir $bin_base_dir $sdimg_base_dir; }
rm -rf $uboot_dir $bin_base_dir; }
[[ "$rc" -ne 0 ]] && { echo -e "\nStage failure."; exit 1; } || { echo -e "\nStage done."; }
}

Loading…
Cancel
Save