dib: add tgz output format

Implement the "tgz" output format, i.e. "tar" compressed as gzip.

This was implemented in diskimage-builder upstream as
commit da41ee6012b064aa6901c871a1104a3a3933117e.
This commit is contained in:
Pino Toscano
2017-02-02 13:34:13 +01:00
parent 91646e0bb6
commit c1bd2c3e74
3 changed files with 40 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ formats = \
qcow2 \
raw \
tar \
tgz \
vhd
SOURCES_ML = \

35
dib/output_format_tgz.ml Normal file
View File

@@ -0,0 +1,35 @@
(* virt-dib
* Copyright (C) 2017 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Common_utils
open Common_gettext.Gettext
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
let fmt = {
defaults with
name = "tgz";
run_on_filesystem = Some tgz_run_fs;
}
let () = register_format fmt

View File

@@ -216,6 +216,10 @@ Raw disk format.
An uncompressed tarball.
=item C<tgz>
A tarball compressed with gzip.
=item C<vhd>
C<Virtual Hard Disk> disk image. This output format requires