1
1
#! /bin/bash
2
2
3
- version=2.0.14
3
+ version=2.0.15
4
4
5
5
# auto run grub-install if grub detected
6
6
grub_auto=1
@@ -1025,7 +1025,7 @@ then
1025
1025
exit 1
1026
1026
fi
1027
1027
1028
- for (( p = 1 ; p <= n_dst_parts; p ++ ))
1028
+ for (( p = n_dst_parts ; p >= 1 ; -- p ))
1029
1029
do
1030
1030
if (( ! dst_exists[p]))
1031
1031
then
@@ -1034,9 +1034,20 @@ do
1034
1034
dir=$( echo " $dst_mount_table " \
1035
1035
| grep -e " ^${dst_device[p]} " | cut -d " " -f 2)
1036
1036
unmount_or_abort " $dir " \
1037
- " Destination disk partition ${dst_device[p]} is mounted on ${dst_mounted_dir[p]} ."
1037
+ " Destination disk partition ${dst_device[p]} is mounted on $dir ."
1038
1038
done
1039
1039
1040
+ mounted_dev=$( findmnt $clone -o source -n)
1041
+ unmount_or_abort " $mounted_dev " \
1042
+ " Directory $clone is already mounted with $mounted_dev ."
1043
+
1044
+ mounted_dev=$( findmnt $clone_src -o source -n)
1045
+ unmount_or_abort " $mounted_dev " \
1046
+ " Directory $clone_src is already mounted with $mounted_dev ."
1047
+
1048
+ mounted_dev=$( findmnt /mnt -o source -n)
1049
+ unmount_or_abort " $mounted_dev " " $mounted_dev is currently mounted on /mnt."
1050
+
1040
1051
1041
1052
if [ ! -d $clone ]
1042
1053
then
@@ -1059,19 +1070,6 @@ then
1059
1070
exclude_swapfile=" --exclude $swapfile "
1060
1071
fi
1061
1072
1062
- # TODO: exclude fuse mounts (readlink_stat errors): process findmnt -D | fuse
1063
-
1064
- mounted_dev=$( findmnt $clone -o source -n)
1065
- unmount_or_abort " $mounted_dev " \
1066
- " Directory $clone is already mounted with $mounted_dev ."
1067
-
1068
- mounted_dev=$( findmnt $clone_src -o source -n)
1069
- unmount_or_abort " $mounted_dev " \
1070
- " Directory $clone_src is already mounted with $mounted_dev ."
1071
-
1072
- mounted_dev=$( findmnt /mnt -o source -n)
1073
- unmount_or_abort " $mounted_dev " " $mounted_dev is currently mounted on /mnt."
1074
-
1075
1073
print_partitions
1076
1074
1077
1075
if (( initialize))
@@ -1276,7 +1274,7 @@ Use -U for unattended even if initializing.
1276
1274
if [ " $fs_type " == " swap" ]
1277
1275
then
1278
1276
printf " => mkswap $dst_dev \n"
1279
- mkswap $dst_dev
1277
+ mkswap $dst_dev & >> /tmp/ $PGM -log
1280
1278
elif (( p != ext_part_num))
1281
1279
then
1282
1280
if [ " ${src_mounted_dir[p]} " != " " ] || (( p == n_image_parts))
@@ -1289,7 +1287,7 @@ Use -U for unattended even if initializing.
1289
1287
fs_type=" vfat -F 32"
1290
1288
fi
1291
1289
printf " => mkfs -t $fs_type $dst_dev ..."
1292
- mkfs -t " $fs_type " " $dst_dev " & > /dev/null <<< " yes"
1290
+ mkfs -t " $fs_type " " $dst_dev " & >> /tmp/ $PGM -output <<< " yes"
1293
1291
# mkfs -t "$fs_type" "$dst_dev" <<< "yes"
1294
1292
echo " "
1295
1293
if (( p == n_image_parts))
@@ -1302,9 +1300,14 @@ Use -U for unattended even if initializing.
1302
1300
fi
1303
1301
fi
1304
1302
else
1305
- printf " \n => dd if=${src_device[$p]} of=$dst_dev bs=1M ...\n"
1306
- dd if=${src_device[$p]} of=$dst_dev bs=1M
1307
- echo " "
1303
+ printf " => dd if=${src_device[$p]} of=$dst_dev bs=1M ..."
1304
+ dd if=${src_device[$p]} of=$dst_dev bs=1M & >> /tmp/$PGM -output
1305
+ if [ " $? " != 0 ]
1306
+ then
1307
+ printf " \n dd failed. See /tmp/$PGM -output.\n"
1308
+ else
1309
+ echo " "
1310
+ fi
1308
1311
fi
1309
1312
fi
1310
1313
fi
@@ -1417,10 +1420,9 @@ do
1417
1420
rsync_file_system " ${clone_src} /" " ${clone} " " "
1418
1421
unmount_list " $unmount_list "
1419
1422
fi
1420
- done
1421
-
1423
+ done
1422
1424
1423
- qprintf " \nSyncing mounted partitions:\n"
1425
+ qprintf " Syncing mounted partitions:\n"
1424
1426
mount_partition $dst_root_dev $clone " "
1425
1427
unmount_list=" $clone "
1426
1428
0 commit comments