[lxc-devel] [lxc/master] Use "rsync -SHaAX" to copy the cached rootfs into place

hallyn on Github lxc-bot at linuxcontainers.org
Fri Jul 28 18:12:19 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 517 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170728/529769e7/attachment.bin>
-------------- next part --------------
From 6273aef16b9409536045b2f337dac7799ed159ff Mon Sep 17 00:00:00 2001
From: Harald Dunkel <harri at afaics.de>
Date: Fri, 28 Jul 2017 13:08:02 -0500
Subject: [PATCH] Use "rsync -SHaAX" to copy the cached rootfs into place

(updated by Serge to also handle hte new lxc-fedora{-legacy{.in
templates)

Signed-off-by: Harald Dunkel <harri at afaics.de>
Signed-off-by: Serge Hallyn <serge at hallyn.com>
Acked-by: Serge Hallyn <serge at hallyn.com>
---
 templates/lxc-altlinux.in      | 2 +-
 templates/lxc-centos.in        | 2 +-
 templates/lxc-debian.in        | 2 +-
 templates/lxc-fedora-legacy.in | 2 +-
 templates/lxc-fedora.in        | 2 +-
 templates/lxc-openmandriva.in  | 2 +-
 templates/lxc-opensuse.in      | 2 +-
 templates/lxc-ubuntu.in        | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/templates/lxc-altlinux.in b/templates/lxc-altlinux.in
index b6de74662..d526fa096 100644
--- a/templates/lxc-altlinux.in
+++ b/templates/lxc-altlinux.in
@@ -221,7 +221,7 @@ copy_altlinux()
     #cp -a $cache/rootfs-$arch $rootfs_path || return 1
     # i prefer rsync (no reason really)
     mkdir -p $rootfs_path
-    rsync -Ha $cache/rootfs/ $rootfs_path/
+    rsync -SHaAX $cache/rootfs/ $rootfs_path/
     return 0
 }
 
diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in
index 6832133b2..4d2777bd6 100644
--- a/templates/lxc-centos.in
+++ b/templates/lxc-centos.in
@@ -533,7 +533,7 @@ copy_centos()
     #cp -a $cache/rootfs-$arch $rootfs_path || return 1
     # i prefer rsync (no reason really)
     mkdir -p $rootfs_path
-    rsync -a $cache/rootfs/ $rootfs_path/
+    rsync -SHaAX $cache/rootfs/ $rootfs_path/
     echo
     return 0
 }
diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
index 5cbfcd1f2..cd00066f3 100644
--- a/templates/lxc-debian.in
+++ b/templates/lxc-debian.in
@@ -433,7 +433,7 @@ copy_debian()
       btrfs subvolume snapshot "$cache/rootfs-$release-$arch" "$realrootfs" || return 1
       [ "$rootfs" = "$realrootfs" ] || mount --bind "$realrootfs" "$rootfs" || return 1
     else
-        rsync -Ha "$cache/rootfs-$release-$arch"/ "$rootfs"/ || return 1
+        rsync -SHaAX "$cache/rootfs-$release-$arch"/ $rootfs/ || return 1
     fi
     return 0
 }
diff --git a/templates/lxc-fedora-legacy.in b/templates/lxc-fedora-legacy.in
index 512adbe5a..3ef341530 100644
--- a/templates/lxc-fedora-legacy.in
+++ b/templates/lxc-fedora-legacy.in
@@ -1015,7 +1015,7 @@ copy_fedora()
     #cp -a $cache/rootfs-$basearch $rootfs_path || return 1
     # i prefer rsync (no reason really)
     mkdir -p $rootfs_path
-    rsync -Ha $cache/rootfs/ $rootfs_path/
+    rsync -SHaAX $cache/rootfs/ $rootfs_path/
     echo
     return 0
 }
diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index 57c5569bc..10b90b1e5 100644
--- a/templates/lxc-fedora.in
+++ b/templates/lxc-fedora.in
@@ -520,7 +520,7 @@ copy_fedora()
     echo -n "Copying ${cache} to ${rootfs} ... "
 
     mkdir -p "${rootfs}" &&
-    rsync --archive --hard-links --sparse "${cache}/" "${rootfs}/" &&
+    rsync --archive --hard-links --sparse --acls --xattrs "${cache}/" "${rootfs}/" &&
     echo || return 1
 
     return 0
diff --git a/templates/lxc-openmandriva.in b/templates/lxc-openmandriva.in
index 6fefb45c1..2761cd509 100644
--- a/templates/lxc-openmandriva.in
+++ b/templates/lxc-openmandriva.in
@@ -155,7 +155,7 @@ copy_openmandriva()
 
     echo -n "Copying rootfs to $rootfs_path ..."
     mkdir -p $rootfs_path
-    rsync -Ha $cache/rootfs/ $rootfs_path/
+    rsync -SHaAX $cache/rootfs/ $rootfs_path/
     return 0
 }
 
diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index 29f9f4178..edecad5e3 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -251,7 +251,7 @@ copy_opensuse()
     # make a local copy of the mini opensuse
     echo "Copying rootfs to $rootfs ..."
     mkdir -p $rootfs
-    rsync -Ha $cache/rootfs-$arch/ $rootfs/ || return 1
+    rsync -SHaAX $cache/rootfs-$arch/ $rootfs/ || return 1
     return 0
 }
 
diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in
index 8077b319c..7fc3e5132 100644
--- a/templates/lxc-ubuntu.in
+++ b/templates/lxc-ubuntu.in
@@ -439,7 +439,7 @@ copy_ubuntu()
       btrfs subvolume snapshot $cache/rootfs-$arch $realrootfs || return 1
       [ "$rootfs" = "$realrootfs" ] || mount --bind $realrootfs $rootfs || return 1
     else
-      rsync -Ha $cache/rootfs-$arch/ $rootfs/ || return 1
+      rsync -SHaAX $cache/rootfs-$arch/ $rootfs/ || return 1
     fi
     return 0
 }


More information about the lxc-devel mailing list