Skip to content

Commit 2f062a9

Browse files
Run parted with --script
This makes it non-interactive and prevents the script from silently hanging when parted finds something weird, e.g.: $ sudo rpi-clone /dev/sda Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. This just hangs, because parted is waiting for an answer: $ sudo parted -m /dev/sda unit s print Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. Ignore/Cancel?
1 parent 3441dac commit 2f062a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rpi-clone

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ fi
690690
# src_root_dev, if on device other than booted, is not in src_partition_table
691691
# and src_fdisk_table, but is in src_df_table and src_mount_table
692692
#
693-
src_partition_table=$(parted -m "/dev/$src_disk" unit s print | tr -d ';')
693+
src_partition_table=$(parted --script -m "/dev/$src_disk" unit s print | tr -d ';')
694694
src_fdisk_table=$(fdisk -l /dev/$src_disk | grep "^/dev/")
695695

696696
tmp=$(df | grep -e "^/dev/$src_disk" -e "^/dev/root" -e "$src_root_dev" \
@@ -1137,7 +1137,7 @@ then
11371137
exit 1
11381138
fi
11391139

1140-
dst_partition_table=$(parted -m "/dev/$dst_disk" unit s print | tr -d ';')
1140+
dst_partition_table=$(parted --script -m "/dev/$dst_disk" unit s print | tr -d ';')
11411141
n_dst_parts=$(echo "$dst_partition_table" | tail -n 1 | cut -d ":" -f 1)
11421142
if [ "$n_dst_parts" == "/dev/$dst_disk" ]
11431143
then

0 commit comments

Comments
 (0)