When extracting the content of the guest as tar, save also the extended
attributes and the SELinux attributes. This makes sure guests exported
as tar, tgz, and as docker image will work fine afterwards.
This is what disk-image-create does as well.
---
dib/output_format_docker.ml | 3 ++-
dib/output_format_tar.ml | 3 ++-
dib/output_format_tgz.ml | 4 ++--
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dib/output_format_docker.ml b/dib/output_format_docker.ml
index 5303cf9..903ac65 100644
--- a/dib/output_format_docker.ml
+++ b/dib/output_format_docker.ml
@@ -38,7 +38,8 @@ let docker_run_fs (g : Guestfs.guestfs) _ temp_dir =
| Some t -> t in
message (f_"Importing the image to docker as '%s'") docker_target;
let dockertmp = Filename.temp_file ~temp_dir "docker." ".tar" in
- g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] "/"
dockertmp;
+ g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] ~xattrs:true
~selinux:true
+ "/" dockertmp;
let cmd = [ "sudo"; "docker"; "import"; dockertmp;
docker_target ] in
if run_command cmd <> 0 then exit 1
diff --git a/dib/output_format_tar.ml b/dib/output_format_tar.ml
index d8d5bfa..132532d 100644
--- a/dib/output_format_tar.ml
+++ b/dib/output_format_tar.ml
@@ -23,7 +23,8 @@ open Output_format
let tar_run_fs (g : Guestfs.guestfs) filename _ =
message (f_"Compressing the image as tar");
- g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] "/"
filename
+ g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] ~xattrs:true
~selinux:true
+ "/" filename
let fmt = {
defaults with
diff --git a/dib/output_format_tgz.ml b/dib/output_format_tgz.ml
index a74a4a6..155afb5 100644
--- a/dib/output_format_tgz.ml
+++ b/dib/output_format_tgz.ml
@@ -23,8 +23,8 @@ open Output_format
let tgz_run_fs (g : Guestfs.guestfs) filename _ =
message (f_"Compressing the image as tar.gz");
- g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |]
~compress:"gzip"
- "/" filename
+ g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] ~xattrs:true
~selinux:true
+ ~compress:"gzip" "/" filename
let fmt = {
defaults with
--
2.9.3