mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-25 15:41:04 +02:00
crosutils: Improve dd in image_to_usb.sh
1. add oflags=sync to allow interrupting dd without hanging system I/O for a long time (since bs=4M, the speed is almost the same) 2. use pv to provide progress report if available. (add pv into host-depends in http://codereview.chromium.org/3608004) BUG=none TEST=manually: 1. install pv in chroot, then execute image_to_usb.sh --to /dev/sdX and verified there's progress bar 2. ctrl-c to break the dd process and verified it can stop immediately 3. remove pv from chroot, then execute image_to_usb.sh and verify that it still works Change-Id: I62fc373a4feee6d7e61897325d9e1e6d84a74d63 Review URL: http://codereview.chromium.org/3581007
This commit is contained in:
parent
3ede50ed4e
commit
4732d5d0c3
@ -236,7 +236,11 @@ then
|
||||
|
||||
if [ ${FLAGS_install} -ne ${FLAGS_TRUE} ]; then
|
||||
echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..."
|
||||
sudo dd if="${SRC_IMAGE}" of="${FLAGS_to}" bs=4M
|
||||
if type pv >/dev/null 2>&1; then
|
||||
sudo pv -ptre "${SRC_IMAGE}" | sudo dd of="${FLAGS_to}" bs=4M oflag=sync
|
||||
else
|
||||
sudo dd if="${SRC_IMAGE}" of="${FLAGS_to}" bs=4M oflag=sync
|
||||
fi
|
||||
sync
|
||||
else
|
||||
if [ ${INSIDE_CHROOT} -ne 1 ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user