Skip to content

Commit fe7a646

Browse files
committed
Add HXA rsync options. -L changes ext labels for sync clones.
Add to rsync options preserve hard links, extended attributes and access control lists.
1 parent 31e571f commit fe7a646

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

rpi-clone

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

3-
version=2.0.18
3+
version=2.0.19
44

55
# auto run grub-install if grub detected
66
grub_auto=1
77

88
PGM=`basename $0`
99
setup_command="$PGM-setup"
1010

11-
rsync_options="--force -rltWDEgoptx"
11+
rsync_options="--force -rltWDEHXAgoptx"
1212

1313
if [ `id -u` != 0 ]
1414
then
@@ -1377,6 +1377,7 @@ Use -U for unattended even if initializing.
13771377
fi
13781378
fi
13791379
done
1380+
ext_label=""
13801381
else
13811382
qecho "== SYNC $src_disk file systems to $dst_disk =="
13821383
print_sync_actions
@@ -1474,15 +1475,33 @@ do
14741475
qprintf "Syncing unmounted partitions:\n"
14751476
fi
14761477
sync_msg_done=1
1478+
dst_dev=/dev/${dst_part_base}${p}
1479+
fs_type=${src_fs_type[$p]}
1480+
ext_label $p $fs_type "" label
1481+
if [ "$label" != "" ]
1482+
then
1483+
qecho " e2label $dst_dev $label"
1484+
e2label $dst_dev $label
1485+
fi
1486+
14771487
mount_partition ${src_device[p]} $clone_src ""
1478-
mount_partition /dev/${dst_part_base}$p $clone "$clone_src"
1488+
mount_partition $dst_dev $clone "$clone_src"
14791489
unmount_list="$clone_src $clone"
14801490
rsync_file_system "${clone_src}/" "${clone}" ""
14811491
unmount_list "$unmount_list"
14821492
fi
14831493
done
14841494

14851495
qprintf "Syncing mounted partitions:\n"
1496+
1497+
fs_type=${src_fs_type[$root_part_num]}
1498+
ext_label $root_part_num $fs_type "" label
1499+
if [ "$label" != "" ]
1500+
then
1501+
qecho " e2label $dst_root_dev $label"
1502+
e2label $dst_root_dev $label
1503+
fi
1504+
14861505
mount_partition $dst_root_dev $clone ""
14871506
unmount_list="$clone"
14881507

@@ -1501,7 +1520,17 @@ do
15011520
then
15021521
mkdir -p $dst_dir
15031522
fi
1504-
mount_partition /dev/${dst_part_base}$p "$dst_dir" "$unmount_list"
1523+
1524+
dst_dev=/dev/${dst_part_base}${p}
1525+
fs_type=${src_fs_type[$p]}
1526+
ext_label $p $fs_type "" label
1527+
if [ "$label" != "" ]
1528+
then
1529+
qecho " e2label $dst_dev $label"
1530+
e2label $dst_dev $label
1531+
fi
1532+
1533+
mount_partition "$dst_dev" "$dst_dir" "$unmount_list"
15051534
rsync_file_system "${src_mounted_dir[p]}/" "${dst_dir}" ""
15061535
unmount_list="$dst_dir $unmount_list"
15071536
fi

0 commit comments

Comments
 (0)