Skip to content

Commit 08da1fe

Browse files
committed
More progress printing formatting changes.
1 parent 2a5d17f commit 08da1fe

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

rpi-clone

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
version=2.0.13
3+
version=2.0.14
44

55
# auto run grub-install if grub detected
66
grub_auto=1
@@ -200,7 +200,7 @@ unmount_list()
200200
fi
201201
for dir in $1
202202
do
203-
qecho "unmounting: $dir"
203+
qecho " unmounting $dir"
204204
if ! umount $dir
205205
then
206206
qecho " Failed to unmount: $dir"
@@ -663,7 +663,12 @@ do
663663
echo "Cannot find script $setup_command for setup arg \"$1\"."
664664
usage_error=1
665665
fi
666-
setup_args="$setup_args $1"
666+
if [ "$setup_args" == "" ]
667+
then
668+
setup_args="$1"
669+
else
670+
setup_args="$setup_args $1"
671+
fi
667672
;;
668673
-e|--edit-fstab)
669674
shift
@@ -1176,10 +1181,17 @@ Use -U for unattended even if initializing.
11761181
image_to_sector=${src_start_sector[$image_to_part]}
11771182
count=$((image_to_sector / 2 / 1024 + 4)) # in MiB blocks for dd bs=1M
11781183

1179-
printf "\nImaging past the start of $msg partition $image_to_part.\n"
1184+
printf "\nInitializing\n"
1185+
printf " Imaging past the start of $msg partition $image_to_part.\n"
11801186
sync
1181-
echo " => dd if=/dev/$src_disk of=/dev/$dst_disk bs=1M count=$count ..."
1182-
dd if=/dev/$src_disk of=/dev/$dst_disk bs=1M count=$count
1187+
printf " => dd if=/dev/$src_disk of=/dev/$dst_disk bs=1M count=$count ..."
1188+
dd if=/dev/$src_disk of=/dev/$dst_disk bs=1M count=$count &> /tmp/$PGM-output
1189+
if [ "$?" != 0 ]
1190+
then
1191+
printf "\n dd failed. See /tmp/$PGM-output.\n"
1192+
printf " Try running $PGM again.\n\n"
1193+
exit 1
1194+
fi
11831195
echo ""
11841196
sync
11851197
sleep 1
@@ -1203,16 +1215,16 @@ Use -U for unattended even if initializing.
12031215
for ((x = 0; x < 3; ++x))
12041216
do
12051217
sleep $((x + 1))
1206-
sfdisk --force /dev/$dst_disk &> /tmp/$PGM-fail <<< "$sfd1"
1218+
sfdisk --force /dev/$dst_disk &> /tmp/$PGM-output <<< "$sfd1"
12071219
if [ "$?" == 0 ]
12081220
then
12091221
break
12101222
fi
12111223
if ((x == 2))
12121224
then
12131225
printf "\n====$PGM\n==orig:\n%s\n\n==edited:\n%s\n" \
1214-
"$sfd0" "$sfd1" >> /tmp/$PGM-fail
1215-
printf "\n Resize failed. See /tmp/$PGM-fail.\n"
1226+
"$sfd0" "$sfd1" >> /tmp/$PGM-output
1227+
printf "\n Resize failed. See /tmp/$PGM-output.\n"
12161228
printf " Try running $PGM again.\n\n"
12171229

12181230
# Don't let dst disk keep source disk ID. Can lead to remounts.
@@ -1432,7 +1444,7 @@ do
14321444
unmount_list="$dst_dir $unmount_list"
14331445
fi
14341446
done
1435-
1447+
echo ""
14361448

14371449
# Fix PARTUUID or device name references in cmdline.txt and fstab
14381450
#

0 commit comments

Comments
 (0)