Browse Source

Merge pull request #91 from mirzak/shrink-fs

always run 'image_shrink_rootfs' in 'do_from_raw_disk_image'
1.2.x
Adam Podogrocki 6 years ago
committed by GitHub
parent
commit
9301b850d7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      mender-convert

24
mender-convert

@ -19,8 +19,6 @@ General commands:
necessary files installed necessary files installed
mender-disk-image-to-artifact - creates Mender artifact file mender-disk-image-to-artifact - creates Mender artifact file
from Mender image from Mender image
raw-disk-image-shrink-rootfs - shrinks existing embedded raw
disk image
Options: [-r|--raw-disk-image | -m|--mender-disk-image | -s|--data-part-size-mb | Options: [-r|--raw-disk-image | -m|--mender-disk-image | -s|--data-part-size-mb |
-d|--device-type | -p|--rootfs-partition-id | -n|--demo | -i|--demo-host-ip | -d|--device-type | -p|--rootfs-partition-id | -n|--demo | -i|--demo-host-ip |
@ -85,13 +83,6 @@ Examples:
Note: artifact name format is: release-<release_no>_<mender_version> Note: artifact name format is: release-<release_no>_<mender_version>
To shrink the existing embedded raw disk image:
./mender-convert raw-disk-image-shrink-rootfs
--raw-disk-image <raw_disk_image_path>
Output: Root filesystem size (sectors): 4521984
EOF EOF
} }
@ -159,8 +150,8 @@ do_raw_disk_image_shrink_rootfs() {
elif [[ $raw_disk_counts -eq 2 ]]; then elif [[ $raw_disk_counts -eq 2 ]]; then
sudo losetup $loopdevice $raw_disk_image -o $((${raw_disk_sizes[prootfs_start]} * $sector_size)) sudo losetup $loopdevice $raw_disk_image -o $((${raw_disk_sizes[prootfs_start]} * $sector_size))
else else
log "Error: invalid/unsupported embedded raw disk image. Aborting." log "Warning: invalid/unsupported embedded raw disk image. Skipping resize..."
return 1 return 0
fi fi
block_size=($(sudo dumpe2fs -h $loopdevice | grep 'Block size' | tr -s ' ' | cut -d ' ' -f3)) block_size=($(sudo dumpe2fs -h $loopdevice | grep 'Block size' | tr -s ' ' | cut -d ' ' -f3))
@ -648,6 +639,9 @@ do_from_raw_disk_image() {
return 1 return 1
fi fi
do_raw_disk_image_shrink_rootfs || rc=$?
[[ $rc -ne 0 ]] && { return 1; }
do_raw_disk_image_create_partitions || rc=$? do_raw_disk_image_create_partitions || rc=$?
[[ $rc -ne 0 ]] && { return 1; } [[ $rc -ne 0 ]] && { return 1; }
@ -797,14 +791,6 @@ mender_rootfs_image=${output_dir}/${mender_rootfs_basename}
mender_artifact=${output_dir}/${mender_disk_basename}.mender mender_artifact=${output_dir}/${mender_disk_basename}.mender
case "$1" in case "$1" in
raw-disk-image-shrink-rootfs)
total=1
do_raw_disk_image_shrink_rootfs || rc=$?
[[ $rc -ne 0 ]] && { log "Check $build_log for details."; exit 1; }
log "The rootfs partition in the raw disk image has been shrinked successfully!"
log "You can now convert the output raw disk image\n\t$raw_disk_image\
\nto a Mender disk image."
;;
mender-disk-image-to-artifact) mender-disk-image-to-artifact)
total=1 total=1
do_mender_disk_image_to_artifact || rc=$? do_mender_disk_image_to_artifact || rc=$?

Loading…
Cancel
Save