Skip to content

Commit 4389dcf

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 16f99d9 commit 4389dcf

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
@@ -689,7 +689,7 @@ fi
689689
# src_root_dev, if on device other than booted, is not in src_partition_table
690690
# and src_fdisk_table, but is in src_df_table and src_mount_table
691691
#
692-
src_partition_table=$(parted -m "/dev/$src_disk" unit s print | tr -d ';')
692+
src_partition_table=$(parted --script -m "/dev/$src_disk" unit s print | tr -d ';')
693693
src_fdisk_table=$(fdisk -l /dev/$src_disk | grep "^/dev/")
694694

695695
tmp=$(df | grep -e "^/dev/$src_disk" -e "^/dev/root" -e "$src_root_dev" \
@@ -1141,7 +1141,7 @@ then
11411141
exit 1
11421142
fi
11431143

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

0 commit comments

Comments
 (0)