diff --git a/.gitignore b/.gitignore index 7a4696b90..2c8bd36dc 100644 --- a/.gitignore +++ b/.gitignore @@ -35,9 +35,6 @@ Makefile.in /.sc-* /aclocal.m4 -/align/stamp-virt-alignment-scan.pod -/align/virt-alignment-scan -/align/virt-alignment-scan.1 /appliance/guestfsd.deps /appliance/libguestfs-make-fixed-appliance /appliance/libguestfs-make-fixed-appliance.1 @@ -83,45 +80,7 @@ Makefile.in /build-aux/snippet/ /build-aux/test-driver /build-aux/ylwrap -/builder/.depend -/builder/*.img -/builder/index-parse.c -/builder/index-parse.h -/builder/index_parser_tests -/builder/index-scan.c -/builder/libguestfs.conf -/builder/opensuse.conf -/builder/osinfo_config.ml -/builder/oUnit-* -/builder/*.out -/builder/*.qcow2 -/builder/repository-testdata -/builder/stamp-virt-builder.pod -/builder/stamp-virt-builder-repository.pod -/builder/stamp-virt-index-validate.pod -/builder/test-config/virt-builder/repos.d/test-index.conf -/builder/test-console-*.sh -/builder/test-simplestreams/virt-builder/repos.d/cirros.conf -/builder/test-website/virt-builder/repos.d/libguestfs.conf -/builder/virt-builder -/builder/virt-builder-repository -/builder/virt-builder.1 -/builder/virt-builder-repository.1 -/builder/virt-index-validate -/builder/virt-index-validate.1 -/builder/*.xz /bundled/ocaml-augeas/.depend -/cat/stamp-virt-*.pod -/cat/virt-cat -/cat/virt-cat.1 -/cat/virt-filesystems -/cat/virt-filesystems.1 -/cat/virt-log -/cat/virt-log.1 -/cat/virt-ls -/cat/virt-ls.1 -/cat/virt-tail -/cat/virt-tail.1 /ChangeLog /compile /config.cache @@ -134,14 +93,6 @@ Makefile.in /config.sub /configure /csharp/Libguestfs.cs -/customize/.depend -/customize/customize_cmdline.ml -/customize/customize_cmdline.mli -/customize/stamp-virt-customize.pod -/customize/test-password-*.sh -/customize/test-settings-*.sh -/customize/virt-customize -/customize/virt-customize.1 /daemon/.depend /daemon/actions.h /daemon/blkid.mli @@ -186,17 +137,6 @@ Makefile.in /daemon/stubs.h /daemon/types.ml /depcomp -/df/stamp-virt-df.pod -/df/virt-df -/df/virt-df.1 -/dib/.depend -/dib/output_format_*.mli -/dib/stamp-virt-dib.pod -/dib/virt-dib -/dib/virt-dib.1 -/diff/stamp-virt-diff.pod -/diff/virt-diff -/diff/virt-diff.1 /docs/guestfs-building.1 /docs/guestfs-faq.1 /docs/guestfs-hacking.1 @@ -216,9 +156,6 @@ Makefile.in /docs/stamp-guestfs-release-notes-*.pod /docs/stamp-guestfs-security.pod /docs/stamp-guestfs-testing.pod -/edit/stamp-virt-*.pod -/edit/virt-edit -/edit/virt-edit.1 /erlang/actions-?.c /erlang/actions.h /erlang/bindtests.erl @@ -270,9 +207,6 @@ Makefile.in /fish/virt-copy-out.1 /fish/virt-tar-in.1 /fish/virt-tar-out.1 -/format/stamp-virt-format.pod -/format/virt-format -/format/virt-format.1 /fuse/guestmount /fuse/guestmount.1 /fuse/guestunmount @@ -287,10 +221,6 @@ Makefile.in /generator/generator /generator/.pod2text.data* /generator/stamp-generator -/get-kernel/.depend -/get-kernel/stamp-virt-get-kernel.pod -/get-kernel/virt-get-kernel -/get-kernel/virt-get-kernel.1 /.gitattributes /.git-module-status /gnulib @@ -312,10 +242,6 @@ Makefile.in /haskell/Guestfs050LVCreate /haskell/Guestfs.hs /include/guestfs.h -/inspector/actual-*.xml -/inspector/stamp-virt-inspector.pod -/inspector/virt-inspector -/inspector/virt-inspector.1 /installcheck.sh /install-sh /java/actions-?.c @@ -366,9 +292,6 @@ Makefile.in /m4/ltsugar.m4 /m4/ltversion.m4 /maint.mk -/make-fs/stamp-virt-make-fs.pod -/make-fs/virt-make-fs -/make-fs/virt-make-fs.1 /missing /ocaml-dep.sh /ocaml-link.sh @@ -474,10 +397,6 @@ Makefile.in /rescue/stamp-virt-rescue.pod /rescue/virt-rescue /rescue/virt-rescue.1 -/resize/.depend -/resize/stamp-virt-resize.pod -/resize/virt-resize -/resize/virt-resize.1 /ruby/bindtests.rb /ruby/doc/site/api /ruby/examples/guestfs-ruby.3 @@ -499,21 +418,7 @@ Makefile.in /rust/src/guestfs.rs /rust/target /run -/sparsify/.depend -/sparsify/stamp-virt-sparsify.pod -/sparsify/virt-sparsify -/sparsify/virt-sparsify.1 /stamp-h1 -/sysprep/.depend -/sysprep/stamp-script1.sh -/sysprep/stamp-script2.sh -/sysprep/stamp-script4.sh -/sysprep/stamp-virt-sysprep.pod -/sysprep/sysprep-extra-options.pod -/sysprep/sysprep-operations.pod -/sysprep/sysprep_operation_*.mli -/sysprep/virt-sysprep -/sysprep/virt-sysprep.1 /tests/c-api/test-add-drive-opts /tests/c-api/test-add-libvirt-dom /tests/c-api/test-backend-settings @@ -592,8 +497,6 @@ Makefile.in /test-tool/libguestfs-test-tool.1 /test-tool/libguestfs-test-tool-helper /test-tool/stamp-libguestfs-test-tool.pod -/tools/stamp-virt-*.pod -/tools/virt-*.1 /website/download/builder/*.xz /website/*.html /website/README.txt diff --git a/BUGS b/BUGS index 782ffdfb9..72e3774b4 100644 --- a/BUGS +++ b/BUGS @@ -1,5 +1,5 @@ NOTE: This file is automatically generated from "update-bugs.sh". -Last updated: 2021-03-03 +Last updated: 2021-03-11 This contains a local list of the bugs that are open against libguestfs. Bugs are tracked in the Red Hat Bugzilla database @@ -623,6 +623,12 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix. 1933640 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1933640 [Regression] lvcreate fails to wipe signatures again +1935647 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1935647 + RFE: virt-builder debian-10 : Cannot (easily) update resolv.conf + +1935753 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1935753 + "Warning: Missing arginfo" - libguestfs needs porting for PHP 8 + 503134 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=503134 guestfish's list splitting does not recognize internal quoting @@ -644,7 +650,7 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix. 1794518 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1794518 setfiles fails on file /etc/.ip with ext4 immutable bit set -(208 bugs) +(210 bugs) -------------------------------------------------- Bugs in MODIFIED, POST or ON_QA state are fixed. diff --git a/Makefile.am b/Makefile.am index 3df1b6a7a..91f33e8d7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,6 +47,7 @@ SUBDIRS += include lib docs examples SUBDIRS += common/mlutils SUBDIRS += bundled/ocaml-augeas SUBDIRS += common/mlpcre +SUBDIRS += common/mlgettext if ENABLE_DAEMON SUBDIRS += daemon SUBDIRS += tests/daemon @@ -102,14 +103,8 @@ SUBDIRS += common/progress SUBDIRS += common/visit SUBDIRS += common/windows -# libguestfs-test-tool -SUBDIRS += test-tool - -# Guestfish. -SUBDIRS += fish - -# virt-tools in C. -SUBDIRS += align cat diff df edit format inspector make-fs rescue +# Small tools written in C. +SUBDIRS += test-tool fish rescue # bash-completion SUBDIRS += bash @@ -155,31 +150,6 @@ endif # Unconditional because nothing is built yet. SUBDIRS += csharp -# OCaml tools. Note 'common/ml*' and 'customize' contain shared code -# used by other OCaml tools, so these must come first. -if HAVE_OCAML -SUBDIRS += common/mlgettext -SUBDIRS += common/mlprogress -SUBDIRS += common/mlvisit -SUBDIRS += common/mlxml -SUBDIRS += common/mltools -SUBDIRS += common/mlcustomize -SUBDIRS += customize -SUBDIRS += builder builder/templates -SUBDIRS += get-kernel -SUBDIRS += resize -SUBDIRS += sparsify -SUBDIRS += sysprep -if HAVE_FUSE -SUBDIRS += dib -endif -endif - -# Perl tools. -if HAVE_TOOLS -SUBDIRS += tools -endif - # guestmount if HAVE_FUSE SUBDIRS += fuse @@ -292,8 +262,6 @@ maintainer-upload-website: # docs/C_SOURCE_FILES # - source files scanned for internal documentation # po/POTFILES - files with ordinary extensions, but not OCaml files -# po/POTFILES-pl - Perl files that don't end in *.pl, which need a -# special xgettext option [not generated here] # po/POTFILES-ml - OCaml files, which need a special tool to translate dist-hook: BUGS ChangeLog docs/C_SOURCE_FILES po/POTFILES po/POTFILES-ml @@ -337,16 +305,6 @@ po/POTFILES: configure.ac LC_ALL=C sort -u > $@-t mv $@-t $@ -po/POTFILES-ml: configure.ac - rm -f $@ $@-t - cd $(srcdir); \ - find builder common/ml* customize dib get-kernel resize sparsify sysprep -name '*.ml' | \ - grep -v '^builder/templates/' | \ - grep -v '^common/mlv2v/' | \ - grep -v -E '.*_tests\.ml$$' | \ - LC_ALL=C sort > $@-t - mv $@-t $@ - # Try to stop people using 'make install' without 'DESTDIR'. install: @if test "x$(DESTDIR)" != "x" || test "x$(REALLY_INSTALL)" = "xyes"; \ @@ -584,7 +542,12 @@ maintainer-check-extra-dist: ( git ls-files ; \ cd common; git ls-files | sed 's,^,common/,' ) | \ grep -v '^common$$' | \ + grep -v '^common/mlcustomize/' | \ + grep -v '^common/mlprogress/' | \ + grep -v '^common/mltools/' | \ grep -v '^common/mlv2v/' | \ + grep -v '^common/mlvisit/' | \ + grep -v '^common/mlxml/' | \ grep -v '^intltool-.*\.in' | \ grep -v '^\.gitmodules' | \ grep -v '^\.gnulib' | \ @@ -594,7 +557,7 @@ maintainer-check-extra-dist: cat tmp/comm-out [ ! -s tmp/comm-out ] @echo Checking for generated files missing from the tarball ... - @for f in `cat generator/files-generated.txt | grep -v '^common/mlv2v/'`; do \ + @for f in `cat generator/files-generated.txt | grep -v '^common/mlcustomize' | grep -v '^common/mlv2v/'`; do \ if ! grep -sq "^$$f\$$" tmp/tarfiles; then \ echo generated file missing from tarball: $$f; \ exit 1; \ diff --git a/align/Makefile.am b/align/Makefile.am deleted file mode 100644 index a3a5d67bc..000000000 --- a/align/Makefile.am +++ /dev/null @@ -1,94 +0,0 @@ -# libguestfs virt alignment tools -# Copyright (C) 2011 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. - -include $(top_srcdir)/subdir-rules.mk - -EXTRA_DIST = \ - test-virt-alignment-scan.sh \ - test-virt-alignment-scan-docs.sh \ - test-virt-alignment-scan-guests.sh \ - virt-alignment-scan.pod - -bin_PROGRAMS = virt-alignment-scan - -virt_alignment_scan_SOURCES = \ - scan.c - -virt_alignment_scan_CPPFLAGS = \ - -DGUESTFS_NO_DEPRECATED=1 \ - -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ - -I$(top_srcdir)/lib -I$(top_builddir)/lib \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \ - -I$(srcdir)/../gnulib/lib -I../gnulib/lib \ - -DLOCALEBASEDIR=\""$(datadir)/locale"\" - -virt_alignment_scan_CFLAGS = \ - -pthread \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - $(LIBXML2_CFLAGS) \ - $(LIBVIRT_CFLAGS) - -virt_alignment_scan_LDADD = \ - $(top_builddir)/common/options/liboptions.la \ - $(top_builddir)/common/parallel/libparallel.la \ - $(top_builddir)/common/structs/libstructs.la \ - $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/lib/libguestfs.la \ - $(LIBXML2_LIBS) \ - $(LIBVIRT_LIBS) \ - $(LTLIBINTL) \ - ../gnulib/lib/libgnu.la \ - -lm - -# Manual pages and HTML files for the website. -man_MANS = virt-alignment-scan.1 -noinst_DATA = $(top_builddir)/website/virt-alignment-scan.1.html - -virt-alignment-scan.1 $(top_builddir)/website/virt-alignment-scan.1.html: stamp-virt-alignment-scan.pod - -stamp-virt-alignment-scan.pod: virt-alignment-scan.pod - $(PODWRAPPER) \ - --man virt-alignment-scan.1 \ - --html $(top_builddir)/website/virt-alignment-scan.1.html \ - --path $(top_srcdir)/common/options \ - --license GPLv2+ \ - --warning safe \ - $< - touch $@ - -# Tests. - -TESTS_ENVIRONMENT = $(top_builddir)/run --test - -TESTS = \ - test-virt-alignment-scan-docs.sh - -if ENABLE_APPLIANCE -TESTS += \ - test-virt-alignment-scan.sh - -if HAVE_LIBVIRT -TESTS += \ - test-virt-alignment-scan-guests.sh -endif -endif - -check-valgrind: - $(MAKE) VG="@VG@" check diff --git a/align/scan.c b/align/scan.c deleted file mode 100644 index 7209bc02a..000000000 --- a/align/scan.c +++ /dev/null @@ -1,384 +0,0 @@ -/* virt-alignment-scan - * Copyright (C) 2011 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#ifdef HAVE_LIBVIRT -#include -#include -#endif - -#include "getprogname.h" - -#include "guestfs.h" -#include "structs-cleanups.h" -#include "options.h" -#include "display-options.h" -#include "parallel.h" -#include "domains.h" - -/* This just needs to be larger than any alignment we care about. */ -static size_t worst_alignment = UINT_MAX; -static pthread_mutex_t worst_alignment_mutex = PTHREAD_MUTEX_INITIALIZER; - -static int scan (guestfs_h *g, const char *prefix, FILE *fp); - -#ifdef HAVE_LIBVIRT -static int scan_work (guestfs_h *g, size_t i, FILE *fp); -#endif - -/* These globals are shared with options.c. */ -guestfs_h *g; - -int read_only = 1; -int live = 0; -int verbose = 0; -int keys_from_stdin = 0; -int echo_keys = 0; -const char *libvirt_uri = NULL; -int inspector = 0; -int in_guestfish = 0; -int in_virt_rescue = 0; - -static int quiet = 0; /* --quiet */ -static int uuid = 0; /* --uuid */ - -static void __attribute__((noreturn)) -usage (int status) -{ - if (status != EXIT_SUCCESS) - fprintf (stderr, _("Try ‘%s --help’ for more information.\n"), - getprogname ()); - else { - printf (_("%s: check alignment of virtual machine partitions\n" - "Copyright (C) 2011 Red Hat Inc.\n" - "Usage:\n" - " %s [--options] -d domname\n" - " %s [--options] -a disk.img [-a disk.img ...]\n" - "Options:\n" - " -a|--add image Add image\n" - " --blocksize[=512|4096]\n" - " Set sector size of the disk for -a option\n" - " -c|--connect uri Specify libvirt URI for -d option\n" - " -d|--domain guest Add disks from libvirt guest\n" - " --format[=raw|..] Force disk format for -a option\n" - " --help Display brief help\n" - " -P nr_threads Use at most nr_threads\n" - " -q|--quiet No output, just exit code\n" - " --uuid Print UUIDs instead of names\n" - " -v|--verbose Verbose messages\n" - " -V|--version Display version and exit\n" - " -x Trace libguestfs API calls\n" - "For more information, see the manpage %s(1).\n"), - getprogname (), getprogname (), - getprogname (), getprogname ()); - } - exit (status); -} - -int -main (int argc, char *argv[]) -{ - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEBASEDIR); - textdomain (PACKAGE); - - enum { HELP_OPTION = CHAR_MAX + 1 }; - - static const char options[] = "a:c:d:P:qvVx"; - static const struct option long_options[] = { - { "add", 1, 0, 'a' }, - { "blocksize", 2, 0, 0 }, - { "connect", 1, 0, 'c' }, - { "domain", 1, 0, 'd' }, - { "format", 2, 0, 0 }, - { "help", 0, 0, HELP_OPTION }, - { "long-options", 0, 0, 0 }, - { "quiet", 0, 0, 'q' }, - { "short-options", 0, 0, 0 }, - { "uuid", 0, 0, 0 }, - { "verbose", 0, 0, 'v' }, - { "version", 0, 0, 'V' }, - { 0, 0, 0, 0 } - }; - struct drv *drvs = NULL; - const char *format = NULL; - bool format_consumed = true; - int blocksize = 0; - bool blocksize_consumed = true; - int c; - int option_index; - int exit_code; - size_t max_threads = 0; - int r; - - g = guestfs_create (); - if (g == NULL) - error (EXIT_FAILURE, errno, "guestfs_create"); - - for (;;) { - c = getopt_long (argc, argv, options, long_options, &option_index); - if (c == -1) break; - - switch (c) { - case 0: /* options which are long only */ - if (STREQ (long_options[option_index].name, "long-options")) - display_long_options (long_options); - else if (STREQ (long_options[option_index].name, "short-options")) - display_short_options (options); - else if (STREQ (long_options[option_index].name, "format")) { - OPTION_format; - } else if (STREQ (long_options[option_index].name, "blocksize")) { - OPTION_blocksize; - } else if (STREQ (long_options[option_index].name, "uuid")) { - uuid = 1; - } else - error (EXIT_FAILURE, 0, - _("unknown long option: %s (%d)"), - long_options[option_index].name, option_index); - break; - - case 'a': - OPTION_a; - break; - - case 'c': - OPTION_c; - break; - - case 'd': - OPTION_d; - break; - - case 'P': - if (sscanf (optarg, "%zu", &max_threads) != 1) - error (EXIT_FAILURE, 0, _("-P option is not numeric")); - break; - - case 'q': - quiet = 1; - break; - - case 'v': - OPTION_v; - break; - - case 'V': - OPTION_V; - break; - - case 'x': - OPTION_x; - break; - - case HELP_OPTION: - usage (EXIT_SUCCESS); - - default: - usage (EXIT_FAILURE); - } - } - - /* These are really constants, but they have to be variables for the - * options parsing code. Assert here that they have known-good - * values. - */ - assert (read_only == 1); - assert (inspector == 0); - assert (live == 0); - - /* Must be no extra arguments on the command line. */ - if (optind != argc) - usage (EXIT_FAILURE); - - CHECK_OPTION_format_consumed; - CHECK_OPTION_blocksize_consumed; - - /* virt-alignment-scan has two modes. If the user didn't specify - * any drives, then we do the scan on every libvirt guest. That's - * the if-clause below. If the user specified domains/drives, then - * we assume they belong to a single guest. That's the else-clause - * below. - */ - if (drvs == NULL) { -#if defined(HAVE_LIBVIRT) - get_all_libvirt_domains (libvirt_uri); - r = start_threads (max_threads, g, scan_work); - free_domains (); - if (r == -1) - exit (EXIT_FAILURE); -#else - error (EXIT_FAILURE, 0, _("compiled without support for libvirt")); -#endif - } else { /* Single guest. */ - if (uuid) - error (EXIT_FAILURE, 0, _("--uuid option cannot be used with -a or -d")); - - /* Add domains/drives from the command line (for a single guest). */ - add_drives (drvs); - - if (guestfs_launch (g) == -1) - exit (EXIT_FAILURE); - - /* Free up data structures, no longer needed after this point. */ - free_drives (drvs); - - /* Perform the scan. */ - r = scan (g, NULL, stdout); - - guestfs_close (g); - - if (r == -1) - exit (EXIT_FAILURE); - } - - /* Decide on an appropriate exit code. */ - if (worst_alignment < 10) /* 2^10 = 4096 */ - exit_code = 3; - else if (worst_alignment < 16) /* 2^16 = 65536 */ - exit_code = 2; - else - exit_code = 0; - - exit (exit_code); -} - -static int -scan (guestfs_h *g, const char *prefix, FILE *fp) -{ - size_t i, j; - size_t alignment; - uint64_t start; - int err; - - CLEANUP_FREE_STRING_LIST char **devices = guestfs_list_devices (g); - if (devices == NULL) - return -1; - - for (i = 0; devices[i] != NULL; ++i) { - CLEANUP_FREE char *name = NULL; - CLEANUP_FREE_PARTITION_LIST struct guestfs_partition_list *parts = NULL; - - guestfs_push_error_handler (g, NULL, NULL); - parts = guestfs_part_list (g, devices[i]); - guestfs_pop_error_handler (g); - if (parts == NULL) { - if (guestfs_last_errno (g) == EINVAL) /* unrecognised disk label */ - continue; - else - return -1; - } - - /* Canonicalize the name of the device for printing. */ - name = guestfs_canonical_device_name (g, devices[i]); - if (name == NULL) - return -1; - - for (j = 0; j < parts->len; ++j) { - /* Start offset of the partition in bytes. */ - start = parts->val[j].part_start; - - if (!quiet) { - if (prefix) - fprintf (fp, "%s:", prefix); - - fprintf (fp, "%s%d %12" PRIu64 " ", - name, (int) parts->val[j].part_num, start); - } - - /* What's the alignment? */ - if (start == 0) /* Probably not possible, but anyway. */ - alignment = 64; - else - for (alignment = 0; (start & 1) == 0; alignment++, start /= 2) - ; - - if (!quiet) { - if (alignment < 10) - fprintf (fp, "%12" PRIu64 " ", UINT64_C(1) << alignment); - else if (alignment < 64) - fprintf (fp, "%12" PRIu64 "K ", UINT64_C(1) << (alignment - 10)); - else - fprintf (fp, "- "); - } - - err = pthread_mutex_lock (&worst_alignment_mutex); - assert (err == 0); - if (alignment < worst_alignment) - worst_alignment = alignment; - err = pthread_mutex_unlock (&worst_alignment_mutex); - assert (err == 0); - - if (alignment < 12) { /* Bad in general: < 4K alignment */ - if (!quiet) - fprintf (fp, "bad (%s)\n", _("alignment < 4K")); - } else if (alignment < 16) { /* Bad on NetApps: < 64K alignment */ - if (!quiet) - fprintf (fp, "bad (%s)\n", _("alignment < 64K")); - } else { - if (!quiet) - fprintf (fp, "ok\n"); - } - } - } - - return 0; -} - -#if defined(HAVE_LIBVIRT) - -/* The multi-threaded version. This callback is called from the code - * in "parallel.c". - */ - -static int -scan_work (guestfs_h *g, size_t i, FILE *fp) -{ - struct guestfs_add_libvirt_dom_argv optargs; - - optargs.bitmask = - GUESTFS_ADD_LIBVIRT_DOM_READONLY_BITMASK | - GUESTFS_ADD_LIBVIRT_DOM_READONLYDISK_BITMASK; - optargs.readonly = 1; - optargs.readonlydisk = "read"; - - if (guestfs_add_libvirt_dom_argv (g, domains[i].dom, &optargs) == -1) - return -1; - - if (guestfs_launch (g) == -1) - return -1; - - return scan (g, !uuid ? domains[i].name : domains[i].uuid, fp); -} - -#endif /* HAVE_LIBVIRT */ diff --git a/align/test-virt-alignment-scan-docs.sh b/align/test-virt-alignment-scan-docs.sh deleted file mode 100755 index ed6b1ab33..000000000 --- a/align/test-virt-alignment-scan-docs.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2016 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. - -set -e - -$TEST_FUNCTIONS -skip_if_skipped - -$top_srcdir/podcheck.pl "$srcdir/virt-alignment-scan.pod" virt-alignment-scan \ - --path $top_srcdir/common/options diff --git a/align/test-virt-alignment-scan-guests.sh b/align/test-virt-alignment-scan-guests.sh deleted file mode 100755 index d149274e7..000000000 --- a/align/test-virt-alignment-scan-guests.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2013 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. - -$TEST_FUNCTIONS -skip_if_skipped - -libvirt_uri="test://$abs_top_builddir/test-data/phony-guests/guests-all-good.xml" - -$VG virt-alignment-scan -c "$libvirt_uri" -r=$? - -# 0, 2 and 3 are reasonable non-error exit codes. Others are errors. -if [ $r -ne 0 -a $r -ne 2 -a $r -ne 3 ]; then - exit $r -fi diff --git a/align/test-virt-alignment-scan.sh b/align/test-virt-alignment-scan.sh deleted file mode 100755 index 59688f6ad..000000000 --- a/align/test-virt-alignment-scan.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2012 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. - -$TEST_FUNCTIONS -skip_if_skipped - -$VG virt-alignment-scan --format=raw -a ../test-data/phony-guests/fedora.img -r=$? - -# 0, 2 and 3 are reasonable non-error exit codes. Others are errors. -if [ $r -ne 0 -a $r -ne 2 -a $r -ne 3 ]; then - exit $r -fi diff --git a/align/virt-alignment-scan.pod b/align/virt-alignment-scan.pod deleted file mode 100644 index 83645f4d0..000000000 --- a/align/virt-alignment-scan.pod +++ /dev/null @@ -1,401 +0,0 @@ -=head1 NAME - -virt-alignment-scan - Check alignment of virtual machine partitions - -=head1 SYNOPSIS - - virt-alignment-scan [--options] -d domname - - virt-alignment-scan [--options] -a disk.img [-a disk.img ...] - - virt-alignment-scan [--options] - -=head1 DESCRIPTION - -When older operating systems install themselves, the partitioning -tools place partitions at a sector misaligned with the underlying -storage (commonly the first partition starts on sector C<63>). -Misaligned partitions can result in an operating system issuing more -I/O than should be necessary. - -The virt-alignment-scan tool checks the alignment of partitions in -virtual machines and disk images and warns you if there are alignment -problems. - -Currently there is no virt tool for fixing alignment problems. You -can only reinstall the guest operating system. The following NetApp -document summarises the problem and possible solutions: -L - -=head1 OUTPUT - -To run this tool on a disk image directly, use the I<-a> option: - - $ virt-alignment-scan -a winxp.img - /dev/sda1 32256 512 bad (alignment < 4K) - - $ virt-alignment-scan -a fedora16.img - /dev/sda1 1048576 1024K ok - /dev/sda2 2097152 2048K ok - /dev/sda3 526385152 2048K ok - -To run the tool on a guest known to libvirt, use the I<-d> option and -possibly the I<-c> option: - - # virt-alignment-scan -d RHEL5 - /dev/sda1 32256 512 bad (alignment < 4K) - /dev/sda2 106928640 512 bad (alignment < 4K) - - $ virt-alignment-scan -c qemu:///system -d Win7TwoDisks - /dev/sda1 1048576 1024K ok - /dev/sda2 105906176 1024K ok - /dev/sdb1 65536 64K ok - -Run virt-alignment-scan without any I<-a> or I<-d> options to scan all -libvirt domains. - - # virt-alignment-scan - F16x64:/dev/sda1 1048576 1024K ok - F16x64:/dev/sda2 2097152 2048K ok - F16x64:/dev/sda3 526385152 2048K ok - -The output consists of 4 or more whitespace-separated columns. Only -the first 4 columns are significant if you want to parse this from a -program. The columns are: - -=over 4 - -=item col 1 - -The device and partition name (eg. F meaning the -first partition on the first block device). - -When listing all libvirt domains (no I<-a> or I<-d> option given) this -column is prefixed by the libvirt name or UUID (if I<--uuid> is -given). eg: C - -=item col 2 - -the start of the partition in bytes - -=item col 3 - -the alignment in bytes or Kbytes (eg. C<512> or C<4K>) - -=item col 4 - -C if the alignment is best for performance, or C if the -alignment can cause performance problems - -=item cols 5+ - -optional free-text explanation. - -=back - -The exit code from the program changes depending on whether poorly -aligned partitions were found. See L below. - -If you just want the exit code with no output, use the I<-q> option. - -=head1 OPTIONS - -=over 4 - -=item B<--help> - -Display brief help. - -=item B<-a> file - -=item B<--add> file - -Add I which should be a disk image from a virtual machine. - -The format of the disk image is auto-detected. To override this and -force a particular format use the I<--format=..> option. - -=item B<-a URI> - -=item B<--add URI> - -Add a remote disk. See L. - -__INCLUDE:blocksize-option.pod__ - -=item B<-c> URI - -=item B<--connect> URI - -If using libvirt, connect to the given I. If omitted, then we -connect to the default libvirt hypervisor. - -If you specify guest block devices directly (I<-a>), then libvirt is -not used at all. - -=item B<-d> guest - -=item B<--domain> guest - -Add all the disks from the named libvirt guest. Domain UUIDs can be -used instead of names. - -=item B<--format=raw|qcow2|..> - -=item B<--format> - -The default for the I<-a> option is to auto-detect the format of the -disk image. Using this forces the disk format for I<-a> options which -follow on the command line. Using I<--format> with no argument -switches back to auto-detection for subsequent I<-a> options. - -For example: - - virt-alignment-scan --format=raw -a disk.img - -forces raw format (no auto-detection) for F. - - virt-alignment-scan --format=raw -a disk.img --format -a another.img - -forces raw format (no auto-detection) for F and reverts to -auto-detection for F. - -If you have untrusted raw-format guest disk images, you should use -this option to specify the disk format. This avoids a possible -security problem with malicious guests (CVE-2010-3851). - -=item B<-P> nr_threads - -Since libguestfs 1.22, virt-alignment-scan is multithreaded and -examines guests in parallel. By default the number of threads to use -is chosen based on the amount of free memory available at the time -that virt-alignment-scan is started. You can force -virt-alignment-scan to use at most C by using the I<-P> -option. - -Note that I<-P 0> means to autodetect, and I<-P 1> means to use a -single thread. - -=item B<-q> - -=item B<--quiet> - -Don’t produce any output. Just set the exit code -(see L below). - -=item B<--uuid> - -Print UUIDs instead of names. This is useful for following a guest -even when the guest is migrated or renamed, or when two guests happen -to have the same name. - -This option only applies when listing all libvirt domains (when no -I<-a> or I<-d> options are specified). - -=item B<-v> - -=item B<--verbose> - -Enable verbose messages for debugging. - -=item B<-V> - -=item B<--version> - -Display version number and exit. - -=item B<-x> - -Enable tracing of libguestfs API calls. - -=back - -=head1 RECOMMENDED ALIGNMENT - -Operating systems older than Windows 2008 and Linux before ca.2010 -place the first sector of the first partition at sector 63, with a 512 -byte sector size. This happens because of a historical accident. -Drives have to report a cylinder / head / sector (CHS) geometry to the -BIOS. The geometry is completely meaningless on modern drives, but it -happens that the geometry reported always has 63 sectors per track. -The operating system therefore places the first partition at the start -of the second "track", at sector 63. - -When the guest OS is virtualized, the host operating system and -hypervisor may prefer accesses aligned to one of: - -=over 4 - -=item * 512 bytes - -if the host OS uses local storage directly on hard drive partitions, -and the hard drive has 512 byte physical sectors. - -=item * 4 Kbytes - -for local storage on new hard drives with 4Kbyte physical sectors; for -file-backed storage on filesystems with 4Kbyte block size; or for some -types of network-attached storage. - -=item * 64 Kbytes - -for high-end network-attached storage. This is the optimal block size -for some NetApp hardware. - -=item * 1 Mbyte - -see L below. - -=back - -Partitions which are not aligned correctly to the underlying -storage cause extra I/O. For example: - - sect#63 - ┌──────────────────────────┬ ─ ─ ─ ─ - │ guest │ - │ filesystem block │ - ─ ┬──────────────────┴──────┬───────────────────┴─────┬ ─ ─ - │ host block │ host block │ - │ │ │ - ─ ┴─────────────────────────┴─────────────────────────┴ ─ ─ - -In this example, each time a 4K guest block is read, two blocks on the -host must be accessed (so twice as much I/O is done). When a 4K guest -block is written, two host blocks must first be read, the old and new -data combined, and the two blocks written back (4x I/O). - -=head2 LINUX HOST BLOCK AND I/O SIZE - -New versions of the Linux kernel expose the physical and logical block -size, and minimum and recommended I/O size. - -For a typical consumer hard drive with 512 byte sectors: - - $ cat /sys/block/sda/queue/hw_sector_size - 512 - $ cat /sys/block/sda/queue/physical_block_size - 512 - $ cat /sys/block/sda/queue/logical_block_size - 512 - $ cat /sys/block/sda/queue/minimum_io_size - 512 - $ cat /sys/block/sda/queue/optimal_io_size - 0 - -For a new consumer hard drive with 4Kbyte sectors: - - $ cat /sys/block/sda/queue/hw_sector_size - 4096 - $ cat /sys/block/sda/queue/physical_block_size - 4096 - $ cat /sys/block/sda/queue/logical_block_size - 4096 - $ cat /sys/block/sda/queue/minimum_io_size - 4096 - $ cat /sys/block/sda/queue/optimal_io_size - 0 - -For a NetApp LUN: - - $ cat /sys/block/sdc/queue/logical_block_size - 512 - $ cat /sys/block/sdc/queue/physical_block_size - 512 - $ cat /sys/block/sdc/queue/minimum_io_size - 4096 - $ cat /sys/block/sdc/queue/optimal_io_size - 65536 - -The NetApp allows 512 byte accesses (but they will be very -inefficient), prefers a minimum 4K I/O size, but the optimal I/O size -is 64K. - -For detailed information about what these numbers mean, see -L - -[Thanks to Matt Booth for providing 4K drive data. Thanks to Mike -Snitzer for providing NetApp data and additional information.] - -=head2 1 MB PARTITION ALIGNMENT - -Microsoft picked 1 MB as the default alignment for all partitions -starting with Windows 2008 Server, and Linux has followed this. - -Assuming 512 byte sectors in the guest, you will now see the first -partition starting at sector 2048, and subsequent partitions (if any) -will start at a multiple of 2048 sectors. - -1 MB alignment is compatible with all current alignment requirements -(4K, 64K) and provides room for future growth in physical block sizes. - -=head2 SETTING ALIGNMENT - -L can change the alignment of the partitions of some -guests. Currently it can fully align all the partitions of all -Windows guests, and it will fix the bootloader where necessary. For -Linux guests, it can align the second and subsequent partitions, so -the majority of OS accesses except at boot will be aligned. - -Another way to correct partition alignment problems is to reinstall -your guest operating systems. If you install operating systems from -templates, ensure these have correct partition alignment too. - -For older versions of Windows, the following NetApp document contains -useful information: L - -For Red Hat Enterprise Linux E 5, use a Kickstart script that -contains an explicit C<%pre> section that creates aligned partitions -using L. Do not use the Kickstart C command. The -NetApp document above contains an example. - -=head1 EXIT STATUS - -This program returns: - -=over 4 - -=item * - -0 - -successful exit, all partitions are aligned E 64K for best performance - -=item * - -1 - -an error scanning the disk image or guest - -=item * - -2 - -successful exit, some partitions have alignment E 64K which can result -in poor performance on high end network storage - -=item * - -3 - -successful exit, some partitions have alignment E 4K which can result -in poor performance on most hypervisors - -=back - -=head1 SEE ALSO - -L, -L, -L, -L, -L, -L. - -=head1 AUTHOR - -Richard W.M. Jones L - -=head1 COPYRIGHT - -Copyright (C) 2011 Red Hat Inc. diff --git a/builder/Makefile.am b/builder/Makefile.am deleted file mode 100644 index 5add6f84e..000000000 --- a/builder/Makefile.am +++ /dev/null @@ -1,486 +0,0 @@ -# libguestfs virt-builder tool -# Copyright (C) 2013-2020 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. - -include $(top_srcdir)/subdir-rules.mk - -AM_YFLAGS = -d - -EXTRA_DIST = \ - $(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \ - $(REPOSITORY_SOURCES_ML) \ - $(REPOSITORY_SOURCES_MLI) \ - index_parser_tests.ml \ - libguestfs.gpg \ - opensuse.gpg \ - test-console.sh \ - test-index \ - test-simplestreams/streams/v1/index.json \ - test-simplestreams/streams/v1/net.cirros-cloud_released_download.json \ - test-virt-builder.sh \ - test-docs.sh \ - test-virt-builder-cacheall.sh \ - test-virt-builder-list.sh \ - test-virt-builder-list-simplestreams.sh \ - test-virt-builder-planner.sh \ - test-virt-builder-repository.sh \ - test-virt-index-validate.sh \ - test-virt-index-validate-bad-1 \ - test-virt-index-validate-good-1 \ - test-virt-index-validate-good-2 \ - test-virt-index-validate-good-3 \ - test-virt-index-validate-good-4 \ - virt-builder.pod \ - virt-builder-repository.pod \ - virt-index-validate.pod - -SOURCES_MLI = \ - builder.mli \ - cache.mli \ - cmdline.mli \ - downloader.mli \ - index.mli \ - index_parser.mli \ - ini_reader.mli \ - languages.mli \ - list_entries.mli \ - osinfo.mli \ - osinfo_config.mli \ - paths.mli \ - pxzcat.mli \ - repository_main.mli \ - setlocale.mli \ - sigchecker.mli \ - simplestreams_parser.mli \ - sources.mli \ - utils.mli - -SOURCES_ML = \ - utils.ml \ - osinfo_config.ml \ - osinfo.ml \ - pxzcat.ml \ - setlocale.ml \ - index.ml \ - ini_reader.ml \ - paths.ml \ - languages.ml \ - cache.ml \ - sources.ml \ - downloader.ml \ - sigchecker.ml \ - index_parser.ml \ - simplestreams_parser.ml \ - list_entries.ml \ - cmdline.ml \ - builder.ml - -SOURCES_C = \ - index-scan.c \ - index-struct.c \ - index-parse.c \ - index-parser-c.c \ - pxzcat-c.c \ - setlocale-c.c - -REPOSITORY_SOURCES_ML = \ - utils.ml \ - index.ml \ - cache.ml \ - downloader.ml \ - sigchecker.ml \ - ini_reader.ml \ - index_parser.ml \ - paths.ml \ - sources.ml \ - osinfo_config.ml \ - osinfo.ml \ - repository_main.ml - -REPOSITORY_SOURCES_MLI = \ - cache.mli \ - downloader.mli \ - index.mli \ - index_parser.mli \ - ini_reader.mli \ - sigchecker.mli \ - sources.mli - -REPOSITORY_SOURCES_C = \ - index-scan.c \ - index-struct.c \ - index-parse.c \ - index-parser-c.c - -man_MANS = -noinst_DATA = -bin_PROGRAMS = - -if HAVE_OCAML - -bin_PROGRAMS += virt-builder virt-builder-repository - -virt_builder_SOURCES = $(SOURCES_C) -virt_builder_CPPFLAGS = \ - -DCAML_NAME_SPACE \ - -I$(builddir) -I$(srcdir) \ - -I$(top_builddir) \ - -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ - -I$(shell $(OCAMLC) -where) \ - -I$(top_srcdir)/gnulib/lib \ - -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/lib \ - -I$(top_srcdir)/include -virt_builder_CFLAGS = \ - -pthread \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - -Wno-unused-macros \ - $(LIBLZMA_CFLAGS) \ - $(LIBTINFO_CFLAGS) \ - $(LIBXML2_CFLAGS) - -BOBJECTS = $(SOURCES_ML:.ml=.cmo) -XOBJECTS = $(BOBJECTS:.cmo=.cmx) - -virt_builder_repository_SOURCES = $(REPOSITORY_SOURCES_C) -virt_builder_repository_CPPFLAGS = \ - -DCAML_NAME_SPACE \ - -I$(builddir) -I$(srcdir) \ - -I$(top_builddir) \ - -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ - -I$(shell $(OCAMLC) -where) \ - -I$(top_srcdir)/gnulib/lib \ - -I$(top_srcdir)/lib -virt_builder_repository_CFLAGS = \ - -pthread \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - -Wno-unused-macros \ - $(LIBTINFO_CFLAGS) \ - $(LIBXML2_CFLAGS) -REPOSITORY_BOBJECTS = $(REPOSITORY_SOURCES_ML:.ml=.cmo) -REPOSITORY_XOBJECTS = $(REPOSITORY_BOBJECTS:.cmo=.cmx) - -# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L -# option to be passed to gcc, so we don't try linking against an -# installed copy of libguestfs. -OCAMLPACKAGES = \ - -package str,unix \ - -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/common/mlxml \ - -I $(top_builddir)/lib/.libs \ - -I $(top_builddir)/gnulib/lib/.libs \ - -I $(top_builddir)/ocaml \ - -I $(top_builddir)/common/mlstdutils \ - -I $(top_builddir)/common/mlutils \ - -I $(top_builddir)/common/mlgettext \ - -I $(top_builddir)/common/mlpcre \ - -I $(top_builddir)/common/mltools \ - -I $(top_builddir)/common/mlcustomize \ - -I $(top_builddir)/customize -OCAMLPACKAGES_TESTS = -if HAVE_OCAML_PKG_GETTEXT -OCAMLPACKAGES += -package gettext-stub -endif -if HAVE_OCAML_PKG_OUNIT -OCAMLPACKAGES_TESTS += -package oUnit -endif - -OCAMLCLIBS = \ - -pthread -lpthread \ - -lutils \ - $(LIBTINFO_LIBS) \ - $(LIBCRYPT_LIBS) \ - $(LIBLZMA_LIBS) \ - $(LIBXML2_LIBS) \ - $(JANSSON_LIBS) \ - $(LIBINTL) \ - -lgnu - -OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) -ccopt '$(CFLAGS)' - -if !HAVE_OCAMLOPT -OBJECTS = $(BOBJECTS) -REPOSITORY_OBJECTS = $(REPOSITORY_BOBJECTS) -else -OBJECTS = $(XOBJECTS) -REPOSITORY_OBJECTS = $(REPOSITORY_XOBJECTS) -endif - -OCAMLLINKFLAGS = \ - mlgettext.$(MLARCHIVE) \ - mlpcre.$(MLARCHIVE) \ - mlxml.$(MLARCHIVE) \ - mlstdutils.$(MLARCHIVE) \ - mlguestfs.$(MLARCHIVE) \ - mlcutils.$(MLARCHIVE) \ - mltools.$(MLARCHIVE) \ - mlcustomize.$(MLARCHIVE) \ - customize.$(MLARCHIVE) \ - $(LINK_CUSTOM_OCAMLC_ONLY) - -virt_builder_DEPENDENCIES = \ - $(OBJECTS) \ - ../common/mlpcre/mlpcre.$(MLARCHIVE) \ - ../common/mlgettext/mlgettext.$(MLARCHIVE) \ - ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ - ../common/mlutils/mlcutils.$(MLARCHIVE) \ - ../common/mltools/mltools.$(MLARCHIVE) \ - ../common/mlcustomize/mlcustomize.$(MLARCHIVE) \ - ../customize/customize.$(MLARCHIVE) \ - $(top_builddir)/ocaml-link.sh -virt_builder_LINK = \ - $(top_builddir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ - $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \ - $(OBJECTS) -o $@ - -virt_builder_repository_DEPENDENCIES = \ - $(REPOSITORY_OBJECTS) \ - ../common/mltools/mltools.$(MLARCHIVE) \ - ../common/mlxml/mlxml.$(MLARCHIVE) \ - $(top_builddir)/ocaml-link.sh -virt_builder_repository_LINK = \ - $(top_builddir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ - $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \ - $(REPOSITORY_OBJECTS) -o $@ - -# Manual pages and HTML files for the website. - -man_MANS += virt-builder.1 -noinst_DATA += $(top_builddir)/website/virt-builder.1.html - -virt-builder.1 $(top_builddir)/website/virt-builder.1.html: stamp-virt-builder.pod - -stamp-virt-builder.pod: virt-builder.pod $(top_srcdir)/common/mlcustomize/customize-synopsis.pod $(top_srcdir)/common/mlcustomize/customize-options.pod - $(PODWRAPPER) \ - --man virt-builder.1 \ - --html $(top_builddir)/website/virt-builder.1.html \ - --insert $(top_srcdir)/common/mlcustomize/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \ - --insert $(top_srcdir)/common/mlcustomize/customize-options.pod:__CUSTOMIZE_OPTIONS__ \ - --license GPLv2+ \ - --warning safe \ - $< - touch $@ - -man_MANS += virt-builder-repository.1 -noinst_DATA += $(top_builddir)/website/virt-builder-repository.1.html - -virt-builder-repository.1 $(top_builddir)/website/virt-builder-repository.1.html: stamp-virt-builder-repository.pod - -stamp-virt-builder-repository.pod: virt-builder-repository.pod - $(PODWRAPPER) \ - --man virt-builder-repository.1 \ - --html $(top_builddir)/website/virt-builder-repository.1.html \ - --license GPLv2+ \ - --warning safe \ - $< - touch $@ - -# Tests. - -TESTS_ENVIRONMENT = $(top_builddir)/run --test - -disk_images := \ - $(shell for f in debian fedora ubuntu windows; do if [ -s "../test-data/phony-guests/$$f.img" ]; then echo $$f.xz; fi; done) \ - $(shell if [ -s "../test-data/phony-guests/fedora.img" ]; then echo fedora.qcow2 fedora.qcow2.xz; fi) - -CLEANFILES += *.qcow2 *.xz - -check_DATA = $(disk_images) - -osinfo_config.ml: Makefile - echo 'let libosinfo_db_path = "$(datadir)/libosinfo/db"' > $@-t - mv $@-t $@ - -fedora.qcow2: ../test-data/phony-guests/fedora.img - rm -f $@ $@-t - qemu-img convert -f raw -O qcow2 $< $@-t - mv $@-t $@ - -fedora.qcow2.xz: fedora.qcow2 - rm -f $@ $@-t - xz --best -c $< > $@-t - mv $@-t $@ - -%.xz: ../test-data/phony-guests/%.img - rm -f $@ $@-t - xz --best -c $< > $@-t - mv $@-t $@ - -index_parser_tests_SOURCES = \ - index-scan.c \ - index-struct.c \ - index-parser-c.c \ - index-parse.c -index_parser_tests_CPPFLAGS = $(virt_builder_CPPFLAGS) -index_parser_tests_BOBJECTS = \ - utils.cmo \ - index.cmo \ - cache.cmo \ - downloader.cmo \ - sigchecker.cmo \ - ini_reader.cmo \ - index_parser.cmo \ - index_parser_tests.cmo -index_parser_tests_XOBJECTS = $(index_parser_tests_BOBJECTS:.cmo=.cmx) - -# Can't call the following as _OBJECTS because automake gets confused. -if HAVE_OCAMLOPT -index_parser_tests_THEOBJECTS = $(index_parser_tests_XOBJECTS) -index_parser_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) -else -index_parser_tests_THEOBJECTS = $(index_parser_tests_BOBJECTS) -index_parser_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) -endif - -index_parser_tests_DEPENDENCIES = \ - $(index_parser_tests_THEOBJECTS) \ - ../common/mltools/mltools.$(MLARCHIVE) \ - $(top_builddir)/ocaml-link.sh -index_parser_tests_LINK = \ - $(top_builddir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ - $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) $(OCAMLLINKFLAGS) \ - $(index_parser_tests_THEOBJECTS) -o $@ - -TESTS = \ - test-docs.sh \ - test-virt-builder-cacheall.sh \ - test-virt-builder-list.sh \ - test-virt-index-validate.sh \ - $(SLOW_TESTS) -check_PROGRAMS = - -TESTS += test-virt-builder-list-simplestreams.sh - -if ENABLE_APPLIANCE -TESTS += test-virt-builder.sh -endif ENABLE_APPLIANCE -if HAVE_OCAML_PKG_OUNIT -check_PROGRAMS += index_parser_tests -TESTS += index_parser_tests -endif - -check-valgrind: - $(MAKE) VG="@VG@" check - -# Slow tests. - -SLOW_TESTS = \ - $(console_test_scripts) \ - test-virt-builder-planner.sh \ - test-virt-builder-repository.sh - -check-slow: - $(MAKE) check TESTS="$(SLOW_TESTS)" SLOW=1 - -# Test that the supplied guests boot with a serial console. -# -# Note that in future we might decide to make the serial console a -# feature, eg. `virt-builder --add-serial-console' or `virt-builder -# --remove-serial-console', so don't assume that having these tests -# means that a serial console is a requirement. -console_test_scripts := \ - test-console-centos-7.2.sh \ - test-console-rhel-6.8.sh \ - test-console-rhel-7.2.sh \ - test-console-debian-7.sh \ - test-console-debian-8.sh \ - test-console-fedora-24.sh \ - test-console-ubuntu-12.04.sh \ - test-console-ubuntu-14.04.sh \ - test-console-ubuntu-16.04.sh \ - test-console-ubuntu-18.04.sh - -test-console-%.sh: - rm -f $@ $@-t - f=`echo "$@" | $(SED) 's/test-console-\(.*\).sh/\1/'`; \ - echo 'script=$@ exec $$srcdir/test-console.sh' "$$f" > $@-t - chmod 0755 $@-t - mv $@-t $@ - -CLEANFILES += \ - $(console_test_scripts) \ - console-*.img \ - console-*.out - -# OCaml dependencies. -.depend: $(srcdir)/*.mli $(srcdir)/*.ml osinfo_config.mli osinfo_config.ml - $(top_builddir)/ocaml-dep.sh $^ --include .depend - -endif - -.PHONY: docs - -# virt-builder's default repository - -repoconfdir = $(sysconfdir)/xdg/virt-builder/repos.d -repoconf_DATA = libguestfs.conf libguestfs.gpg \ - opensuse.conf opensuse.gpg - -install-exec-hook: - $(LN_S) -f xdg/virt-builder $(DESTDIR)$(sysconfdir)/virt-builder - -# Build a small C index validator program. -bin_PROGRAMS += virt-index-validate - -virt_index_validate_SOURCES = \ - index-parse.y \ - index-scan.l \ - index-struct.h \ - index-struct.c \ - index-validate.c - -virt_index_validate_CPPFLAGS = \ - -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ - -I. \ - -I$(top_builddir) \ - -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ - -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/lib \ - -I$(top_srcdir)/include -virt_index_validate_CFLAGS = \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - -Wno-unused-macros -virt_index_validate_LDADD = \ - $(LTLIBINTL) \ - ../gnulib/lib/libgnu.la - -man_MANS += virt-index-validate.1 -noinst_DATA += $(top_builddir)/website/virt-index-validate.1.html - -virt-index-validate.1 $(top_builddir)/website/virt-index-validate.1.html: stamp-virt-index-validate.pod - -stamp-virt-index-validate.pod: virt-index-validate.pod - $(PODWRAPPER) \ - --man virt-index-validate.1 \ - --html $(top_builddir)/website/virt-index-validate.1.html \ - --license GPLv2+ \ - --warning safe \ - $< - touch $@ - -CLEANFILES += \ - index-parse.c \ - index-parse.h \ - index-scan.c - -BUILT_SOURCES = index-parse.h - -# Apparently there's no clean way with Automake to not have them -# in the distribution, so just remove them from the distdir. -dist-hook: - rm -f $(distdir)/index-parse.c $(distdir)/index-parse.h $(distdir)/index-scan.c diff --git a/builder/builder.ml b/builder/builder.ml deleted file mode 100644 index 6dbe7a19d..000000000 --- a/builder/builder.ml +++ /dev/null @@ -1,794 +0,0 @@ -(* virt-builder - * Copyright (C) 2013-2020 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_gettext.Gettext - -module G = Guestfs - -open Std_utils -open Tools_utils -open Unix_utils -open Password -open Planner -open Utils - -open Cmdline -open Customize_cmdline - -open Unix -open Printf - -let () = Random.self_init () - -let remove_duplicates index = - let compare_revisions rev1 rev2 = - match rev1, rev2 with - | Rev_int n1, Rev_int n2 -> compare n1 n2 - | Rev_string s1, Rev_int n2 -> compare s1 (string_of_int n2) - | Rev_int n1, Rev_string s2 -> compare (string_of_int n1) s2 - | Rev_string s1, Rev_string s2 -> compare s1 s2 - in - (* Fill an hash with the higher revision of the available - * (name, arch) tuples, so it possible to ignore duplicates, - * and versions with a lower revision. - *) - let nseen = Hashtbl.create 13 in - List.iter ( - fun (name, { Index.arch; revision }) -> - let id = name, arch in - try - let rev = Hashtbl.find nseen id in - if compare_revisions rev revision > 0 then - Hashtbl.replace nseen id revision - with Not_found -> - Hashtbl.add nseen id revision - ) index; - List.filter ( - fun (name, { Index.arch ; revision }) -> - let id = name, arch in - try - let rev = Hashtbl.find nseen (name, arch) in - (* Take the first occurrency with the higher revision, - * removing it from the hash so the other occurrencies - * are ignored. - *) - if revision = rev then ( - Hashtbl.remove nseen id; - true - ) else - false - with Not_found -> - (* Already taken, so ignore. *) - false - ) index - -(* Look for the specified os-version, resolving it as alias first. *) -let selected_cli_item cmdline index = - let arg = - (* Try to resolve the alias. *) - try - let item = - List.find ( - fun (name, { Index.aliases }) -> - match aliases with - | None -> false - | Some l -> List.mem cmdline.arg l - ) index in - fst item - with Not_found -> cmdline.arg in - let item = - try List.find ( - fun (name, { Index.arch = a }) -> - name = arg && cmdline.arch = normalize_arch (Index.string_of_arch a) - ) index - with Not_found -> - error (f_"cannot find os-version ‘%s’ with architecture ‘%s’.\nUse --list to list available guest types.") - arg cmdline.arch in - item - -let main () = - (* Command line argument parsing - see cmdline.ml. *) - let cmdline = parse_cmdline () in - - (* If debugging, echo the command line arguments and the sources. *) - if verbose () then ( - printf "command line:"; - List.iter (printf " %s") (Array.to_list Sys.argv); - print_newline (); - List.iteri ( - fun i (source, fingerprint) -> - printf "source[%d] = (%S, %S)\n" i source fingerprint - ) cmdline.sources - ); - - (* Handle some modes here, some later on. *) - let mode = - match cmdline.mode with - | `Get_kernel -> (* --get-kernel is really a different program ... *) - let cmd = [ "virt-get-kernel" ] @ - (if verbose () then [ "--verbose" ] else []) @ - (if trace () then [ "-x" ] else []) @ - (match cmdline.format with - | None -> [] - | Some format -> [ "--format"; format ]) @ - (match cmdline.output with - | None -> [] - | Some output -> [ "--output"; output ]) @ - [ "--add"; cmdline.arg ] in - exit (run_command cmd) - - | `Delete_cache -> (* --delete-cache *) - (match cmdline.cache with - | Some cachedir -> - message (f_"Deleting: %s") cachedir; - Cache.clean_cachedir cachedir; - exit 0 - | None -> - error (f_"could not find cache directory. Is $HOME set?") - ) - - | (`Install|`List|`Notes|`Print_cache|`Cache_all) as mode -> mode in - - (* Check various programs/dependencies are installed. *) - - (* Check that gpg is installed. Optional as long as the user - * disables all signature checks. - *) - if cmdline.check_signature then ( - let cmd = sprintf "%s --help >/dev/null 2>&1" cmdline.gpg in - if cmdline.gpg = "" || shell_command cmd <> 0 then - error (f_"no GNU Privacy Guard (GnuPG, gpg) binary was found.\n\nEither gpg v1 or v2 can be installed to check signatures. Virt-builder looks for a binary called either ‘gpg2’ or ‘gpg‘ on the $PATH. You can also specify a binary using the ‘--gpg’ option. If you don't want to check signatures, use ’--no-check-signature’ but note that this may make you vulnerable to Man-In-The-Middle attacks.") - ); - - (* Check that curl works. *) - let cmd = sprintf "%s --help >/dev/null 2>&1" cmdline.curl in - if shell_command cmd <> 0 then - error (f_"curl is not installed (or does not work)"); - - (* Check that virt-resize works. *) - let cmd = "virt-resize --help >/dev/null 2>&1" in - if shell_command cmd <> 0 then - error (f_"virt-resize is not installed (or does not work)"); - - (* Create the cache. *) - let cache = - match cmdline.cache with - | None -> None - | Some dir -> - try Some (Cache.create ~directory:dir) - with exn -> - warning (f_"cache %s: %s") dir (Printexc.to_string exn); - warning (f_"disabling the cache"); - None - in - - (* Create a single temporary directory for all the small-or-so - * temporary files that Downloader, Sigchecker, etc, are going - * create. - *) - let tmpdir = Mkdtemp.temp_dir "virt-builder." in - rmdir_on_exit tmpdir; - - (* Download the sources. *) - let downloader = Downloader.create ~curl:cmdline.curl ~cache ~tmpdir in - let repos = Sources.read_sources () in - let sources = List.map ( - fun (source, fingerprint) -> - { - Sources.name = source; uri = source; - gpgkey = Utils.Fingerprint fingerprint; - proxy = Curl.SystemProxy; - format = Sources.FormatNative; - } - ) cmdline.sources in - let sources = List.append sources repos in - let index : Index.index = - List.concat ( - List.map ( - fun source -> - let sigchecker = - Sigchecker.create ~gpg:cmdline.gpg - ~check_signature:cmdline.check_signature - ~gpgkey:source.Sources.gpgkey - ~tmpdir in - match source.Sources.format with - | Sources.FormatNative -> - Index_parser.get_index ~downloader ~sigchecker source - | Sources.FormatSimpleStreams -> - Simplestreams_parser.get_index ~downloader ~sigchecker source - ) sources - ) in - let index = remove_duplicates index in - - (* Now handle the remaining modes. *) - let mode = - match mode with - | `List -> (* --list *) - let sources, index = - match cmdline.arg with - | "" -> sources, index (* no template -> all the available ones *) - | arg -> (* just the specified template *) - let item = selected_cli_item cmdline index in - [], [item] in - List_entries.list_entries ~list_format:cmdline.list_format ~sources index; - exit 0 - - | `Print_cache -> (* --print-cache *) - (match cache with - | Some cache -> - let l = List.filter ( - fun (_, { Index.hidden }) -> - hidden <> true - ) index in - let l = List.map ( - fun (name, { Index.revision; arch }) -> - (name, arch, revision) - ) l in - Cache.print_item_status cache ~header:true l - | None -> printf (f_"no cache directory\n") - ); - exit 0 - - | `Cache_all -> (* --cache-all-templates *) - (match cache with - | None -> - error (f_"no cache directory") - | Some _ -> - List.iter ( - fun (name, - { Index.revision; file_uri; proxy; arch }) -> - let template = name, arch, revision in - message (f_"Downloading: %s") file_uri; - let progress_bar = not (quiet ()) in - ignore (Downloader.download downloader ~template ~progress_bar - ~proxy file_uri) - ) index; - exit 0 - ); - - | (`Install|`Notes) as mode -> mode in - - (* Which os-version (ie. index entry)? *) - let item = selected_cli_item cmdline index in - let arg = fst item in - let entry = snd item in - let sigchecker = entry.Index.sigchecker in - - (match mode with - | `Notes -> (* --notes *) - let notes = - Languages.find_notes (Languages.languages ()) entry.Index.notes in - (match notes with - | notes :: _ -> - print_endline notes - | [] -> - printf (f_"There are no notes for %s\n") arg - ); - exit 0 - - | `Install -> - () (* fall through to create the guest *) - ); - - (* --- If we get here, we want to create a guest. --- *) - - (* Warn if the user might be writing to a partition on a USB key. *) - (match cmdline.output with - | Some device when is_partition device -> - if cmdline.warn_if_partition then - warning (f_"output device (%s) is a partition. If you are writing to a USB key or external drive then you probably need to write to the whole device, not to a partition. If this warning is wrong then you can disable it with --no-warn-if-partition") - device; - | Some _ | None -> () - ); - - (* Download the template, or it may be in the cache. *) - let template = - let template, delete_on_exit = - let { Index.revision; file_uri; proxy } = entry in - let template = arg, Index.Arch cmdline.arch, revision in - message (f_"Downloading: %s") file_uri; - let progress_bar = not (quiet ()) in - Downloader.download downloader ~template ~progress_bar ~proxy - file_uri in - if delete_on_exit then unlink_on_exit template; - template in - - (* Check the signature of the file. *) - let () = - match entry with - (* New-style: Using a checksum. *) - | { Index.checksums = Some csums } -> - (match Checksums.verify_checksums csums template with - | Checksums.Good_checksum -> () - | Checksums.Mismatched_checksum (csum, csum_actual) -> - error (f_"%s checksum of template did not match the expected checksum!\n found checksum: %s\n expected checksum: %s\nTry:\n - Use the ‘-v’ option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!") - (Checksums.string_of_csum_t csum) csum_actual (Checksums.string_of_csum csum) - | Checksums.Missing_file -> - error (f_"%s: template not downloaded or deleted. You may have run ‘virt-builder --delete-cache’ in parallel.") - template - ) - - | { Index.checksums = None } -> - (* Old-style: detached signature. *) - let sigfile = - match entry with - | { Index.signature_uri = None } -> None - | { Index.signature_uri = Some signature_uri } -> - let sigfile, delete_on_exit = - Downloader.download downloader signature_uri in - if delete_on_exit then unlink_on_exit sigfile; - Some sigfile in - - Sigchecker.verify_detached sigchecker template sigfile in - - (* For an explanation of the Planner, see: - * http://rwmj.wordpress.com/2013/12/14/writing-a-planner-to-solve-a-tricky-programming-optimization-problem/ - *) - - (* Planner: Input tags. *) - let itags = - let { Index.size; format } = entry in - let format_tag = - match format with - | None -> [] - | Some format -> [`Format, format] in - let compression_tag = - match detect_file_type template with - | `XZ -> [ `XZ, "" ] - | `GZip | `Tar | `Zip -> - error (f_"input file (%s) has an unsupported type") template - | `Unknown -> [] in - [ `Template, ""; `Filename, template; `Size, Int64.to_string size ] @ - format_tag @ compression_tag in - - (* Planner: Goal. *) - let output_filename, output_format = - match cmdline.output, cmdline.format with - | None, None -> sprintf "%s.img" arg, "raw" - | None, Some "raw" -> sprintf "%s.img" arg, "raw" - | None, Some format -> sprintf "%s.%s" arg format, format - | Some output, None -> output, "raw" - | Some output, Some format -> output, format in - - if is_char_device output_filename then - error (f_"cannot output to a character device or /dev/null"); - - let blockdev_getsize64 dev = - let cmd = sprintf "blockdev --getsize64 %s" (quote dev) in - let lines = external_command cmd in - assert (List.length lines >= 1); - Int64.of_string (List.hd lines) - in - let output_is_block_dev, blockdev_size = - let b = is_block_device output_filename in - let sz = if b then blockdev_getsize64 output_filename else 0L in - b, sz in - - let output_size = - let { Index.size = original_image_size } = entry in - - let size = - match cmdline.size with - | Some size -> size - (* --size parameter missing, output to file: use original image size *) - | None when not output_is_block_dev -> original_image_size - (* --size parameter missing, block device: use block device size *) - | None -> blockdev_size in - - if size < original_image_size then - error (f_"images cannot be shrunk, the output size is too small for this image. Requested size = %s, minimum size = %s") - (human_size size) (human_size original_image_size) - else if output_is_block_dev && output_format = "raw" && size > blockdev_size then - error (f_"output size is too large for this block device. Requested size = %s, output block device = %s, output block device size = %s") - (human_size size) output_filename (human_size blockdev_size); - size in - - (* Goal: must *) - let must = [ - `Filename, output_filename; - `Size, Int64.to_string output_size; - `Format, output_format - ] in - - (* Goal: must not *) - let must_not = [ `Template, ""; `XZ, "" ] in - - let cache_dir = (open_guestfs ())#get_cachedir () in - - (* Planner: Transitions. *) - let transitions itags = - let is t = List.mem_assoc t itags in - let is_not t = not (is t) in - let remove = List.remove_assoc in - let ret = ref [] in - - let infile = List.assoc `Filename itags in - - (* The scheme for weights ranges from 0 = free to 100 = most expensive: - * - * 0 = free operations like renaming a file in the same directory - * 10 = in-place conversions (like [qemu-img resize]) - * 20 = copy or move a file between two local filesystems - * 30 = copy and convert a file between two local filesystems - * 40 = copy a file within the same local filesystem - * 50 = copy and convert a file within the same local filesystem - * 80 = copy, move, convert if source or target is on network filesystem - * 100 = complex operations like virt-resize - * - * Copies and moves across different local filesystems are - * cheaper than copies within the same filesystem. The - * theory because less bandwith is available if both source - * and destination hit the same device (except in the special - * case of moving within a filesystem which is free). - * - * We could estimate weights better by looking at file sizes. - *) - let weight task otags = - let outfile = List.assoc `Filename otags in - - (* If infile/outfile don't exist, get the containing directory. *) - let infile = - if Sys.file_exists infile then infile else Filename.dirname infile in - let outfile = - if Sys.file_exists outfile then outfile else Filename.dirname outfile in - - match task with - | `Virt_resize -> 100 (* virt-resize is a special case*) - | (`Copy|`Move|`Pxzcat|`Disk_resize|`Convert) as task -> - if StatVFS.is_network_filesystem infile || - StatVFS.is_network_filesystem outfile - then 80 (* NFS etc. *) - else ( - let across = (lstat infile).st_dev <> (lstat outfile).st_dev in - match task, across with - | `Move, false -> 0 (* rename in same filesystem *) - | `Disk_resize, _ -> 10 (* in-place conversion *) - | `Move, true (* move or copy between two filesystems *) - | `Copy, true -> 20 - | (`Pxzcat|`Convert), true -> 30 (* convert between two local fses*) - | `Copy, false -> 40 (* copy within same filesystem *) - | (`Pxzcat|`Convert), false -> 50 (* convert with same local fs*) - ) - in - - (* Add a transition to the returned list. *) - let tr task otags = List.push_front (task, weight task otags, otags) ret in - - (* Since the final plan won't run in parallel, we don't only need - * to choose unique tempfiles per transition, so this is OK: - *) - let tempfile = Filename.temp_file ~temp_dir:cache_dir "vb" ".img" in - unlink_on_exit tempfile; - - (* Always possible to copy from one place to another. The only - * thing a copy does is to remove the template tag (since it's always - * copied out of the cache directory). - *) - if infile <> output_filename then - tr `Copy ((`Filename, output_filename) :: remove `Template itags); - tr `Copy ((`Filename, tempfile) :: remove `Template itags); - - (* We can rename a file instead of copying, but don't rename the - * cache copy! - *) - if is_not `Template then ( - if not output_is_block_dev && infile <> output_filename then - tr `Move ((`Filename, output_filename) :: itags); - tr `Move ((`Filename, tempfile) :: itags) - ); - - if is `XZ then ( - (* If the input is XZ-compressed, then we can run xzcat, either - * to the output file or to a temp file. - *) - if not output_is_block_dev && infile <> output_filename then - tr `Pxzcat - ((`Filename, output_filename) :: remove `XZ (remove `Template itags)); - tr `Pxzcat - ((`Filename, tempfile) :: remove `XZ (remove `Template itags)); - ) - else ( - (* If the input is NOT compressed then we could run virt-resize - * if it makes sense to resize the image. Note that virt-resize - * can do both size and format conversions. - *) - let old_size = Int64.of_string (List.assoc `Size itags) in - let headroom = 256L *^ 1024L *^ 1024L in - if output_size >= old_size +^ headroom then ( - if infile <> output_filename then - tr `Virt_resize - ((`Size, Int64.to_string output_size) :: - (`Filename, output_filename) :: - (`Format, output_format) :: (remove `Template itags)); - tr `Virt_resize - ((`Size, Int64.to_string output_size) :: - (`Filename, tempfile) :: - (`Format, output_format) :: (remove `Template itags)) - ) - - (* If the size increase is smaller than the amount of headroom - * inside the disk image, then virt-resize won't work. However - * we can do a disk resize (using 'qemu-img resize') instead, - * although it won't resize the filesystems for the user. - * - * 'qemu-img resize' works on the file in-place and won't change - * the format. It must not be run on a template directly. - * - * Don't run 'qemu-img resize' on an auto format. This is to - * force an explicit conversion step to a real format. - *) - else if output_size > old_size && is_not `Template - && List.mem_assoc `Format itags then - tr `Disk_resize ((`Size, Int64.to_string output_size) :: itags); - - (* qemu-img convert is always possible, and quicker. It doesn't - * resize, but it does change the format. - *) - if infile <> output_filename then - tr `Convert - ((`Filename, output_filename) :: (`Format, output_format) :: - (remove `Template itags)); - tr `Convert - ((`Filename, tempfile) :: (`Format, output_format) :: - (remove `Template itags)); - ); - - (* Return the list of possible transitions. *) - !ret - in - - (* Plan how to create the disk image. *) - message (f_"Planning how to build this image"); - let plan = - match plan ~max_depth:5 transitions itags ~must ~must_not with - | Some plan -> plan - | None -> - error (f_"no plan could be found for making a disk image with\nthe required size, format etc. This is a bug in libguestfs!\nPlease file a bug, giving the command line arguments you used.") in - - (* Print out the plan. *) - if verbose () then ( - let print_tags tags = - (try - let v = List.assoc `Filename tags in printf " +filename=%s" v - with Not_found -> ()); - (try - let v = List.assoc `Size tags in printf " +size=%s" v - with Not_found -> ()); - (try - let v = List.assoc `Format tags in printf " +format=%s" v - with Not_found -> ()); - if List.mem_assoc `Template tags then printf " +template"; - if List.mem_assoc `XZ tags then printf " +xz" - in - let print_task = function - | `Copy -> printf "cp" - | `Move -> printf "mv" - | `Pxzcat -> printf "pxzcat" - | `Virt_resize -> printf "virt-resize" - | `Disk_resize -> printf "qemu-img resize" - | `Convert -> printf "qemu-img convert" - in - - List.iteri ( - fun i (itags, task, otags) -> - printf "%d: itags:" i; - print_tags itags; - printf "\n"; - printf "%d: task : " i; - print_task task; - printf "\n"; - printf "%d: otags:" i; - print_tags otags; - printf "\n\n%!" - ) plan - ); - - (* Delete the output file before we finish. However don't delete it - * if it's block device, or if --no-delete-on-failure is set. - *) - let delete_output_file = - ref (cmdline.delete_on_failure && not output_is_block_dev) in - let delete_file () = - if !delete_output_file then - try unlink output_filename with _ -> () - in - at_exit delete_file; - - (* Carry out the plan. *) - List.iter ( - function - | itags, `Copy, otags -> - let ifile = List.assoc `Filename itags in - let ofile = List.assoc `Filename otags in - message (f_"Copying"); - let cmd = [ "cp"; ifile; ofile ] in - if run_command cmd <> 0 then exit 1 - - | itags, `Move, otags -> - let ifile = List.assoc `Filename itags in - let ofile = List.assoc `Filename otags in - let cmd = [ "mv"; ifile; ofile ] in - if run_command cmd <> 0 then exit 1 - - | itags, `Pxzcat, otags -> - let ifile = List.assoc `Filename itags in - let ofile = List.assoc `Filename otags in - message (f_"Uncompressing"); - Pxzcat.pxzcat ifile ofile - - | itags, `Virt_resize, otags -> - let ifile = List.assoc `Filename itags in - let iformat = - try Some (List.assoc `Format itags) with Not_found -> None in - let ofile = List.assoc `Filename otags in - let osize = Int64.of_string (List.assoc `Size otags) in - let osize = roundup64 osize 512L in - let oformat = List.assoc `Format otags in - let { Index.expand; lvexpand } = entry in - message (f_"Resizing (using virt-resize) to expand the disk to %s") - (human_size osize); - let preallocation = if oformat = "qcow2" then Some "metadata" else None in - let () = - let g = open_guestfs () in - g#disk_create ?preallocation ofile oformat osize in - let cmd = [ "virt-resize" ] @ - (if verbose () then [ "--verbose" ] else [ "--quiet" ]) @ - (if is_block_device ofile then [ "--no-sparse" ] else []) @ - (match iformat with - | None -> [] - | Some iformat -> [ "--format"; iformat ]) @ - [ "--output-format"; oformat ] @ - (match expand with - | None -> [] - | Some expand -> [ "--expand"; expand ]) @ - (match lvexpand with - | None -> [] - | Some lvexpand -> [ "--lv-expand"; lvexpand ]) @ - [ "--unknown-filesystems"; "error"; ifile; ofile ] in - if run_command cmd <> 0 then exit 1 - - | itags, `Disk_resize, otags -> - let ofile = List.assoc `Filename otags in - let osize = Int64.of_string (List.assoc `Size otags) in - let osize = roundup64 osize 512L in - message (f_"Resizing container (but not filesystems) to expand the disk to %s") - (human_size osize); - let cmd = sprintf "qemu-img resize %s %Ld%s" - (quote ofile) osize (if verbose () then "" else " >/dev/null") in - if shell_command cmd <> 0 then exit 1 - - | itags, `Convert, otags -> - let ifile = List.assoc `Filename itags in - let iformat = - try Some (List.assoc `Format itags) with Not_found -> None in - let ofile = List.assoc `Filename otags in - let oformat = List.assoc `Format otags in - (match iformat with - | None -> message (f_"Converting to %s") oformat - | Some f -> message (f_"Converting %s to %s") f oformat - ); - let cmd = sprintf "qemu-img convert%s %s -O %s %s%s" - (match iformat with - | None -> "" - | Some iformat -> sprintf " -f %s" (quote iformat)) - (quote ifile) (quote oformat) (quote (qemu_input_filename ofile)) - (if verbose () then "" else " >/dev/null 2>&1") in - if shell_command cmd <> 0 then exit 1 - ) plan; - - (* Now mount the output disk so we can make changes. *) - message (f_"Opening the new disk"); - let g = - let g = open_guestfs () in - - Option.may g#set_memsize cmdline.memsize; - Option.may g#set_smp cmdline.smp; - g#set_network cmdline.network; - - (* The output disk is being created, so use cache=unsafe here. *) - g#add_drive_opts ~format:output_format ~cachemode:"unsafe" output_filename; - - (* Attach ISOs, if we have any. *) - List.iter ( - fun (format, file) -> - g#add_drive_opts ?format ~readonly:true file; - ) cmdline.attach; - - g#launch (); - - g in - - (* Inspect the disk and mount it up. *) - let root = - match Array.to_list (g#inspect_os ()) with - | [root] -> - inspect_mount_root g root; - root - | _ -> - error (f_"no guest operating systems or multiboot OS found in this disk image\nThis is a failure of the source repository. Use -v for more information.") - in - - Customize_run.run g root cmdline.customize_ops; - - (* Collect some stats about the final output file. - * Notes: - * - These are virtual disk stats. - * - Never fail here. - *) - let stats = - if not (quiet ()) then ( - try - (* Calculate the free space (in bytes) across all mounted - * filesystems in the guest. - *) - let free_bytes, total_bytes = - let filesystems = List.map snd (g#mountpoints ()) in - let stats = List.map g#statvfs filesystems in - let stats = List.map ( - fun { G.bfree; bsize; blocks } -> - bfree *^ bsize, blocks *^ bsize - ) stats in - List.fold_left ( - fun (f,t) (f',t') -> f +^ f', t +^ t' - ) (0L, 0L) stats in - let free_percent = 100L *^ free_bytes /^ total_bytes in - - Some ( - String.concat "\n" [ - sprintf "%30s: %s" (s_"Output file") output_filename; - sprintf "%30s: %s" (s_"Output size") (human_size output_size); - sprintf "%30s: %s" (s_"Output format") output_format; - sprintf "%30s: %s" (s_"Total usable space") - (human_size total_bytes); - sprintf "%30s: %s (%Ld%%)" (s_"Free space") - (human_size free_bytes) free_percent; - ] ^ "\n" - ) - with - _ -> None - ) - else None in - - (* Unmount everything and we're done! *) - message (f_"Finishing off"); - - g#umount_all (); - g#shutdown (); - g#close (); - - (* Because we used cache=unsafe when writing the output file, the - * file might not be committed to disk. This is a problem if qemu is - * immediately used afterwards with cache=none (which uses O_DIRECT - * and therefore bypasses the host cache). In general you should not - * use cache=none. - *) - if cmdline.sync then - Fsync.file output_filename; - - (* Now that we've finished the build, don't delete the output file on - * exit. - *) - delete_output_file := false; - - (* Print the stats calculated above. *) - Pervasives.flush Pervasives.stdout; - Pervasives.flush Pervasives.stderr; - - Option.may print_string stats - -let () = run_main_and_handle_errors main diff --git a/builder/builder.mli b/builder/builder.mli deleted file mode 100644 index fb2b9f8c1..000000000 --- a/builder/builder.mli +++ /dev/null @@ -1,19 +0,0 @@ -(* virt-builder - * 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. - *) - -(* Nothing is exported. *) diff --git a/builder/cache.ml b/builder/cache.ml deleted file mode 100644 index c39f5fd07..000000000 --- a/builder/cache.ml +++ /dev/null @@ -1,61 +0,0 @@ -(* virt-builder - * Copyright (C) 2013-2020 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 Std_utils -open Tools_utils -open Common_gettext.Gettext - -open Utils - -open Unix -open Printf - -let clean_cachedir dir = - let cmd = [ "rm"; "-rf"; dir ] in - ignore (run_command cmd); - -type t = { - directory : string; -} - -let create ~directory = - if not (is_directory directory) then - mkdir_p directory 0o755; - { - directory = directory; - } - -let cache_of_name t name arch revision = - t.directory // sprintf "%s.%s.%s" name - (Index.string_of_arch arch) - (string_of_revision revision) - -let is_cached t name arch revision = - let filename = cache_of_name t name arch revision in - Sys.file_exists filename - -let print_item_status t ~header l = - if header then ( - printf (f_"cache directory: %s\n") t.directory - ); - List.iter ( - fun (name, arch, revision) -> - let cached = is_cached t name arch revision in - printf "%-24s %-10s %s\n" name (Index.string_of_arch arch) - (if cached then s_"cached" else (*s_*)"no") - ) l diff --git a/builder/cache.mli b/builder/cache.mli deleted file mode 100644 index 12faf8bb9..000000000 --- a/builder/cache.mli +++ /dev/null @@ -1,45 +0,0 @@ -(* virt-builder - * Copyright (C) 2013-2020 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. - *) - -(** This module represents a local cache. *) - -val clean_cachedir : string -> unit -(** [clean_cachedir dir] clean the specified cache directory. *) - -type t -(** The abstract data type. *) - -val create : directory:string -> t -(** Create the abstract type. *) - -val cache_of_name : t -> string -> Index.arch -> Utils.revision -> string -(** [cache_of_name t name arch revision] return the filename - of the cached file. (Note: It doesn't check if the filename - exists, this is just a simple string transformation). *) - -val is_cached : t -> string -> Index.arch -> Utils.revision -> bool -(** [is_cached t name arch revision] return whether the file with - specified name, architecture and revision is cached. *) - -val print_item_status : t -> header:bool -> (string * Index.arch * Utils.revision) list -> unit -(** [print_item_status t header items] print the status in the cache - of the specified items (which are tuples of name, architecture, - and revision). - - If [~header:true] then display a header with the path of the - cache. *) diff --git a/builder/cmdline.ml b/builder/cmdline.ml deleted file mode 100644 index 491059aa6..000000000 --- a/builder/cmdline.ml +++ /dev/null @@ -1,334 +0,0 @@ -(* virt-builder - * Copyright (C) 2013-2020 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. - *) - -(* Command line argument parsing. *) - -open Std_utils -open Tools_utils -open Common_gettext.Gettext -open Getopt.OptionName - -open Customize_cmdline - -open Utils - -module G = Guestfs - -open Unix -open Printf - -type cmdline = { - mode : [ `Cache_all | `Delete_cache | `Get_kernel | `Install | `List - | `Notes | `Print_cache ]; - arg : string; - arch : string; - attach : (string option * string) list; - cache : string option; - check_signature : bool; - curl : string; - customize_ops : Customize_cmdline.ops; - delete_on_failure : bool; - format : string option; - gpg : string; - list_format : List_entries.format; - memsize : int option; - network : bool; - output : string option; - size : int64 option; - smp : int option; - sources : (string * string) list; - sync : bool; - warn_if_partition : bool; -} - -let parse_cmdline () = - let mode = ref `Install in - let list_mode () = mode := `List in - let notes_mode () = mode := `Notes in - let get_kernel_mode () = mode := `Get_kernel in - let cache_all_mode () = mode := `Cache_all in - let print_cache_mode () = mode := `Print_cache in - let delete_cache_mode () = mode := `Delete_cache in - - let arch = ref "" in - - let attach = ref [] in - let attach_format = ref None in - let set_attach_format = function - | "auto" -> attach_format := None - | s -> attach_format := Some s - in - let attach_disk s = List.push_front (!attach_format, s) attach in - - let cache = ref Paths.xdg_cache_home in - let set_cache arg = cache := Some arg in - let no_cache () = cache := None in - - let check_signature = ref true in - let curl = ref "curl" in - - let delete_on_failure = ref true in - - let fingerprints = ref [] in - let add_fingerprint arg = List.push_front arg fingerprints in - - let format = ref "" in - let gpg = - try which "gpg2" - with Executable_not_found _ -> - try which "gpg" - with Executable_not_found _ -> - "" in - let gpg = ref gpg in - - let list_format = ref List_entries.Short in - let list_set_long () = list_format := List_entries.Long in - let list_set_format arg = - (* Do not catch the Invalid_argument that list_format_of_string - * throws on invalid input, as it is already checked by the - * Getopt handling of Symbol. *) - list_format := List_entries.list_format_of_string arg in - - let memsize = ref None in - let set_memsize arg = memsize := Some arg in - - let network = ref true in - let output = ref "" in - - let size = ref None in - let set_size arg = size := Some (parse_size arg) in - - let smp = ref None in - let set_smp arg = smp := Some arg in - - let sources = ref [] in - let add_source arg = List.push_front arg sources in - - let sync = ref true in - let warn_if_partition = ref true in - - let formats = List_entries.list_formats - and formats_string = String.concat "|" List_entries.list_formats in - - let argspec = [ - [ L"arch" ], Getopt.Set_string ("arch", arch), s_"Set the output architecture"; - [ L"attach" ], Getopt.String ("iso", attach_disk), s_"Attach data disk/ISO during install"; - [ L"attach-format" ], Getopt.String ("format", set_attach_format), - s_"Set attach disk format"; - [ L"cache" ], Getopt.String ("dir", set_cache), s_"Set template cache dir"; - [ L"no-cache" ], Getopt.Unit no_cache, s_"Disable template cache"; - [ L"cache-all-templates" ], Getopt.Unit cache_all_mode, - s_"Download all templates to the cache"; - [ L"check-signature"; L"check-signatures" ], Getopt.Set check_signature, - s_"Check digital signatures"; - [ L"no-check-signature"; L"no-check-signatures" ], Getopt.Clear check_signature, - s_"Disable digital signatures"; - [ L"curl" ], Getopt.Set_string ("curl", curl), s_"Set curl binary/command"; - [ L"delete-cache" ], Getopt.Unit delete_cache_mode, - s_"Delete the template cache"; - [ L"no-delete-on-failure" ], Getopt.Clear delete_on_failure, - s_"Don’t delete output file on failure"; - [ L"fingerprint" ], Getopt.String ("AAAA..", add_fingerprint), - s_"Fingerprint of valid signing key"; - [ L"format" ], Getopt.Set_string ("raw|qcow2", format), s_"Output format (default: raw)"; - [ L"get-kernel" ], Getopt.Unit get_kernel_mode, - s_"Get kernel from image"; - [ L"gpg" ], Getopt.Set_string ("gpg", gpg), s_"Set GPG binary/command"; - [ S 'l'; L"list" ], Getopt.Unit list_mode, s_"List available templates"; - [ L"long" ], Getopt.Unit list_set_long, s_"Shortcut for --list-format long"; - [ L"list-format" ], Getopt.Symbol (formats_string, formats, list_set_format), - s_"Set the format for --list (default: short)"; - [ S 'm'; L"memsize" ], Getopt.Int ("mb", set_memsize), s_"Set memory size"; - [ L"network" ], Getopt.Set network, s_"Enable appliance network (default)"; - [ L"no-network" ], Getopt.Clear network, s_"Disable appliance network"; - [ L"notes" ], Getopt.Unit notes_mode, s_"Display installation notes"; - [ S 'o'; L"output" ], Getopt.Set_string ("file", output), s_"Set output filename"; - [ L"print-cache" ], Getopt.Unit print_cache_mode, - s_"Print info about template cache"; - [ L"size" ], Getopt.String ("size", set_size), s_"Set output disk size"; - [ L"smp" ], Getopt.Int ("vcpus", set_smp), s_"Set number of vCPUs"; - [ L"source" ], Getopt.String ("URL", add_source), s_"Set source URL"; - [ L"no-sync" ], Getopt.Clear sync, s_"Do not fsync output file on exit"; - [ L"no-warn-if-partition" ], Getopt.Clear warn_if_partition, - s_"Do not warn if writing to a partition"; - ] in - let customize_argspec, get_customize_ops = Customize_cmdline.argspec () in - let customize_argspec = - List.map (fun (spec, _, _) -> spec) customize_argspec in - let argspec = argspec @ customize_argspec in - - let args = ref [] in - let anon_fun s = List.push_front s args in - let usage_msg = - sprintf (f_"\ -%s: build virtual machine images quickly - - virt-builder OS-VERSION - virt-builder -l - virt-builder --notes OS-VERSION - virt-builder --print-cache - virt-builder --cache-all-templates - virt-builder --delete-cache - virt-builder --get-kernel IMAGE - -A short summary of the options is given below. For detailed help please -read the man page virt-builder(1). -") - prog in - let opthandle = create_standard_options argspec ~anon_fun ~machine_readable:true usage_msg in - Getopt.parse opthandle.getopt; - - (* Dereference options. *) - let args = List.rev !args in - let mode = !mode in - let arch = !arch in - let attach = List.rev !attach in - let cache = !cache in - let check_signature = !check_signature in - let curl = !curl in - let delete_on_failure = !delete_on_failure in - let fingerprints = List.rev !fingerprints in - let format = match !format with "" -> None | s -> Some s in - let gpg = !gpg in - let list_format = !list_format in - let memsize = !memsize in - let network = !network in - let ops = get_customize_ops () in - let output = match !output with "" -> None | s -> Some s in - let size = !size in - let smp = !smp in - let sources = List.rev !sources in - let sync = !sync in - let warn_if_partition = !warn_if_partition in - - (* No arguments and machine-readable mode? Print some facts. *) - (match args, machine_readable () with - | [], Some { pr } -> - pr "virt-builder\n"; - pr "arch\n"; - pr "config-file\n"; - pr "customize\n"; - pr "json-list\n"; - if Pxzcat.using_parallel_xzcat () then pr "pxzcat\n"; - exit 0 - | _, _ -> () - ); - - (* Check options. *) - let arg = - match mode with - | `Install -> - (match args with - | [arg] -> arg - | [] -> - error (f_"virt-builder os-version\nMissing ‘os-version’. Use ‘--list’ to list available template names.") - | _ -> - error (f_"too many parameters, expecting ‘os-version’") - ) - | `List -> - if format <> None then - error (f_"--list: use ‘--list-format’, not ‘--format’"); - (match args with - | [arg] -> arg - | [] -> "" - | _ -> - error (f_"too many parameters, at most one ‘os-version’ is allowed for --list") - ) - | `Notes -> - (match args with - | [arg] -> arg - | [] -> - error (f_"virt-builder --notes os-version\nMissing ‘os-version’. Use ‘--list’ to list available template names.") - | _ -> - error (f_"--notes: too many parameters, expecting ‘os-version’"); - ) - | `Cache_all - | `Print_cache - | `Delete_cache -> - (match args with - | [] -> "" - | _ -> - error (f_"--cache-all-templates/--print-cache/--delete-cache does not need any extra arguments") - ) - | `Get_kernel -> - (match args with - | [arg] -> arg - | [] -> - error (f_"virt-builder --get-kernel image\nMissing ‘image’ (disk image file) argument") - | _ -> - error (f_"--get-kernel: too many parameters") - ) in - - (* Check source(s) and fingerprint(s). *) - let sources = - let rec repeat x = function - | 0 -> [] | 1 -> [x] - | n -> x :: repeat x (n-1) - in - - let nr_sources = List.length sources in - let fingerprints = - if check_signature then ( - match fingerprints with - | [fingerprint] -> - (* You're allowed to have multiple sources and one fingerprint: it - * means that the same fingerprint is used for all sources. - *) - repeat fingerprint nr_sources - | xs -> xs - ) else - (* We are not checking signatures, so just ignore any fingerprint - * specified. *) - repeat "" nr_sources in - - if List.length fingerprints <> nr_sources then - error (f_"source and fingerprint lists are not the same length"); - - (* Combine the sources and fingerprints into a single list of pairs. *) - List.combine sources fingerprints in - - (* Check the architecture. *) - let arch = - match arch with - | "" -> Guestfs_config.host_cpu - | arch -> arch in - let arch = normalize_arch arch in - - (* If user didn't elect any root password, that means we set a random - * root password. - *) - let customize_ops = - let has_set_root_password = List.exists ( - function `RootPassword _ -> true | _ -> false - ) ops.ops in - if has_set_root_password then ops - else ( - let pw = Password.parse_selector "random" in - { ops with ops = ops.ops @ [ `RootPassword pw ] } - ) in - - { mode = mode; arg = arg; - arch = arch; attach = attach; cache = cache; - check_signature = check_signature; curl = curl; - customize_ops = customize_ops; - delete_on_failure = delete_on_failure; format = format; - gpg = gpg; list_format = list_format; memsize = memsize; - network = network; output = output; - size = size; smp = smp; sources = sources; sync = sync; - warn_if_partition = warn_if_partition; - } diff --git a/builder/cmdline.mli b/builder/cmdline.mli deleted file mode 100644 index 70990ed6e..000000000 --- a/builder/cmdline.mli +++ /dev/null @@ -1,45 +0,0 @@ -(* virt-builder - * Copyright (C) 2013-2020 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. - *) - -(** Command line argument parsing. *) - -type cmdline = { - mode : [ `Cache_all | `Delete_cache | `Get_kernel | `Install | `List - | `Notes | `Print_cache ]; - arg : string; - arch : string; - attach : (string option * string) list; - cache : string option; - check_signature : bool; - curl : string; - customize_ops : Customize_cmdline.ops; - delete_on_failure : bool; - format : string option; - gpg : string; - list_format : List_entries.format; - memsize : int option; - network : bool; - output : string option; - size : int64 option; - smp : int option; - sources : (string * string) list; - sync : bool; - warn_if_partition : bool; -} - -val parse_cmdline : unit -> cmdline diff --git a/builder/downloader.ml b/builder/downloader.ml deleted file mode 100644 index 424c9cd34..000000000 --- a/builder/downloader.ml +++ /dev/null @@ -1,144 +0,0 @@ -(* virt-builder - * Copyright (C) 2013 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 Std_utils -open Tools_utils -open Common_gettext.Gettext - -open Utils - -open Unix -open Printf - -type uri = string -type filename = string - -type t = { - curl : string; - tmpdir : string; - cache : Cache.t option; (* cache for templates *) -} - -let create ~curl ~tmpdir ~cache = { - curl = curl; - tmpdir = tmpdir; - cache = cache; -} - -let rec download t ?template ?progress_bar ?(proxy = Curl.SystemProxy) uri = - match template with - | None -> (* no cache, simple download *) - (* Create a temporary name. *) - let tmpfile = Filename.temp_file ~temp_dir:t.tmpdir "vbcache" ".txt" in - download_to t ?progress_bar ~proxy uri tmpfile; - (tmpfile, true) - - | Some (name, arch, revision) -> - match t.cache with - | None -> - (* Not using the cache at all? *) - download t ?progress_bar ~proxy uri - - | Some cache -> - let filename = Cache.cache_of_name cache name arch revision in - - (* Is the requested template name + revision in the cache already? - * If not, download it. - *) - if not (Sys.file_exists filename) then - download_to t ?progress_bar ~proxy uri filename; - - (filename, false) - -and download_to t ?(progress_bar = false) ~proxy uri filename = - let parseduri = - try URI.parse_uri uri - with URI.Parse_failed -> - error (f_"error parsing URI '%s'. Look for error messages printed above.") - uri in - - (* Note because there may be parallel virt-builder instances running - * and also to avoid partial downloads in the cache if the network - * fails, we download to a random name in the cache and then - * atomically rename it to the final filename. - *) - let filename_new = filename ^ "." ^ String.random8 () in - unlink_on_exit filename_new; - - (match parseduri.URI.protocol with - (* Download (ie. copy) from a local file. *) - | "file" -> - let path = parseduri.URI.path in - let cmd = [ "cp" ] @ - (if verbose () then [ "-v" ] else []) @ - [ path; filename_new ] in - let r = run_command cmd in - if r <> 0 then - error (f_"cp (download) command failed copying ‘%s’") path; - - (* Any other protocol. *) - | _ -> - let common_args = [ - "location", None; (* Follow 3xx redirects. *) - "url", Some uri; (* URI to download. *) - ] in - - let quiet_args = [ "silent", None; "show-error", None ] in - - (* Get the status code first to ensure the file exists. *) - let curl_h = - let curl_args = ref common_args in - if not (verbose ()) then List.push_back_list curl_args quiet_args; - List.push_back_list curl_args [ - "output", Some "/dev/null"; (* Write output to /dev/null. *) - "head", None; (* Request only HEAD. *) - "write-out", Some "%{http_code}" (* HTTP status code to stdout. *) - ]; - - Curl.create ~curl:t.curl ~tmpdir:t.tmpdir !curl_args in - - let lines = Curl.run curl_h in - if List.length lines < 1 then - error (f_"unexpected output from curl command, enable debug and look at previous messages"); - let status_code = List.hd lines in - let bad_status_code = function - | "" -> true - | s when s.[0] = '4' -> true (* 4xx *) - | s when s.[0] = '5' -> true (* 5xx *) - | _ -> false - in - if bad_status_code status_code then - error (f_"failed to download %s: HTTP status code %s") uri status_code; - - (* Now download the file. *) - let curl_h = - let curl_args = ref common_args in - List.push_back curl_args ("output", Some filename_new); - - if not (verbose ()) then ( - if progress_bar then List.push_back curl_args ("progress-bar", None) - else List.push_back_list curl_args quiet_args - ); - - Curl.create ~curl:t.curl ~tmpdir:t.tmpdir !curl_args in - - ignore (Curl.run curl_h) - ); - - (* Rename the file if the download was successful. *) - rename filename_new filename diff --git a/builder/downloader.mli b/builder/downloader.mli deleted file mode 100644 index a199440cb..000000000 --- a/builder/downloader.mli +++ /dev/null @@ -1,45 +0,0 @@ -(* virt-builder - * Copyright (C) 2013 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. - *) - -(** This module is a wrapper around curl, plus local caching. *) - -type uri = string -type filename = string - -type t -(** The abstract data type. *) - -val create : curl:string -> tmpdir:string -> cache:Cache.t option -> t -(** Create the abstract type. *) - -val download : t -> ?template:string * Index.arch * Utils.revision -> ?progress_bar:bool -> ?proxy:Curl.proxy -> uri -> filename * bool -(** Download the URI, returning the downloaded filename and a - temporary file flag. The temporary file flag is [true] iff - the downloaded file is temporary and should be deleted by the - caller (otherwise it's in the cache and you shouldn't delete it). - - For templates, you must supply [~template:(name, arch, revision)]. - This causes the cache to be used (if possible). Name, arch(itecture) - and revision are used for cache control (see the man page for details). - - If [~progress_bar:true] then display a progress bar if the file - doesn't come from the cache. In verbose mode, progress messages - are always displayed. - - [proxy] specifies the type of proxy to be used in the transfer, - if possible. *) diff --git a/builder/index-parse.y b/builder/index-parse.y deleted file mode 100644 index 6dba255c0..000000000 --- a/builder/index-parse.y +++ /dev/null @@ -1,184 +0,0 @@ -/* libguestfs virt-builder tool -*- fundamental -*- - * Copyright (C) 2013 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. - */ - -%{ -#include - -#include -#include -#include - -#include "index-struct.h" -#include "index-parse.h" - -/* The generated code uses frames > 5000 bytes. */ -#if defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wframe-larger-than=" -#pragma GCC diagnostic ignored "-Wstack-usage=" -#endif - -#define YY_EXTRA_TYPE struct parse_context * - -extern void yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg); -extern int yylex (YYSTYPE * yylval, YYLTYPE * yylloc, yyscan_t scanner); - -extern int do_parse (struct parse_context *context, FILE *in); -extern void scanner_init (yyscan_t *scanner, struct parse_context *context, FILE *in); -extern void scanner_destroy (yyscan_t scanner); - -/* Join two strings with \n */ -static char * -concat_newline (const char *str1, const char *str2) -{ - size_t len1, len2, len; - char *ret; - - if (str2 == NULL) - return strdup (str1); - - len1 = strlen (str1); - len2 = strlen (str2); - len = len1 + 1 /* \n */ + len2 + 1 /* \0 */; - ret = malloc (len); - memcpy (ret, str1, len1); - ret[len1] = '\n'; - memcpy (ret + len1 + 1, str2, len2); - ret[len-1] = '\0'; - - return ret; -} - -%} - -%code requires { -#ifndef YY_TYPEDEF_YY_SCANNER_T -#define YY_TYPEDEF_YY_SCANNER_T -typedef void *yyscan_t; -#endif -} - -%locations - -%union { - struct section *section; - struct field *field; - char *str; -} - -%token SECTION_HEADER -%token FIELD -%token VALUE_CONT -%token EMPTY_LINE -%token PGP_PROLOGUE -%token PGP_EPILOGUE -%token UNKNOWN_LINE - -%type
sections section -%type fields field -%type continuations - -%pure-parser - -%lex-param { yyscan_t scanner } -%parse-param { yyscan_t scanner } -%parse-param { struct parse_context *context } - -%destructor { section_free ($$); }
-%destructor { field_free ($$); } - -%% - -index: - sections - { context->parsed_index = $1; } - | PGP_PROLOGUE sections PGP_EPILOGUE - { context->parsed_index = $2; } - -sections: - emptylines section emptylines - { $$ = $2; } - | emptylines section EMPTY_LINE emptylines sections - { $$ = $2; $$->next = $5; } - | emptylines - { $$ = NULL; } - -section: - SECTION_HEADER fields - { $$ = malloc (sizeof (struct section)); - $$->next = NULL; - $$->name = $1; - $$->fields = $2; } - -fields: - /* empty */ - { $$ = NULL; } - | field fields - { $$ = $1; $$->next = $2; } - -field: FIELD continuations - { $$ = $1; - char *old_value = $$->value; - $$->value = concat_newline (old_value, $2); - free (old_value); - free ($2); } - -continuations: - /* empty */ - { $$ = NULL; } - | VALUE_CONT continuations - { $$ = concat_newline ($1, $2); - free ($1); - free ($2); } - -emptylines: - /* empty */ - {} - | EMPTY_LINE emptylines - {} - -%% - -void -yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg) -{ - const int has_suffix = - context->error_suffix != NULL && context->error_suffix[0] != 0; - - fprintf (stderr, "%s%s%s%ssyntax error at line %d: %s%s%s\n", - context->progname ? context->progname : "", - context->progname ? ": " : "", - context->input_file ? context->input_file : "", - context->input_file ? ": " : "", - yylloc->first_line, msg, - has_suffix ? " " : "", - has_suffix ? context->error_suffix : ""); -} - -int -do_parse (struct parse_context *context, FILE *in) -{ - yyscan_t scanner; - int res; - - scanner_init (&scanner, context, in); - res = yyparse (scanner, context); - scanner_destroy (scanner); - - return res; -} diff --git a/builder/index-parser-c.c b/builder/index-parser-c.c deleted file mode 100644 index 2e1ca3d30..000000000 --- a/builder/index-parser-c.c +++ /dev/null @@ -1,116 +0,0 @@ -/* virt-builder - * Copyright (C) 2013 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. - */ - -/** - * This file handles the interface between the C/lex/yacc index file - * parser, and the OCaml world. See F for - * the OCaml type definition. - */ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "index-struct.h" -#include "index-parse.h" - -extern int do_parse (struct parse_context *context, FILE *in); - -extern value virt_builder_parse_index (value progv, value error_suffixv, value filenamev); - -value -virt_builder_parse_index (value progv, value error_suffixv, value filenamev) -{ - CAMLparam2 (progv, filenamev); - CAMLlocal5 (rv, v, sv, sv2, fv); - struct section *sections; - size_t i, nr_sections; - struct parse_context context; - FILE *in; - - parse_context_init (&context); - context.progname = String_val (progv); - context.input_file = String_val (filenamev); - context.error_suffix = String_val (error_suffixv); - - in = fopen (String_val (filenamev), "r"); - if (in == NULL) - unix_error (errno, (char *) "fopen", filenamev); - - if (do_parse (&context, in) != 0) { - fclose (in); - caml_invalid_argument ("parse error"); - } - - if (fclose (in) == EOF) - unix_error (errno, (char *) "fclose", filenamev); - - /* Convert the parsed data to OCaml structures. */ - nr_sections = 0; - for (sections = context.parsed_index; sections != NULL; sections = sections->next) - nr_sections++; - rv = caml_alloc (nr_sections, 0); - - for (i = 0, sections = context.parsed_index; sections != NULL; - i++, sections = sections->next) { - struct field *fields; - size_t j, nr_fields; - - nr_fields = 0; - for (fields = sections->fields; fields != NULL; fields = fields->next) - nr_fields++; - fv = caml_alloc (nr_fields, 0); - - for (j = 0, fields = sections->fields; fields != NULL; - j++, fields = fields->next) { - v = caml_alloc_tuple (3); - sv = caml_copy_string (fields->key); - Store_field (v, 0, sv); /* (key, Some subkey, value) */ - if (fields->subkey) { - sv2 = caml_copy_string (fields->subkey); - sv = caml_alloc (1, 0); - Store_field (sv, 0, sv2); - } else - sv = Val_int (0); - Store_field (v, 1, sv); - sv = caml_copy_string (fields->value); - Store_field (v, 2, sv); - Store_field (fv, j, v); /* assign to return array of fields */ - } - - v = caml_alloc_tuple (2); - sv = caml_copy_string (sections->name); - Store_field (v, 0, sv); /* (name, fields) */ - Store_field (v, 1, fv); - Store_field (rv, i, v); /* assign to return array of sections */ - } - - /* Free parsed data. */ - parse_context_free (&context); - - CAMLreturn (rv); -} diff --git a/builder/index-scan.l b/builder/index-scan.l deleted file mode 100644 index 49dad72bc..000000000 --- a/builder/index-scan.l +++ /dev/null @@ -1,153 +0,0 @@ -/* libguestfs virt-builder tool -*- fundamental -*- - * Copyright (C) 2013 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. - */ - -%top{ -#include -} - -%{ -#include -#include -#include - -/* Silence gcc warnings from the generated code. */ -#if defined(__GNUC__) -#pragma GCC diagnostic push -/* flex creates macros that it doesn't use */ -#pragma GCC diagnostic ignored "-Wunused-macros" -/* on aarch64, flex doesn't know that char is unsigned */ -#pragma GCC diagnostic ignored "-Wsign-compare" -/* on debian-mipsel, flex doesn't create prototypes for all functions */ -#pragma GCC diagnostic ignored "-Wmissing-prototypes" -#endif - -#include "index-struct.h" -#include "index-parse.h" - -#define YY_EXTRA_TYPE struct parse_context * -#define YY_USER_ACTION yylloc->first_line = yylloc->last_line = yylineno; - -extern void scanner_init (yyscan_t *scanner, struct parse_context *context, FILE *in); -extern void scanner_destroy (yyscan_t scanner); - -#if (YY_FLEX_MAJOR_VERSION > 2) \ - || ((YY_FLEX_MAJOR_VERSION == 2) && (YY_FLEX_MINOR_VERSION > 6)) \ - || ((YY_FLEX_MAJOR_VERSION == 2) && (YY_FLEX_MINOR_VERSION == 6) && (YY_FLEX_SUBMINOR_VERSION >= 1)) -#define IS_EOF 0 -#else -#define IS_EOF EOF -#endif - -%} - -%option nounput -%option noyywrap -%option yylineno -%option reentrant -%option bison-bridge -%option bison-locations - -%% - - /* Apart from the PGP prologue/epilogue which is a hack, the - * scanning strategy is to deal with the file strictly line by - * line, and pass those lines up to the parser which deals with - * whether they appear in the right order to be meaningful. - * Note that flex does longest-match. - */ - - /* Ignore comments - '#' MUST appear at the start of a line. */ -^"#".*\n { yyextra->seen_comments++; } - - /* An empty line is significant. */ -^\n { return EMPTY_LINE; } - - /* [...] marks beginning of a section. */ -^"["[-A-Za-z0-9._]+"]"[[:blank:]]*\n { - const char *end = strrchr (yytext, ']'); - yylval->str = strndup (yytext+1, end-yytext-1); - return SECTION_HEADER; - } - - /* field=value or field[subfield]=value */ -^[A-Za-z0-9_.]+("["[A-Za-z0-9_,.]+"]")?"=".*\n { - size_t i = strcspn (yytext, "=["); - yylval->field = malloc (sizeof (struct field)); - yylval->field->next = NULL; - yylval->field->key = strndup (yytext, i); - if (yytext[i] == '[') { - const size_t j = strcspn (yytext+i+1, "]"); - yylval->field->subkey = strndup (yytext+i+1, j); - i += 1+j+1; - } else { - yylval->field->subkey = NULL; - } - /* Note we chop the final \n off here. */ - yylval->field->value = strndup (yytext+i+1, yyleng-(i+2)); - return FIELD; - } - - /* Continuation line for multi-line values. */ -^[[:blank:]].*\n { - yylval->str = strndup (yytext+1, yyleng-2); - return VALUE_CONT; - } - - /* Hack to eat the PGP prologue. */ -^"-----BEGIN PGP SIGNED MESSAGE-----\n" { - int c, prevnl = 0; - - /* Eat everything to the first blank line. */ - while ((c = input (yyscanner)) != IS_EOF) { - if (c == '\n' && prevnl) - break; - prevnl = c == '\n'; - } - - return PGP_PROLOGUE; -} - - /* Hack to eat the PGP epilogue. */ -^"-----BEGIN PGP SIGNATURE-----\n" { - /* Eat everything to the end of the file. */ - while (input (yyscanner) != IS_EOF) - ; - - return PGP_EPILOGUE; -} - - /* anything else is an error */ -. { - return UNKNOWN_LINE; -} - -%% - -void -scanner_init (yyscan_t *scanner, struct parse_context *context, FILE *in) -{ - yylex_init (scanner); - yyset_extra (context, *scanner); - yyset_in (in, *scanner); -} - -void -scanner_destroy (yyscan_t scanner) -{ - yylex_destroy (scanner); -} diff --git a/builder/index-struct.c b/builder/index-struct.c deleted file mode 100644 index eacca6c37..000000000 --- a/builder/index-struct.c +++ /dev/null @@ -1,60 +0,0 @@ -/* libguestfs virt-builder tool - * Copyright (C) 2013 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. - */ - -#include - -#include -#include -#include - -#include "index-struct.h" - -void -parse_context_init (struct parse_context *context) -{ - memset (context, 0, sizeof *context); -} - -void -parse_context_free (struct parse_context *context) -{ - section_free (context->parsed_index); -} - -void -section_free (struct section *section) -{ - if (section) { - section_free (section->next); - free (section->name); - field_free (section->fields); - free (section); - } -} - -void -field_free (struct field *field) -{ - if (field) { - field_free (field->next); - free (field->key); - free (field->subkey); - free (field->value); - free (field); - } -} diff --git a/builder/index-struct.h b/builder/index-struct.h deleted file mode 100644 index ada35e3d7..000000000 --- a/builder/index-struct.h +++ /dev/null @@ -1,67 +0,0 @@ -/* libguestfs virt-builder tool - * Copyright (C) 2013 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. - */ - -/* The data structures produced when parsing the index file. */ - -#ifndef INDEX_STRUCT_H -#define INDEX_STRUCT_H - -/* A section or list of sections. */ -struct section { - struct section *next; - char *name; - struct field *fields; -}; - -/* A field or list of fields. */ -struct field { - struct field *next; - char *key; - char *subkey; - char *value; -}; - -/* A struct holding the data needed during the parsing. */ -struct parse_context { - struct section *parsed_index; /* The result of the parsing. */ - /* yyparse sets this if any comments were seen. Required for checking - * compatibility with virt-builder 1.24. - */ - int seen_comments; - const char *input_file; - const char *progname; - const char *error_suffix; -}; - -/* Initialize the content of a parse_context. */ -extern void parse_context_init (struct parse_context *state); - -/* Free the content of a parse_context. The actual pointer is not freed. */ -extern void parse_context_free (struct parse_context *state); - -/* Free the content of a section, recursively freeing also its fields. - * The actual pointer is not freed. - */ -extern void section_free (struct section *section); - -/* Free the content of a field, recursively freeing also its next field. - * The actual pointer is not freed. - */ -extern void field_free (struct field *field); - -#endif /* INDEX_STRUCT_H */ diff --git a/builder/index-validate.c b/builder/index-validate.c deleted file mode 100644 index 98c4e8279..000000000 --- a/builder/index-validate.c +++ /dev/null @@ -1,186 +0,0 @@ -/* libguestfs virt-builder tool - * Copyright (C) 2013 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "getprogname.h" -#include "guestfs-utils.h" - -#include "index-struct.h" -#include "index-parse.h" - -extern int do_parse (struct parse_context *context, FILE *in); - -static void __attribute__((noreturn)) -usage (int exit_status) -{ - printf ("%s index\n", getprogname ()); - exit (exit_status); -} - -int -main (int argc, char *argv[]) -{ - enum { HELP_OPTION = CHAR_MAX + 1 }; - static const char options[] = "V"; - static const struct option long_options[] = { - { "help", 0, 0, HELP_OPTION }, - { "compat-1.24.0", 0, 0, 0 }, - { "compat-1.24.1", 0, 0, 0 }, - { "version", 0, 0, 'V' }, - { 0, 0, 0, 0 } - }; - int c; - int option_index; - int compat_1_24_0 = 0; - int compat_1_24_1 = 0; - const char *input; - struct section *sections; - struct parse_context context; - FILE *in; - int ret; - - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEBASEDIR); - textdomain (PACKAGE); - - parse_context_init (&context); - - for (;;) { - c = getopt_long (argc, argv, options, long_options, &option_index); - if (c == -1) break; - - switch (c) { - case 0: /* options which are long only */ - if (STREQ (long_options[option_index].name, "compat-1.24.0")) - compat_1_24_0 = compat_1_24_1 = 1; - else if (STREQ (long_options[option_index].name, "compat-1.24.1")) - compat_1_24_1 = 1; - else - error (EXIT_FAILURE, 0, - _("unknown long option: %s (%d)"), - long_options[option_index].name, option_index); - break; - - case 'V': - printf ("%s %s%s\n", - getprogname (), - PACKAGE_VERSION, PACKAGE_VERSION_EXTRA); - exit (EXIT_SUCCESS); - - case HELP_OPTION: - usage (EXIT_SUCCESS); - - default: - usage (EXIT_FAILURE); - } - } - - if (optind != argc-1) - usage (EXIT_FAILURE); - - input = argv[optind++]; - - in = fopen (input, "r"); - if (in == NULL) - error (EXIT_FAILURE, errno, "fopen: %s", input); - - ret = do_parse (&context, in); - - if (fclose (in) == EOF) { - fprintf (stderr, _("%s: %s: error closing input file: %m (ignored)\n"), - getprogname (), input); - } - - if (ret != 0) { - parse_context_free (&context); - error (EXIT_FAILURE, 0, - _("‘%s’ could not be validated, see errors above"), input); - } - - if (compat_1_24_1 && context.seen_comments) { - parse_context_free (&context); - error (EXIT_FAILURE, 0, - _("%s contains comments which will not work with virt-builder 1.24.1"), - input); - } - - /* Iterate over the parsed sections, semantically validating it. */ - for (sections = context.parsed_index; sections != NULL; sections = sections->next) { - int seen_sig = 0; - struct field *fields; - - if (compat_1_24_0) { - if (strchr (sections->name, '_')) { - parse_context_free (&context); - error (EXIT_FAILURE, 0, - _("%s: section [%s] has invalid characters which will not work with virt-builder 1.24.0"), - input, sections->name); - } - } - - for (fields = sections->fields; fields != NULL; fields = fields->next) { - if (compat_1_24_0) { - if (strchr (fields->key, '[') || - strchr (fields->key, ']')) { - parse_context_free (&context); - error (EXIT_FAILURE, 0, - _("%s: section [%s], field ‘%s’ has invalid characters which will not work with virt-builder 1.24.0"), - input, sections->name, fields->key); - } - } - if (compat_1_24_1) { - if (strchr (fields->key, '.') || - strchr (fields->key, ',')) { - parse_context_free (&context); - error (EXIT_FAILURE, 0, - _("%s: section [%s], field ‘%s’ has invalid characters which will not work with virt-builder 1.24.1"), - input, sections->name, fields->key); - } - } - if (STREQ (fields->key, "sig")) - seen_sig = 1; - } - - if (compat_1_24_0 && !seen_sig) { - parse_context_free (&context); - error (EXIT_FAILURE, 0, - _("%s: section [%s] is missing a ‘sig’ field which will not work with virt-builder 1.24.0"), - input, sections->name); - } - } - - /* Free the parsed data. */ - parse_context_free (&context); - - printf ("%s validated OK\n", input); - - exit (EXIT_SUCCESS); -} diff --git a/builder/index.ml b/builder/index.ml deleted file mode 100644 index 303655593..000000000 --- a/builder/index.ml +++ /dev/null @@ -1,86 +0,0 @@ -(* virt-builder - * Copyright (C) 2013-2020 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 Std_utils -open Tools_utils -open Common_gettext.Gettext - -open Utils - -open Printf -open Unix - -type index = (string * entry) list (* string = "os-version" *) -and entry = { - printable_name : string option; (* the name= field *) - osinfo : string option; - file_uri : string; - arch : arch; - signature_uri : string option; (* deprecated, will be removed in 1.26 *) - checksums : Checksums.csum_t list option; - revision : Utils.revision; - format : string option; - size : int64; - compressed_size : int64 option; - expand : string option; - lvexpand : string option; - notes : (string * string) list; - hidden : bool; - aliases : string list option; - - sigchecker : Sigchecker.t; - proxy : Curl.proxy; -} -and arch = - | Arch of string - | GuessedArch of string - -let string_of_arch = function Arch a | GuessedArch a -> a - -let print_entry chan (name, { printable_name; file_uri; arch; osinfo; - signature_uri; checksums; revision; format; - size; compressed_size; expand; lvexpand; - notes; aliases; hidden }) = - let fp fs = fprintf chan fs in - fp "[%s]\n" name; - Option.may (fp "name=%s\n") printable_name; - Option.may (fp "osinfo=%s\n") osinfo; - fp "file=%s\n" file_uri; - fp "arch=%s\n" (string_of_arch arch); - Option.may (fp "sig=%s\n") signature_uri; - Option.may ( - List.iter ( - fun c -> - fp "checksum[%s]=%s\n" - (Checksums.string_of_csum_t c) (Checksums.string_of_csum c) - ) - ) checksums; - fp "revision=%s\n" (string_of_revision revision); - Option.may (fp "format=%s\n") format; - fp "size=%Ld\n" size; - Option.may (fp "compressed_size=%Ld\n") compressed_size; - Option.may (fp "expand=%s\n") expand; - Option.may (fp "lvexpand=%s\n") lvexpand; - List.iter ( - fun (lang, notes) -> - match lang with - | "" -> fp "notes=%s\n" notes - | lang -> fp "notes[%s]=%s\n" lang notes - ) notes; - Option.may (fun l -> fp "aliases=%s\n" (String.concat " " l)) aliases; - if hidden then fp "hidden=true\n" diff --git a/builder/index.mli b/builder/index.mli deleted file mode 100644 index e0b4063a2..000000000 --- a/builder/index.mli +++ /dev/null @@ -1,50 +0,0 @@ -(* virt-builder - * Copyright (C) 2013-2020 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. - *) - -type index = (string * entry) list (* string = "os-version" *) -and entry = { - printable_name : string option; (* the name= field *) - osinfo : string option; - file_uri : string; - arch : arch; - signature_uri : string option; (* deprecated, will be removed in 1.26 *) - checksums : Checksums.csum_t list option; - revision : Utils.revision; - format : string option; - size : int64; - compressed_size : int64 option; - expand : string option; - lvexpand : string option; - notes : (string * string) list; - hidden : bool; - aliases : string list option; - - sigchecker : Sigchecker.t; - proxy : Curl.proxy; -} -and arch = - | Arch of string (** Specified in the metadata. *) - | GuessedArch of string (** Guess from inspection data. *) - -val string_of_arch : arch -> string -(** [string_of_arch a]Get the string value of [a]. *) - -val print_entry : out_channel -> (string * entry) -> unit -(** Debugging helper function dumping an index entry to a stream. - To write entries for non-debugging purpose, use the - [Index_parser.write_entry] function. *) diff --git a/builder/index_parser.ml b/builder/index_parser.ml deleted file mode 100644 index 59fa5097d..000000000 --- a/builder/index_parser.ml +++ /dev/null @@ -1,306 +0,0 @@ -(* virt-builder - * Copyright (C) 2013 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 Std_utils -open Tools_utils -open Common_gettext.Gettext - -open Utils - -open Printf -open Unix - -let get_index ~downloader ~sigchecker ?(template = false) { Sources.uri; proxy } = - let corrupt_file () = - error (f_"The index file downloaded from ‘%s’ is corrupt.\nYou need to ask the supplier of this file to fix it and upload a fixed version.") uri - in - - let rec get_index () = - (* Get the index page. *) - let tmpfile, _ = Downloader.download downloader ~proxy uri in - - (* Check index file signature (also verifies it was fully - * downloaded and not corrupted in transit). - *) - Sigchecker.verify sigchecker tmpfile; - - (* Try parsing the file. *) - let sections = Ini_reader.read_ini tmpfile in - - (* Check for repeated os-version+arch combination. *) - let name_arch_map = List.map ( - fun (n, fields) -> - let rec find_arch = function - | ("arch", None, value) :: y -> value - | _ :: y -> find_arch y - | [] -> "" - in - n, (find_arch fields) - ) sections in - let nseen = Hashtbl.create 13 in - List.iter ( - fun (n, arch) -> - let id = n, arch in - if Hashtbl.mem nseen id then ( - eprintf (f_"%s: index is corrupt: os-version ‘%s’ with architecture ‘%s’ appears two or more times\n") prog n arch; - corrupt_file () - ); - Hashtbl.add nseen id true - ) name_arch_map; - - (* Check for repeated fields. *) - List.iter ( - fun (n, fields) -> - let fseen = Hashtbl.create 13 in - List.iter ( - fun (field, subkey, _) -> - let hashkey = (field, subkey) in - if Hashtbl.mem fseen hashkey then ( - (match subkey with - | Some value -> - eprintf (f_"%s: index is corrupt: %s: field ‘%s[%s]’ appears two or more times\n") prog n field value - | None -> - eprintf (f_"%s: index is corrupt: %s: field ‘%s’ appears two or more times\n") prog n field); - corrupt_file () - ); - Hashtbl.add fseen hashkey true - ) fields - ) sections; - - (* Turn the sections into the final index. *) - let entries = - List.map ( - fun (n, fields) -> - let fields = List.map (fun (k, sk, v) -> (k, sk), v) fields in - let printable_name = - try Some (List.assoc ("name", None) fields) with Not_found -> None in - let osinfo = - try Some (List.assoc ("osinfo", None) fields) with Not_found -> None in - let file_uri = - try make_absolute_uri (List.assoc ("file", None) fields) - with Not_found -> - eprintf (f_"%s: no ‘file’ (URI) entry for ‘%s’\n") prog n; - corrupt_file () in - let arch = - try Index.Arch (List.assoc ("arch", None) fields) - with Not_found -> - if template then - let g = open_guestfs ~identifier:"template" () in - g#add_drive_ro file_uri; - g#launch (); - let roots = g#inspect_os () in - let nroots = Array.length roots in - if nroots <> 1 then ( - eprintf (f_"%s: no ‘arch’ entry for %s and failed to guess it\n") prog n; - corrupt_file () - ); - let inspected_arch = g#inspect_get_arch (Array.get roots 0) in - g#close(); - Index.GuessedArch inspected_arch - else ( - eprintf (f_"%s: no ‘arch’ entry for ‘%s’\n") prog n; - corrupt_file () - ) in - let signature_uri = - try Some (make_absolute_uri (List.assoc ("sig", None) fields)) - with Not_found -> None in - let checksum_sha512 = - try Some (List.assoc ("checksum", Some "sha512") fields) - with Not_found -> - try Some (List.assoc ("checksum", None) fields) - with Not_found -> None in - let revision = - try Rev_int (int_of_string (List.assoc ("revision", None) fields)) - with - | Not_found -> if template then Rev_int 0 else Rev_int 1 - | Failure _ -> - eprintf (f_"%s: cannot parse ‘revision’ field for ‘%s’\n") prog n; - corrupt_file () in - let format = - try Some (List.assoc ("format", None) fields) with Not_found -> None in - let size = - let get_image_size filepath = - (* If a compressed image manages to reach this code, qemu-img just - returns a virtual-size equal to actual-size *) - match detect_file_type filepath with - | `Unknown -> - let infos = Utils.get_image_infos filepath in - JSON_parser.object_get_number "virtual-size" infos - | `XZ | `GZip | `Tar | ` Zip -> - eprintf (f_"%s: cannot determine the virtual size of %s due to compression") - prog filepath; - corrupt_file () in - - try Int64.of_string (List.assoc ("size", None) fields) - with - | Not_found -> - if template then - get_image_size file_uri - else ( - eprintf (f_"%s: no ‘size’ field for ‘%s’\n") prog n; - corrupt_file () - ) - | Failure _ -> - if template then - get_image_size file_uri - else ( - eprintf (f_"%s: cannot parse ‘size’ field for ‘%s’\n") prog n; - corrupt_file () - ) in - let compressed_size = - try Some (Int64.of_string (List.assoc ("compressed_size", None) fields)) - with - | Not_found -> - None - | Failure _ -> - eprintf (f_"%s: cannot parse ‘compressed_size’ field for ‘%s’\n") - prog n; - corrupt_file () in - let expand = - try Some (List.assoc ("expand", None) fields) with Not_found -> None in - let lvexpand = - try Some (List.assoc ("lvexpand", None) fields) with Not_found -> None in - let notes = - let rec loop = function - | [] -> [] - | (("notes", subkey), value) :: xs -> - let subkey = match subkey with - | None -> "" - | Some v -> v in - (subkey, value) :: loop xs - | _ :: xs -> loop xs in - List.sort ( - fun (k1, _) (k2, _) -> - String.compare k1 k2 - ) (loop fields) in - let hidden = - try bool_of_string (List.assoc ("hidden", None) fields) - with - | Not_found -> false - | Failure _ -> - eprintf (f_"%s: cannot parse ‘hidden’ field for ‘%s’\n") - prog n; - corrupt_file () in - let aliases = - let l = - try String.nsplit " " (List.assoc ("aliases", None) fields) - with Not_found -> [] in - match l with - | [] -> None - | l -> Some l in - - let checksums = - match checksum_sha512 with - | Some c -> Some [Checksums.SHA512 c] - | None -> None in - - let entry = { Index.printable_name = printable_name; - osinfo = osinfo; - file_uri = file_uri; - arch = arch; - signature_uri = signature_uri; - checksums = checksums; - revision = revision; - format = format; - size = size; - compressed_size = compressed_size; - expand = expand; - lvexpand = lvexpand; - notes = notes; - hidden = hidden; - aliases = aliases; - proxy = proxy; - sigchecker = sigchecker } in - n, entry - ) sections in - - if verbose () then ( - printf "index file (%s) after parsing (C parser):\n" uri; - List.iter (Index.print_entry Pervasives.stdout) entries - ); - - entries - - (* Verify same-origin policy for the file= and sig= fields. *) - and make_absolute_uri path = - if String.length path = 0 then ( - eprintf (f_"%s: zero length path in the index file\n") prog; - corrupt_file () - ) - else if String.find path "://" >= 0 then ( - eprintf (f_"%s: cannot use a URI (‘%s’) in the index file\n") prog path; - corrupt_file () - ) - else if path.[0] = '/' then ( - eprintf (f_"%s: you must use relative paths (not ‘%s’) in the index file\n") prog path; - corrupt_file () - ) - else ( - (* Construct the URI. *) - try - let i = String.rindex uri '/' in - String.sub uri 0 (i+1) ^ path - with - Not_found -> uri // path - ) - in - - get_index () - -let write_entry chan (name, { Index.printable_name; file_uri; arch; osinfo; - signature_uri; checksums; revision; format; size; - compressed_size; expand; lvexpand; notes; - aliases; hidden}) = - let fp fs = fprintf chan fs in - fp "[%s]\n" name; - Option.may (fp "name=%s\n") printable_name; - Option.may (fp "osinfo=%s\n") osinfo; - fp "file=%s\n" file_uri; - fp "arch=%s\n" (Index.string_of_arch arch); - Option.may (fp "sig=%s\n") signature_uri; - (match checksums with - | None -> () - | Some checksums -> - List.iter ( - fun c -> - fp "checksum[%s]=%s\n" - (Checksums.string_of_csum_t c) (Checksums.string_of_csum c) - ) checksums - ); - fp "revision=%s\n" (string_of_revision revision); - Option.may (fp "format=%s\n") format; - fp "size=%Ld\n" size; - Option.may (fp "compressed_size=%Ld\n") compressed_size; - Option.may (fp "expand=%s\n") expand; - Option.may (fp "lvexpand=%s\n") lvexpand; - - let format_notes notes = - String.concat "\n " (String.nsplit "\n" notes) in - - List.iter ( - fun (lang, notes) -> - match lang with - | "" -> fp "notes=%s\n" (format_notes notes) - | lang -> fp "notes[%s]=%s\n" lang (format_notes notes) - ) notes; - (match aliases with - | None -> () - | Some l -> fp "aliases=%s\n" (String.concat " " l) - ); - if hidden then fp "hidden=true\n"; - fp "\n" diff --git a/builder/index_parser.mli b/builder/index_parser.mli deleted file mode 100644 index dc6b0b407..000000000 --- a/builder/index_parser.mli +++ /dev/null @@ -1,26 +0,0 @@ -(* virt-builder - * Copyright (C) 2013 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. - *) - -val get_index : downloader:Downloader.t -> sigchecker:Sigchecker.t -> ?template:bool -> Sources.source -> Index.index -(** [get_index download sigchecker template source] will parse the source - index file into an index entry list. If the template flag is set to - true, the parser will be less picky about missing values. *) - -val write_entry : out_channel -> (string * Index.entry) -> unit -(** [write_entry chan entry] writes the index entry to the chan output - stream.*) diff --git a/builder/index_parser_tests.ml b/builder/index_parser_tests.ml deleted file mode 100644 index 2123f9b06..000000000 --- a/builder/index_parser_tests.ml +++ /dev/null @@ -1,130 +0,0 @@ -(* builder - * Copyright (C) 2017 SUSE 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. - *) - -(* This file tests the Index_parser module. *) - -open Printf - -open OUnit2 - -open Std_utils -open Unix_utils -open Tools_utils - -let tmpdir = - let tmpdir = Mkdtemp.temp_dir "guestfs-tests." in - rmdir_on_exit tmpdir; - tmpdir - -let dummy_sigchecker = Sigchecker.create ~gpg:"gpg" - ~check_signature:false - ~gpgkey:Utils.No_Key - ~tmpdir - -let dummy_downloader = Downloader.create ~curl:"do-not-use-curl" - ~cache:None ~tmpdir - -(* Utils. *) -let write_entries file entries = - let chan = open_out (tmpdir // file) in - List.iter (Index_parser.write_entry chan) entries; - close_out chan - -let read_file file = - read_whole_file (tmpdir // file) - -let parse_file file = - let source = { Sources.name = "input"; - uri = tmpdir // file; - gpgkey = Utils.No_Key; - proxy = Curl.SystemProxy; - format = Sources.FormatNative } in - let entries = Index_parser.get_index ~downloader:dummy_downloader - ~sigchecker:dummy_sigchecker - source in - List.map ( - fun (id, e) -> (id, { e with Index.file_uri = Filename.basename e.Index.file_uri }) - ) entries - -let format_entries entries = - let format_entry entry = - write_entries "out" [entry]; - read_file "out" in - List.map format_entry entries - -let assert_equal_string = assert_equal ~printer:(fun x -> sprintf "\"%s\"" x) -let assert_equal_list formatter = - let printer = ( - fun x -> "(" ^ (String.escaped (String.concat "," (formatter x))) ^ ")" - ) in - assert_equal ~printer - -let test_write_complete ctx = - let entry = - ("test-id", { Index.printable_name = Some "test_name"; - osinfo = Some "osinfo_data"; - file_uri = "image_path"; - arch = Index.Arch "test_arch"; - signature_uri = None; - checksums = Some [Checksums.SHA512 "512checksum"]; - revision = Utils.Rev_int 42; - format = Some "qcow2"; - size = Int64.of_int 123456; - compressed_size = Some (Int64.of_int 12345); - expand = Some "/dev/sda1"; - lvexpand = Some "/some/lv"; - notes = [ ("", "Notes split\non several lines\n\n with starting space ") ]; - hidden = false; - aliases = Some ["alias1"; "alias2"]; - sigchecker = dummy_sigchecker; - proxy = Curl.SystemProxy }) in - - write_entries "out" [entry]; - let actual = read_file "out" in - let expected = "[test-id] -name=test_name -osinfo=osinfo_data -file=image_path -arch=test_arch -checksum[sha512]=512checksum -revision=42 -format=qcow2 -size=123456 -compressed_size=12345 -expand=/dev/sda1 -lvexpand=/some/lv -notes=Notes split - on several lines - - with starting space -aliases=alias1 alias2 - -" in - assert_equal_string expected actual; - - let parsed_entries = parse_file "out" in - assert_equal_list format_entries [entry] parsed_entries - -let suite = - "builder Index_parser" >::: - [ - "write.complete" >:: test_write_complete; - ] - -let () = - run_test_tt_main suite diff --git a/builder/ini_reader.ml b/builder/ini_reader.ml deleted file mode 100644 index ba5b8949a..000000000 --- a/builder/ini_reader.ml +++ /dev/null @@ -1,41 +0,0 @@ -(* virt-builder - * Copyright (C) 2013-2020 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 Std_utils -open Tools_utils - -type sections = section list -and section = string * fields (* [name] + fields *) -and fields = field list -and field = string * string option * string (* key + subkey + value *) - -(* Types returned by the C index parser. *) -type c_sections = c_section array -and c_section = string * c_fields (* [name] + fields *) -and c_fields = field array - -(* Calls yyparse in the C code. *) -external parse_index : prog:string -> error_suffix:string -> string -> c_sections = "virt_builder_parse_index" - -let read_ini ?(error_suffix = "") file = - let sections = parse_index ~prog ~error_suffix file in - let sections = Array.to_list sections in - List.map ( - fun (n, fields) -> - n, Array.to_list fields - ) sections diff --git a/builder/ini_reader.mli b/builder/ini_reader.mli deleted file mode 100644 index 8a014d09b..000000000 --- a/builder/ini_reader.mli +++ /dev/null @@ -1,24 +0,0 @@ -(* virt-builder - * Copyright (C) 2013-2020 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. - *) - -type sections = section list -and section = string * fields (* [name] + fields *) -and fields = field list -and field = string * string option * string (* key + subkey + value *) - -val read_ini : ?error_suffix:string -> string -> sections diff --git a/builder/languages.ml b/builder/languages.ml deleted file mode 100644 index ab3ac92dd..000000000 --- a/builder/languages.ml +++ /dev/null @@ -1,57 +0,0 @@ -(* virt-builder - * Copyright (C) 2013-2020 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 Std_utils -open Tools_utils - -let re_locale = - PCRE.compile ~caseless:true "^([a-z]+)(_([a-z]+))?(\\.([a-z0-9-]+))?(@([a-z]+))?$" - -let split_locale loc = - let l = ref [] in - if PCRE.matches re_locale loc then ( - let match_or_empty n = try PCRE.sub n with Not_found -> "" in - let lang = PCRE.sub 1 in - let territory = match_or_empty 3 in - (match territory with - | "" -> () - | territory -> List.push_front (lang ^ "_" ^ territory) l); - List.push_front lang l; - ); - List.push_front "" l; - List.rev !l - -let languages () = - match Setlocale.setlocale Setlocale.LC_MESSAGES None with - | None -> [""] - | Some locale -> split_locale locale - -let find_notes languages notes = - let notes = List.fold_left ( - fun acc lang -> - let res = List.filter ( - fun (langkey, _) -> - match langkey with - | "C" -> lang = "" - | langkey -> langkey = lang - ) notes in - match res with - | (_, noteskey) :: _ -> noteskey :: acc - | [] -> acc - ) [] languages in - List.rev notes diff --git a/builder/languages.mli b/builder/languages.mli deleted file mode 100644 index f096e9aa5..000000000 --- a/builder/languages.mli +++ /dev/null @@ -1,21 +0,0 @@ -(* virt-builder - * Copyright (C) 2014 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. - *) - -val languages : unit -> string list - -val find_notes : string list -> (string * string) list -> string list diff --git a/builder/libguestfs.conf.in b/builder/libguestfs.conf.in deleted file mode 100644 index 412079df6..000000000 --- a/builder/libguestfs.conf.in +++ /dev/null @@ -1,7 +0,0 @@ -[libguestfs.org] -uri=http://builder.libguestfs.org/index.asc -gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/libguestfs.gpg - -[archive.libguestfs.org] -uri=http://archive.libguestfs.org/builder/index.asc -gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/libguestfs.gpg diff --git a/builder/libguestfs.gpg b/builder/libguestfs.gpg deleted file mode 100644 index 306a234f9..000000000 --- a/builder/libguestfs.gpg +++ /dev/null @@ -1,64 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.14 (GNU/Linux) - -mQINBE6UMMEBEADM811hfTulaF4JpkVpAI10FImyb4ArvOiu8NdcUwTFo+cyWno3 -U85B86H1Bsk/LgLTYtthSrTgsCtdxy+i5OaMjxZDIwKQ2+IYI3FCn9T3Mn28Idyh -kLHzrO9ph0Dv0BNfrlDZhQEC53aAFe/QxN7+A49BNBV7D1VAOOCsHjxMEDzcZkCa -oCrtXw1aNm2vkkj5ukbfukHAyLcQL7kow0qKPSVa1G4lfQP0WiG259Ydy+sUmbVb -TGdb6MEC84PQRDuw6/ZeoV04tn7ZNtQEMOS0uiciHOGfr2hBxQf9VIPNrHg42yaL -dOv51D99GuaxZ9E0HSoH/RwB1oXgd6rFdqVNYaBIQnnkwJANUEeGBArtIOZNCADT -Bt8vkSDm+lLEAFS+V8CACyW/LMIrGCvLdHeqtoAv0GDVyR2GPxldYfdtEmCUMWcb -Jlf71V9iAse2gUdoiHp5FfpGMkA5j7idKuxIws11XxRZJXXbBqiBqmVEAQ/v0m6p -kdo0MYTHydmecLuUK2bAGhpysfX97EfTSrxfrYphYWjTfKRD9GrADeZNfuz1DbKs -7LSqVaQJSjQrfgAwcnZLRaU0V4P5zxiz50gz1Aj3AZRL+Y3meZenzZTXcLFdnusg -wUfhhCuL3tluMtEh6tznumyxb43WO1yLwj6J6LtveiuJN1Z+KSQ6OieZcwARAQAB -tCVSaWNoYXJkIFcuTS4gSm9uZXMgPHJpY2hAYW5uZXhpYS5vcmc+iQI4BBMBAgAi -BQJOlDDBAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCRc49z4bdooHQY -D/wJLklSZNyXIW+rG5sUbg7j9cTIF5p/lB9kI2yx6KodJp/2knKyvnmzz0gBw/OE -HL4E4UW26oWKo+36I8wkBnuGa6UtANeITcJqFE19VpHEXHsxre64jNQnO8/w748W -1ROW+Ry43xmrlRWKuCm4oPYUzlp0fq9ATAne8eblfG+NOs8DYuA8xZNQzFaI2kDC -QLD4YoXLoNsP27Koga36b0KwxPFD9tyVZiu9XDH/3hMN7Nb15B66PFr+HcMmQ67G -nUIN5ulcIwj38i40cyaTs1VRheOzTHXE/a6Q2AhMKiKqOoEjQ73/mV7cAVoPtM3o -83Q/8aVKBH0bVRwAeV1tju6b14fqKoG0zNBEcXdlSkht6ScxJYIc/LPUxAMDwgSE -OWshjmeRzKXypBbHn/DP8QVyM2gk5wY+mMSH7MpR0p/hgj+rFO8H9L7pC4dCog3E -qzrYhRN+TaP6MPH3WkOwPH4d4IfQRFnHp+VPYPijKEiLrUl/o8k3DyAanAPBpJ/x -na4wXAjlFBctOq6g+SrCUiHpwk7b2YNwGgr5Vl3GmZELzK/G8gg3uJYKQ9Bpv16t -WWOz+IFiOFa0UULeo0QPmFAIMZiDojNsY1SwBKB3ZL1YWZezgMdQAbpze/IXoSt7 -zxWJoKH2jK7q9mvFiaY12l2YnKuCcegWVAViLxRpBnrbz7QmUmljaGFyZCBXLk0u -IEpvbmVzIDxyam9uZXNAcmVkaGF0LmNvbT6JAjgEEwECACIFAk6UOQsCGwMGCwkI -BwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEJFzj3Pht2igIUYQAKomI0edLakahsUQ -MxOZuhBbXJ4/VWF8bXYChDNPKvJp5nB7fBXujJ+39cIUM5fe2ViO6qSDpFC29imx -F5pPbAqspZBPBkLLiZLji8R42hGarntdtTW0UWSBpq+nC5+G1psrnATI3uXGNxKQ -R99c5HoMY7dBC2Y8TCGE64NINZ/XVh472s6IGLPn8MTn26YdRKC9BrVkCFMP2OBr -6D4IprnyTAWAzb68ew20QmyWO+NBi9MplaDNQVl8PIOgfpyWlkgX1z9m67pcSDkw -46hksp0yuOD1VwR4iVZ2/CmIsGRUlx41vWD6BIp9KxKyDIU1CYTRhq72dahHsl/8 -BjCndV5PO0GphqfCzmCv4DXjUwmrMTbH/GFnt5rfwcMcXUgcK0vV9vQ2SOU56Zd1 -fb27ZCFJKZc0Fu8krwFldCp/NYILf6ogUL/C1hfuCGSSuyDVY16Gg3dla1x+6zpF -asnWQlaw8xT5LlMWvTZs5WsoSVHu7dVZWlgxINP++hlZrTz/S8l38yyQ15YFFl3W -9M7dzkegOeDTPfx6B89WgfvfJjA/D0/FYxxWPXEtrn9DlJ4daEJqNsrvfLErz9R8 -4IQmfmhR93j+rdotner+6keC/wVByEfbW1wmXtmFKXQ6srdpj8VKRFrvkyXVgepM -DypLgRH2v7lL2kdWhUu2y4EAgrwzuQINBE6UMMEBEADxQxMgUuDrw5GT4tqARTPI -SSdNcUsRxRhVA8srYOyECliE+B3TwcRDFBs+MyPFJVEuX8fi4eGj/AK5t1GHerfk -orUGlz72q4c7LLhkfZrsuJbk2dgkjvldKJnIazQJa6epGLqdsE5RlmSgwedIbtMd -naGJBQH8aKP/Wi1+wUxsm5N3p7+R2WRx48VfpEhYB+Zf/FkFm1Ycjwh57KQ0+OHw -ykf8VfMisxuH30tDxOCV+VptWKfOF2rDNdaNPWhij2YIjhJXRpkuRR+1PpI4jLaD -JxcVZmG/0zucacupUN2g5OUH59ySU/totD6YMnmp3FONoyF1uIEJo6Vs30npHGkO -XgBo3Pxt7oLJeykLPtdSLgm3cwXIYMWarVsAkKNXitQIVGpVRLeaK373VwmXFqoi -M2SMHeawTUdOORFjpQzkknlJWM1TmUVtHHKt8Pl9+/5+wXKyt2IDdcUkMrB6K5qF -fb7EwVhoI8ehJQK+eeDCjFwCAiwB3iV8JlyW+tEU7JuyXOQlwY1VWm/WqMD8gaRi -rT+RFDFliZ3tQbW2pqUoZBROV5HN4tieDfwxGKCvk6Tsdb30zA9DPQp93+238bYf -312sg9R+CD0AqxoxFG5FJu4HShcPRrPnYtRZqKRe40GDWvBEArXZprwL1qrP+Kl/ -mRrEQpxAGIoFG8HbVvD3EQARAQABiQIfBBgBAgAJBQJOlDDBAhsMAAoJEJFzj3Ph -t2igSLQP/2uIrAY2CDr0kWBJiD3TztiHy8IdxwUpyTBTebwmAbi44/EvtJfIisrG -YjKIEv/w0E61gO7O1JBG4+IG93W+v9fTT/e39JMyxsYqoZZHUhP11Okx5grDS5b0 -O8VXOmXVRMdVNfstRBr10HD9uNDq7ruKD18TxYTwN0GPD4gj1dbHQDR77Tr5cyBs -6Ou5PBOH4r3qcqf/cJUSMeUUu75xLwixux6E7tD2S+t6F07wlWxntUcPtzyAHj20 -J89orUC+dT6r6MypBoI0jdJCp9JPGtR7i+fE5Gm4E5+AUSubLPtZGRY9Um2eMoS2 -DnQpGOKx1VvsixR/Kw44j2tRAvmYMS4iDKcuZU+nZ+xokAgObILj/b9n/Qe2/fXy -CFdcgSvbm+dV1fZxsdMF/P9OU8aqdT9A9Fv5y+cDMEg4DVnhwMJTxGh/TCkw/H+A -frHEtRc98lSQN5odpITNG17mG6JOdHM+wA57qHH0uy4+5RsbyAJahcdBcmObK/RF -i4WZlThpbHftX5O/LH98aYQ2fJayIxv1EAjzOBOQ0MfBHI0KCJR1pysEisX28sJA -Ic73gnJJ3BLZbqfBRgxjNMNroxC+5Tw6uPGFHa3YnuIAxxw0HcDVZ9vnTWBWFPGw -ZvXkQ3FVJwZoLmHw47vvlVpLD/4gi1SuHWieRvZ+UdDq00E348pm -=neBW ------END PGP PUBLIC KEY BLOCK----- diff --git a/builder/list_entries.ml b/builder/list_entries.ml deleted file mode 100644 index f1f67290c..000000000 --- a/builder/list_entries.ml +++ /dev/null @@ -1,156 +0,0 @@ -(* virt-builder - * Copyright (C) 2013 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 Std_utils -open Tools_utils -open Common_gettext.Gettext - -open Printf - -type format = - | Short - | Long - | Json - -let list_formats = [ "short"; "long"; "json" ] - -let list_format_of_string = function - | "short" -> Short - | "long" -> Long - | "json" -> Json - | fmt -> invalid_arg fmt - -let rec list_entries ~list_format ~sources index = - match list_format with - | Short -> list_entries_short index - | Long -> list_entries_long ~sources index - | Json -> list_entries_json ~sources index - -and list_entries_short index = - List.iter ( - fun (name, { Index.printable_name; arch; hidden }) -> - if not hidden then ( - printf "%-24s" name; - printf " %-10s" (Index.string_of_arch arch); - Option.may (printf " %s") printable_name; - printf "\n" - ) - ) index - -and list_entries_long ~sources index = - let langs = Languages.languages () in - - List.iter ( - fun { Sources.uri; gpgkey } -> - printf (f_"Source URI: %s\n") uri; - (match gpgkey with - | Utils.No_Key -> () - | Utils.Fingerprint fp -> - printf (f_"Fingerprint: %s\n") fp; - | Utils.KeyFile kf -> - printf (f_"Key: %s\n") kf; - ); - printf "\n" - ) sources; - - List.iter ( - fun (name, { Index.printable_name; arch; size; compressed_size; - notes; aliases; hidden }) -> - if not hidden then ( - printf "%-24s %s\n" "os-version:" name; - Option.may (printf "%-24s %s\n" (s_"Full name:")) printable_name; - printf "%-24s %s\n" (s_"Architecture:") (Index.string_of_arch arch); - printf "%-24s %s\n" (s_"Minimum/default size:") (human_size size); - Option.may (fun size -> - printf "%-24s %s\n" (s_"Download size:") (human_size size) - ) compressed_size; - Option.may ( - fun l -> printf "%-24s %s\n" (s_"Aliases:") (String.concat " " l) - ) aliases; - let notes = Languages.find_notes langs notes in - (match notes with - | notes :: _ -> - printf "\n"; - printf (f_"Notes:\n\n%s\n") notes - | [] -> () - ); - printf "\n" - ) - ) index - -and list_entries_json ~sources index = - let json_sources = - List.map ( - fun { Sources.uri; gpgkey } -> - let item = [ "uri", JSON.String uri ] in - let item = - match gpgkey with - | Utils.No_Key -> item - | Utils.Fingerprint fp -> - ("fingerprint", JSON.String fp) :: item - | Utils.KeyFile kf -> - ("key", JSON.String kf) :: item in - JSON.Dict item - ) sources in - let json_templates = - List.map ( - fun (name, { Index.printable_name; arch; size; compressed_size; - notes; aliases; osinfo; hidden }) -> - let item = [ "os-version", JSON.String name ] in - let item = - match printable_name with - | None -> item - | Some str -> ("full-name", JSON.String str) :: item in - let item = ("arch", JSON.String (Index.string_of_arch arch)) :: item in - let item = ("size", JSON.Int size) :: item in - let item = - match compressed_size with - | None -> item - | Some n -> ("compressed-size", JSON.String (Int64.to_string n)) :: item in - let item = - let json_notes = - List.fold_right ( - fun (lang, langnotes) acc -> - let lang = - match lang with - | "" -> "C" - | x -> x in - (lang, JSON.String langnotes) :: acc - ) notes [] in - if List.length json_notes = 0 then item - else ("notes", JSON.Dict json_notes) :: item in - let item = - match aliases with - | None -> item - | Some l -> - let l = List.map (fun x -> JSON.String x) l in - ("aliases", JSON.List l) :: item in - let item = - match osinfo with - | None -> item - | Some str -> ("osinfo", JSON.String str) :: item in - let item = ("hidden", JSON.Bool hidden) :: item in - JSON.Dict (List.rev item) - ) index in - let doc = [ - "version", JSON.Int 1L; - "sources", JSON.List json_sources; - "templates", JSON.List json_templates; - ] in - print_string (JSON.string_of_doc ~fmt:JSON.Indented doc); - print_newline () diff --git a/builder/list_entries.mli b/builder/list_entries.mli deleted file mode 100644 index 008b90623..000000000 --- a/builder/list_entries.mli +++ /dev/null @@ -1,33 +0,0 @@ -(* virt-builder - * Copyright (C) 2013 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. - *) - -type format = - | Short - | Long - | Json - -val list_formats : string list -(** The string representation of the available formats. *) - -val list_format_of_string : string -> format -(** Convert from a string to the corresponding format. - - Throw [Invalid_argument] if the string does not match any - valid format. *) - -val list_entries : list_format:format -> sources:Sources.source list -> Index.index -> unit diff --git a/builder/opensuse.conf.in b/builder/opensuse.conf.in deleted file mode 100644 index 80db26711..000000000 --- a/builder/opensuse.conf.in +++ /dev/null @@ -1,3 +0,0 @@ -[opensuse.org] -uri=http://download.opensuse.org/repositories/Virtualization:/virt-builder-images/images/index -gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/opensuse.gpg diff --git a/builder/opensuse.gpg b/builder/opensuse.gpg deleted file mode 100644 index 001376f0f..000000000 --- a/builder/opensuse.gpg +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.5 (GNU/Linux) - -mQENBFImAl0BCACkjaXGvVLHBGTVXVP0khtpUVHqFvCRtaIIMHaX/5oTr3nyehDQ -Ex9VLsSRcNa0QxtnCHFRQzjWWqe+i6pBginnSjucgmjnIKyJsF4l6R+rwAiinHQX -C4s6Lqg/wH9xDPRBrMYFqlc/7MVf0Glhk1+lAxgQjolMt+5AbbrWlBbwc/i+++zl -ES3MaeH8aiwup/ogjhmk0SbCQQ/ib21p3XWBwx2oz/KM6Voq9tKDvMczjzNRY3ZT -6Di3FsUSKI7kgljiNiuN+675YwqEqxWEJgdE5a7Zb67giH1Ik08b5wQiF5jSAICD -DxW7/ibWBvZJnqhqQT2xJpLC5VaJqwkN8o83ABEBAAG0PlZpcnR1YWxpemF0aW9u -IE9CUyBQcm9qZWN0IDxWaXJ0dWFsaXphdGlvbkBidWlsZC5vcGVuc3VzZS5vcmc+ -iQE7BBMBAgAmBQJSJgJdAhsDBQkEHrAABgsJCAcDAgQVAggDBBYCAwECHgECF4AA -CgkQoZP7tXIXT8ITnwf3SVUUoVjVLFCjhIxdet8BL011cJDwr9TwKEQfq4Ybsq5L -5Y1/Zk86rTzrVOZrODLwNRIC3fMuegZV5f85KMggXu37Di+UvX+dQW9v1hte+hAT -+gsqb60kOnE/Yacgkb6D3xIzRudAB2q/xfvHl/hgfn416yGI8NvntT7n4Hk9wT28 -9JSFkun0uaessg77aXlAdsqHwdugm9hELeva89OoYoiZ4d9r4ScTMSj0UkNgnh7g -CyIScZHYqiiOeosUtAX9u1PyUFfFsg9s5snfud7aF48EfXU0RTtZAGKtG4GPDv3q -bYc5TJ2pQzs9y5Bk/jAMR/QQw8CKglBsn1cjYkKViEYEExECAAYFAlImAl0ACgkQ -OzARt2udZSO5yACgr6Ei7QZ+PAmg4Mr5db+4M3aepAEAniU33RaTKBCGkwQi6kHr -4VaII2/E -=l8DH ------END PGP PUBLIC KEY BLOCK----- diff --git a/builder/osinfo.ml b/builder/osinfo.ml deleted file mode 100644 index aff132742..000000000 --- a/builder/osinfo.ml +++ /dev/null @@ -1,76 +0,0 @@ -(* virt-builder - * 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 Std_utils -open Tools_utils -open Osinfo_config - -let rec fold fn base = - let locations = - (* (1) Try the shared osinfo directory, using either the - * $OSINFO_SYSTEM_DIR envvar or its default value. - *) - let dir = - try Sys.getenv "OSINFO_SYSTEM_DIR" - with Not_found -> "/usr/share/osinfo" in - ((dir // "os"), read_osinfo_db_three_levels) :: - - (* (2) Try the libosinfo directory, using the newer three-directory - * layout ($LIBOSINFO_DB_PATH / "os" / $group-ID / [file.xml]). - *) - let path = Osinfo_config.libosinfo_db_path // "os" in - (path, read_osinfo_db_three_levels) :: - - (* (3) Try the libosinfo directory, using the old flat directory - * layout ($LIBOSINFO_DB_PATH / "oses" / [file.xml]). - *) - let path = Osinfo_config.libosinfo_db_path // "oses" in - (path, read_osinfo_db_flat) :: [] in - - - let files = - List.flatten ( - List.filter_map ( - fun (path, f) -> - if is_directory path then Some (f path) - (* This is not an error: RHBZ#948324. *) - else None - ) locations - ) in - - List.fold_left fn base files - -and read_osinfo_db_three_levels path = - debug "osinfo: loading 3-level-directories database from %s" path; - let entries = Array.to_list (Sys.readdir path) in - let entries = List.map ((//) path) entries in - (* Iterate only on directories. *) - let entries = List.filter is_directory entries in - List.flatten (List.map read_osinfo_db_directory entries) - -and read_osinfo_db_flat path = - debug "osinfo: loading flat database from %s" path; - read_osinfo_db_directory path - -and read_osinfo_db_directory path = - let entries = Sys.readdir path in - let entries = Array.to_list entries in - let entries = List.filter (fun x -> Filename.check_suffix x ".xml") entries in - let entries = List.map ((//) path) entries in - let entries = List.filter is_regular_file entries in - entries diff --git a/builder/osinfo.mli b/builder/osinfo.mli deleted file mode 100644 index fa179509d..000000000 --- a/builder/osinfo.mli +++ /dev/null @@ -1,22 +0,0 @@ -(* virt-builder - * 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. - *) - -val fold : ('a -> string -> 'a) -> 'a -> 'a -(** [fold f base] folds function [f] over every file in the - osinfo-db/libosinfo database of OS definitions. - *) diff --git a/builder/osinfo_config.mli b/builder/osinfo_config.mli deleted file mode 100644 index 60f1b88da..000000000 --- a/builder/osinfo_config.mli +++ /dev/null @@ -1,21 +0,0 @@ -(* virt-builder - * 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. - *) - -val libosinfo_db_path : string -(** The path to the libosinfo database. Note the path is generated - at runtime by [Makefile.am]. *) diff --git a/builder/paths.ml b/builder/paths.ml deleted file mode 100644 index b8ce57191..000000000 --- a/builder/paths.ml +++ /dev/null @@ -1,42 +0,0 @@ -(* virt-builder - * Copyright (C) 2014 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 Std_utils -open Tools_utils - -let xdg_cache_home = - try Some (Sys.getenv "XDG_CACHE_HOME" // "virt-builder") - with Not_found -> - try Some (Sys.getenv "HOME" // ".cache" // "virt-builder") - with Not_found -> - None (* no cache directory *) - -let xdg_config_home () = - try Some (Sys.getenv "XDG_CONFIG_HOME" // prog) - with Not_found -> - try Some (Sys.getenv "HOME" // ".config" // prog) - with Not_found -> - None (* no config directory *) - -let xdg_config_dirs () = - let dirs = - try Sys.getenv "XDG_CONFIG_DIRS" - with Not_found -> "/etc/xdg" in - let dirs = String.nsplit ":" dirs in - let dirs = List.filter (fun x -> x <> "") dirs in - List.map (fun x -> x // prog) dirs diff --git a/builder/paths.mli b/builder/paths.mli deleted file mode 100644 index 566c323e5..000000000 --- a/builder/paths.mli +++ /dev/null @@ -1,28 +0,0 @@ -(* virt-builder - * Copyright (C) 2014-2020 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. - *) - -val xdg_cache_home : string option -(** [$XDG_CACHE_HOME/virt-builder] or [$HOME/.cache/virt-builder] or [None]. *) - -val xdg_config_home : unit -> string option -(** [$XDG_CONFIG_HOME/prog] or [$HOME/.config/prog] or [None]. *) - -val xdg_config_dirs : unit -> string list -(** [$XDG_CONFIG_DIRS] (which is a colon-separated path), split. Empty - elements are removed from the list. If the environment variable - is not set [["/etc/xdg"]] is returned instead. *) diff --git a/builder/pxzcat-c.c b/builder/pxzcat-c.c deleted file mode 100644 index 15c3c32c0..000000000 --- a/builder/pxzcat-c.c +++ /dev/null @@ -1,692 +0,0 @@ -/* virt-builder - * Copyright (C) 2013 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include "guestfs.h" -#include "guestfs-utils.h" - -#include "ignore-value.h" - -#if HAVE_LIBLZMA -#include -#endif - -#if defined (HAVE_LIBLZMA) && \ - defined (HAVE_LZMA_INDEX_STREAM_FLAGS) && \ - defined (HAVE_LZMA_INDEX_STREAM_PADDING) -#define PARALLEL_XZCAT 1 -#else -#define PARALLEL_XZCAT 0 -#endif - -extern value virt_builder_using_parallel_xzcat (value unitv); - -value -virt_builder_using_parallel_xzcat (value unitv) -{ - return PARALLEL_XZCAT ? Val_true : Val_false; -} - -#if PARALLEL_XZCAT -static void pxzcat (value filenamev, value outputfilev, unsigned nr_threads); -#endif /* PARALLEL_XZCAT */ - -extern value virt_builder_pxzcat (value inputfilev, value outputfilev); - -value -virt_builder_pxzcat (value inputfilev, value outputfilev) -{ - CAMLparam2 (inputfilev, outputfilev); - -#if PARALLEL_XZCAT - - /* Parallel implementation of xzcat (pxzcat). */ - /* XXX Make number of threads configurable? */ - long i; - unsigned nr_threads; - - i = sysconf (_SC_NPROCESSORS_ONLN); - if (i <= 0) { - perror ("could not get number of cores"); - i = 1; - } - nr_threads = (unsigned) i; - - /* NB: This might throw an exception if something fails. If it - * does, this function won't return as a regular C function. - */ - pxzcat (inputfilev, outputfilev, nr_threads); - -#else /* !PARALLEL_XZCAT */ - - /* Fallback: use regular xzcat. */ - int fd; - pid_t pid; - int status; - - fd = open (String_val (outputfilev), O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY, 0666); - if (fd == -1) - unix_error (errno, (char *) "open", outputfilev); - - pid = fork (); - if (pid == -1) { - const int err = errno; - close (fd); - unix_error (err, (char *) "fork", Nothing); - } - - if (pid == 0) { /* child - run xzcat */ - dup2 (fd, 1); - execlp (XZCAT, XZCAT, String_val (inputfilev), NULL); - perror (XZCAT); - _exit (EXIT_FAILURE); - } - - close (fd); - - if (waitpid (pid, &status, 0) == -1) - unix_error (errno, (char *) "waitpid", Nothing); - if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) - caml_failwith (XZCAT " program failed, see earlier error messages"); - -#endif /* !PARALLEL_XZCAT */ - - CAMLreturn (Val_unit); -} - -#if PARALLEL_XZCAT - -#define DEBUG 0 - -#if DEBUG -#define debug(fs,...) fprintf (stderr, "pxzcat: debug: " fs "\n", ## __VA_ARGS__) -#else -#define debug(fs,...) /* nothing */ -#endif - -/* Size of buffers used in decompression loop. */ -#define BUFFER_SIZE (64*1024) - -#define XZ_HEADER_MAGIC "\xfd" "7zXZ\0" -#define XZ_HEADER_MAGIC_LEN 6 - -static int check_header_magic (int fd); -static lzma_index *parse_indexes (value filenamev, int fd); -static void iter_blocks (lzma_index *idx, unsigned nr_threads, value filenamev, int fd, value outputfilev, int ofd); - -static void -pxzcat (value filenamev, value outputfilev, unsigned nr_threads) -{ - int fd, ofd; - uint64_t size; - lzma_index *idx; - - /* Open the file. */ - fd = open (String_val (filenamev), O_RDONLY); - if (fd == -1) - unix_error (errno, (char *) "open", filenamev); - - guestfs_int_fadvise_noreuse (fd); - guestfs_int_fadvise_random (fd); - - /* Check file magic. */ - if (!check_header_magic (fd)) { - close (fd); - caml_invalid_argument ("input file is not an xz file"); - } - - /* Read and parse the indexes. */ - idx = parse_indexes (filenamev, fd); - - /* Get the file uncompressed size, create the output file. */ - size = lzma_index_uncompressed_size (idx); - debug ("uncompressed size = %" PRIu64 " bytes", size); - - /* Avoid annoying ext4 auto_da_alloc which causes a flush on close - * unless we are very careful about not truncating a regular file - * from non-zero size to zero size. (Thanks Eric Sandeen) - */ - ofd = open (String_val (outputfilev), O_WRONLY|O_CREAT|O_NOCTTY, 0644); - if (ofd == -1) { - const int err = errno; - close (fd); - unix_error (err, (char *) "open", outputfilev); - } - - guestfs_int_fadvise_random (ofd); - - if (ftruncate (ofd, 1) == -1) { - const int err = errno; - close (fd); - unix_error (err, (char *) "ftruncate", outputfilev); - } - - if (lseek (ofd, 0, SEEK_SET) == -1) { - const int err = errno; - close (fd); - unix_error (err, (char *) "lseek", outputfilev); - } - - if (write (ofd, "\0", 1) == -1) { - const int err = errno; - close (fd); - unix_error (err, (char *) "write", outputfilev); - } - - if (ftruncate (ofd, size) == -1) { - const int err = errno; - close (fd); - unix_error (err, (char *) "ftruncate", outputfilev); - } - - /* Iterate over blocks. */ - iter_blocks (idx, nr_threads, filenamev, fd, outputfilev, ofd); - - lzma_index_end (idx, NULL); - - if (close (fd) == -1) - unix_error (errno, (char *) "close", filenamev); - - if (close (ofd) == -1) - unix_error (errno, (char *) "close", outputfilev); -} - -static int -check_header_magic (int fd) -{ - char buf[XZ_HEADER_MAGIC_LEN]; - - if (lseek (fd, 0, SEEK_SET) == -1) - return 0; - if (read (fd, buf, XZ_HEADER_MAGIC_LEN) != XZ_HEADER_MAGIC_LEN) - return 0; - if (memcmp (buf, XZ_HEADER_MAGIC, XZ_HEADER_MAGIC_LEN) != 0) - return 0; - return 1; -} - -/* For explanation of this function, see src/xz/list.c:parse_indexes - * in the xz sources. - */ -static lzma_index * -parse_indexes (value filenamev, int fd) -{ - lzma_ret r; - off_t pos, index_size; - CLEANUP_FREE uint8_t *footer = NULL; - CLEANUP_FREE uint8_t *header = NULL; - lzma_stream_flags footer_flags; - lzma_stream_flags header_flags; - lzma_stream strm = LZMA_STREAM_INIT; - ssize_t n; - lzma_index *combined_index = NULL; - lzma_index *this_index = NULL; - lzma_vli stream_padding = 0; - size_t nr_streams = 0; - CLEANUP_FREE uint8_t *buf = NULL; - - footer = malloc (sizeof (uint8_t) * LZMA_STREAM_HEADER_SIZE); - header = malloc (sizeof (uint8_t) * LZMA_STREAM_HEADER_SIZE); - buf = malloc (sizeof (uint8_t) * BUFSIZ); - if (footer == NULL || header == NULL || buf == NULL) - caml_raise_out_of_memory (); - - /* Check file size is a multiple of 4 bytes. */ - pos = lseek (fd, 0, SEEK_END); - if (pos == (off_t) -1) - unix_error (errno, (char *) "lseek", filenamev); - - if ((pos & 3) != 0) - caml_invalid_argument ("input not an xz file: size is not a multiple of 4 bytes"); - - /* Jump backwards through the file identifying each stream. */ - while (pos > 0) { - debug ("looping through streams: pos = %" PRIu64, (uint64_t) pos); - - if (pos < LZMA_STREAM_HEADER_SIZE) - caml_invalid_argument ("corrupted xz file"); - - if (lseek (fd, -LZMA_STREAM_HEADER_SIZE, SEEK_CUR) == -1) - unix_error (errno, (char *) "lseek", filenamev); - - if (read (fd, footer, LZMA_STREAM_HEADER_SIZE) != LZMA_STREAM_HEADER_SIZE) - unix_error (errno, (char *) "read", filenamev); - - /* Skip stream padding. */ - if (footer[8] == 0 && footer[9] == 0 && - footer[10] == 0 && footer[11] == 0) { - stream_padding += 4; - pos -= 4; - continue; - } - - pos -= LZMA_STREAM_HEADER_SIZE; - nr_streams++; - - debug ("decode stream footer at pos = %" PRIu64, (uint64_t) pos); - - /* Does the stream footer look reasonable? */ - r = lzma_stream_footer_decode (&footer_flags, footer); - if (r != LZMA_OK) { - fprintf (stderr, "invalid stream footer - error %u\n", r); - caml_invalid_argument ("invalid stream footer"); - } - - debug ("backward_size = %" PRIu64, (uint64_t) footer_flags.backward_size); - index_size = footer_flags.backward_size; - if (pos < index_size + LZMA_STREAM_HEADER_SIZE) - caml_invalid_argument ("invalid stream footer"); - - pos -= index_size; - debug ("decode index at pos = %" PRIu64, (uint64_t) pos); - - /* Seek backwards to the index of this stream. */ - if (lseek (fd, pos, SEEK_SET) == -1) - unix_error (errno, (char *) "lseek", filenamev); - - /* Decode the index. */ - r = lzma_index_decoder (&strm, &this_index, UINT64_MAX); - if (r != LZMA_OK) { - fprintf (stderr, "invalid stream index - error %u\n", r); - caml_invalid_argument ("invalid stream index"); - } - - do { - strm.avail_in = index_size; - if (strm.avail_in > BUFSIZ) - strm.avail_in = BUFSIZ; - - n = read (fd, buf, strm.avail_in); - if (n == -1) - unix_error (errno, (char *) "read", filenamev); - - index_size -= strm.avail_in; - - strm.next_in = buf; - r = lzma_code (&strm, LZMA_RUN); - } while (r == LZMA_OK); - - if (r != LZMA_STREAM_END) { - fprintf (stderr, "could not parse index - error %u\n", r); - caml_invalid_argument ("could not parse index"); - } - - pos -= lzma_index_total_size (this_index) + LZMA_STREAM_HEADER_SIZE; - - debug ("decode stream header at pos = %" PRIu64, (uint64_t) pos); - - /* Read and decode the stream header. */ - if (lseek (fd, pos, SEEK_SET) == -1) - unix_error (errno, (char *) "lseek", filenamev); - - if (read (fd, header, LZMA_STREAM_HEADER_SIZE) != LZMA_STREAM_HEADER_SIZE) - unix_error (errno, (char *) "read stream header", filenamev); - - r = lzma_stream_header_decode (&header_flags, header); - if (r != LZMA_OK) { - fprintf (stderr, "invalid stream header - error %u\n", r); - caml_invalid_argument ("invalid stream header"); - } - - /* Header and footer of the stream should be equal. */ - r = lzma_stream_flags_compare (&header_flags, &footer_flags); - if (r != LZMA_OK) { - fprintf (stderr, "header and footer of stream are not equal - error %u\n", - r); - caml_invalid_argument ("header and footer of stream are not equal"); - } - - /* Store the decoded stream flags in this_index. */ - r = lzma_index_stream_flags (this_index, &footer_flags); - if (r != LZMA_OK) { - fprintf (stderr, "cannot read stream_flags from index - error %u\n", r); - caml_invalid_argument ("cannot read stream_flags from index"); - } - - /* Store the amount of stream padding so far. Needed to calculate - * compressed offsets correctly in multi-stream files. - */ - r = lzma_index_stream_padding (this_index, stream_padding); - if (r != LZMA_OK) { - fprintf (stderr, "cannot set stream_padding in index - error %u\n", r); - caml_invalid_argument ("cannot set stream_padding in index"); - } - - if (combined_index != NULL) { - r = lzma_index_cat (this_index, combined_index, NULL); - if (r != LZMA_OK) { - fprintf (stderr, "cannot combine indexes - error %u\n", r); - caml_invalid_argument ("cannot combine indexes"); - } - } - - combined_index = this_index; - this_index = NULL; - } - - lzma_end (&strm); - - return combined_index; -} - -struct global_state { - /* Current iterator. Threads update this, but it is protected by a - * mutex, and each thread takes a copy of it when working on it. - */ - lzma_index_iter iter; - lzma_bool iter_finished; - pthread_mutex_t iter_mutex; - - /* Note that all threads are accessing these fds, so you have - * to use pread/pwrite instead of lseek! - */ - - /* Input file. */ - const char *filename; - int fd; - - /* Output file. */ - const char *outputfile; - int ofd; -}; - -struct per_thread_state { - unsigned thread_num; - struct global_state *global; - int status; -}; - -/* Create threads to iterate over the blocks and uncompress. */ -static void *worker_thread (void *vp); - -static void -iter_blocks (lzma_index *idx, unsigned nr_threads, - value filenamev, int fd, value outputfilev, int ofd) -{ - struct global_state global; - CLEANUP_FREE struct per_thread_state *per_thread = NULL; - CLEANUP_FREE pthread_t *thread = NULL; - unsigned u, nr_errors; - int err; - void *status; - - per_thread = malloc (sizeof (struct per_thread_state) * nr_threads); - thread = malloc (sizeof (pthread_t) * nr_threads); - if (per_thread == NULL || thread == NULL) - caml_raise_out_of_memory (); - - lzma_index_iter_init (&global.iter, idx); - global.iter_finished = 0; - err = pthread_mutex_init (&global.iter_mutex, NULL); - if (err != 0) - unix_error (err, (char *) "pthread_mutex_init", Nothing); - - global.filename = String_val (filenamev); - global.fd = fd; - global.outputfile = String_val (outputfilev); - global.ofd = ofd; - - for (u = 0; u < nr_threads; ++u) { - per_thread[u].thread_num = u; - per_thread[u].global = &global; - } - - /* Start the threads. */ - for (u = 0; u < nr_threads; ++u) { - err = pthread_create (&thread[u], NULL, worker_thread, &per_thread[u]); - if (err != 0) - unix_error (err, (char *) "pthread_create", Nothing); - } - - /* Wait for the threads to exit. */ - nr_errors = 0; - for (u = 0; u < nr_threads; ++u) { - err = pthread_join (thread[u], &status); - if (err != 0) { - fprintf (stderr, "pthread_join (%u): %s\n", u, strerror (err)); - nr_errors++; - } - if (*(int *)status == -1) - nr_errors++; - } - - if (nr_errors > 0) - caml_invalid_argument ("some threads failed, see earlier errors"); -} - -static int -xpwrite (int fd, const void *bufvp, size_t count, off_t offset) -{ - const char *buf = bufvp; - ssize_t r; - - while (count > 0) { - r = pwrite (fd, buf, count, offset); - if (r == -1) - return -1; - count -= r; - offset += r; - buf += r; - } - - return 0; -} - -/* Iterate over the blocks and uncompress. */ -static void * -worker_thread (void *vp) -{ - struct per_thread_state *state = vp; - struct global_state *global = state->global; - lzma_index_iter iter; - int err; - off_t position, oposition; - CLEANUP_FREE uint8_t *header = NULL; - ssize_t n; - lzma_block block; - CLEANUP_FREE lzma_filter *filters = NULL; - lzma_ret r; - lzma_stream strm = LZMA_STREAM_INIT; - CLEANUP_FREE uint8_t *buf = NULL; - CLEANUP_FREE uint8_t *outbuf = NULL; - size_t i; - lzma_bool iter_finished; - - state->status = -1; - - header = malloc (sizeof (uint8_t) * LZMA_BLOCK_HEADER_SIZE_MAX); - filters = malloc (sizeof (lzma_filter) * (LZMA_FILTERS_MAX + 1)); - buf = malloc (sizeof (uint8_t) * BUFFER_SIZE); - outbuf = malloc (sizeof (uint8_t) * BUFFER_SIZE); - - if (header == NULL || filters == NULL || buf == NULL || outbuf == NULL) { - perror ("malloc"); - return &state->status; - } - - for (;;) { - /* Get the next block. */ - err = pthread_mutex_lock (&global->iter_mutex); - if (err != 0) abort (); - iter_finished = global->iter_finished; - if (!iter_finished) { - iter_finished = global->iter_finished = - lzma_index_iter_next (&global->iter, LZMA_INDEX_ITER_NONEMPTY_BLOCK); - if (!iter_finished) - /* Take a local copy of this iterator since another thread will - * update the global version. - */ - iter = global->iter; - } - err = pthread_mutex_unlock (&global->iter_mutex); - if (err != 0) abort (); - if (iter_finished) - break; - - /* Read the block header. Start by reading a single byte which - * tell us how big the block header is. - */ - position = iter.block.compressed_file_offset; - n = pread (global->fd, header, 1, position); - if (n == 0) { - fprintf (stderr, - "%s: read: unexpected end of file reading block header byte\n", - global->filename); - return &state->status; - } - if (n == -1) { - perror (String_val (global->filename)); - return &state->status; - } - position++; - - if (header[0] == '\0') { - fprintf (stderr, - "%s: read: unexpected invalid block in file, header[0] = 0\n", - global->filename); - return &state->status; - } - - block.version = 0; - block.check = iter.stream.flags->check; - block.filters = filters; - block.header_size = lzma_block_header_size_decode (header[0]); - - /* Now read and decode the block header. */ - n = pread (global->fd, &header[1], block.header_size-1, position); - if (n >= 0 && n != (ssize_t) block.header_size-1) { - fprintf (stderr, - "%s: read: unexpected end of file reading block header\n", - global->filename); - return &state->status; - } - if (n == -1) { - perror (global->filename); - return &state->status; - } - position += n; - - r = lzma_block_header_decode (&block, NULL, header); - if (r != LZMA_OK) { - fprintf (stderr, "%s: invalid block header (error %u)\n", - global->filename, r); - return &state->status; - } - - /* What this actually does is it checks that the block header - * matches the index. - */ - r = lzma_block_compressed_size (&block, iter.block.unpadded_size); - if (r != LZMA_OK) { - fprintf (stderr, - "%s: cannot calculate compressed size (error %u)\n", - global->filename, r); - return &state->status; - } - - /* Where we will start writing to. */ - oposition = iter.block.uncompressed_file_offset; - - /* Read the block data and uncompress it. */ - r = lzma_block_decoder (&strm, &block); - if (r != LZMA_OK) { - fprintf (stderr, "%s: invalid block (error %u)\n", global->filename, r); - return &state->status; - } - - strm.next_in = NULL; - strm.avail_in = 0; - strm.next_out = outbuf; - strm.avail_out = BUFFER_SIZE; - - for (;;) { - lzma_action action = LZMA_RUN; - - if (strm.avail_in == 0) { - strm.next_in = buf; - n = pread (global->fd, buf, BUFFER_SIZE, position); - if (n == -1) { - perror (global->filename); - return &state->status; - } - position += n; - strm.avail_in = n; - if (n == 0) - action = LZMA_FINISH; - } - - r = lzma_code (&strm, action); - - if (strm.avail_out == 0 || r == LZMA_STREAM_END) { - size_t wsz = BUFFER_SIZE - strm.avail_out; - - /* Don't write if the block is all zero, to preserve output file - * sparseness. However we have to update oposition. - */ - if (!is_zero ((char *) outbuf, wsz)) { - if (xpwrite (global->ofd, outbuf, wsz, oposition) == -1) { - perror (global->outputfile); - return &state->status; - } - } - oposition += wsz; - - strm.next_out = outbuf; - strm.avail_out = BUFFER_SIZE; - } - - if (r == LZMA_STREAM_END) - break; - if (r != LZMA_OK) { - fprintf (stderr, - "%s: could not parse block data (error %u)\n", - global->filename, r); - return &state->status; - } - } - - lzma_end (&strm); - - for (i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i) - free (filters[i].options); - } - - state->status = 0; - return &state->status; -} - -#endif /* PARALLEL_XZCAT */ diff --git a/builder/pxzcat.ml b/builder/pxzcat.ml deleted file mode 100644 index b34b43603..000000000 --- a/builder/pxzcat.ml +++ /dev/null @@ -1,20 +0,0 @@ -(* virt-builder - * Copyright (C) 2013 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. - *) - -external pxzcat : string -> string -> unit = "virt_builder_pxzcat" -external using_parallel_xzcat : unit -> bool = "virt_builder_using_parallel_xzcat" "noalloc" diff --git a/builder/pxzcat.mli b/builder/pxzcat.mli deleted file mode 100644 index 502defefb..000000000 --- a/builder/pxzcat.mli +++ /dev/null @@ -1,34 +0,0 @@ -(* virt-builder - * Copyright (C) 2013 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. - *) - -(** {1 Parallel xzcat (or fall back to regular xzcat).} - - Eventually regular xzcat will be able to work in parallel and this - code can go away. -*) - -val pxzcat : string -> string -> unit - (** [pxzcat input output] uncompresses the file [input] to the file - [output]. The input and output must both be seekable. - - If liblzma was found at compile time, this uses an internal - implementation of parallel xzcat. Otherwise regular xzcat is - used. *) - -val using_parallel_xzcat : unit -> bool -(** Returns [true] iff the implementation uses parallel xzcat. *) diff --git a/builder/repository_main.ml b/builder/repository_main.ml deleted file mode 100644 index 39250d94b..000000000 --- a/builder/repository_main.ml +++ /dev/null @@ -1,583 +0,0 @@ -(* virt-builder - * Copyright (C) 2016-2020 SUSE 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 Std_utils -open Common_gettext.Gettext -open Tools_utils -open Unix_utils -open Getopt.OptionName -open Utils -open JSON_parser -open Xpath_helpers - -open Printf - -type cmdline = { - gpg : string; - gpgkey : string option; - interactive : bool; - compression : bool; - repo : string; -} - -type disk_image_info = { - format : string; - size : int64; -} - -let parse_cmdline () = - let gpg = ref "gpg" in - let gpgkey = ref None in - let set_gpgkey arg = gpgkey := Some arg in - - let interactive = ref false in - let compression = ref true in - - let argspec = [ - [ L"gpg" ], Getopt.Set_string ("gpg", gpg), s_"Set GPG binary/command"; - [ S 'K'; L"gpg-key" ], Getopt.String ("gpgkey", set_gpgkey), - s_"ID of the GPG key to sign the repo with"; - [ S 'i'; L"interactive" ], Getopt.Set interactive, s_"Ask the user about missing data"; - [ L"no-compression" ], Getopt.Clear compression, s_"Don’t compress the new images in the index"; - ] in - - let args = ref [] in - let anon_fun s = List.push_front s args in - let usage_msg = - sprintf (f_"\ -%s: create a repository for virt-builder - - virt-builder-repository REPOSITORY_PATH - -A short summary of the options is given below. For detailed help please -read the man page virt-builder-repository(1). -") - prog in - let opthandle = create_standard_options argspec ~anon_fun ~machine_readable:true usage_msg in - Getopt.parse opthandle.getopt; - - (* Machine-readable mode? Print out some facts about what - * this binary supports. - *) - (match machine_readable () with - | Some { pr } -> - pr "virt-builder-repository\n"; - exit 0 - | None -> () - ); - - (* Dereference options. *) - let args = List.rev !args in - let gpg = !gpg in - let gpgkey = !gpgkey in - let interactive = !interactive in - let compression = !compression in - - (* Check options *) - let repo = - match args with - | [repo] -> repo - | [] -> - error (f_"virt-builder-repository /path/to/repo - -Use ‘/path/to/repo’ to point to the repository folder.") - | _ -> - error (f_"too many parameters, only one path to repository is allowed") in - - { - gpg = gpg; - gpgkey = gpgkey; - interactive = interactive; - compression = compression; - repo = repo; - } - -let do_mv src dest = - let cmd = [ "mv"; src; dest ] in - let r = run_command cmd in - if r <> 0 then - error (f_"moving file ‘%s’ to ‘%s’ failed") src dest - -let checksums_get_sha512 = function - | None -> None - | Some csums -> - let rec loop = function - | [] -> None - | Checksums.SHA512 csum :: _ -> Some (Checksums.SHA512 csum) - | _ :: rest -> loop rest - in - loop csums - -let osinfo_ids = ref None - -let rec osinfo_get_short_ids () = - match !osinfo_ids with - | Some ids -> ids - | None -> - osinfo_ids := - Some ( - Osinfo.fold ( - fun set filepath -> - let doc = Xml.parse_file filepath in - let xpathctx = Xml.xpath_new_context doc in - let nodes = xpath_get_nodes xpathctx "/libosinfo/os/short-id" in - List.fold_left ( - fun set node -> - let id = Xml.node_as_string node in - StringSet.add id set - ) set nodes - ) StringSet.empty - ); - osinfo_get_short_ids () - -let compress_to file outdir = - let outimg = outdir // Filename.basename file ^ ".xz" in - - info "Compressing ..."; - let cmd = [ "xz"; "-f"; "--best"; "--block-size=16777216"; "-c"; file ] in - let file_flags = [ Unix.O_WRONLY; Unix.O_CREAT; Unix.O_TRUNC; ] in - let outfd = Unix.openfile outimg file_flags 0o666 in - let res = run_command cmd ~stdout_fd:outfd in - if res <> 0 then - error (f_"‘xz’ command failed"); - outimg - -let get_mime_type filepath = - let file_cmd = "file --mime-type --brief " ^ (quote filepath) in - match external_command file_cmd with - | [] -> None - | line :: _ -> Some line - -let get_disk_image_info filepath = - let infos = get_image_infos filepath in - { - format = object_get_string "format" infos; - size = object_get_number "virtual-size" infos - } - -let cmp a b = - Index.string_of_arch a = Index.string_of_arch b - -let has_entry id arch index = - List.exists ( - fun (item_id, { Index.arch = item_arch }) -> - item_id = id && cmp item_arch arch - ) index - -let process_image acc_entries filename repo tmprepo index interactive - compression sigchecker = - message (f_"Preparing %s") filename; - - let filepath = repo // filename in - let { format; size } = get_disk_image_info filepath in - let out_path = - if not compression then filepath - else compress_to filepath tmprepo in - let out_filename = Filename.basename out_path in - let checksum = Checksums.compute_checksum "sha512" out_path in - let compressed_size = (Unix.LargeFile.stat out_path).Unix.LargeFile.st_size in - - let ask ~default ?values message = - printf "%s [%s] " message default; - (match values with - | None -> () - | Some x -> - printf (f_"Choose one from the list below:\n %s\n") - (String.concat "\n " x)); - let value = read_line () in - - if value = "" then - default - else - value - in - - let re_valid_id = PCRE.compile ~anchored:true "[-a-zA-Z0-9_.]+" in - let rec ask_id default = - let id = ask (s_"Identifier: ") ~default in - if not (PCRE.matches re_valid_id id) then ( - warning (f_"Allowed characters are letters, digits, - _ and ."); - ask_id default - ) else - id in - - let ask_arch guess = - let arches = [ "x86_64"; "aarch64"; "armv7l"; "i686"; "ppc64"; "ppc64le"; "s390x" ] in - Index.Arch (ask (s_"Architecture: ") ~default:guess ~values:arches) - in - - let ask_osinfo default = - let osinfo = ask (s_ "osinfo short ID: ") ~default in - let osinfo_ids = osinfo_get_short_ids () in - if not (StringSet.mem osinfo osinfo_ids) then - warning (f_"‘%s’ is not a recognized osinfo OS id; using it anyway") osinfo; - osinfo in - - let extract_entry_data ?entry () = - message (f_"Extracting data from the image..."); - let g = Tools_utils.open_guestfs () in - g#add_drive_ro filepath; - g#launch (); - - let roots = g#inspect_os () in - let nroots = Array.length roots in - if nroots <> 1 then - error (f_"virt-builder template images must have one and only one root file system, found %d") - nroots; - - let root = Array.get roots 0 in - let inspected_arch = g#inspect_get_arch root in - let product = g#inspect_get_product_name root in - let shortid = g#inspect_get_osinfo root in - let lvs = g#lvs () in - let filesystems = g#inspect_get_filesystems root in - - g#close (); - - let id = - match entry with - | Some (id, _) -> id - | None -> ( - if interactive then ask_id shortid - else error (f_"missing image identifier") - ) in - - let arch = - match entry with - | Some (_, { Index.arch }) -> ( - match arch with - | Index.Arch arch -> Index.Arch arch - | Index.GuessedArch arch -> - if interactive then ask_arch arch - else Index.Arch arch ) - | None -> - if interactive then ask_arch inspected_arch - else Index.Arch inspected_arch in - - if has_entry id arch acc_entries then ( - let arch = - match arch with - | Index.Arch arch - | Index.GuessedArch arch -> arch in - error (f_"Already existing image with id %s and architecture %s") id arch - ); - - let printable_name = - match entry with - | Some (_, { Index.printable_name }) -> - if printable_name = None then - if interactive then Some (ask (s_"Display name: ") ~default:product) - else Some product - else - printable_name - | None -> Some product in - - let osinfo = - match entry with - | Some (_, { Index.osinfo }) -> - if osinfo = None then - Some (if interactive then ask_osinfo shortid else shortid) - else - osinfo - | None -> - Some (if interactive then ask_osinfo shortid else shortid) in - - let expand = - match entry with - | Some (_, { Index.expand }) -> - if expand = None then - if interactive then - Some (ask (s_"Expandable partition: ") ~default:root - ~values:(Array.to_list filesystems)) - else Some root - else - expand - | None -> - if interactive then - Some (ask (s_"Expandable partition: ") ~default:root - ~values:(Array.to_list filesystems)) - else Some root in - - let lvexpand = - if lvs = [||] then - None - else - match entry with - | Some (_, { Index.lvexpand }) -> - if lvexpand = None then - if interactive then - Some (ask (s_"Expandable volume: ") ~values:(Array.to_list lvs) - ~default:(Array.get lvs 0)) - else Some (Array.get lvs 0) - else - lvexpand - | None -> - if interactive then - Some (ask (s_"Expandable volume: ") ~values:(Array.to_list lvs) - ~default:(Array.get lvs 0)) - else Some (Array.get lvs 0) in - - let revision = - match entry with - | Some (_, { Index.revision }) -> - Utils.increment_revision revision - | None -> Rev_int 1 in - - let notes = - match entry with - | Some (_, { Index.notes }) -> notes - | None -> [] in - - let hidden = - match entry with - | Some (_, { Index.hidden }) -> hidden - | None -> false in - - let aliases = - match entry with - | Some (_, { Index.aliases }) -> aliases - | None -> None in - - (id, { Index.printable_name; - osinfo; - file_uri = Filename.basename out_path; - arch; - signature_uri = None; - checksums = Some [checksum]; - revision; - format = Some format; - size; - compressed_size = Some compressed_size; - expand; - lvexpand; - notes; - hidden; - aliases; - sigchecker; - proxy = Curl.SystemProxy }) - in - - (* Do we have an entry for that file already? *) - let file_entry = - try - List.hd ( - List.filter ( - fun (_, { Index.file_uri }) -> - let basename = Filename.basename file_uri in - basename = out_filename || basename = filename - ) index - ) - with - | Failure _ -> extract_entry_data () in - - let _, { Index.checksums } = file_entry in - let old_checksum = checksums_get_sha512 checksums in - - match old_checksum with - | Some old_sum -> - if old_sum = checksum then - let id, entry = file_entry in - (id, { entry with Index.file_uri = out_filename }) - else - extract_entry_data ~entry:file_entry () - | None -> - extract_entry_data ~entry:file_entry () - -let unsafe_remove_directory_prefix parent path = - if path = parent then - "" - else if String.is_prefix path (parent // "") then ( - let len = String.length parent in - String.sub path (len+1) (String.length path - len-1) - ) else - invalid_arg (sprintf "%S is not a path prefix of %S" parent path) - -let main () = - let cmdline = parse_cmdline () in - - (* If debugging, echo the command line arguments. *) - debug "command line: %s" (String.concat " " (Array.to_list Sys.argv)); - - (* Check that the paths are existing *) - if not (Sys.file_exists cmdline.repo) then - error (f_"repository folder ‘%s’ doesn’t exist") cmdline.repo; - - (* Create a temporary folder to work in *) - let tmpdir = Mkdtemp.temp_dir ~base_dir:cmdline.repo - "virt-builder-repository." in - rmdir_on_exit tmpdir; - - let tmprepo = tmpdir // "repo" in - mkdir_p tmprepo 0o700; - - let sigchecker = Sigchecker.create ~gpg:cmdline.gpg - ~check_signature:false - ~gpgkey:No_Key - ~tmpdir in - - let index = - try - let index_filename = - List.find ( - fun filename -> Sys.file_exists (cmdline.repo // filename) - ) [ "index.asc"; "index" ] in - - let downloader = Downloader.create ~curl:"do-not-use-curl" - ~cache:None ~tmpdir in - - let source = { Sources.name = index_filename; - uri = cmdline.repo // index_filename; - gpgkey = No_Key; - proxy = Curl.SystemProxy; - format = Sources.FormatNative } in - - Index_parser.get_index ~downloader ~sigchecker ~template:true source - with Not_found -> [] in - - (* Check for index/interactive consistency *) - if not cmdline.interactive && index = [] then - error (f_"the repository must contain an index file when running in automated mode"); - - debug "Searching for images ..."; - - let images = - let is_supported_format file = - let extension = last_part_of file '.' in - match extension with - | Some ext -> List.mem ext [ "qcow2"; "raw"; "img" ] - | None -> - match get_mime_type file with - | None -> false - | Some mime -> mime = "application/octet-stream" in - let is_new file = - try - let _, { Index.checksums } = - List.find ( - fun (_, { Index.file_uri }) -> - Filename.basename file_uri = file - ) index in - let checksum = checksums_get_sha512 checksums in - let path = cmdline.repo // file in - let file_checksum = Checksums.compute_checksum "sha512" path in - match checksum with - | None -> true - | Some sum -> sum <> file_checksum - with Not_found -> true in - let files = Array.to_list (Sys.readdir cmdline.repo) in - let files = List.filter ( - fun file -> is_regular_file (cmdline.repo // file) - ) files in - List.filter ( - fun file -> is_supported_format (cmdline.repo // file) && is_new file - ) files in - - if images = [] then ( - info (f_ "No new image found"); - exit 0 - ); - - info (f_ "Found new images: %s") (String.concat " " images); - - with_open_out (tmprepo // "index") ( - fun index_channel -> - (* Generate entries for uncompressed images *) - let images_entries = List.fold_right ( - fun filename acc -> - let image_entry = process_image acc - filename - cmdline.repo - tmprepo - index - cmdline.interactive - cmdline.compression - sigchecker in - image_entry :: acc - ) images [] in - - (* Filter out entries for newly found images and entries - without a corresponding image file or with empty arch *) - let index = List.filter ( - fun (id, { Index.arch; file_uri }) -> - not (has_entry id arch images_entries) && Sys.file_exists file_uri - ) index in - - (* Convert all URIs back to relative ones *) - let index = List.map ( - fun (id, entry) -> - let { Index.file_uri } = entry in - let rel_path = - try (* XXX wrong *) - unsafe_remove_directory_prefix cmdline.repo file_uri - with - | Invalid_argument _ -> - file_uri in - let rel_entry = { entry with Index.file_uri = rel_path } in - (id, rel_entry) - ) index in - - (* Write all the entries *) - List.iter ( - fun entry -> - Index_parser.write_entry index_channel entry; - ) (index @ images_entries); - ); - - (* GPG sign the generated index *) - (match cmdline.gpgkey with - | None -> - debug "Skip index signing" - | Some gpgkey -> - message (f_"Signing index with the GPG key %s") gpgkey; - let cmd = sprintf "%s --armor --output %s --export %s" - (quote (cmdline.gpg // "index.gpg")) - (quote tmprepo) (quote gpgkey) in - if shell_command cmd <> 0 then - error (f_"failed to export the GPG key %s") gpgkey; - - let cmd = sprintf "%s --armor --default-key %s --clearsign %s" - (quote cmdline.gpg) (quote gpgkey) - (quote (tmprepo // "index" )) in - if shell_command cmd <> 0 then - error (f_"failed to sign index"); - ); - - message (f_"Creating index backup copy"); - - List.iter ( - fun filename -> - let filepath = cmdline.repo // filename in - if Sys.file_exists filepath then - do_mv filepath (filepath ^ ".bak") - ) ["index"; "index.asc"]; - - message (f_"Moving files to final destination"); - - Array.iter ( - fun filename -> - do_mv (tmprepo // filename) cmdline.repo - ) (Sys.readdir tmprepo); - - debug "Cleanup"; - - (* Remove the processed image files *) - if cmdline.compression then - List.iter ( - fun filename -> Sys.remove (cmdline.repo // filename) - ) images - -let () = run_main_and_handle_errors main diff --git a/builder/repository_main.mli b/builder/repository_main.mli deleted file mode 100644 index fb964f473..000000000 --- a/builder/repository_main.mli +++ /dev/null @@ -1,19 +0,0 @@ -(* virt-builder - * Copyright (C) 2016-2020 SUSE 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. - *) - -(* empty *) diff --git a/builder/setlocale-c.c b/builder/setlocale-c.c deleted file mode 100644 index 1834c11df..000000000 --- a/builder/setlocale-c.c +++ /dev/null @@ -1,64 +0,0 @@ -/* virt-builder - * Copyright (C) 2014 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. - */ - -#include - -#include - -#include -#include -#include -#include - -static const int lc_string_table[7] = { - LC_ALL, - LC_CTYPE, - LC_NUMERIC, - LC_TIME, - LC_COLLATE, - LC_MONETARY, - LC_MESSAGES -}; - -#ifndef Val_none -#define Val_none (Val_int (0)) -#endif - -extern value virt_builder_setlocale (value val_category, value val_name); - -value -virt_builder_setlocale (value val_category, value val_name) -{ - CAMLparam2 (val_category, val_name); - CAMLlocal2 (rv, rv2); - const char *locstring; - char *ret; - int category; - - category = lc_string_table[Int_val (val_category)]; - locstring = val_name == Val_none ? NULL : String_val (Field (val_name, 0)); - ret = setlocale (category, locstring); - if (ret) { - rv2 = caml_copy_string (ret); - rv = caml_alloc (1, 0); - Store_field (rv, 0, rv2); - } else - rv = Val_none; - - CAMLreturn (rv); -} diff --git a/builder/setlocale.ml b/builder/setlocale.ml deleted file mode 100644 index 9b3289d30..000000000 --- a/builder/setlocale.ml +++ /dev/null @@ -1,29 +0,0 @@ -(* virt-builder - * Copyright (C) 2014 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. - *) - -type localecategory = - | LC_ALL - | LC_CTYPE - | LC_NUMERIC - | LC_TIME - | LC_COLLATE - | LC_MONETARY - | LC_MESSAGES -;; - -external setlocale : localecategory -> string option -> string option = "virt_builder_setlocale" diff --git a/builder/setlocale.mli b/builder/setlocale.mli deleted file mode 100644 index 1e34204da..000000000 --- a/builder/setlocale.mli +++ /dev/null @@ -1,30 +0,0 @@ -(* virt-builder - * Copyright (C) 2014 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. - *) - -type localecategory = - | LC_ALL - | LC_CTYPE - | LC_NUMERIC - | LC_TIME - | LC_COLLATE - | LC_MONETARY - | LC_MESSAGES -;; - -val setlocale : localecategory -> string option -> string option -(** [setlocale category newlocale] Tiny wrapper to the C [setlocale]. *) diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml deleted file mode 100644 index 088674d66..000000000 --- a/builder/sigchecker.ml +++ /dev/null @@ -1,221 +0,0 @@ -(* virt-builder - * Copyright (C) 2013 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 Std_utils -open Tools_utils -open Unix_utils -open Common_gettext.Gettext - -open Utils - -open Printf -open Unix - -type t = { - gpg : string; - fingerprint : string; - subkeys_fingerprints : string list; - check_signature : bool; - gpghome : string; - tmpdir : string; -} - -(* Import the specified key file. *) -let import_keyfile ~gpg ~gpghome ~tmpdir ?(trust = true) keyfile = - let status_file = Filename.temp_file ~temp_dir:tmpdir "vbstat" ".txt" in - let cmd = sprintf "%s --homedir %s --status-file %s --import %s%s" - gpg gpghome (quote status_file) (quote keyfile) - (if verbose () then "" else " >/dev/null 2>&1") in - let r = shell_command cmd in - if r <> 0 then - error (f_"could not import public key\nUse the ‘-v’ option and look for earlier error messages."); - let status = read_whole_file status_file in - let status = String.nsplit "\n" status in - let key_id = ref "" in - let fingerprint = ref "" in - List.iter ( - fun line -> - let line = String.nsplit " " line in - match line with - | "[GNUPG:]" :: "IMPORT_OK" :: _ :: fp :: _ -> fingerprint := fp - | "[GNUPG:]" :: "IMPORTED" :: key :: _ -> key_id := key - | _ -> () - ) status; - if trust then ( - let cmd = sprintf "%s --homedir %s --trusted-key %s --list-keys%s" - gpg gpghome (quote !key_id) - (if verbose () then "" else " >/dev/null 2>&1") in - let r = shell_command cmd in - if r <> 0 then - error (f_"GPG failure: could not trust the imported key\nUse the ‘-v’ option and look for earlier error messages."); - ); - let subkeys = - (* --with-fingerprint is specified twice so gpg outputs the full - * fingerprint of the subkeys. *) - let cmd = sprintf "%s --homedir %s --with-colons --with-fingerprint --with-fingerprint --list-keys %s" - gpg gpghome !fingerprint in - let lines = external_command cmd in - let current = ref None in - let subkeys = ref [] in - List.iter ( - fun line -> - let line = String.nsplit ":" line in - match line with - | "sub" :: ("u"|"-") :: _ :: _ :: id :: _ -> - current := Some id - | "fpr" :: _ :: _ :: _ :: _ :: _ :: _ :: _ :: _ :: id :: _ -> - (match !current with - | None -> () - | Some k -> - if String.is_suffix id k then List.push_front id subkeys; - current := None - ) - | _ -> () - ) lines; - !subkeys in - !fingerprint, subkeys - -let rec create ~gpg ~gpgkey ~check_signature ~tmpdir = - (* Create a temporary directory for gnupg. *) - let gpgtmpdir = Mkdtemp.temp_dir ~base_dir:tmpdir "vb.gpghome." in - (* Make sure we have no check_signature=true with no actual key. *) - let check_signature, gpgkey = - match check_signature, gpgkey with - | true, No_Key -> false, No_Key - | x, y -> x, y in - let fingerprint, subkeys = - if check_signature then ( - (* Run gpg so it can setup its own home directory, failing if it - * cannot. - *) - let cmd = sprintf "%s --homedir %s --list-keys%s" - gpg gpgtmpdir (if verbose () then "" else " >/dev/null 2>&1") in - let r = shell_command cmd in - if r <> 0 then - error (f_"GPG failure: could not run GPG the first time\nUse the ‘-v’ option and look for earlier error messages."); - match gpgkey with - | No_Key -> - assert false - | KeyFile kf -> - import_keyfile gpg gpgtmpdir tmpdir kf - | Fingerprint fp -> - let filename = Filename.temp_file ~temp_dir:tmpdir "vbpubkey" ".asc" in - let cmd = sprintf "%s --yes --armor --output %s --export %s%s" - gpg (quote filename) (quote fp) - (if verbose () then "" else " >/dev/null 2>&1") in - let r = shell_command cmd in - if r <> 0 then - error (f_"could not export public key\nUse the ‘-v’ option and look for earlier error messages."); - import_keyfile gpg gpgtmpdir tmpdir filename - ) else - "", [] in - { - gpg = gpg; - fingerprint = fingerprint; - subkeys_fingerprints = subkeys; - check_signature = check_signature; - gpghome = gpgtmpdir; - tmpdir = tmpdir; - } - -(* Compare two strings of hex digits ignoring whitespace and case. *) -and equal_fingerprints fp1 fp2 = - let len1 = String.length fp1 and len2 = String.length fp2 in - let rec loop i j = - if i = len1 && j = len2 then true (* match! *) - else if i = len1 || j = len2 then false (* no match - different lengths *) - else ( - let x1 = getxdigit fp1.[i] and x2 = getxdigit fp2.[j] in - match x1, x2 with - | Some x1, Some x2 when x1 = x2 -> loop (i+1) (j+1) - | Some x1, Some x2 -> false (* no match - different content *) - | Some _, None -> loop i (j+1) - | None, Some _ -> loop (i+1) j - | None, None -> loop (i+1) (j+1) - ) - in - loop 0 0 - -and getxdigit = function - | '0'..'9' as c -> Some (Char.code c - Char.code '0') - | 'a'..'f' as c -> Some (Char.code c - Char.code 'a') - | 'A'..'F' as c -> Some (Char.code c - Char.code 'A') - | _ -> None - -let verifying_signatures t = - t.check_signature - -let rec verify t filename = - if t.check_signature then ( - let args = quote filename in - do_verify t args - ) - -and verify_detached t filename sigfile = - if t.check_signature then ( - match sigfile with - | None -> - error (f_"there is no detached signature file\nThis probably means the index file is missing a sig=... line.\nYou can use --no-check-signature to ignore this error, but that means you are susceptible to man-in-the-middle attacks.") - | Some sigfile -> - let args = sprintf "%s %s" (quote sigfile) (quote filename) in - do_verify t args - ) - -and verify_and_remove_signature t filename = - if t.check_signature then ( - (* Copy the input file as temporary file with the .asc extension, - * so gpg recognises that format. *) - let asc_file = Filename.temp_file ~temp_dir:t.tmpdir "vbfile" ".asc" in - let cmd = [ "cp"; filename; asc_file ] in - if run_command cmd <> 0 then exit 1; - let out_file = Filename.temp_file ~temp_dir:t.tmpdir "vbfile" "" in - let args = sprintf "--yes --output %s %s" (quote out_file) (quote filename) in - do_verify ~verify_only:false t args; - Some out_file - ) else - None - -and do_verify ?(verify_only = true) t args = - let status_file = Filename.temp_file ~temp_dir:t.tmpdir "vbstat" ".txt" in - let cmd = - sprintf "%s --homedir %s %s%s --status-file %s %s" - t.gpg t.gpghome - (if verify_only then "--verify" else "") - (if verbose () then "" else " --batch -q --logger-file /dev/null") - (quote status_file) args in - let r = shell_command cmd in - if r <> 0 then - error (f_"GPG failure: could not verify digital signature of file\nTry:\n - Use the ‘-v’ option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!"); - - (* Check the fingerprint is who it should be. *) - let status = read_whole_file status_file in - - let status = String.nsplit "\n" status in - let fingerprint = ref "" in - List.iter ( - fun line -> - let line = String.nsplit " " line in - match line with - | "[GNUPG:]" :: "VALIDSIG" :: fp :: _ -> fingerprint := fp - | _ -> () - ) status; - - if not (equal_fingerprints !fingerprint t.fingerprint) && - not (List.exists (equal_fingerprints !fingerprint) t.subkeys_fingerprints) then - error (f_"fingerprint of signature does not match the expected fingerprint!\n found fingerprint: %s\n expected fingerprint: %s") - !fingerprint t.fingerprint diff --git a/builder/sigchecker.mli b/builder/sigchecker.mli deleted file mode 100644 index bba2b6d63..000000000 --- a/builder/sigchecker.mli +++ /dev/null @@ -1,36 +0,0 @@ -(* virt-builder - * Copyright (C) 2013 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. - *) - -type t - -val create : gpg:string -> gpgkey:Utils.gpgkey_type -> check_signature:bool -> tmpdir:string -> t - -val verifying_signatures : t -> bool -(** Return whether signatures are being verified by this - Sigchecker.t. *) - -val verify : t -> string -> unit -(** Verify the file is signed (if check_signature is true). *) - -val verify_detached : t -> string -> string option -> unit -(** Verify the file is signed against the detached signature - (if check_signature is true). *) - -val verify_and_remove_signature : t -> string -> string option -(** If check_signature is true, verify the file is signed and extract - the content of the file (i.e. without the signature). *) diff --git a/builder/simplestreams_parser.ml b/builder/simplestreams_parser.ml deleted file mode 100644 index 407eb11fb..000000000 --- a/builder/simplestreams_parser.ml +++ /dev/null @@ -1,153 +0,0 @@ -(* virt-builder - * Copyright (C) 2015 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 Std_utils -open Tools_utils -open Common_gettext.Gettext - -open JSON_parser -open Utils - -open Printf - -let ensure_trailing_slash str = - if String.length str > 0 && str.[String.length str - 1] <> '/' then str ^ "/" - else str - -let get_index ~downloader ~sigchecker { Sources.uri; proxy } = - - let uri = ensure_trailing_slash uri in - - let download_and_parse uri = - let tmpfile, _ = Downloader.download downloader ~proxy uri in - let file = - if Sigchecker.verifying_signatures sigchecker then ( - let tmpunsigned = - Sigchecker.verify_and_remove_signature sigchecker tmpfile in - match tmpunsigned with - | None -> assert false (* only when not verifying signatures *) - | Some f -> f - ) else - tmpfile in - json_parser_tree_parse_file file in - - let downloads = - let uri_index = - if Sigchecker.verifying_signatures sigchecker then - uri ^ "streams/v1/index.sjson" - else - uri ^ "streams/v1/index.json" in - let tree = download_and_parse uri_index in - - let format = object_get_string "format" tree in - if format <> "index:1.0" then - error (f_"%s is not a Simple Streams (index) v1.0 JSON file (format: %s)") - uri format; - - let index = object_get_object "index" tree in - List.filter_map ( - fun (_, desc) -> - let format = object_get_string "format" desc in - let datatype = object_get_string "datatype" desc in - match format, datatype with - | "products:1.0", "image-downloads" -> - Some (object_get_string "path" desc) - | _ -> None - ) index in - - let scan_product_list path = - let tree = download_and_parse (uri ^ path) in - - let format = object_get_string "format" tree in - if format <> "products:1.0" then - error (f_"%s is not a Simple Streams (products) v1.0 JSON file (format: %s)") - uri format; - - let products = object_get_object "products" tree in - - List.filter_map ( - fun (prod, prod_desc) -> - let arch = Index.Arch (object_get_string "arch" prod_desc) in - let prods = object_get_object "versions" prod_desc in - let prods = List.filter_map ( - fun (rel, rel_desc) -> - let pubname = objects_get_string "pubname" [rel_desc; prod_desc] in - let items = object_find_object "items" rel_desc in - let disk_items = object_find_objects ( - function - | (("disk.img"|"disk1.img"), v) -> Some v - | _ -> None - ) items in - (match disk_items with - | [] -> None - | disk_item :: _ -> - let printable_name = Some pubname in - let file_uri = uri ^ (object_get_string "path" disk_item) in - let checksums = - let checksums = object_find_objects ( - function - (* Since this catches all the keys, and not just - * the ones related to checksums, explicitly filter - * the supported checksums. - *) - | ("sha256"|"sha512" as t, JSON.String c) -> - Some (Checksums.of_string t c) - | _ -> None - ) disk_item in - match checksums with - | [] -> None - | x -> Some x in - let revision = Rev_string rel in - let size = object_get_number "size" disk_item in - let aliases = Some [pubname;] in - - let entry = { Index.printable_name = printable_name; - osinfo = None; - file_uri = file_uri; - arch = arch; - signature_uri = None; - checksums = checksums; - revision = revision; - format = None; - size = size; - compressed_size = None; - expand = None; - lvexpand = None; - notes = []; - hidden = false; - aliases = aliases; - sigchecker = sigchecker; - proxy = proxy; } in - Some (rel, (prod, entry)) - ) - ) prods in - (* Select the disk image with the bigger version (i.e. usually - * the most recent one. *) - let reverse_revision_compare (rev1, _) (rev2, _) = compare rev2 rev1 in - let prods = List.sort reverse_revision_compare prods in - match prods with - | [] -> None - | (_, entry) :: _ -> Some entry - ) products in - - let entries = List.flatten (List.map scan_product_list downloads) in - if verbose () then ( - printf "simplestreams tree (%s) after parsing:\n" uri; - List.iter (Index.print_entry Pervasives.stdout) entries - ); - entries diff --git a/builder/simplestreams_parser.mli b/builder/simplestreams_parser.mli deleted file mode 100644 index a4b91baae..000000000 --- a/builder/simplestreams_parser.mli +++ /dev/null @@ -1,19 +0,0 @@ -(* virt-builder - * Copyright (C) 2015 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. - *) - -val get_index : downloader:Downloader.t -> sigchecker:Sigchecker.t -> Sources.source -> Index.index diff --git a/builder/sources.ml b/builder/sources.ml deleted file mode 100644 index d6de15968..000000000 --- a/builder/sources.ml +++ /dev/null @@ -1,142 +0,0 @@ -(* virt-builder - * Copyright (C) 2014 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 Std_utils -open Tools_utils -open Common_gettext.Gettext - -open Printf -open Unix - -type source = { - name : string; - uri : string; - gpgkey : Utils.gpgkey_type; - proxy : Curl.proxy; - format : source_format; -} -and source_format = -| FormatNative -| FormatSimpleStreams - -let parse_conf file = - debug "trying to read %s" file; - let sections = Ini_reader.read_ini ~error_suffix:"[ignored]" file in - - let sources = List.fold_right ( - fun (n, fields) acc -> - let give_source n fields = - let fields = List.map (fun (k, sk, v) -> (k, sk), v) fields in - let uri = - try List.assoc ("uri", None) fields - with Not_found as ex -> - eprintf (f_"%s: no ‘uri’ entry for ‘%s’ in %s, skipping it\n") prog n file; - raise ex in - let gpgkey = - let k = - try Some (URI.parse_uri (List.assoc ("gpgkey", None) fields)) with - | Not_found -> None - | URI.Parse_failed as ex -> - debug "'%s' has invalid gpgkey URI" n; - raise ex in - match k with - | None -> Utils.No_Key - | Some uri -> - (match uri.URI.protocol with - | "file" -> Utils.KeyFile uri.URI.path - | _ -> - debug "'%s' has non-local gpgkey URI" n; - Utils.No_Key - ) in - let proxy = - try - (match (List.assoc ("proxy", None) fields) with - | "no" | "off" -> Curl.UnsetProxy - | "system" -> Curl.SystemProxy - | _ as proxy -> Curl.ForcedProxy proxy - ) - with - Not_found -> Curl.SystemProxy in - let format = - try - (match (List.assoc ("format", None) fields) with - | "native" | "" -> FormatNative - | "simplestreams" -> FormatSimpleStreams - | fmt -> - debug "unknown repository type '%s' in %s, skipping it" fmt file; - invalid_arg fmt - ) - with - Not_found -> FormatNative in - { - name = n; uri = uri; gpgkey = gpgkey; proxy = proxy; - format = format; - } - in - try (give_source n fields) :: acc - with Not_found | Invalid_argument _ -> acc - ) sections [] in - - debug "read %d sources" (List.length sources); - - sources - -let merge_sources current_sources new_sources = - List.fold_right ( - fun source acc -> - if List.exists (fun { name = n } -> n = source.name) acc then - acc - else - source :: acc - ) new_sources current_sources - -let filter_filenames filename = - Filename.check_suffix filename ".conf" - -let read_sources () = - let dirs = Paths.xdg_config_dirs () in - let dirs = - match Paths.xdg_config_home () with - | None -> dirs - | Some dir -> dir :: dirs in - let dirs = List.map (fun x -> x // "repos.d") dirs in - let fnseen = ref StringSet.empty in - List.fold_left ( - fun acc dir -> - let files = - try List.filter filter_filenames (Array.to_list (Sys.readdir dir)) - with Sys_error _ -> [] in - let files = List.filter (fun x -> StringSet.mem x !fnseen <> true) files in - List.fold_left ( - fun acc file -> - try ( - let s = merge_sources acc (parse_conf (dir // file)) in - (* Add the current file name to the set only if its parsing - * was successful. - *) - fnseen := StringSet.add file !fnseen; - s - ) with - | Unix_error (code, fname, _) -> - debug "file error: %s: %s\n" fname (error_message code); - acc - | Invalid_argument msg -> - debug "internal error: invalid argument: %s" msg; - acc - ) acc files - ) [] dirs diff --git a/builder/sources.mli b/builder/sources.mli deleted file mode 100644 index 6594d002d..000000000 --- a/builder/sources.mli +++ /dev/null @@ -1,30 +0,0 @@ -(* virt-builder - * Copyright (C) 2014 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. - *) - -type source = { - name : string; - uri : string; - gpgkey : Utils.gpgkey_type; - proxy : Curl.proxy; - format : source_format; -} -and source_format = -| FormatNative -| FormatSimpleStreams - -val read_sources : unit -> source list diff --git a/builder/templates/Makefile.am b/builder/templates/Makefile.am deleted file mode 100644 index 7748591f5..000000000 --- a/builder/templates/Makefile.am +++ /dev/null @@ -1,48 +0,0 @@ -# libguestfs virt-builder tool -# Copyright (C) 2013-2020 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. - -include $(top_srcdir)/subdir-rules.mk - -index_fragments = $(wildcard *.index-fragment) - -EXTRA_DIST = \ - $(index_fragments) \ - *.ks \ - *.virt-install-cmd \ - debian.preseed \ - make-template.ml \ - ubuntu.preseed \ - validate.sh - -# Create the index file under the top level website/ directory. -noinst_DATA = $(top_builddir)/website/download/builder/index - -$(top_builddir)/website/download/builder/index: $(index_fragments) - rm -f $@ $@-t - LANG=C sh -c 'cat *.index-fragment' > $@-t - mv $@-t $@ - @echo "NOTE: $@.asc must be updated by running:" - @echo " gpg --clearsign --armor $@" - -# Validates the index file. -TESTS_ENVIRONMENT = \ - top_srcdir="$(top_srcdir)" \ - $(top_builddir)/run --test -TESTS = validate.sh - -check-valgrind: - $(MAKE) VG="@VG@" check diff --git a/builder/templates/centos-6.index-fragment b/builder/templates/centos-6.index-fragment deleted file mode 100644 index affde194a..000000000 --- a/builder/templates/centos-6.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[centos-6] -name=CentOS 6.6 -osinfo=centos6.6 -arch=x86_64 -file=centos-6.xz -revision=6 -checksum=fc403ea3555a5608a25ad30ce2514b67288311a7197ddf9fb664475820f26db2bd95a86be9cd6e3f772187b384a02e0965430456dd518d343a80457057bc5441 -format=raw -size=6442450944 -compressed_size=199265736 -expand=/dev/sda3 -notes=CentOS 6.6 - - This CentOS image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/centos.sh - - Note that ‘virt-builder centos-6’ will always install the latest - 6.x release. - diff --git a/builder/templates/centos-7.0.index-fragment b/builder/templates/centos-7.0.index-fragment deleted file mode 100644 index 77f06bb4a..000000000 --- a/builder/templates/centos-7.0.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[centos-7.0] -name=CentOS 7.0 -osinfo=centos7.0 -arch=x86_64 -file=centos-7.0.xz -checksum=cf9ae295f633fbd04e575eeca16f372e933c70c3107c44eb06864760d04354aa94b4f356bfc9a598c138e687304a52e96777e4467e7db1ec0cb5b2d2ec61affc -format=raw -size=6442450944 -compressed_size=213203844 -expand=/dev/sda3 -notes=CentOS 7.0 - - This CentOS image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/centos.sh - diff --git a/builder/templates/centos-7.1.index-fragment b/builder/templates/centos-7.1.index-fragment deleted file mode 100644 index d8f7c1821..000000000 --- a/builder/templates/centos-7.1.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[centos-7.1] -name=CentOS 7.1 -osinfo=centos7.1 -arch=x86_64 -file=centos-7.1.xz -checksum=4bd2536710daa27a70ff69a96d8a694bde1ecf48d811e75d5e6881cfdcd214c0af6949d5a8252ace06e4e8b33337f65ccb16305c85ff88156d49ac559e840b5c -format=raw -size=6442450944 -compressed_size=238579176 -expand=/dev/sda3 -notes=CentOS 7.1 - - This CentOS image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/centos.sh - diff --git a/builder/templates/centos-7.2-aarch64.index-fragment b/builder/templates/centos-7.2-aarch64.index-fragment deleted file mode 100644 index dcd80b892..000000000 --- a/builder/templates/centos-7.2-aarch64.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[centos-7.2] -name=CentOS 7.2 (aarch64) -osinfo=centos7.2 -arch=aarch64 -file=centos-7.2-aarch64.xz -checksum=e61c5381026c419110ec42626c1cbb0e081240ae4d8c70f5bac2c80d771d5159b72dd3723068cf3cc9339e095b05b62d29ba9c22ef199f53a4e89c07e5615ca3 -format=raw -size=6442450944 -compressed_size=248167668 -expand=/dev/sda4 -notes=CentOS 7.2 (aarch64) - - This CentOS image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/centos-aarch64.sh - diff --git a/builder/templates/centos-7.2.index-fragment b/builder/templates/centos-7.2.index-fragment deleted file mode 100644 index a05a559c3..000000000 --- a/builder/templates/centos-7.2.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[centos-7.2] -name=CentOS 7.2 -osinfo=centos7.2 -arch=x86_64 -file=centos-7.2.xz -checksum=b32e6003d1f15e3a97e3644e35bb3fdc345a9b2e7448655d951ec331af6cd2b5548d6acfc9d92f09ac3a8a6439069c27fa539997118cb8a3f77d3bfa45c659d0 -format=raw -size=6442450944 -compressed_size=252158848 -expand=/dev/sda3 -notes=CentOS 7.2 - - This CentOS image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/centos.sh - diff --git a/builder/templates/centos-7.3.index-fragment b/builder/templates/centos-7.3.index-fragment deleted file mode 100644 index 48cf54de6..000000000 --- a/builder/templates/centos-7.3.index-fragment +++ /dev/null @@ -1,21 +0,0 @@ -[centos-7.3] -name=CentOS 7.3 -osinfo=centos7.3 -arch=x86_64 -file=centos-7.3.xz -revision=2 -checksum[sha512]=07c8941506b1104a2571912060dc275455924415222397316fe28efd5501979c75a23c59b946acad481160b5260f61585c64777a4a9fe6f8365f9fa29df68e6c -format=raw -size=6442450944 -compressed_size=294531760 -expand=/dev/sda2 -lvexpand=/dev/cl/root -notes=CentOS 7.3 - - This CentOS image contains only unmodified @Core group packages. - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/centos-7.3.ks b/builder/templates/centos-7.3.ks deleted file mode 100644 index f19ad8211..000000000 --- a/builder/templates/centos-7.3.ks +++ /dev/null @@ -1,28 +0,0 @@ -# Kickstart file for centos-7.3 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=lvm - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/centos-7.4.index-fragment b/builder/templates/centos-7.4.index-fragment deleted file mode 100644 index ef00b803c..000000000 --- a/builder/templates/centos-7.4.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[centos-7.4] -name=CentOS 7.4 -osinfo=centos7.4 -arch=x86_64 -file=centos-7.4.xz -checksum[sha512]=593a0c2534b097ddb7bcf55f64d0095c6042f9d611ee297d56e8cf37d31e9c72df77bcbdd1580d704cef25b063df43935c8bf05c79fca362a89e3a633616ea6d -format=raw -size=6442450944 -compressed_size=309453024 -expand=/dev/sda3 -notes=CentOS 7.4 - - This CentOS image contains only unmodified @Core group packages. - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/centos-7.4.ks b/builder/templates/centos-7.4.ks deleted file mode 100644 index e69f8edfc..000000000 --- a/builder/templates/centos-7.4.ks +++ /dev/null @@ -1,28 +0,0 @@ -# Kickstart file for centos-7.4 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/centos-7.5.index-fragment b/builder/templates/centos-7.5.index-fragment deleted file mode 100644 index 21514a75e..000000000 --- a/builder/templates/centos-7.5.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[centos-7.5] -name=CentOS 7.5 -osinfo=centos7.5 -arch=x86_64 -file=centos-7.5.xz -checksum[sha512]=4d9c64aae69d1a18c6137554e25ba77d7bc7dd4dced88d359ed6d9cf91c252e67afc0c297b10bf58309cc09bbaaf2cec647cd1dd14b63edf0c31d55e209c3b2e -format=raw -size=6442450944 -compressed_size=333305636 -expand=/dev/sda4 -notes=CentOS 7.5 - - This CentOS image contains only unmodified @Core group packages. - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/centos-7.5.ks b/builder/templates/centos-7.5.ks deleted file mode 100644 index 41bb9e8b6..000000000 --- a/builder/templates/centos-7.5.ks +++ /dev/null @@ -1,28 +0,0 @@ -# Kickstart file for centos-7.5 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/centos-7.5.virt-install-cmd b/builder/templates/centos-7.5.virt-install-cmd deleted file mode 100644 index 12c2b2e75..000000000 --- a/builder/templates/centos-7.5.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'centos-7.5' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-mfilsn2l' \ - '--ram=2048' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=centos7.0' \ - '--initrd-inject=centos-7.5.ks' \ - '--extra-args=ks=file:/centos-7.5.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-mfilsn2l.img,size=6,format=raw' \ - '--location=http://mirror.centos.org/centos-7/7/os/x86_64/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/centos-7.6.index-fragment b/builder/templates/centos-7.6.index-fragment deleted file mode 100644 index 2f4efc45b..000000000 --- a/builder/templates/centos-7.6.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[centos-7.6] -name=CentOS 7.6 -osinfo=centos7.6 -arch=x86_64 -file=centos-7.6.xz -checksum[sha512]=aec0e3b2c012d97e01ff81afe924ce36f5fc8d8688f0ffc83f304f138619935af19d12525f1479f724c35a758feb92b659397805b0fab1fdc482ff5bf6e924d5 -format=raw -size=6442450944 -compressed_size=323800576 -expand=/dev/sda4 -notes=CentOS 7.6 - - This CentOS image contains only unmodified @Core group packages. - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/centos-7.6.ks b/builder/templates/centos-7.6.ks deleted file mode 100644 index 377c3ca5e..000000000 --- a/builder/templates/centos-7.6.ks +++ /dev/null @@ -1,28 +0,0 @@ -# Kickstart file for centos-7.6 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/centos-7.6.virt-install-cmd b/builder/templates/centos-7.6.virt-install-cmd deleted file mode 100644 index bc035be60..000000000 --- a/builder/templates/centos-7.6.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'centos-7.6' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-pi6i1jmm' \ - '--ram=2048' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=centos7.0' \ - '--initrd-inject=centos-7.6.ks' \ - '--extra-args=ks=file:/centos-7.6.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-pi6i1jmm.img,size=6,format=raw' \ - '--location=http://mirror.centos.org/centos-7/7/os/x86_64/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/centos-7.7.index-fragment b/builder/templates/centos-7.7.index-fragment deleted file mode 100644 index 72a32eb01..000000000 --- a/builder/templates/centos-7.7.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[centos-7.7] -name=CentOS 7.7 -osinfo=centos7.7 -arch=x86_64 -file=centos-7.7.xz -checksum[sha512]=0cc4d5a5ddff9d6dc11ddbf0161368630f4517cc4a12ac449619a0cdb7825b0b16973226617574ea8dc60338094f94db6a34d7fb7ee2906f0ef0b05215e8912d -format=raw -size=6442450944 -compressed_size=353990508 -expand=/dev/sda4 -notes=CentOS 7.7 - - This CentOS image contains only unmodified @Core group packages. - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/centos-7.7.ks b/builder/templates/centos-7.7.ks deleted file mode 100644 index 6c50e48ba..000000000 --- a/builder/templates/centos-7.7.ks +++ /dev/null @@ -1,28 +0,0 @@ -# Kickstart file for centos-7.7 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/centos-7.7.virt-install-cmd b/builder/templates/centos-7.7.virt-install-cmd deleted file mode 100644 index d613b2ce7..000000000 --- a/builder/templates/centos-7.7.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'centos-7.7' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-sbpyaejm' \ - '--ram=2048' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=centos7.0' \ - '--initrd-inject=centos-7.7.ks' \ - '--extra-args=ks=file:/centos-7.7.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-sbpyaejm.img,size=6,format=raw' \ - '--location=http://mirror.centos.org/centos-7/7/os/x86_64/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/centos-7.8.index-fragment b/builder/templates/centos-7.8.index-fragment deleted file mode 100644 index 3290ca7dd..000000000 --- a/builder/templates/centos-7.8.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[centos-7.8] -name=CentOS 7.8 -osinfo=centos7.8 -arch=x86_64 -file=centos-7.8.xz -checksum[sha512]=fe3c35515606d956a7a4e7894e4572d90f733740c7ff8d4e2c8724cd3a8ebe9cba70267da133955d331f671104cbe5c7959f9637cc57a744fec4253ac5d3fe3e -format=raw -size=6442450944 -compressed_size=363772768 -expand=/dev/sda4 -notes=CentOS 7.8 - - This CentOS image contains only unmodified @Core group packages. - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/centos-7.8.ks b/builder/templates/centos-7.8.ks deleted file mode 100644 index 21e762a8f..000000000 --- a/builder/templates/centos-7.8.ks +++ /dev/null @@ -1,29 +0,0 @@ -# Kickstart file for centos-7.8 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/centos-7.8.virt-install-cmd b/builder/templates/centos-7.8.virt-install-cmd deleted file mode 100644 index 55467697d..000000000 --- a/builder/templates/centos-7.8.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'centos-7.8' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-bv7gf3r0' \ - '--ram=4096' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=centos7.0' \ - '--initrd-inject=centos-7.8.ks' \ - '--extra-args=ks=file:/centos-7.8.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-bv7gf3r0.img,size=6,format=raw' \ - '--location=http://mirror.centos.org/centos-7/7/os/x86_64/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/centos-8.0.index-fragment b/builder/templates/centos-8.0.index-fragment deleted file mode 100644 index 98e9c8d7d..000000000 --- a/builder/templates/centos-8.0.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[centos-8.0] -name=CentOS 8.0 -osinfo=centos8.0 -arch=x86_64 -file=centos-8.0.xz -checksum[sha512]=ac2f6639998867d96ac76f974024af6e3f122a6315e08dfbd2545460e8df6aef6bf5f708cefdf50bb74b1ccce91b10f35f025e599b5e21ba8972c3003d198bc1 -format=raw -size=6442450944 -compressed_size=351045520 -expand=/dev/sda4 -notes=CentOS 8.0 - - This CentOS image contains only unmodified @Core group packages. - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/centos-8.0.ks b/builder/templates/centos-8.0.ks deleted file mode 100644 index 36252766f..000000000 --- a/builder/templates/centos-8.0.ks +++ /dev/null @@ -1,30 +0,0 @@ -# Kickstart file for centos-8.0 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -url --url="http://mirror.centos.org/centos-8/8/BaseOS/x86_64/os" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/centos-8.0.virt-install-cmd b/builder/templates/centos-8.0.virt-install-cmd deleted file mode 100644 index 68b64d470..000000000 --- a/builder/templates/centos-8.0.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'centos-8.0' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-1md2o05m' \ - '--ram=4096' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel8.0' \ - '--initrd-inject=centos-8.0.ks' \ - '--extra-args=ks=file:/centos-8.0.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-1md2o05m.img,size=6,format=raw' \ - '--location=http://mirror.centos.org/centos-8/8/BaseOS/x86_64/kickstart' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/centos-8.2.index-fragment b/builder/templates/centos-8.2.index-fragment deleted file mode 100644 index 336d4c369..000000000 --- a/builder/templates/centos-8.2.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[centos-8.2] -name=CentOS 8.2 -osinfo=centos8.2 -arch=x86_64 -file=centos-8.2.xz -checksum[sha512]=22ecd8a97321094178592862eb47ae7552bbafbbd0d7c03c10da8eadab9bcd9dafd99f048d7520278507839ee47b16bec54f0f70ad7c8402a5ff643e62b9ae5a -format=raw -size=6442450944 -compressed_size=379922752 -expand=/dev/sda4 -notes=CentOS 8.2 - - This CentOS image contains only unmodified @Core group packages. - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/centos-8.2.ks b/builder/templates/centos-8.2.ks deleted file mode 100644 index d38b2f789..000000000 --- a/builder/templates/centos-8.2.ks +++ /dev/null @@ -1,30 +0,0 @@ -# Kickstart file for centos-8.2 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -url --url="http://mirror.centos.org/centos-8/8/BaseOS/x86_64/os" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/centos-8.2.virt-install-cmd b/builder/templates/centos-8.2.virt-install-cmd deleted file mode 100644 index 4c98ab65f..000000000 --- a/builder/templates/centos-8.2.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'centos-8.2' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-y2rkkuka' \ - '--ram=4096' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel8.0' \ - '--initrd-inject=centos-8.2.ks' \ - '--extra-args=ks=file:/centos-8.2.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-y2rkkuka.img,size=6,format=raw' \ - '--location=http://mirror.centos.org/centos-8/8/BaseOS/x86_64/kickstart' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/cirros-0.3.1.index-fragment b/builder/templates/cirros-0.3.1.index-fragment deleted file mode 100644 index da9cdeb28..000000000 --- a/builder/templates/cirros-0.3.1.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[cirros-0.3.1] -name=CirrOS 0.3.1 -arch=x86_64 -file=cirros-0.3.1.xz -checksum=096209f00eb62d5722accf3d22ca3a4ee5baaac6d7d4ce0be93b56bbd1c8ab2e3eb4f5db1deffcb570e2c3d41f4d721798a1c499675346cee9546554a4b10388 -format=raw -size=41126400 -compressed_size=11419004 -expand=/dev/sda1 -notes=CirrOS 0.3.1 - - CirrOS is a commonly used test image, ideal because it is very - small and boots into a minimally usable Linux system. - - Note this is not a real Linux distribution, and several virt-builder - features such as installing packages will not (and cannot) work. - - This CirrOS image comes from https://launchpad.net/cirros - diff --git a/builder/templates/cirros-0.3.5.index-fragment b/builder/templates/cirros-0.3.5.index-fragment deleted file mode 100644 index 2b13266c8..000000000 --- a/builder/templates/cirros-0.3.5.index-fragment +++ /dev/null @@ -1,21 +0,0 @@ -[cirros-0.3.5] -name=CirrOS 0.3.5 -arch=x86_64 -file=cirros-0.3.5.xz -checksum=77f74203aa26e843e83f522ba44d765c6ba9ab595c19c14d629064c71f875158beb7e93e7b6ac5e6895c6e3b6daa8b94d7286230b9fdf166ae65d0d6e9c9329a -format=raw -size=41126400 -compressed_size=11479284 -expand=/dev/sda1 -notes=CirrOS 0.3.5 - - CirrOS is a commonly used test image, ideal because it is very - small and boots into a minimally usable Linux system. - - Note this is not a real Linux distribution, and several virt-builder - features such as installing packages will not (and cannot) work. - - This CirrOS image comes from https://download.cirros-cloud.net/0.3.5/ - and was prepared by running ‘qemu-img convert .. -O raw’ followed by - ‘xz --best’. - diff --git a/builder/templates/debian-10.index-fragment b/builder/templates/debian-10.index-fragment deleted file mode 100644 index 11ca74f5a..000000000 --- a/builder/templates/debian-10.index-fragment +++ /dev/null @@ -1,24 +0,0 @@ -[debian-10] -name=Debian 10 (buster) -osinfo=debian10 -arch=x86_64 -file=debian-10.xz -checksum[sha512]=264d340e843d349f8caee14add56da4de95b22224ec48c6b3d9245afc764e4d460edabaf16fe6e4026008383128dc878a6d85eaf5dc55d66cef55cca88929c05 -format=raw -size=6442450944 -compressed_size=218919120 -expand=/dev/sda1 -notes=Debian 10 (buster) - - This is a minimal Debian install. - - This image is so very minimal that it only includes an ssh server - This image does not contain SSH host keys. To regenerate them use: - - --firstboot-command "dpkg-reconfigure openssh-server" - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/debian-10.virt-install-cmd b/builder/templates/debian-10.virt-install-cmd deleted file mode 100644 index 686c376a4..000000000 --- a/builder/templates/debian-10.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'debian-10' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-ksggvz66' \ - '--ram=2048' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=debian8' \ - '--initrd-inject=/tmp/dqaxqsv8.tmp/preseed.cfg' \ - '--extra-args=auto mirror/http/proxy= console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-ksggvz66.img,size=6,format=raw' \ - '--location=http://deb.debian.org/debian/dists/buster/main/installer-amd64' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/debian-6.index-fragment b/builder/templates/debian-6.index-fragment deleted file mode 100644 index 3b0c78da9..000000000 --- a/builder/templates/debian-6.index-fragment +++ /dev/null @@ -1,32 +0,0 @@ -[debian-6] -name=Debian 6 (Squeeze) -osinfo=debian6 -arch=x86_64 -file=debian-6.xz -revision=2 -checksum=bff9c28da0375fde65fa238d7a2ea644cbfad0ea3246783a2f44a98f2374850987679c3f1032a632d3c6238de8d9e43291d07a82efc1e824945000e206b9f6cc -format=raw -size=4294967296 -compressed_size=139615908 -expand=/dev/sda1 -notes=Debian 6 (Squeeze). - - This is a default Debian install. - - The preseed and virt-install scripts that produced this image - can be found in the libguestfs source tree: - - builder/website/debian.preseed - builder/website/debian.sh - - This image is so very minimal that it only includes an ssh - server and no virtual consoles. To enable virtual consoles - use this virt-builder option: - - virt-builder debian-6 \ - --edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,' - - This image does not contain SSH host keys. To regenerate them use: - - --firstboot-command "dpkg-reconfigure openssh-server" - diff --git a/builder/templates/debian-7-sparc64.index-fragment b/builder/templates/debian-7-sparc64.index-fragment deleted file mode 100644 index 31bd8241c..000000000 --- a/builder/templates/debian-7-sparc64.index-fragment +++ /dev/null @@ -1,35 +0,0 @@ -[debian-7] -name=Debian 7 (Wheezy) (sparc64) -osinfo=debian7 -arch=sparc64 -file=debian-7-sparc64.xz -checksum=a81530ec2335d578e54fcf3c62b979a2985faee8e6480a49e7d24269097c89585f39a04b00d99e82aca00f3304c44dfbed843ce6ce5dcd7828256a51219b701f -format=raw -size=4294967296 -compressed_size=96292208 -expand=/dev/sda3 -notes=Debian 7 (Wheezy). - - This is a Debian 7 (Wheezy) sparc64 image. This was not built using - a reproducible script, but by installing Debian by hand, so don't use - this in production. - - There is also a 'debian' account which you should be aware of and - may need to remove. - - To build the image, use: - - virt-builder [...] \ - --edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,' \ - --firstboot-command "dpkg-reconfigure openssh-server" - - Resizing the image will not work because virt-builder does not - understand the partition format. - - To boot the image: - - qemu-system-sparc64 -drive file=debian-7.img,format=raw -serial stdio - - Console messages are lost after the bootconsole is disabled, but it - is still booting and will eventually give you a login prompt. - diff --git a/builder/templates/debian-7.index-fragment b/builder/templates/debian-7.index-fragment deleted file mode 100644 index cb0648bf8..000000000 --- a/builder/templates/debian-7.index-fragment +++ /dev/null @@ -1,25 +0,0 @@ -[debian-7] -name=Debian 7 (wheezy) -osinfo=debian7 -arch=x86_64 -file=debian-7.xz -revision=3 -checksum[sha512]=428d5867009c49bdffe3e752c68da7aa17fac415a308dffe1a0863376325aed93945500afedc0dd14b06f1b1e86598c0445c63c3bc3be91aafe4de7a0aefcbdd -format=raw -size=6442450944 -compressed_size=200048080 -expand=/dev/sda1 -notes=Debian 7 (wheezy) - - This is a minimal Debian install. - - This image is so very minimal that it only includes an ssh server - This image does not contain SSH host keys. To regenerate them use: - - --firstboot-command "dpkg-reconfigure openssh-server" - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/debian-8.index-fragment b/builder/templates/debian-8.index-fragment deleted file mode 100644 index b61b010dc..000000000 --- a/builder/templates/debian-8.index-fragment +++ /dev/null @@ -1,24 +0,0 @@ -[debian-8] -name=Debian 8 (jessie) -osinfo=debian8 -arch=x86_64 -file=debian-8.xz -revision=2 -checksum[sha512]=bd182ce61636166e4cb9c98d786f61e4b53069cc945036ff04ddec3f39f3b2218183bbe059e0e237ba782622cbbee6683018cc8f45fc47a1ed7464e754b87ed3 -format=raw -size=6442450944 -compressed_size=232182108 -expand=/dev/sda1 -notes=Debian 8 (jessie) - - This is a minimal Debian install. - - This image does not contain SSH host keys. To regenerate them use: - - --firstboot-command "dpkg-reconfigure openssh-server" - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/debian-9.index-fragment b/builder/templates/debian-9.index-fragment deleted file mode 100644 index 1f2ccde8a..000000000 --- a/builder/templates/debian-9.index-fragment +++ /dev/null @@ -1,24 +0,0 @@ -[debian-9] -name=Debian 9 (stretch) -osinfo=debian9 -arch=x86_64 -file=debian-9.xz -revision=2 -checksum[sha512]=2e8bc3b34940157766b9ad628ddf8eb9a1b410798b921959fd57ae8a4e54fdfa74ac939fe214b8200f9d783be940f4b75b640dbf388e51ef5e74f0c96acd5529 -format=raw -size=6442450944 -compressed_size=194181968 -expand=/dev/sda1 -notes=Debian 9 (stretch) - - This is a minimal Debian install. - - This image does not contain SSH host keys. To regenerate them use: - - --firstboot-command "dpkg-reconfigure openssh-server" - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/debian.preseed b/builder/templates/debian.preseed deleted file mode 100644 index 8c51fa7f9..000000000 --- a/builder/templates/debian.preseed +++ /dev/null @@ -1,443 +0,0 @@ -#### Contents of the preconfiguration file (for stretch) -### Localization -# Preseeding only locale sets language, country and locale. -d-i debian-installer/locale string en_US - -# The values can also be preseeded individually for greater flexibility. -#d-i debian-installer/language string en -#d-i debian-installer/country string NL -#d-i debian-installer/locale string en_GB.UTF-8 -# Optionally specify additional locales to be generated. -#d-i localechooser/supported-locales multiselect en_US.UTF-8, nl_NL.UTF-8 - -# Keyboard selection. -d-i keyboard-configuration/xkb-keymap select us -# d-i keyboard-configuration/toggle select No toggling - -### Network configuration -# Disable network configuration entirely. This is useful for cdrom -# installations on non-networked devices where the network questions, -# warning and long timeouts are a nuisance. -d-i netcfg/enable boolean true - -# netcfg will choose an interface that has link if possible. This makes it -# skip displaying a list if there is more than one interface. -d-i netcfg/choose_interface select auto - -# To pick a particular interface instead: -#d-i netcfg/choose_interface select eth1 - -# To set a different link detection timeout (default is 3 seconds). -# Values are interpreted as seconds. -#d-i netcfg/link_wait_timeout string 10 - -# If you have a slow dhcp server and the installer times out waiting for -# it, this might be useful. -#d-i netcfg/dhcp_timeout string 60 -#d-i netcfg/dhcpv6_timeout string 60 - -# If you prefer to configure the network manually, uncomment this line and -# the static network configuration below. -#d-i netcfg/disable_autoconfig boolean true - -# If you want the preconfiguration file to work on systems both with and -# without a dhcp server, uncomment these lines and the static network -# configuration below. -#d-i netcfg/dhcp_failed note -#d-i netcfg/dhcp_options select Configure network manually - -# Static network configuration. -# -# IPv4 example -#d-i netcfg/get_ipaddress string 192.168.1.42 -#d-i netcfg/get_netmask string 255.255.255.0 -#d-i netcfg/get_gateway string 192.168.1.1 -#d-i netcfg/get_nameservers string 192.168.1.1 -#d-i netcfg/confirm_static boolean true -# -# IPv6 example -#d-i netcfg/get_ipaddress string fc00::2 -#d-i netcfg/get_netmask string ffff:ffff:ffff:ffff:: -#d-i netcfg/get_gateway string fc00::1 -#d-i netcfg/get_nameservers string fc00::1 -#d-i netcfg/confirm_static boolean true - -# Any hostname and domain names assigned from dhcp take precedence over -# values set here. However, setting the values still prevents the questions -# from being shown, even if values come from dhcp. -d-i netcfg/get_hostname string unassigned-hostname -d-i netcfg/get_domain string unassigned-domain - -# If you want to force a hostname, regardless of what either the DHCP -# server returns or what the reverse DNS entry for the IP is, uncomment -# and adjust the following line. -d-i netcfg/hostname string unassigned-hostname.unassigned-domain - -# Disable that annoying WEP key dialog. -d-i netcfg/wireless_wep string -# The wacky dhcp hostname that some ISPs use as a password of sorts. -#d-i netcfg/dhcp_hostname string radish - -# If non-free firmware is needed for the network or other hardware, you can -# configure the installer to always try to load it, without prompting. Or -# change to false to disable asking. -#d-i hw-detect/load_firmware boolean true - -### Network console -# Use the following settings if you wish to make use of the network-console -# component for remote installation over SSH. This only makes sense if you -# intend to perform the remainder of the installation manually. -#d-i anna/choose_modules string network-console -#d-i network-console/authorized_keys_url string http://10.0.0.1/openssh-key -#d-i network-console/password password r00tme -#d-i network-console/password-again password r00tme - -### Mirror settings -# If you select ftp, the mirror/country string does not need to be set. -#d-i mirror/protocol string ftp -d-i mirror/country string manual -d-i mirror/http/hostname string deb.debian.org -d-i mirror/http/directory string /debian -#d-i mirror/http/proxy string - -# Suite to install. -#d-i mirror/suite string testing -# Suite to use for loading installer components (optional). -#d-i mirror/udeb/suite string testing - -### Account setup -# Skip creation of a root account (normal user account will be able to -# use sudo). -#d-i passwd/root-login boolean false -# Alternatively, to skip creation of a normal user account. -d-i passwd/make-user boolean false - -# Root password, either in clear text -d-i passwd/root-password password builder -d-i passwd/root-password-again password builder -# or encrypted using a crypt(3) hash. -#d-i passwd/root-password-crypted password [crypt(3) hash] - -# To create a normal user account. -#d-i passwd/user-fullname string Debian User -#d-i passwd/username string debian -# Normal user's password, either in clear text -#d-i passwd/user-password password insecure -#d-i passwd/user-password-again password insecure -# or encrypted using a crypt(3) hash. -#d-i passwd/user-password-crypted password [crypt(3) hash] -# Create the first user with the specified UID instead of the default. -#d-i passwd/user-uid string 1010 - -# The user account will be added to some standard initial groups. To -# override that, use this. -#d-i passwd/user-default-groups string audio cdrom video - -### Clock and time zone setup -# Controls whether or not the hardware clock is set to UTC. -d-i clock-setup/utc boolean true - -# You may set this to any valid setting for $TZ; see the contents of -# /usr/share/zoneinfo/ for valid values. -d-i time/zone string US/Eastern - -# Controls whether to use NTP to set the clock during the install -d-i clock-setup/ntp boolean true -# NTP server to use. The default is almost always fine here. -#d-i clock-setup/ntp-server string ntp.example.com - -### Partitioning -## Partitioning example -# If the system has free space you can choose to only partition that space. -# This is only honoured if partman-auto/method (below) is not set. -#d-i partman-auto/init_automatically_partition select biggest_free - -# Alternatively, you may specify a disk to partition. If the system has only -# one disk the installer will default to using that, but otherwise the device -# name must be given in traditional, non-devfs format (so e.g. /dev/sda -# and not e.g. /dev/discs/disc0/disc). -# For example, to use the first SCSI/SATA hard disk: -#d-i partman-auto/disk string /dev/sda -# In addition, you'll need to specify the method to use. -# The presently available methods are: -# - regular: use the usual partition types for your architecture -# - lvm: use LVM to partition the disk -# - crypto: use LVM within an encrypted partition -d-i partman-auto/method string regular - -# If one of the disks that are going to be automatically partitioned -# contains an old LVM configuration, the user will normally receive a -# warning. This can be preseeded away... -d-i partman-lvm/device_remove_lvm boolean true -# The same applies to pre-existing software RAID array: -d-i partman-md/device_remove_md boolean true -# And the same goes for the confirmation to write the lvm partitions. -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true -d-i partman-basicfilesystems/no_swap boolean false - -d-i partman-auto/expert_recipe string myroot :: 500 10000 1000000 ext4 \ - $primary{ } \ - $bootable{ } \ - method{ format } \ - format{ } \ - use_filesystem{ } \ - filesystem{ ext4 } \ - mountpoint{ / } . - -# You can choose one of the three predefined partitioning recipes: -# - atomic: all files in one partition -# - home: separate /home partition -# - multi: separate /home, /var, and /tmp partitions - -d-i partman-auto/choose_recipe select myroot - -# Or provide a recipe of your own... -# If you have a way to get a recipe file into the d-i environment, you can -# just point at it. -#d-i partman-auto/expert_recipe_file string /hd-media/recipe - -# If not, you can put an entire recipe into the preconfiguration file in one -# (logical) line. This example creates a small /boot partition, suitable -# swap, and uses the rest of the space for the root partition: -#d-i partman-auto/expert_recipe string \ -# boot-root :: \ -# 40 50 100 ext3 \ -# $primary{ } $bootable{ } \ -# method{ format } format{ } \ -# use_filesystem{ } filesystem{ ext3 } \ -# mountpoint{ /boot } \ -# . \ -# 500 10000 1000000000 ext3 \ -# method{ format } format{ } \ -# use_filesystem{ } filesystem{ ext3 } \ -# mountpoint{ / } \ -# . \ -# 64 512 300% linux-swap \ -# method{ swap } format{ } \ -# . - -# The full recipe format is documented in the file partman-auto-recipe.txt -# included in the 'debian-installer' package or available from D-I source -# repository. This also documents how to specify settings such as file -# system labels, volume group names and which physical devices to include -# in a volume group. - -# This makes partman automatically partition without confirmation, provided -# that you told it what to do using one of the methods above. -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - -# When disk encryption is enabled, skip wiping the partitions beforehand. -#d-i partman-auto-crypto/erase_disks boolean false - -## Partitioning using RAID -# The method should be set to "raid". -#d-i partman-auto/method string raid -# Specify the disks to be partitioned. They will all get the same layout, -# so this will only work if the disks are the same size. -#d-i partman-auto/disk string /dev/sda /dev/sdb - -# Next you need to specify the physical partitions that will be used. -#d-i partman-auto/expert_recipe string \ -# multiraid :: \ -# 1000 5000 4000 raid \ -# $primary{ } method{ raid } \ -# . \ -# 64 512 300% raid \ -# method{ raid } \ -# . \ -# 500 10000 1000000000 raid \ -# method{ raid } \ -# . - -# Last you need to specify how the previously defined partitions will be -# used in the RAID setup. Remember to use the correct partition numbers -# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported; -# devices are separated using "#". -# Parameters are: -# \ -# - -#d-i partman-auto-raid/recipe string \ -# 1 2 0 ext3 / \ -# /dev/sda1#/dev/sdb1 \ -# . \ -# 1 2 0 swap - \ -# /dev/sda5#/dev/sdb5 \ -# . \ -# 0 2 0 ext3 /home \ -# /dev/sda6#/dev/sdb6 \ -# . - -# For additional information see the file partman-auto-raid-recipe.txt -# included in the 'debian-installer' package or available from D-I source -# repository. - -# This makes partman automatically partition without confirmation. -d-i partman-md/confirm boolean true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - -## Controlling how partitions are mounted -# The default is to mount by UUID, but you can also choose "traditional" to -# use traditional device names, or "label" to try filesystem labels before -# falling back to UUIDs. -#d-i partman/mount_style select uuid - -### Base system installation -# Configure APT to not install recommended packages by default. Use of this -# option can result in an incomplete system and should only be used by very -# experienced users. -#d-i base-installer/install-recommends boolean false - -# The kernel image (meta) package to be installed; "none" can be used if no -# kernel is to be installed. -#d-i base-installer/kernel/image string linux-image-486 - -### Apt setup -# You can choose to install non-free and contrib software. -#d-i apt-setup/non-free boolean true -#d-i apt-setup/contrib boolean true -# Uncomment this if you don't want to use a network mirror. -#d-i apt-setup/use_mirror boolean false -# Select which update services to use; define the mirrors to be used. -# Values shown below are the normal defaults. -#d-i apt-setup/services-select multiselect security, volatile -#d-i apt-setup/security_host string security.debian.org -#d-i apt-setup/volatile_host string volatile.debian.org - -# Additional repositories, local[0-9] available -#d-i apt-setup/local0/repository string \ -# http://local.server/debian stable main -#d-i apt-setup/local0/comment string local server -# Enable deb-src lines -#d-i apt-setup/local0/source boolean true -# URL to the public key of the local repository; you must provide a key or -# apt will complain about the unauthenticated repository and so the -# sources.list line will be left commented out -#d-i apt-setup/local0/key string http://local.server/key - -# By default the installer requires that repositories be authenticated -# using a known gpg key. This setting can be used to disable that -# authentication. Warning: Insecure, not recommended. -#d-i debian-installer/allow_unauthenticated boolean true - -# Uncomment this to add multiarch configuration for i386 -#d-i apt-setup/multiarch string i386 - - -### Package selection -tasksel tasksel/first multiselect standard, ssh-server - -# Individual additional packages to install -#d-i pkgsel/include string openssh-server build-essential -# Whether to upgrade packages after debootstrap. -# Allowed values: none, safe-upgrade, full-upgrade -d-i pkgsel/upgrade select full-upgrade - -# Some versions of the installer can report back on what software you have -# installed, and what software you use. The default is not to report back, -# but sending reports helps the project determine what software is most -# popular and include it on CDs. -popularity-contest popularity-contest/participate boolean false - -### Boot loader installation -# Grub is the default boot loader (for x86). If you want lilo installed -# instead, uncomment this: -#d-i grub-installer/skip boolean true -# To also skip installing lilo, and install no bootloader, uncomment this -# too: -#d-i lilo-installer/skip boolean true - - -# This is fairly safe to set, it makes grub install automatically to the MBR -# if no other operating system is detected on the machine. -d-i grub-installer/only_debian boolean true - -# This one makes grub-installer install to the MBR if it also finds some other -# OS, which is less safe as it might not be able to boot that other OS. -d-i grub-installer/with_other_os boolean true - -# Due notably to potential USB sticks, the location of the MBR can not be -# determined safely in general, so this needs to be specified: -#d-i grub-installer/bootdev string /dev/sda -# To install to the first device (assuming it is not a USB stick): -d-i grub-installer/bootdev string default - -# Alternatively, if you want to install to a location other than the mbr, -# uncomment and edit these lines: -#d-i grub-installer/only_debian boolean false -#d-i grub-installer/with_other_os boolean false -#d-i grub-installer/bootdev string (hd0,1) -# To install grub to multiple disks: -#d-i grub-installer/bootdev string (hd0,1) (hd1,1) (hd2,1) - -# Optional password for grub, either in clear text -#d-i grub-installer/password password r00tme -#d-i grub-installer/password-again password r00tme -# or encrypted using an MD5 hash, see grub-md5-crypt(8). -#d-i grub-installer/password-crypted password [MD5 hash] - -# Use the following option to add additional boot parameters for the -# installed system (if supported by the bootloader installer). -# Note: options passed to the installer will be added automatically. -#d-i debian-installer/add-kernel-opts string nousb - -### Finishing up the installation -# During installations from serial console, the regular virtual consoles -# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next -# line to prevent this. -#d-i finish-install/keep-consoles boolean true - -# Avoid that last message about the install being complete. -d-i finish-install/reboot_in_progress note - -# This will prevent the installer from ejecting the CD during the reboot, -# which is useful in some situations. -#d-i cdrom-detect/eject boolean false - -# This is how to make the installer shutdown when finished, but not -# reboot into the installed system. -#d-i debian-installer/exit/halt boolean true -# This will power off the machine instead of just halting it. -#d-i debian-installer/exit/poweroff boolean true - -### Preseeding other packages -# Depending on what software you choose to install, or if things go wrong -# during the installation process, it's possible that other questions may -# be asked. You can preseed those too, of course. To get a list of every -# possible question that could be asked during an install, do an -# installation, and then run these commands: -# debconf-get-selections --installer > file -# debconf-get-selections >> file - - -#### Advanced options -### Running custom commands during the installation -# d-i preseeding is inherently not secure. Nothing in the installer checks -# for attempts at buffer overflows or other exploits of the values of a -# preconfiguration file like this one. Only use preconfiguration files from -# trusted locations! To drive that home, and because it's generally useful, -# here's a way to run any shell command you'd like inside the installer, -# automatically. - -# This first command is run as early as possible, just after -# preseeding is read. -#d-i preseed/early_command string anna-install some-udeb -# This command is run immediately before the partitioner starts. It may be -# useful to apply dynamic partitioner preseeding that depends on the state -# of the disks (which may not be visible when preseed/early_command runs). -#d-i partman/early_command \ -# string debconf-set partman-auto/disk "$(list-devices disk | head -n1)" -# This command is run just before the install finishes, but when there is -# still a usable /target directory. You can chroot to /target and use it -# directly, or use the apt-install and in-target commands to easily install -# packages and run commands in the target system. -#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh -d-i preseed/late_command string in-target sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200n8"/g; s/# *GRUB_TERMINAL=console/GRUB_TERMINAL=serial/g' /etc/default/grub; in-target update-grub - diff --git a/builder/templates/fedora-18.index-fragment b/builder/templates/fedora-18.index-fragment deleted file mode 100644 index d57e8b44e..000000000 --- a/builder/templates/fedora-18.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-18] -name=Fedora® 18 -osinfo=fedora18 -arch=x86_64 -file=fedora-18.xz -checksum=12435775193b69f6e22658aaa001d4ca9b15fd68a04b4b7e9be20b3b517e857e417dc3268a302979d4a702b20f25754025f7ae0e9fb7088419a4ca1669585e6f -format=raw -size=6442450944 -compressed_size=148947524 -expand=/dev/sda3 -notes=Fedora 18. - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-19.index-fragment b/builder/templates/fedora-19.index-fragment deleted file mode 100644 index 681c54135..000000000 --- a/builder/templates/fedora-19.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-19] -name=Fedora® 19 -osinfo=fedora19 -arch=x86_64 -file=fedora-19.xz -revision=2 -checksum=acecd8d4bca0d6a3f937e0c9386f3185c916df3eaf5f825988c73d41e946a6dc4fda06cdd74a12bc60932edd65846097547b11aca2309a61dd6d0e91ab9d16f3 -format=raw -size=6442450944 -compressed_size=169531628 -expand=/dev/sda3 -notes=Fedora 19. - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-20.index-fragment b/builder/templates/fedora-20.index-fragment deleted file mode 100644 index 3c7071f0b..000000000 --- a/builder/templates/fedora-20.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-20] -name=Fedora® 20 -osinfo=fedora20 -arch=x86_64 -file=fedora-20.xz -revision=2 -checksum=983a1b33c34cb311ea3a283f06312d24dc81041b64ebc90e40ef2fd7587362acd1a5654b13252f9f57001870aa95495065537e730d5225b49389c1a0478cb028 -format=raw -size=6442450944 -compressed_size=181164220 -expand=/dev/sda3 -notes=Fedora 20. - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-21-aarch64.index-fragment b/builder/templates/fedora-21-aarch64.index-fragment deleted file mode 100644 index 7914b7a94..000000000 --- a/builder/templates/fedora-21-aarch64.index-fragment +++ /dev/null @@ -1,25 +0,0 @@ -[fedora-21] -name=Fedora® 21 Server (aarch64) -osinfo=fedora21 -arch=aarch64 -file=fedora-21-aarch64.xz -checksum=57026dd867cbc2e49894dd056ffdc1c397548f4f7e296f393a77ee55343a17f684ddcd3ff7661f514b54209c472f41fce809f2e36064fb66d4f92d8dce5e9b62 -format=raw -size=6442450944 -compressed_size=186616612 -expand=/dev/sda4 -notes=Fedora 21 Server (aarch64) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-aarch64.sh - - Please note you will need to use the associated EFI NVRAM variables: - http://libguestfs.org/download/builder/fedora-21-aarch64-nvram.xz - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-21-armv7l.index-fragment b/builder/templates/fedora-21-armv7l.index-fragment deleted file mode 100644 index 8af4a3e99..000000000 --- a/builder/templates/fedora-21-armv7l.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-21] -name=Fedora® 21 Server (armv7l) -osinfo=fedora21 -arch=armv7l -file=fedora-21-armv7l.xz -checksum=eb44c66f04781064850380fa1747cadc8645c2f3fd8f2dc1b45cbf5b3f31b91383fa9b7b8b2c951556de2ca499a9251487845208aa1a3881ada6d15e49d24300 -format=raw -size=6442450944 -compressed_size=199232964 -expand=/dev/sda3 -notes=Fedora 21 Server (armv7l) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-armv7l.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-21-ppc64.index-fragment b/builder/templates/fedora-21-ppc64.index-fragment deleted file mode 100644 index f79a77886..000000000 --- a/builder/templates/fedora-21-ppc64.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-21] -name=Fedora® 21 Server (ppc64) -osinfo=fedora21 -arch=ppc64 -file=fedora-21-ppc64.xz -revision=3 -checksum=acdd9bbd2a434cae48b8f8cf715b00a0cedbb8d276d76a9d4a4f1d469c9522755e82dd03e5f499c1447e09d9bb5a33ada8a061a601d91c007704edfdd80cddb2 -format=raw -size=6442450944 -compressed_size=233099788 -expand=/dev/sda3 -notes=Fedora 21 Server (ppc64 big endian) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-ppc64.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-21-ppc64le.index-fragment b/builder/templates/fedora-21-ppc64le.index-fragment deleted file mode 100644 index d12f579ad..000000000 --- a/builder/templates/fedora-21-ppc64le.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-21] -name=Fedora® 21 Server (ppc64le) -osinfo=fedora21 -arch=ppc64le -file=fedora-21-ppc64le.xz -revision=3 -checksum=490aeb5f1bd8754a3c2ed705d3ca84ccec26f839492c6955f40289c4ce9754ad40f22710e24449aeda4177ae16541dc61c989e3c1751f657ffbd4740240c13c4 -format=raw -size=6442450944 -compressed_size=233706980 -expand=/dev/sda3 -notes=Fedora 21 Server (ppc64le) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-ppc64le.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-21.index-fragment b/builder/templates/fedora-21.index-fragment deleted file mode 100644 index b899da7e6..000000000 --- a/builder/templates/fedora-21.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-21] -name=Fedora® 21 Server -osinfo=fedora21 -arch=x86_64 -file=fedora-21.xz -revision=1 -checksum=4dc92cbf540d3a0745ffe1fa01ffae15f17e7a8aa45c70ad975a1dda82b7f1ebe42f912be74d91a5866a91ee2ca3be3c2be274b5da29db930fe1ec8c2286575b -format=raw -size=6442450944 -compressed_size=209059864 -expand=/dev/sda3 -notes=Fedora 21 Server. - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-22-aarch64.index-fragment b/builder/templates/fedora-22-aarch64.index-fragment deleted file mode 100644 index 390e8fe80..000000000 --- a/builder/templates/fedora-22-aarch64.index-fragment +++ /dev/null @@ -1,25 +0,0 @@ -[fedora-22] -name=Fedora® 22 Server (aarch64) -osinfo=fedora22 -arch=aarch64 -file=fedora-22-aarch64.xz -checksum=a9606947c036d3aade6a0680857adf4bcfb31a62833475466ff4502087cc427926a28d89b684fbe882a65752be263c567b655a988ff5563fee002e2d6f1ccecb -format=raw -size=6442450944 -compressed_size=215050068 -expand=/dev/sda4 -notes=Fedora 22 Server (aarch64) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-aarch64.sh - - Please note you will need to use the associated EFI NVRAM variables: - http://libguestfs.org/download/builder/fedora-22-aarch64-nvram.xz - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-22-armv7l.index-fragment b/builder/templates/fedora-22-armv7l.index-fragment deleted file mode 100644 index 1a04c7a0f..000000000 --- a/builder/templates/fedora-22-armv7l.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-22] -name=Fedora® 22 Server (armv7l) -osinfo=fedora22 -arch=armv7l -file=fedora-22-armv7l.xz -checksum=8c5c39890409e3fe6f0204834289776bb7a8dca95da2f4d3459a99282f5ed100d7ada1caac2234dd0b357ad4047ef441b128c9ba6256b76df79dee6b5c9e33f8 -format=raw -size=6442450944 -compressed_size=242234088 -expand=/dev/sda3 -notes=Fedora 22 Server (armv7l) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-armv7l.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-22-i686.index-fragment b/builder/templates/fedora-22-i686.index-fragment deleted file mode 100644 index 1f81fd839..000000000 --- a/builder/templates/fedora-22-i686.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-22] -name=Fedora® 22 Server (i686) -osinfo=fedora22 -arch=i686 -file=fedora-22-i686.xz -checksum=3547b94d5c418792e722786cfae41decd41f0725d529d65a2c719094c0b815eaa4fae195514a14d42fa19b57b895bcdbfdb305edf918b1b3722f30f338042d31 -format=raw -size=6442450944 -compressed_size=225185592 -expand=/dev/sda3 -notes=Fedora 22 Server (i686) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-i686.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-22.index-fragment b/builder/templates/fedora-22.index-fragment deleted file mode 100644 index cc8ec3bac..000000000 --- a/builder/templates/fedora-22.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-22] -name=Fedora® 22 Server -osinfo=fedora22 -arch=x86_64 -file=fedora-22.xz -checksum=59f8b32ba363b64ad37a4bd3d17abd049e80691b84ea9b6c4f0485bcc743b6c8dff5bacd4ed838c555487f750edfd132a22421976a0821d82f16811361d4d98d -format=raw -size=6442450944 -compressed_size=228011712 -expand=/dev/sda3 -notes=Fedora 22 Server. - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-23-aarch64.index-fragment b/builder/templates/fedora-23-aarch64.index-fragment deleted file mode 100644 index 72fb635b8..000000000 --- a/builder/templates/fedora-23-aarch64.index-fragment +++ /dev/null @@ -1,25 +0,0 @@ -[fedora-23] -name=Fedora® 23 Server (aarch64) -osinfo=fedora23 -arch=aarch64 -file=fedora-23-aarch64.xz -checksum=aa1359b2a81841ac07e4e25bef9d3ef3b7cf10c171403505cbbd732644fe6c37938cf6c9e3251dae201b659b47033fb792cb29f587fd4d4816b6c0d100dc5be8 -format=raw -size=6442450944 -compressed_size=216417776 -expand=/dev/sda4 -notes=Fedora 23 Server (aarch64) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-aarch64.sh - - You may need to use the associated EFI NVRAM variables: - http://libguestfs.org/download/builder/fedora-23-aarch64-nvram.xz - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-23-armv7l.index-fragment b/builder/templates/fedora-23-armv7l.index-fragment deleted file mode 100644 index 9c3199ebf..000000000 --- a/builder/templates/fedora-23-armv7l.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-23] -name=Fedora® 23 Server (armv7l) -osinfo=fedora23 -arch=armv7l -file=fedora-23-armv7l.xz -checksum=e2c74544b3e9d25c92724536875a3cbcee0c4c4774bb3956ce6938fdbf1588781a1eb3b54a5fad8cc0d63f0af0c699f7e322c613e13552591eec641edf401d78 -format=raw -size=6442450944 -compressed_size=241758696 -expand=/dev/sda3 -notes=Fedora 23 Server (armv7l) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-armv7l.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-23-i686.index-fragment b/builder/templates/fedora-23-i686.index-fragment deleted file mode 100644 index 85ff268e6..000000000 --- a/builder/templates/fedora-23-i686.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-23] -name=Fedora® 23 Server (i686) -osinfo=fedora23 -arch=i686 -file=fedora-23-i686.xz -revision=2 -checksum=4b1badbb92f40ca1b3336e70b2564755d643bc00005fd6364c389a1f3078952968a6887c36c4f79fe3873cf42d41cb36dd226521fee32ed6e08c65d6d059af3c -format=raw -size=6442450944 -compressed_size=322831152 -expand=/dev/sda3 -notes=Fedora 23 Server (i686) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-i686.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-23-ppc64.index-fragment b/builder/templates/fedora-23-ppc64.index-fragment deleted file mode 100644 index db1e8f23f..000000000 --- a/builder/templates/fedora-23-ppc64.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-23] -name=Fedora® 23 Server (ppc64) -osinfo=fedora23 -arch=ppc64 -file=fedora-23-ppc64.xz -checksum=99e0c8186b21525d49c0db074fd25bf6631d2fd2cef2ac22f1b1beb6cb492cfc9aed632a2ea091d39d8762fa892b6d2393fecbde7e140236ba4a88d8c54c3152 -format=raw -size=6442450944 -compressed_size=280692072 -expand=/dev/sda3 -notes=Fedora 23 Server (ppc64 big endian) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-ppc64.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-23-ppc64le.index-fragment b/builder/templates/fedora-23-ppc64le.index-fragment deleted file mode 100644 index 54873f3c1..000000000 --- a/builder/templates/fedora-23-ppc64le.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-23] -name=Fedora® 23 Server (ppc64le) -osinfo=fedora23 -arch=ppc64le -file=fedora-23-ppc64le.xz -revision=2 -checksum=bb6a4cb02a4d7f99f3b8a0f73faa585a4c14e0120a4ace584e0c86062736302bd293072513510378ad30bbdb5fc905077f15ecb8fb5f2ab6ef50b0532af6b8a7 -format=raw -size=6442450944 -compressed_size=278241384 -expand=/dev/sda3 -notes=Fedora 23 Server (ppc64le) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-ppc64le.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-23.index-fragment b/builder/templates/fedora-23.index-fragment deleted file mode 100644 index 8982a4314..000000000 --- a/builder/templates/fedora-23.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-23] -name=Fedora® 23 Server -osinfo=fedora23 -arch=x86_64 -file=fedora-23.xz -revision=3 -checksum=90cd606923e16e2c01a08eaa360e213cdd49462e259a04cc6efb1d2516215fb4ac3c62811dfd1646d89650f717da030fa6dec693571e027a644eee589accb78d -format=raw -size=6442450944 -compressed_size=317209280 -expand=/dev/sda3 -notes=Fedora 23 Server. - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-24-aarch64.index-fragment b/builder/templates/fedora-24-aarch64.index-fragment deleted file mode 100644 index abf3b580f..000000000 --- a/builder/templates/fedora-24-aarch64.index-fragment +++ /dev/null @@ -1,25 +0,0 @@ -[fedora-24] -name=Fedora® 24 Server (aarch64) -osinfo=fedora24 -arch=aarch64 -file=fedora-24-aarch64.xz -checksum=d17a0ee0e5f661f9d2cbffe12dae306f295a0716ef440a12944d3d2805f5a5c637766c98267e914f588502d7ba7eca888edd93ae34a15e30faf907d8c55f4689 -format=raw -size=6442450944 -compressed_size=287727544 -expand=/dev/sda4 -notes=Fedora 24 Server (aarch64) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-aarch64.sh - - You may need to use the associated EFI NVRAM variables: - http://libguestfs.org/download/builder/fedora-24-aarch64-nvram.xz - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-24-armv7l.index-fragment b/builder/templates/fedora-24-armv7l.index-fragment deleted file mode 100644 index 516168d5d..000000000 --- a/builder/templates/fedora-24-armv7l.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-24] -name=Fedora® 24 Server (armv7l) -osinfo=fedora24 -arch=armv7l -file=fedora-24-armv7l.xz -checksum=7d9a5ce8e10c13e8d07ace42555183bfee5e561464e9fc439d0fefc3e85048bdc0c14d44d5584029d4015d0f3316c7583af8ae6d4c0ff8bcfcdb9037a37cacc0 -format=raw -size=6442450944 -compressed_size=324231484 -expand=/dev/sda3 -notes=Fedora 24 Server (armv7l) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-armv7l.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-24-i686.index-fragment b/builder/templates/fedora-24-i686.index-fragment deleted file mode 100644 index 8320113ad..000000000 --- a/builder/templates/fedora-24-i686.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-24] -name=Fedora® 24 Server (i686) -osinfo=fedora24 -arch=i686 -file=fedora-24-i686.xz -checksum=1461da1557327e0641987654919698a6b7c2df1c58f76a4a4d61fb66476dac1b19fe6e3650b82a246df7d241037725c7b8e57e73d3312e370dfb132f54b5cbf4 -format=raw -size=6442450944 -compressed_size=319087504 -expand=/dev/sda3 -notes=Fedora 24 Server (i686) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-i686.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-24.index-fragment b/builder/templates/fedora-24.index-fragment deleted file mode 100644 index e0c17199b..000000000 --- a/builder/templates/fedora-24.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-24] -name=Fedora® 24 Server -osinfo=fedora24 -arch=x86_64 -file=fedora-24.xz -checksum=907656be1f0bb4ed221a54f4339660d02071bdf79acd1644087e5ca20e315ba8e4b9008d7f0814a840904198a54499556f226db8b32f96a01ecd20370da8d03d -format=raw -size=6442450944 -compressed_size=321359432 -expand=/dev/sda3 -notes=Fedora 24 Server. - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-25-aarch64.index-fragment b/builder/templates/fedora-25-aarch64.index-fragment deleted file mode 100644 index 5eaa02995..000000000 --- a/builder/templates/fedora-25-aarch64.index-fragment +++ /dev/null @@ -1,25 +0,0 @@ -[fedora-25] -name=Fedora® 25 Server (aarch64) -osinfo=fedora25 -arch=aarch64 -file=fedora-25-aarch64.xz -checksum=ad8283c6ac4e0b297fd2413d3ffd231bdfbbb0609960d6fd1af45d8047652f7d515398d97345b0d837eca244a501279f9920c6149e00b6504bd08ab965ef19ac -format=raw -size=6442450944 -compressed_size=294070292 -expand=/dev/sda4 -notes=Fedora 25 Server (aarch64) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-aarch64.sh - - You may need to use the associated EFI NVRAM variables: - http://libguestfs.org/download/builder/fedora-25-aarch64-nvram.xz - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-25-armv7l.index-fragment b/builder/templates/fedora-25-armv7l.index-fragment deleted file mode 100644 index 9c18ea873..000000000 --- a/builder/templates/fedora-25-armv7l.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-25] -name=Fedora® 25 Server (armv7l) -osinfo=fedora25 -arch=armv7l -file=fedora-25-armv7l.xz -checksum=3303230d3e907524817ed95504b7b7a5f6a3e167d9564193fdd0781207b1ca841b244d47778ea639e2af709bb8838256f18503b76f1ede06ca7bb9f72693c538 -format=raw -size=6442450944 -compressed_size=270482468 -expand=/dev/sda3 -notes=Fedora 25 Server (armv7l) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-armv7l.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-25-i686.index-fragment b/builder/templates/fedora-25-i686.index-fragment deleted file mode 100644 index 102755846..000000000 --- a/builder/templates/fedora-25-i686.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-25] -name=Fedora® 25 Server (i686) -osinfo=fedora25 -arch=i686 -file=fedora-25-i686.xz -checksum=17cdf048a3961a316ac32aa084b4b7d20d0ff4756bd5e942c1aae29c6e8b3cf2a41516e87e301ee1122643aca14ca252554ebbadbe468a582c10591edc56177a -format=raw -size=6442450944 -compressed_size=247412792 -expand=/dev/sda3 -notes=Fedora 25 Server (i686) - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora-i686.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-25-ppc64.index-fragment b/builder/templates/fedora-25-ppc64.index-fragment deleted file mode 100644 index b4c735b03..000000000 --- a/builder/templates/fedora-25-ppc64.index-fragment +++ /dev/null @@ -1,24 +0,0 @@ -[fedora-25] -name=Fedora® 25 Server (ppc64) -osinfo=fedora25 -arch=ppc64 -file=fedora-25-ppc64.xz -revision=3 -checksum[sha512]=5d5adde673322853eb9f04aebd5a238339f2db6bbb9e4e708d83a81c08fb4847eb538af89348d081560cac6a16da8a51e9942bddf9c200f701eb5793776eaad8 -format=raw -size=6442450944 -compressed_size=336881480 -expand=/dev/sda3 -lvexpand=/dev/fedora/root -notes=Fedora® 25 Server (ppc64) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-25-ppc64.ks b/builder/templates/fedora-25-ppc64.ks deleted file mode 100644 index 8c1a6cf87..000000000 --- a/builder/templates/fedora-25-ppc64.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-25-ppc64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=hvc0 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=lvm - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+="virtio-blk virtio-scsi"' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-25-ppc64le.index-fragment b/builder/templates/fedora-25-ppc64le.index-fragment deleted file mode 100644 index b813e98fc..000000000 --- a/builder/templates/fedora-25-ppc64le.index-fragment +++ /dev/null @@ -1,24 +0,0 @@ -[fedora-25] -name=Fedora® 25 Server (ppc64le) -osinfo=fedora25 -arch=ppc64le -file=fedora-25-ppc64le.xz -revision=3 -checksum[sha512]=da55406553b5a2e3984d11f4621d41ccbb3c30c9484b66096fc1f85cf590bd4c80750b87886447217e8e9f007e27641c4470dd57245c175bb40543d958d9de1e -format=raw -size=6442450944 -compressed_size=340668452 -expand=/dev/sda3 -lvexpand=/dev/fedora/root -notes=Fedora® 25 Server (ppc64le) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-25-ppc64le.ks b/builder/templates/fedora-25-ppc64le.ks deleted file mode 100644 index e4b902a12..000000000 --- a/builder/templates/fedora-25-ppc64le.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-25-ppc64le -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=hvc0 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=lvm - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+="virtio-blk virtio-scsi"' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-25.index-fragment b/builder/templates/fedora-25.index-fragment deleted file mode 100644 index 3e21f2bed..000000000 --- a/builder/templates/fedora-25.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-25] -name=Fedora® 25 Server -osinfo=fedora25 -arch=x86_64 -file=fedora-25.xz -checksum=fd7f8c9c7f6093b0c8c154ab12a116952745a00f5634ee8ded8c81d5f3b9b614558b11109de98f814f4f57fb2c0a394fba43d8a9ed127b99b78ff02c39957f7b -format=raw -size=6442450944 -compressed_size=337395436 -expand=/dev/sda3 -notes=Fedora 25 Server. - - This Fedora image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/fedora.sh - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - diff --git a/builder/templates/fedora-26-aarch64.index-fragment b/builder/templates/fedora-26-aarch64.index-fragment deleted file mode 100644 index 4e0865b49..000000000 --- a/builder/templates/fedora-26-aarch64.index-fragment +++ /dev/null @@ -1,26 +0,0 @@ -[fedora-26] -name=Fedora® 26 Server (aarch64) -osinfo=fedora26 -arch=aarch64 -file=fedora-26-aarch64.xz -revision=2 -checksum[sha512]=130a1f87666dab934e0fd3803003652394c243430e287fdbdd866f72813a840d1ac31afc0e29a7e865e07b8508038108ff9c355be8d964bb33f5d7cd70e9ed2b -format=raw -size=6442450944 -compressed_size=330131876 -expand=/dev/sda4 -notes=Fedora® 26 Server (aarch64) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - You will need to use the associated UEFI NVRAM variables file: - http://libguestfs.org/download/builder/fedora-26-aarch64-nvram.xz - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-26-aarch64.ks b/builder/templates/fedora-26-aarch64.ks deleted file mode 100644 index 376cb21c4..000000000 --- a/builder/templates/fedora-26-aarch64.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-26-aarch64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-26-armv7l.index-fragment b/builder/templates/fedora-26-armv7l.index-fragment deleted file mode 100644 index c7304c8a4..000000000 --- a/builder/templates/fedora-26-armv7l.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-26] -name=Fedora® 26 Server (armv7l) -osinfo=fedora26 -arch=armv7l -file=fedora-26-armv7l.xz -revision=2 -checksum[sha512]=579c3038601fd20ae27023c16c542ecfee03df0c1925c3def1443f36658a6b671d21295f5c7f3d457e35015a21e50094a23ce6993344d94c645da9298def1631 -format=raw -size=6442450944 -compressed_size=343672984 -expand=/dev/sda3 -notes=Fedora® 26 Server (armv7l) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-26-armv7l.ks b/builder/templates/fedora-26-armv7l.ks deleted file mode 100644 index 87297f0e8..000000000 --- a/builder/templates/fedora-26-armv7l.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-26-armv7l -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyAMA0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-26-i686.index-fragment b/builder/templates/fedora-26-i686.index-fragment deleted file mode 100644 index 48c055dc8..000000000 --- a/builder/templates/fedora-26-i686.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-26] -name=Fedora® 26 Server (i686) -osinfo=fedora26 -arch=i686 -file=fedora-26-i686.xz -revision=2 -checksum[sha512]=5e246089550ad25a78b88b9d815c59b9564d49ce2a3c81146bf971ce39903d4b143e2c549fe764cedbd47efa6327871886d8f2a7e3e724fde449d611e2bec7ae -format=raw -size=6442450944 -compressed_size=346508392 -expand=/dev/sda3 -notes=Fedora® 26 Server (i686) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-26-i686.ks b/builder/templates/fedora-26-i686.ks deleted file mode 100644 index 574309ff9..000000000 --- a/builder/templates/fedora-26-i686.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-26-i686 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-26-ppc64.index-fragment b/builder/templates/fedora-26-ppc64.index-fragment deleted file mode 100644 index ebaaea528..000000000 --- a/builder/templates/fedora-26-ppc64.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-26] -name=Fedora® 26 Server (ppc64) -osinfo=fedora26 -arch=ppc64 -file=fedora-26-ppc64.xz -revision=3 -checksum[sha512]=8dce4d0c05ed4b4b958b8016a6fea778581e0eafe7aa40047609e27fe14e342fe4d7c2a269fd4f44fdd2b4c970f77076961fe3714a508be0d3bb011c8af6a257 -format=raw -size=6442450944 -compressed_size=345508032 -expand=/dev/sda4 -notes=Fedora® 26 Server (ppc64) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-26-ppc64.ks b/builder/templates/fedora-26-ppc64.ks deleted file mode 100644 index 4aaa66397..000000000 --- a/builder/templates/fedora-26-ppc64.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-26-ppc64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=hvc0 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-26-ppc64le.index-fragment b/builder/templates/fedora-26-ppc64le.index-fragment deleted file mode 100644 index 7da5dab0e..000000000 --- a/builder/templates/fedora-26-ppc64le.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-26] -name=Fedora® 26 Server (ppc64le) -osinfo=fedora26 -arch=ppc64le -file=fedora-26-ppc64le.xz -revision=3 -checksum[sha512]=402dcdff341b933a831408e7d32261826c86db5c39bd295aaad94e808d23d83f6821669c431cb91d2e689d17660b4d8108f1c69a8d0715373396636608c7d260 -format=raw -size=6442450944 -compressed_size=344584844 -expand=/dev/sda4 -notes=Fedora® 26 Server (ppc64le) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-26-ppc64le.ks b/builder/templates/fedora-26-ppc64le.ks deleted file mode 100644 index e74e6bd2c..000000000 --- a/builder/templates/fedora-26-ppc64le.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-26-ppc64le -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=hvc0 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-26.index-fragment b/builder/templates/fedora-26.index-fragment deleted file mode 100644 index 4cd7f3a14..000000000 --- a/builder/templates/fedora-26.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-26] -name=Fedora® 26 Server -osinfo=fedora26 -arch=x86_64 -file=fedora-26.xz -revision=2 -checksum[sha512]=8b37d7fb6224ab920f5413e4bb425f38c0920a25ae91ccb7f930f77578f547ca813edf6b182423187d13cf1d52c3014b116bbc59abfd06c63e574ddd81b52f56 -format=raw -size=6442450944 -compressed_size=357866028 -expand=/dev/sda3 -notes=Fedora® 26 Server - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-26.ks b/builder/templates/fedora-26.ks deleted file mode 100644 index 50d081b1c..000000000 --- a/builder/templates/fedora-26.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-26 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable Xen domU support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-27-aarch64.index-fragment b/builder/templates/fedora-27-aarch64.index-fragment deleted file mode 100644 index 33713c451..000000000 --- a/builder/templates/fedora-27-aarch64.index-fragment +++ /dev/null @@ -1,25 +0,0 @@ -[fedora-27] -name=Fedora® 27 Server (aarch64) -osinfo=fedora27 -arch=aarch64 -file=fedora-27-aarch64.xz -checksum[sha512]=c250817fc0211593c4de4b75307bb996821d9a0a4c76b8c213f1e253f3c377112daad6cac61ec1b4e7366e0df4eeb3f86eb93c34e251500e6568b9a80671a3e2 -format=raw -size=6442450944 -compressed_size=333834292 -expand=/dev/sda4 -notes=Fedora® 27 Server (aarch64) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - You will need to use the associated UEFI NVRAM variables file: - http://libguestfs.org/download/builder/fedora-27-aarch64-nvram.xz - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-27-aarch64.ks b/builder/templates/fedora-27-aarch64.ks deleted file mode 100644 index 0ed65630d..000000000 --- a/builder/templates/fedora-27-aarch64.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-27-aarch64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-27-aarch64.virt-install-cmd b/builder/templates/fedora-27-aarch64.virt-install-cmd deleted file mode 100644 index 99187453f..000000000 --- a/builder/templates/fedora-27-aarch64.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-27-aarch64' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-c12ztsw3' \ - '--ram=2048' \ - '--arch=aarch64' \ - '--vcpus=1' \ - '--os-variant=fedora23' \ - '--boot' 'loader=/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw,loader_ro=yes,loader_type=pflash,nvram=/home/rjones/d/libguestfs/builder/templates/tmp-c12ztsw3.vars' \ - '--initrd-inject=fedora-27-aarch64.ks' \ - '--extra-args=ks=file:/fedora-27-aarch64.ks proxy=http://cache.home.annexia.org:3128 console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-c12ztsw3.img,size=6,format=raw' \ - '--location=https://dl.fedoraproject.org/pub/fedora-secondary/releases/27/Server/aarch64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-27-armv7l.index-fragment b/builder/templates/fedora-27-armv7l.index-fragment deleted file mode 100644 index 69898ac97..000000000 --- a/builder/templates/fedora-27-armv7l.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-27] -name=Fedora® 27 Server (armv7l) -osinfo=fedora27 -arch=armv7l -file=fedora-27-armv7l.xz -checksum[sha512]=b5ea481f4841d22022b2de9505120f95f0cc56f984cdbbdef2c8d29cf35f94c5b8fe89a9c548e4f24e6770995ff01aaf77c9f4eb56faa76d9ac5e4149ad9ef86 -format=raw -size=6442450944 -compressed_size=367813400 -expand=/dev/sda3 -notes=Fedora® 27 Server (armv7l) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-27-armv7l.ks b/builder/templates/fedora-27-armv7l.ks deleted file mode 100644 index e70a49c52..000000000 --- a/builder/templates/fedora-27-armv7l.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-27-armv7l -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyAMA0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-27-armv7l.virt-install-cmd b/builder/templates/fedora-27-armv7l.virt-install-cmd deleted file mode 100644 index c251daa34..000000000 --- a/builder/templates/fedora-27-armv7l.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-27-armv7l' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-362rplz1' \ - '--ram=2048' \ - '--arch=armv7l' \ - '--vcpus=1' \ - '--os-variant=fedora23' \ - '--initrd-inject=fedora-27-armv7l.ks' \ - '--extra-args=ks=file:/fedora-27-armv7l.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyAMA0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-362rplz1.img,size=6,format=raw' \ - '--location=http://mirror.bytemark.co.uk/fedora/linux/releases/27/Server/armhfp/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-27-i686.index-fragment b/builder/templates/fedora-27-i686.index-fragment deleted file mode 100644 index a4af73d32..000000000 --- a/builder/templates/fedora-27-i686.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-27] -name=Fedora® 27 Server (i686) -osinfo=fedora27 -arch=i686 -file=fedora-27-i686.xz -checksum[sha512]=c29fccb7b372a11a4a4e027705456c3e861f848cb2ac4e6573c28977c6c66a244c6356996f5df0ccb890290a5ee58eb62edec9907bc86bc9e0825d5e26a56083 -format=raw -size=6442450944 -compressed_size=353771776 -expand=/dev/sda4 -notes=Fedora® 27 Server (i686) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-27-i686.ks b/builder/templates/fedora-27-i686.ks deleted file mode 100644 index 410ce91aa..000000000 --- a/builder/templates/fedora-27-i686.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-27-i686 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-27-i686.virt-install-cmd b/builder/templates/fedora-27-i686.virt-install-cmd deleted file mode 100644 index 8a674f578..000000000 --- a/builder/templates/fedora-27-i686.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-27-i686' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-aqk78va5' \ - '--ram=2048' \ - '--arch=i686' \ - '--vcpus=1' \ - '--os-variant=fedora23' \ - '--initrd-inject=fedora-27-i686.ks' \ - '--extra-args=ks=file:/fedora-27-i686.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-aqk78va5.img,size=6,format=raw' \ - '--location=https://dl.fedoraproject.org/pub/fedora-secondary/releases/27/Server/i386/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-27-ppc64.index-fragment b/builder/templates/fedora-27-ppc64.index-fragment deleted file mode 100644 index b39c80e62..000000000 --- a/builder/templates/fedora-27-ppc64.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-27] -name=Fedora® 27 Server (ppc64) -osinfo=fedora27 -arch=ppc64 -file=fedora-27-ppc64.xz -checksum[sha512]=eb6fb9e0fae8618f10d5eb7812581d23e9f9d13c8029ea43ce3efef6ea4ae37f72561d2a9cbfbea49942ba9b236351cb4f37b11d6873f5a3dc3752e9ab1b90b9 -format=raw -size=6442450944 -compressed_size=344503404 -expand=/dev/sda4 -notes=Fedora® 27 Server (ppc64) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-27-ppc64.ks b/builder/templates/fedora-27-ppc64.ks deleted file mode 100644 index 0e1e1d8ad..000000000 --- a/builder/templates/fedora-27-ppc64.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-27-ppc64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=hvc0 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-27-ppc64.virt-install-cmd b/builder/templates/fedora-27-ppc64.virt-install-cmd deleted file mode 100644 index 395955be4..000000000 --- a/builder/templates/fedora-27-ppc64.virt-install-cmd +++ /dev/null @@ -1,21 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-27-ppc64' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-jat538rh' \ - '--ram=4096' \ - '--arch=ppc64' \ - '--machine=pseries' \ - '--cpu=POWER7' \ - '--vcpus=1' \ - '--os-variant=fedora22' \ - '--initrd-inject=fedora-27-ppc64.ks' \ - '--extra-args=ks=file:/fedora-27-ppc64.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=hvc0 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-jat538rh.img,size=6,format=raw' \ - '--location=https://dl.fedoraproject.org/pub/fedora-secondary/releases/27/Server/ppc64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-27-ppc64le.index-fragment b/builder/templates/fedora-27-ppc64le.index-fragment deleted file mode 100644 index f5a9d85c7..000000000 --- a/builder/templates/fedora-27-ppc64le.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-27] -name=Fedora® 27 Server (ppc64le) -osinfo=fedora27 -arch=ppc64le -file=fedora-27-ppc64le.xz -checksum[sha512]=d38fe2412508700d292f4eb816c90a16aa8424a3bf77a5148d25e49bc34a52963ae3fccd5ae21d9c7c632ecbfd1892ee643d3124d9ddddd5cec75f19d97962b6 -format=raw -size=6442450944 -compressed_size=345536532 -expand=/dev/sda4 -notes=Fedora® 27 Server (ppc64le) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-27-ppc64le.ks b/builder/templates/fedora-27-ppc64le.ks deleted file mode 100644 index 4207f0ba3..000000000 --- a/builder/templates/fedora-27-ppc64le.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-27-ppc64le -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=hvc0 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-27-ppc64le.virt-install-cmd b/builder/templates/fedora-27-ppc64le.virt-install-cmd deleted file mode 100644 index b7202d514..000000000 --- a/builder/templates/fedora-27-ppc64le.virt-install-cmd +++ /dev/null @@ -1,21 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-27-ppc64le' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-fiwz7naa' \ - '--ram=4096' \ - '--arch=ppc64le' \ - '--machine=pseries' \ - '--cpu=POWER8' \ - '--vcpus=1' \ - '--os-variant=fedora22' \ - '--initrd-inject=fedora-27-ppc64le.ks' \ - '--extra-args=ks=file:/fedora-27-ppc64le.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=hvc0 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-fiwz7naa.img,size=6,format=raw' \ - '--location=https://dl.fedoraproject.org/pub/fedora-secondary/releases/27/Server/ppc64le/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-27.index-fragment b/builder/templates/fedora-27.index-fragment deleted file mode 100644 index db0f60f7c..000000000 --- a/builder/templates/fedora-27.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-27] -name=Fedora® 27 Server -osinfo=fedora27 -arch=x86_64 -file=fedora-27.xz -checksum[sha512]=01bed9d8d0f66053a0a91bc41e737016db477a06e264e691a74ab88c8982c034606af3cca50e86e310418ff6edb4296c637dca2926d51bc620da6502e01d9da4 -format=raw -size=6442450944 -compressed_size=364702928 -expand=/dev/sda4 -notes=Fedora® 27 Server - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-27.ks b/builder/templates/fedora-27.ks deleted file mode 100644 index c84875a79..000000000 --- a/builder/templates/fedora-27.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-27 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable Xen domU support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-27.virt-install-cmd b/builder/templates/fedora-27.virt-install-cmd deleted file mode 100644 index 04f32f66e..000000000 --- a/builder/templates/fedora-27.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-27' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-95vf03b0' \ - '--ram=2048' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=fedora23' \ - '--initrd-inject=fedora-27.ks' \ - '--extra-args=ks=file:/fedora-27.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-95vf03b0.img,size=6,format=raw' \ - '--location=http://mirror.bytemark.co.uk/fedora/linux/releases/27/Server/x86_64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-28-i686.index-fragment b/builder/templates/fedora-28-i686.index-fragment deleted file mode 100644 index eaf16c35b..000000000 --- a/builder/templates/fedora-28-i686.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-28] -name=Fedora® 28 Server (i686) -osinfo=fedora28 -arch=i686 -file=fedora-28-i686.xz -checksum[sha512]=6475d5bd0988d2008f883c963d6b55526cc00cc188c4946a130cfc812d24c2cb3dd7bb1b43ba93e389279c5da42236eee1a6e25f4d08cd421e77bba50f015f72 -format=raw -size=6442450944 -compressed_size=400219028 -expand=/dev/sda4 -notes=Fedora® 28 Server (i686) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-28-i686.ks b/builder/templates/fedora-28-i686.ks deleted file mode 100644 index 3dc537ed9..000000000 --- a/builder/templates/fedora-28-i686.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-28-i686 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-28-i686.virt-install-cmd b/builder/templates/fedora-28-i686.virt-install-cmd deleted file mode 100644 index 5cbdc6c17..000000000 --- a/builder/templates/fedora-28-i686.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-28-i686' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-5vmjtqua' \ - '--ram=2048' \ - '--arch=i686' \ - '--vcpus=1' \ - '--os-variant=fedora23' \ - '--initrd-inject=fedora-28-i686.ks' \ - '--extra-args=ks=file:/fedora-28-i686.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-5vmjtqua.img,size=6,format=raw' \ - '--location=https://dl.fedoraproject.org/pub/fedora-secondary/releases/28/Server/i386/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-28.index-fragment b/builder/templates/fedora-28.index-fragment deleted file mode 100644 index f193869d5..000000000 --- a/builder/templates/fedora-28.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-28] -name=Fedora® 28 Server -osinfo=fedora28 -arch=x86_64 -file=fedora-28.xz -checksum[sha512]=13e102cb4378f1a4d83383e0310ad7366063388ad8bf1068e91e106d2f818c8df4dc620fbdd69b733ed0004bf1f8f5cbea2d8fbfe65d20c7c577c99110278262 -format=raw -size=6442450944 -compressed_size=418347084 -expand=/dev/sda4 -notes=Fedora® 28 Server - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-28.ks b/builder/templates/fedora-28.ks deleted file mode 100644 index 8afa52414..000000000 --- a/builder/templates/fedora-28.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-28 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable Xen domU support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-28.virt-install-cmd b/builder/templates/fedora-28.virt-install-cmd deleted file mode 100644 index 99b8d4f3b..000000000 --- a/builder/templates/fedora-28.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-28' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-kg7tbfnd' \ - '--ram=2048' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=fedora23' \ - '--initrd-inject=fedora-28.ks' \ - '--extra-args=ks=file:/fedora-28.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-kg7tbfnd.img,size=6,format=raw' \ - '--location=http://mirror.bytemark.co.uk/fedora/linux/releases/28/Server/x86_64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-29-aarch64.index-fragment b/builder/templates/fedora-29-aarch64.index-fragment deleted file mode 100644 index 989ee6531..000000000 --- a/builder/templates/fedora-29-aarch64.index-fragment +++ /dev/null @@ -1,25 +0,0 @@ -[fedora-29] -name=Fedora® 29 Server (aarch64) -osinfo=fedora29 -arch=aarch64 -file=fedora-29-aarch64.xz -checksum[sha512]=2a0edc92586d6a0a07329d7b6b7f673d63a0a643574dafb5a33fbcd314f12c0c6f6d50e22629eae62425d91837880b522923f9cd4fad5ee9bc7fd9646c0e8489 -format=raw -size=6442450944 -compressed_size=317124664 -expand=/dev/sda4 -notes=Fedora® 29 Server (aarch64) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - You will need to use the associated UEFI NVRAM variables file: - http://libguestfs.org/download/builder/fedora-29-aarch64-nvram.xz - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-29-aarch64.ks b/builder/templates/fedora-29-aarch64.ks deleted file mode 100644 index 2114b5b10..000000000 --- a/builder/templates/fedora-29-aarch64.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-29-aarch64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-29-aarch64.virt-install-cmd b/builder/templates/fedora-29-aarch64.virt-install-cmd deleted file mode 100644 index bb172961b..000000000 --- a/builder/templates/fedora-29-aarch64.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-29-aarch64' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-j4n0jzwh' \ - '--ram=2048' \ - '--arch=aarch64' \ - '--vcpus=1' \ - '--os-variant=fedora26' \ - '--boot' 'loader=/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw,loader_ro=yes,loader_type=pflash,nvram=/home/rjones/d/libguestfs/builder/templates/tmp-j4n0jzwh.vars' \ - '--initrd-inject=fedora-29-aarch64.ks' \ - '--extra-args=ks=file:/fedora-29-aarch64.ks proxy=http://cache.home.annexia.org:3128 console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-j4n0jzwh.img,size=6,format=raw' \ - '--location=http://mirror.bytemark.co.uk/fedora/linux/releases/29/Server/aarch64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-29-armv7l.ks b/builder/templates/fedora-29-armv7l.ks deleted file mode 100644 index dfc596c68..000000000 --- a/builder/templates/fedora-29-armv7l.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-29-armv7l -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyAMA0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-29-armv7l.virt-install-cmd b/builder/templates/fedora-29-armv7l.virt-install-cmd deleted file mode 100644 index 1dc48ed93..000000000 --- a/builder/templates/fedora-29-armv7l.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-29-armv7l' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-rqkkcvm6' \ - '--ram=2048' \ - '--arch=armv7l' \ - '--vcpus=1' \ - '--os-variant=fedora26' \ - '--initrd-inject=fedora-29-armv7l.ks' \ - '--extra-args=ks=file:/fedora-29-armv7l.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyAMA0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-rqkkcvm6.img,size=6,format=raw' \ - '--location=http://mirror.bytemark.co.uk/fedora/linux/releases/29/Server/armhfp/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-29-i686.index-fragment b/builder/templates/fedora-29-i686.index-fragment deleted file mode 100644 index c4f56eba5..000000000 --- a/builder/templates/fedora-29-i686.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-29] -name=Fedora® 29 Server (i686) -osinfo=fedora29 -arch=i686 -file=fedora-29-i686.xz -checksum[sha512]=f3e09f9616b317d88cada0461f26f5efef769551f9694734e7f69a0d96144337a17f3bc83ba38e83e747627b7b55c4aaf9ff5e6717b0d31367e3876890d26953 -format=raw -size=6442450944 -compressed_size=328510404 -expand=/dev/sda4 -notes=Fedora® 29 Server (i686) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-29-i686.ks b/builder/templates/fedora-29-i686.ks deleted file mode 100644 index d774cd71b..000000000 --- a/builder/templates/fedora-29-i686.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-29-i686 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-29-i686.virt-install-cmd b/builder/templates/fedora-29-i686.virt-install-cmd deleted file mode 100644 index b61a0e0bc..000000000 --- a/builder/templates/fedora-29-i686.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-29-i686' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-yujbiztf' \ - '--ram=2048' \ - '--arch=i686' \ - '--vcpus=1' \ - '--os-variant=fedora26' \ - '--initrd-inject=fedora-29-i686.ks' \ - '--extra-args=ks=file:/fedora-29-i686.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-yujbiztf.img,size=6,format=raw' \ - '--location=https://dl.fedoraproject.org/pub/fedora-secondary/releases/29/Server/i386/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-29-ppc64.ks b/builder/templates/fedora-29-ppc64.ks deleted file mode 100644 index d2344ef06..000000000 --- a/builder/templates/fedora-29-ppc64.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-29-ppc64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=hvc0 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-29-ppc64.virt-install-cmd b/builder/templates/fedora-29-ppc64.virt-install-cmd deleted file mode 100644 index 2fc2d4a80..000000000 --- a/builder/templates/fedora-29-ppc64.virt-install-cmd +++ /dev/null @@ -1,21 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-29-ppc64' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-p999pob7' \ - '--ram=4096' \ - '--arch=ppc64' \ - '--machine=pseries' \ - '--cpu=power7' \ - '--vcpus=1' \ - '--os-variant=fedora22' \ - '--initrd-inject=fedora-29-ppc64.ks' \ - '--extra-args=ks=file:/fedora-29-ppc64.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=hvc0 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-p999pob7.img,size=6,format=raw' \ - '--location=https://dl.fedoraproject.org/pub/fedora-secondary/releases/29/Server/ppc64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-29-ppc64le.index-fragment b/builder/templates/fedora-29-ppc64le.index-fragment deleted file mode 100644 index 03ef28458..000000000 --- a/builder/templates/fedora-29-ppc64le.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-29] -name=Fedora® 29 Server (ppc64le) -osinfo=fedora29 -arch=ppc64le -file=fedora-29-ppc64le.xz -checksum[sha512]=a599eb936718cb01ebeb7549c090eaec2207214d1950d7f329bde718a67c7edf756f6ba1c5b5fd7f00fd057fd90b2368582b6160048c0a4c5f4a2be32824e7d1 -format=raw -size=6442450944 -compressed_size=422787028 -expand=/dev/sda4 -notes=Fedora® 29 Server (ppc64le) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-29-ppc64le.ks b/builder/templates/fedora-29-ppc64le.ks deleted file mode 100644 index e93aab5a0..000000000 --- a/builder/templates/fedora-29-ppc64le.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-29-ppc64le -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=hvc0 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-29-ppc64le.virt-install-cmd b/builder/templates/fedora-29-ppc64le.virt-install-cmd deleted file mode 100644 index 51a695b39..000000000 --- a/builder/templates/fedora-29-ppc64le.virt-install-cmd +++ /dev/null @@ -1,21 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-29-ppc64le' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-bm4kun85' \ - '--ram=4096' \ - '--arch=ppc64le' \ - '--machine=pseries' \ - '--cpu=power8' \ - '--vcpus=1' \ - '--os-variant=fedora22' \ - '--initrd-inject=fedora-29-ppc64le.ks' \ - '--extra-args=ks=file:/fedora-29-ppc64le.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=hvc0 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-bm4kun85.img,size=6,format=raw' \ - '--location=https://dl.fedoraproject.org/pub/fedora-secondary/releases/29/Server/ppc64le/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-29.index-fragment b/builder/templates/fedora-29.index-fragment deleted file mode 100644 index 90b664c09..000000000 --- a/builder/templates/fedora-29.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-29] -name=Fedora® 29 Server -osinfo=fedora29 -arch=x86_64 -file=fedora-29.xz -checksum[sha512]=092d2fff309a124e50e6065f2cc1309caf9af9ef9789fd98d47b99ca50a0574b4b518d581bec4b9b92680a15860e641b085b2e0ff292784d13e8f9aef6a7d1e9 -format=raw -size=6442450944 -compressed_size=332259748 -expand=/dev/sda4 -notes=Fedora® 29 Server - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-29.ks b/builder/templates/fedora-29.ks deleted file mode 100644 index 7b46608f8..000000000 --- a/builder/templates/fedora-29.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-29 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable Xen domU support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-29.virt-install-cmd b/builder/templates/fedora-29.virt-install-cmd deleted file mode 100644 index fdc68b788..000000000 --- a/builder/templates/fedora-29.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-29' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-r32qazdd' \ - '--ram=2048' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=fedora26' \ - '--initrd-inject=fedora-29.ks' \ - '--extra-args=ks=file:/fedora-29.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-r32qazdd.img,size=6,format=raw' \ - '--location=http://mirror.bytemark.co.uk/fedora/linux/releases/29/Server/x86_64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-30-aarch64.index-fragment b/builder/templates/fedora-30-aarch64.index-fragment deleted file mode 100644 index d9ef980aa..000000000 --- a/builder/templates/fedora-30-aarch64.index-fragment +++ /dev/null @@ -1,25 +0,0 @@ -[fedora-30] -name=Fedora® 30 Server (aarch64) -osinfo=fedora30 -arch=aarch64 -file=fedora-30-aarch64.xz -checksum[sha512]=ee076a91e8773489c6fafd31e0fcc8f35490f1a81782bdf221cc56303e6361a30de9d75f914a88a8cf494e613a06849baebb401f3ff1971fb01d3bbb9146a6fc -format=raw -size=6442450944 -compressed_size=319857936 -expand=/dev/sda4 -notes=Fedora® 30 Server (aarch64) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - You will need to use the associated UEFI NVRAM variables file: - http://libguestfs.org/download/builder/fedora-30-aarch64-nvram.xz - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-30-aarch64.ks b/builder/templates/fedora-30-aarch64.ks deleted file mode 100644 index 7d57de167..000000000 --- a/builder/templates/fedora-30-aarch64.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-30-aarch64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-30-aarch64.virt-install-cmd b/builder/templates/fedora-30-aarch64.virt-install-cmd deleted file mode 100644 index b5554ff44..000000000 --- a/builder/templates/fedora-30-aarch64.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-30-aarch64' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-7rvvfkmr' \ - '--ram=2048' \ - '--arch=aarch64' \ - '--vcpus=1' \ - '--os-variant=fedora26' \ - '--boot' 'loader=/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw,loader_ro=yes,loader_type=pflash,nvram=/home/rjones/d/libguestfs/builder/templates/tmp-7rvvfkmr.vars' \ - '--initrd-inject=fedora-30-aarch64.ks' \ - '--extra-args=ks=file:/fedora-30-aarch64.ks console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-7rvvfkmr.img,size=6,format=raw' \ - '--location=http://mirror.bytemark.co.uk/fedora/linux/releases/30/Server/aarch64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-30-i686.index-fragment b/builder/templates/fedora-30-i686.index-fragment deleted file mode 100644 index 681df9938..000000000 --- a/builder/templates/fedora-30-i686.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-30] -name=Fedora® 30 Server (i686) -osinfo=fedora30 -arch=i686 -file=fedora-30-i686.xz -checksum[sha512]=1ef82bb27c59224a86eb523013f75a83c6d2f4961b435d6f7ed70fd031509cbb730ea34738c2c95d3128a5ea8b0d39b775e7f5372351ba633b096fb4f848e917 -format=raw -size=6442450944 -compressed_size=324581848 -expand=/dev/sda4 -notes=Fedora® 30 Server (i686) - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-30-i686.ks b/builder/templates/fedora-30-i686.ks deleted file mode 100644 index 55127d45d..000000000 --- a/builder/templates/fedora-30-i686.ks +++ /dev/null @@ -1,33 +0,0 @@ -# Kickstart file for fedora-30-i686 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -%end - -# EOF diff --git a/builder/templates/fedora-30-i686.virt-install-cmd b/builder/templates/fedora-30-i686.virt-install-cmd deleted file mode 100644 index 2a6712096..000000000 --- a/builder/templates/fedora-30-i686.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-30-i686' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-etdiijg2' \ - '--ram=2048' \ - '--arch=i686' \ - '--vcpus=1' \ - '--os-variant=fedora26' \ - '--initrd-inject=fedora-30-i686.ks' \ - '--extra-args=ks=file:/fedora-30-i686.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-etdiijg2.img,size=6,format=raw' \ - '--location=https://dl.fedoraproject.org/pub/fedora-secondary/releases/30/Server/i386/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-30.index-fragment b/builder/templates/fedora-30.index-fragment deleted file mode 100644 index 00a230fbb..000000000 --- a/builder/templates/fedora-30.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-30] -name=Fedora® 30 Server -osinfo=fedora30 -arch=x86_64 -file=fedora-30.xz -checksum[sha512]=295409fcd855f5479780586205142ca8aca5d93f1bd95d9427d8c46eba330049a2bc47a528693b6b9cc6fcc9beb8b03d77aa9bc683dbae6e02ed5c3da00f550d -format=raw -size=6442450944 -compressed_size=332691880 -expand=/dev/sda4 -notes=Fedora® 30 Server - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-30.ks b/builder/templates/fedora-30.ks deleted file mode 100644 index d17e5bf3b..000000000 --- a/builder/templates/fedora-30.ks +++ /dev/null @@ -1,43 +0,0 @@ -# Kickstart file for fedora-30 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable Xen domU support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-30.virt-install-cmd b/builder/templates/fedora-30.virt-install-cmd deleted file mode 100644 index 2867e0f54..000000000 --- a/builder/templates/fedora-30.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-30' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-h841cv95' \ - '--ram=2048' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=fedora26' \ - '--initrd-inject=fedora-30.ks' \ - '--extra-args=ks=file:/fedora-30.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-h841cv95.img,size=6,format=raw' \ - '--location=http://mirror.bytemark.co.uk/fedora/linux/releases/30/Server/x86_64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-31.index-fragment b/builder/templates/fedora-31.index-fragment deleted file mode 100644 index 756d2383a..000000000 --- a/builder/templates/fedora-31.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-31] -name=Fedora® 31 Server -osinfo=fedora31 -arch=x86_64 -file=fedora-31.xz -checksum[sha512]=87ba97b25fc691d17a69d76d749eb479b55fc68be3c56c31e74fab9d54bcf3348d56df5c3d609d078d6c33c8f8f1b1466f6c829becfd0af6236c8965bd46e168 -format=raw -size=6442450944 -compressed_size=429574212 -expand=/dev/sda4 -notes=Fedora® 31 Server - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-31.ks b/builder/templates/fedora-31.ks deleted file mode 100644 index 90c8c4365..000000000 --- a/builder/templates/fedora-31.ks +++ /dev/null @@ -1,44 +0,0 @@ -# Kickstart file for fedora-31 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable Xen domU support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-31.virt-install-cmd b/builder/templates/fedora-31.virt-install-cmd deleted file mode 100644 index eb59e40d5..000000000 --- a/builder/templates/fedora-31.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-31' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-bfkesnv2' \ - '--ram=4096' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=fedora26' \ - '--initrd-inject=fedora-31.ks' \ - '--extra-args=ks=file:/fedora-31.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-bfkesnv2.img,size=6,format=raw' \ - '--location=http://mirror.bytemark.co.uk/fedora/linux/releases/31/Server/x86_64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-32.index-fragment b/builder/templates/fedora-32.index-fragment deleted file mode 100644 index dae7e36fa..000000000 --- a/builder/templates/fedora-32.index-fragment +++ /dev/null @@ -1,22 +0,0 @@ -[fedora-32] -name=Fedora® 32 Server -osinfo=fedora32 -arch=x86_64 -file=fedora-32.xz -checksum[sha512]=eef6fe13d32c09e991a5192c746a0104a8cca8945c9e8317256ea2d4d6e39de69c0954cb7fd15698b478694663ddc583472e7febeaa2ae721446dcdefacfd147 -format=raw -size=6442450944 -compressed_size=474921112 -expand=/dev/sda4 -notes=Fedora® 32 Server - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-32.ks b/builder/templates/fedora-32.ks deleted file mode 100644 index 8fa67b47f..000000000 --- a/builder/templates/fedora-32.ks +++ /dev/null @@ -1,44 +0,0 @@ -# Kickstart file for fedora-32 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -dnf -y --best upgrade -# Enable Xen domU support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-32.virt-install-cmd b/builder/templates/fedora-32.virt-install-cmd deleted file mode 100644 index 2b5a751c7..000000000 --- a/builder/templates/fedora-32.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-32' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-pzrl639w' \ - '--ram=4096' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=fedora26' \ - '--initrd-inject=fedora-32.ks' \ - '--extra-args=ks=file:/fedora-32.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-pzrl639w.img,size=6,format=raw' \ - '--location=http://mirror.bytemark.co.uk/fedora/linux/releases/32/Server/x86_64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/fedora-33.index-fragment b/builder/templates/fedora-33.index-fragment deleted file mode 100644 index 44e456f76..000000000 --- a/builder/templates/fedora-33.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[fedora-33] -name=Fedora® 33 Server -osinfo=fedora33 -arch=x86_64 -file=fedora-33.xz -revision=2 -checksum[sha512]=f80a018b494d5f2e44873094855f03a1f15080ee46f88d825bfe1de55b5903f5d9d822de18122ecac00d6295b2a8e7461950befef4c494ebcfe6b1f5e3aa5cc3 -format=raw -size=6442450944 -compressed_size=392812568 -expand=/dev/sda3 -notes=Fedora® 33 Server - - This Fedora image contains only unmodified @Core group packages. - - Fedora and the Infinity design logo are trademarks of Red Hat, Inc. - Source and further information is available from http://fedoraproject.org/ - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/fedora-33.ks b/builder/templates/fedora-33.ks deleted file mode 100644 index ed2d3c5f2..000000000 --- a/builder/templates/fedora-33.ks +++ /dev/null @@ -1,44 +0,0 @@ -# Kickstart file for fedora-33 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Ensure the installation is up-to-date. -#dnf -y --best upgrade -# Enable Xen domU support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/fedora-33.virt-install-cmd b/builder/templates/fedora-33.virt-install-cmd deleted file mode 100644 index 52138160f..000000000 --- a/builder/templates/fedora-33.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'fedora-33' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-vxsw7p2j' \ - '--ram=4096' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=fedora26' \ - '--initrd-inject=fedora-33.ks' \ - '--extra-args=ks=file:/fedora-33.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-vxsw7p2j.img,size=6,format=raw' \ - '--location=http://mirror.bytemark.co.uk/fedora/linux/releases/33/Server/x86_64/os/' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/freebsd-11.1.index-fragment b/builder/templates/freebsd-11.1.index-fragment deleted file mode 100644 index 57de554b9..000000000 --- a/builder/templates/freebsd-11.1.index-fragment +++ /dev/null @@ -1,19 +0,0 @@ -[freebsd-11.1] -name=FreeBSD 11.1 -osinfo=freebsd11.1 -arch=x86_64 -file=freebsd-11.1.xz -checksum[sha512]=e7a90f18137aa43a7f8b839a91a222adbf0d9eae2a417ec1a933b50489834b0939e94c2ae87b9bbeddb762fb8d1952d5096c5f2681d679f03902bb87bb0cdffd -format=raw -size=6442450944 -compressed_size=401484776 -expand=/dev/sda5 -notes=FreeBSD 11.1 - - This is an all-default FreeBSD install. - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml deleted file mode 100755 index 4fd0a35a9..000000000 --- a/builder/templates/make-template.ml +++ /dev/null @@ -1,1571 +0,0 @@ -#!/usr/bin/env ocaml -(* libguestfs - * Copyright (C) 2016-2020 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. - *) - -(* This script is used to create the virt-builder templates hosted - * http://libguestfs.org/download/builder/ - * - * Prior to November 2016, the templates were generated using - * shell scripts located in libguestfs.git/builder/website. - *) - -#load "str.cma";; -#load "unix.cma";; -#directory "../../ocaml";; (* use locally built guestfs *) -(*#directory "+guestfs";; (* use globally installed guestfs *) *) -#load "mlguestfs.cma";; - -open Printf - -let windows_installers = "/mnt/media/installers/Windows" - -let prog = "make-template" - -(* Ensure that a file is deleted on exit. *) -let unlink_on_exit = - let files = ref [] in - at_exit ( - fun () -> List.iter (fun f -> try Unix.unlink f with _ -> ()) !files - ); - fun file -> files := file :: !files - -let () = - (* Check we are being run from the correct directory. *) - if not (Sys.file_exists "debian.preseed") then ( - eprintf "%s: run this script from the builder/templates subdirectory\n" - prog; - exit 1 - ); - - (* Check that the ./run script was used. *) - (try ignore (Sys.getenv "CAML_LD_LIBRARY_PATH") - with Not_found -> - eprintf "%s: you must use `../../run ./make-template.ml ...' to run this script\n" - prog; - exit 1 - ); - - (* Check we're not being run as root. *) - if Unix.geteuid () = 0 then ( - eprintf "%s: don't run this script as root\n" prog; - exit 1 - ); - (* ... and that LIBVIRT_DEFAULT_URI=qemu:///system is NOT set, - * which is the same as above. - *) - let s = try Sys.getenv "LIBVIRT_DEFAULT_URI" with Not_found -> "" in - if s = "qemu:///system" then ( - eprintf "%s: don't set LIBVIRT_DEFAULT_URI=qemu:///system\n" prog; - exit 1 - ) - ;; - -type os = - | CentOS of int * int (* major, minor *) - | RHEL of int * int - | Debian of int * string (* version, dist name like "wheezy" *) - | Ubuntu of string * string - | Fedora of int (* version number *) - | FreeBSD of int * int (* major, minor *) - | Windows of int * int * windows_variant (* major, minor, variant *) -and windows_variant = Client | Server -type arch = X86_64 | Aarch64 | Armv7 | I686 | PPC64 | PPC64le | S390X - -type boot_media = - | Location of string (* virt-install --location (preferred) *) - | CDRom of string (* downloaded CD-ROM *) - -let quote = Filename.quote -let (//) = Filename.concat - -let rec main () = - assert (Sys.word_size = 64); - Random.self_init (); - - (* Parse the command line. *) - let os, arch = parse_cmdline () in - - (* Choose a disk size for this OS. *) - let virtual_size_gb = get_virtual_size_gb os arch in - - (* For OSes which require a kickstart, this generates one. - * For OSes which require a preseed file, this returns one (we - * don't generate preseed files at the moment). - * For Windows this returns an unattend file in an ISO. - * For OSes which cannot be automated (FreeBSD), this returns None. - *) - let ks = make_kickstart os arch in - - (* Find the boot media. Normally ‘virt-install --location’ but - * for FreeBSD it downloads the boot ISO. - *) - let boot_media = make_boot_media os arch in - - (* Choose a random temporary name for the libvirt domain. *) - let tmpname = sprintf "tmp-%s" (random8 ()) in - - (* Choose a random temporary disk name. *) - let tmpout = sprintf "%s.img" tmpname in - unlink_on_exit tmpout; - - (* Create the final output name (actually not quite final because - * we will xz-compress it). - *) - let output = filename_of_os os arch "" in - - (* Some architectures need EFI boot. *) - let tmpefivars = - if needs_uefi os arch then ( - let code, vars = - match arch with - | X86_64 -> - "/usr/share/edk2/ovmf/OVMF_CODE.fd", - "/usr/share/edk2/ovmf/OVMF_VARS.fd" - | Aarch64 -> - "/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw", - "/usr/share/edk2/aarch64/vars-template-pflash.raw" - | _ -> assert false in - - let vars_out = Sys.getcwd () // sprintf "%s.vars" tmpname in - unlink_on_exit vars_out; - let cmd = sprintf "cp %s %s" (quote vars) (quote vars_out) in - if Sys.command cmd <> 0 then exit 1; - Some (code, vars_out) - ) - else None in - - (* Now construct the virt-install command. *) - let vi = make_virt_install_command os arch ks tmpname tmpout tmpefivars - boot_media virtual_size_gb in - - (* Print the virt-install command just before we run it, because - * this is expected to be long-running. - *) - print_virt_install_command stdout vi; - - (* Save the virt-install command to a file, for documentation. *) - let chan = open_out (filename_of_os os arch ".virt-install-cmd") in - fprintf chan "# This is the virt-install command which was used to create\n"; - fprintf chan "# the virt-builder template '%s'\n" (string_of_os os arch); - fprintf chan "# NB: This file is generated for documentation purposes ONLY!\n"; - fprintf chan "# This script was never run, and is not intended to be run.\n"; - fprintf chan "\n"; - print_virt_install_command chan vi; - close_out chan; - - (* Print the virt-install notes for OSes which cannot be automated - * fully. (These are different from the ‘notes=’ section in the - * index fragment). - *) - print_install_notes os; - printf "\n\n%!"; - - (* Run the virt-install command. *) - let pid = Unix.fork () in - if pid = 0 then Unix.execvp "virt-install" vi; - let _, pstat = Unix.waitpid [] pid in - check_process_status_for_errors pstat; - (* If there were NVRAM variables, move them to the final name and - * compress them. Doing this operation later means the cleanup of - * the guest will remove them as well (because of --nvram). - *) - let nvram = - match tmpefivars with - | Some (_, vars) -> - let f = sprintf "%s-nvram" output in - let cmd = sprintf "mv %s %s" (quote vars) (quote f) in - if Sys.command cmd <> 0 then exit 1; - let cmd = sprintf "xz -f --best %s" (quote f) in - if Sys.command cmd <> 0 then exit 1; - Some (f ^ ".xz") - | None -> None in - - ignore (Sys.command "sync"); - - (* Run virt-filesystems, simply to display the filesystems in the image. *) - let cmd = sprintf "virt-filesystems -a %s --all --long -h" (quote tmpout) in - if Sys.command cmd <> 0 then exit 1; - - (* Some guests are special flowers that need post-installation - * filesystem changes. - *) - let postinstall = make_postinstall os arch in - - (* Get the root filesystem. If the root filesystem is LVM then - * get the partition containing it. - *) - let g = open_guest ~mount:(postinstall <> None) tmpout in - let roots = g#inspect_get_roots () in - let expandfs, lvexpandfs = - let rootfs = g#canonical_device_name roots.(0) in - if String.length rootfs >= 7 && String.sub rootfs 0 7 = "/dev/sd" then - rootfs, None (* non-LVM case *) - else ( - (* The LVM case, find the containing partition to expand. *) - let pvs = Array.to_list (g#pvs ()) in - match pvs with - | [pv] -> - let pv = g#canonical_device_name pv in - assert (String.length pv >= 7 && String.sub pv 0 7 = "/dev/sd"); - pv, Some rootfs - | [] | _::_::_ -> assert false - ) in - - (match postinstall with - | None -> () - | Some f -> f g - ); - - g#shutdown (); - g#close (); - - (match os with - | Ubuntu (ver, _) when ver >= "14.04" -> - (* In Ubuntu >= 14.04 you can't complete the install without creating - * a user account. We create one called 'builder', but we also - * disable it. XXX Combine with virt-sysprep step. - *) - let cmd = - sprintf "virt-customize -a %s --password builder:disabled" - (quote tmpout) in - if Sys.command cmd <> 0 then exit 1 - | _ -> () - ); - - if can_sysprep_os os then ( - (* Sysprep. Relabel SELinux-using guests. *) - printf "Sysprepping ...\n%!"; - let cmd = - sprintf "virt-sysprep --quiet -a %s%s" - (quote tmpout) - (if is_selinux_os os then " --selinux-relabel" else "") in - if Sys.command cmd <> 0 then exit 1 - ); - - (* Sparsify and copy to output name. *) - printf "Sparsifying ...\n%!"; - let cmd = - sprintf "virt-sparsify --inplace --quiet %s" (quote tmpout) in - if Sys.command cmd <> 0 then exit 1; - - (* Move file to final name before compressing. *) - let cmd = - sprintf "mv %s %s" (quote tmpout) (quote output) in - if Sys.command cmd <> 0 then exit 1; - - (* Compress the output. *) - printf "Compressing ...\n%!"; - let cmd = - sprintf "xz -f --best --block-size=16777216 %s" (quote output) in - if Sys.command cmd <> 0 then exit 1; - let output = output ^ ".xz" in - - (* Set public readable permissions on the final file. *) - let cmd = sprintf "chmod 0644 %s" (quote output) in - if Sys.command cmd <> 0 then exit 1; - - printf "Template completed: %s\n%!" output; - - (* Construct the index fragment, but don't create this for the private - * RHEL images. - *) - (match os with - | RHEL _ -> () - | _ -> - let index_fragment = filename_of_os os arch ".index-fragment" in - (* If there is an existing file, read the revision and increment it. *) - let revision = read_revision index_fragment in - let revision = - match revision with - (* no existing file *) - | `No_file -> None - (* file exists, but no revision line, so revision=1 *) - | `No_revision -> Some 2 - (* existing file with revision line *) - | `Revision i -> Some (i+1) in - make_index_fragment os arch index_fragment output nvram revision - expandfs lvexpandfs virtual_size_gb; - - (* Validate the fragment we have just created. *) - let cmd = sprintf "virt-index-validate %s" (quote index_fragment) in - if Sys.command cmd <> 0 then exit 1; - printf "Index fragment created: %s\n" index_fragment - ); - - printf "Finished successfully.\n%!" - -and parse_cmdline () = - let anon = ref [] in - - let usage = "\ -../../run ./make-template.ml [--options] os version [arch] - -Usage: - ../../run ./make-template.ml [--options] os version [arch] - -Examples: - ../../run ./make-template.ml fedora 25 - ../../run ./make-template.ml rhel 7.3 ppc64le - -The arch defaults to x86_64. Note that i686 is treated as a -separate arch. - -Options: -" in - let spec = Arg.align [ - ] in - - Arg.parse spec (fun s -> anon := s :: !anon) usage; - - let os, ver, arch = - match List.rev !anon with - | [os; ver] -> os, ver, "x86_64" - | [os; ver; arch] -> os, ver, arch - | _ -> - eprintf "%s [--options] os version [arch]\n" prog; - exit 1 in - let os = os_of_string os ver - and arch = arch_of_string arch in - - os, arch - -and os_of_string os ver = - match os, ver with - | "centos", ver -> let maj, min = parse_major_minor ver in CentOS (maj, min) - | "rhel", ver -> let maj, min = parse_major_minor ver in RHEL (maj, min) - | "debian", "6" -> Debian (6, "squeeze") - | "debian", "7" -> Debian (7, "wheezy") - | "debian", "8" -> Debian (8, "jessie") - | "debian", "9" -> Debian (9, "stretch") - | "debian", "10" -> Debian (10, "buster") - | "ubuntu", "10.04" -> Ubuntu (ver, "lucid") - | "ubuntu", "12.04" -> Ubuntu (ver, "precise") - | "ubuntu", "14.04" -> Ubuntu (ver, "trusty") - | "ubuntu", "16.04" -> Ubuntu (ver, "xenial") - | "ubuntu", "18.04" -> Ubuntu (ver, "bionic") - | "ubuntu", "20.04" -> Ubuntu (ver, "focal") - | "fedora", ver -> Fedora (int_of_string ver) - | "freebsd", ver -> let maj, min = parse_major_minor ver in FreeBSD (maj, min) - | "windows", ver -> parse_windows_version ver - | _ -> - eprintf "%s: unknown or unsupported OS (%s, %s)\n" prog os ver; exit 1 - -and parse_major_minor ver = - let rex = Str.regexp "^\\([0-9]+\\)\\.\\([0-9]+\\)$" in - if Str.string_match rex ver 0 then ( - int_of_string (Str.matched_group 1 ver), - int_of_string (Str.matched_group 2 ver) - ) - else ( - eprintf "%s: cannot parse major.minor (%s)\n" prog ver; - exit 1 - ) - -(* https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions *) -and parse_windows_version = function - | "7" -> Windows (6, 1, Client) - | "2k8r2" -> Windows (6, 1, Server) - | "2k12" -> Windows (6, 2, Server) - | "2k12r2" -> Windows (6, 3, Server) - | "2k16" -> Windows (10, 0, Server) - | _ -> - eprintf "%s: cannot parse Windows version, see ‘parse_windows_version’\n" - prog; - exit 1 - -and arch_of_string = function - | "x86_64" -> X86_64 - | "aarch64" -> Aarch64 - | "armv7l" -> Armv7 - | "i686" -> I686 - | "ppc64" -> PPC64 - | "ppc64le" -> PPC64le - | "s390x" -> S390X - | s -> - eprintf "%s: unknown or unsupported arch (%s)\n" prog s; exit 1 - -and string_of_arch = function - | X86_64 -> "x86_64" - | Aarch64 -> "aarch64" - | Armv7 -> "armv7l" - | I686 -> "i686" - | PPC64 -> "ppc64" - | PPC64le -> "ppc64le" - | S390X -> "s390x" - -and debian_arch_of_arch = function - | X86_64 -> "amd64" - | Aarch64 -> "arm64" - | Armv7 -> "armhf" - | I686 -> "i386" - | PPC64 -> "ppc64" - | PPC64le -> "ppc64el" - | S390X -> "s390x" - -and filename_of_os os arch ext = - match os with - | Fedora ver -> - if arch = X86_64 then sprintf "fedora-%d%s" ver ext - else sprintf "fedora-%d-%s%s" ver (string_of_arch arch) ext - | CentOS (major, minor) -> - if arch = X86_64 then sprintf "centos-%d.%d%s" major minor ext - else sprintf "centos-%d.%d-%s%s" major minor (string_of_arch arch) ext - | RHEL (major, minor) -> - if arch = X86_64 then sprintf "rhel-%d.%d%s" major minor ext - else sprintf "rhel-%d.%d-%s%s" major minor (string_of_arch arch) ext - | Debian (ver, _) -> - if arch = X86_64 then sprintf "debian-%d%s" ver ext - else sprintf "debian-%d-%s%s" ver (string_of_arch arch) ext - | Ubuntu (ver, _) -> - if arch = X86_64 then sprintf "ubuntu-%s%s" ver ext - else sprintf "ubuntu-%s-%s%s" ver (string_of_arch arch) ext - | FreeBSD (major, minor) -> - if arch = X86_64 then sprintf "freebsd-%d.%d%s" major minor ext - else sprintf "freebsd-%d.%d-%s%s" major minor (string_of_arch arch) ext - | Windows (major, minor, Client) -> - if arch = X86_64 then sprintf "windows-%d.%d-client%s" major minor ext - else sprintf "windows-%d.%d-client-%s%s" - major minor (string_of_arch arch) ext - | Windows (major, minor, Server) -> - if arch = X86_64 then sprintf "windows-%d.%d-server%s" major minor ext - else sprintf "windows-%d.%d-server-%s%s" - major minor (string_of_arch arch) ext - -and string_of_os os arch = filename_of_os os arch "" - -(* This is what virt-builder called "os-version". *) -and string_of_os_noarch = function - | Fedora ver -> sprintf "fedora-%d" ver - | CentOS (major, minor) -> sprintf "centos-%d.%d" major minor - | RHEL (major, minor) -> sprintf "rhel-%d.%d" major minor - | Debian (ver, _) -> sprintf "debian-%d" ver - | Ubuntu (ver, _) -> sprintf "ubuntu-%s" ver - | FreeBSD (major, minor) -> sprintf "freebsd-%d.%d" major minor - | Windows (major, minor, Client) -> sprintf "windows-%d.%d-client" major minor - | Windows (major, minor, Server) -> sprintf "windows-%d.%d-server" major minor - -(* Does virt-sysprep know how to sysprep this OS? *) -and can_sysprep_os = function - | RHEL _ | CentOS _ | Fedora _ | Debian _ | Ubuntu _ -> true - | FreeBSD _ | Windows _ -> false - -and is_selinux_os = function - | RHEL _ | CentOS _ | Fedora _ -> true - | Debian _ | Ubuntu _ - | FreeBSD _ | Windows _ -> false - -and needs_uefi os arch = - match os, arch with - | Fedora _, Aarch64 - | RHEL _, Aarch64 -> true - | RHEL _, _ | CentOS _, _ | Fedora _, _ - | Debian _, _ | Ubuntu _, _ - | FreeBSD _, _ | Windows _, _ -> false - -and get_virtual_size_gb os arch = - match os with - | RHEL _ | CentOS _ | Fedora _ - | Debian _ | Ubuntu _ - | FreeBSD _ -> 6 - | Windows (10, _, _) -> 40 (* Windows 10 *) - | Windows (6, _, _) -> 10 (* Windows from 2008 - 2012 *) - | Windows (5, _, _) -> 6 (* Windows <= 2003 *) - | Windows _ -> assert false - -and make_kickstart os arch = - match os with - (* Kickstart. *) - | Fedora _ | CentOS _ | RHEL _ -> - let ks_filename = filename_of_os os arch ".ks" in - Some (make_kickstart_common ks_filename os arch) - - (* Preseed. *) - | Debian _ -> Some (copy_preseed_to_temporary "debian.preseed") - | Ubuntu _ -> Some (copy_preseed_to_temporary "ubuntu.preseed") - - (* Not automated. *) - | FreeBSD _ -> None - - (* Windows unattend.xml wrapped in an ISO. *) - | Windows _ -> Some (make_unattend_iso os arch) - -and make_kickstart_common ks_filename os arch = - let buf = Buffer.create 4096 in - let bpf fs = bprintf buf fs in - - bpf "\ -# Kickstart file for %s -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -" (string_of_os os arch); - - (match os with - | RHEL (ver, _) when ver <= 4 -> - bpf "\ -langsupport en_US -mouse generic -"; - | _ -> () - ); - - (match os with - | RHEL (3, _) -> () - | _ -> - bpf "selinux --enforcing\n" - ); - - (match os with - | RHEL (5, _) -> bpf "key --skip\n" - | _ -> () - ); - bpf "\n"; - - bpf "bootloader --location=mbr --append=\"%s\"\n" - (kernel_cmdline_of_os os arch); - bpf "\n"; - - (* Required as a workaround for CentOS 8.0, see: - * https://lists.centos.org/pipermail/centos-devel/2019-September/017813.html - * https://lists.centos.org/pipermail/centos-devel/2019-October/017882.html - *) - (match os with - | CentOS (8, _) -> - bpf "url --url=\"http://mirror.centos.org/centos-8/8/BaseOS/x86_64/os\"\n" - | _ -> () - ); - bpf "\n"; - - (match os with - | CentOS ((3|4|5|6) as major, _) | RHEL ((3|4|5|6) as major, _) -> - let bootfs = if major <= 5 then "ext2" else "ext4" in - let rootfs = if major <= 4 then "ext3" else "ext4" in - bpf "\ -zerombr -clearpart --all --initlabel -part /boot --fstype=%s --size=512 --asprimary -part swap --size=1024 --asprimary -part / --fstype=%s --size=1024 --grow --asprimary -" bootfs rootfs; - | CentOS _ | RHEL _ | Fedora _ -> - bpf "\ -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain -"; - | _ -> assert false (* cannot happen, see caller *) - ); - bpf "\n"; - - (match os with - | RHEL (3, _) -> () - | _ -> - bpf "\ -# Halt the system once configuration has finished. -poweroff -"; - ); - bpf "\n"; - - bpf "\ -%%packages -@core -"; - - (match os with - | RHEL ((3|4|5), _) -> () - | _ -> - bpf "%%end\n" - ); - bpf "\n"; - - (* Generate the %post script section. The previous scripts did - * many different things here. The current script tries to update - * the packages and enable Xen drivers only. - *) - let regenerate_dracut () = - bpf "\ -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION=\"$(rpm -q kernel --qf '%%{version}-%%{release}.%%{arch}\\n' | sort -V | tail -1)\" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -" - in - - (match os with - | Fedora _ -> - bpf "%%post\n"; - bpf "\ -# Ensure the installation is up-to-date. -# This makes Fedora >= 33 unbootable, see: -# https://bugzilla.redhat.com/show_bug.cgi?id=1911177 -#dnf -y --best upgrade -"; - - let needs_regenerate_dracut = ref false in - if arch = X86_64 then ( - bpf "\ -# Enable Xen domU support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=\" xen:vbd xen:vif \"' > virt-builder-xen-drivers.conf -popd -"; - needs_regenerate_dracut := true - ); - - if arch = PPC64 || arch = PPC64le then ( - bpf "\ -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=\" virtio-blk virtio-scsi \"' > virt-builder-virtio-scsi.conf -popd -"; - needs_regenerate_dracut := true - ); - - if !needs_regenerate_dracut then regenerate_dracut (); - bpf "%%end\n\n" - - | RHEL (7,_) -> - bpf "%%post\n"; - - let needs_regenerate_dracut = ref false in - - if arch = PPC64 || arch = PPC64le then ( - bpf "\ -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=\" virtio-blk virtio-scsi \"' > virt-builder-virtio-scsi.conf -popd -"; - needs_regenerate_dracut := true - ); - - if !needs_regenerate_dracut then regenerate_dracut (); - bpf "%%end\n\n" - - | _ -> () - ); - - bpf "# EOF\n"; - - (* Write out the kickstart file. *) - let chan = open_out (ks_filename ^ ".new") in - Buffer.output_buffer chan buf; - close_out chan; - let cmd = - sprintf "mv %s %s" (quote (ks_filename ^ ".new")) (quote ks_filename) in - if Sys.command cmd <> 0 then exit 1; - - (* Return the kickstart filename. *) - ks_filename - -and copy_preseed_to_temporary source = - (* d-i only works if the file is literally called "/preseed.cfg" *) - let d = Filename.get_temp_dir_name () // random8 () ^ ".tmp" in - let f = d // "preseed.cfg" in - Unix.mkdir d 0o700; - let cmd = sprintf "cp %s %s" (quote source) (quote f) in - if Sys.command cmd <> 0 then exit 1; - f - -(* For Windows: - * https://serverfault.com/questions/644437/unattended-installation-of-windows-server-2012-on-kvm - *) -and make_unattend_iso os arch = - printf "enter Windows product key: "; - let product_key = read_line () in - - let output_iso = - Sys.getcwd () // filename_of_os os arch "-unattend.iso" in - unlink_on_exit output_iso; - - let d = Filename.get_temp_dir_name () // random8 () in - Unix.mkdir d 0o700; - let config_dir = d // "config" in - Unix.mkdir config_dir 0o700; - let f = config_dir // "autounattend.xml" in - - let chan = open_out f in - let arch = - match arch with - | X86_64 -> "amd64" - | I686 -> "x86" - | _ -> - eprintf "%s: Windows architecture %s not supported\n" - prog (string_of_arch arch); - exit 1 in - (* Tip: If the install fails with a useless error "The answer file is - * invalid", type Shift + F10 into the setup screen and look for a - * file called \Windows\Panther\Setupact.log (NB: - * not \Windows\Setupact.log) - *) - fprintf chan " - - - - - true - - %s - OnError - - - - - - 0 - true - - - - 1 - Primary - 300 - - - - 2 - Primary - true - - - - - - 1 - 1 - - NTFS - true - - - - 2 - 2 - - C - NTFS - - - - OnError - - - - - Never - - - /IMAGE/INDEX - 1 - - - - 0 - 2 - - - - - - - - en-US - - en-US - en-US - en-US - - -" - arch product_key arch; - close_out chan; - - let cmd = sprintf "cd %s && mkisofs -o %s -J -r config" - (quote d) (quote output_iso) in - if Sys.command cmd <> 0 then exit 1; - let cmd = sprintf "rm -rf %s" (quote d) in - if Sys.command cmd <> 0 then exit 1; - - (* Return the name of the unattend ISO. *) - output_iso - -and make_boot_media os arch = - match os, arch with - | CentOS (major, _), Aarch64 -> - (* XXX This always points to the latest CentOS, so - * effectively the minor number is always ignored. - *) - Location (sprintf "http://mirror.centos.org/altarch/%d/os/aarch64/" - major) - - | CentOS (7, _), X86_64 -> - (* For 6.x we rebuild this every time there is a new 6.x release, and bump - * the revision in the index. - * For 7.x this always points to the latest CentOS, so - * effectively the minor number is always ignored. - *) - Location "http://mirror.centos.org/centos-7/7/os/x86_64/" - - | CentOS (8, _), X86_64 -> - Location "http://mirror.centos.org/centos-8/8/BaseOS/x86_64/kickstart" - - | Debian (_, dist), arch -> - Location (sprintf "http://deb.debian.org/debian/dists/%s/main/installer-%s" - dist (debian_arch_of_arch arch)) - - (* Fedora primary architectures. *) - | Fedora ver, Armv7 -> - Location (sprintf "http://mirror.bytemark.co.uk/fedora/linux/releases/%d/Server/armhfp/os/" ver) - - | Fedora ver, X86_64 when ver < 21 -> - Location (sprintf "http://mirror.bytemark.co.uk/fedora/linux/releases/%d/Fedora/x86_64/os/" ver) - - | Fedora ver, X86_64 -> - Location (sprintf "http://mirror.bytemark.co.uk/fedora/linux/releases/%d/Server/x86_64/os/" ver) - - | Fedora ver, Aarch64 -> - Location (sprintf "http://mirror.bytemark.co.uk/fedora/linux/releases/%d/Server/aarch64/os/" ver) - - (* Fedora secondary architectures. - * By using dl.fedoraproject.org we avoid randomly using mirrors - * which might have incomplete copies. - *) - | Fedora ver, I686 -> - Location (sprintf "https://dl.fedoraproject.org/pub/fedora-secondary/releases/%d/Server/i386/os/" ver) - - | Fedora ver, PPC64 -> - Location (sprintf "https://dl.fedoraproject.org/pub/fedora-secondary/releases/%d/Server/ppc64/os/" ver) - - | Fedora ver, PPC64le -> - Location (sprintf "https://dl.fedoraproject.org/pub/fedora-secondary/releases/%d/Server/ppc64le/os/" ver) - - | Fedora ver, S390X -> - Location (sprintf "https://dl.fedoraproject.org/pub/fedora-secondary/releases/%d/Server/s390x/os/" ver) - - | RHEL (3, minor), X86_64 -> - Location (sprintf "http://download.devel.redhat.com/released/RHEL-3/U%d/AS/x86_64/tree" minor) - - | RHEL (4, minor), X86_64 -> - Location (sprintf "http://download.devel.redhat.com/released/RHEL-4/U%d/AS/x86_64/tree" minor) - - | RHEL (5, minor), I686 -> - Location (sprintf "http://download.devel.redhat.com/released/RHEL-5-Server/U%d/i386/os" minor) - - | RHEL (5, minor), X86_64 -> - Location (sprintf "http://download.devel.redhat.com/released/RHEL-5-Server/U%d/x86_64/os" minor) - - | RHEL (6, minor), I686 -> - Location (sprintf "http://download.devel.redhat.com/released/RHEL-6/6.%d/Server/i386/os" minor) - - | RHEL (6, minor), X86_64 -> - Location (sprintf "http://download.devel.redhat.com/released/RHEL-6/6.%d/Server/x86_64/os" minor) - - | RHEL (7, minor), X86_64 -> - Location (sprintf "http://download.devel.redhat.com/released/rhel-6-7-8/rhel-7/RHEL-7/7.%d/Server/x86_64/os" minor) - - | RHEL (7, minor), PPC64 -> - Location (sprintf "http://download.devel.redhat.com/released/rhel-6-7-8/rhel-7/RHEL-7/7.%d/Server/ppc64/os" minor) - - | RHEL (7, minor), PPC64le -> - Location (sprintf "http://download.devel.redhat.com/released/rhel-6-7-8/rhel-7/RHEL-7/7.%d/Server/ppc64le/os" minor) - - | RHEL (7, minor), S390X -> - Location (sprintf "http://download.devel.redhat.com/released/rhel-6-7-8/rhel-7/RHEL-7/7.%d/Server/s390x/os" minor) - - | RHEL (7, minor), Aarch64 -> - Location (sprintf "http://download.eng.bos.redhat.com/released/RHEL-ALT-7/7.%d/Server/aarch64/os" minor) - - | RHEL (8, minor), arch -> - Location (sprintf "http://download.eng.bos.redhat.com/released/rhel-6-7-8/rhel-8/RHEL-8/8.%d.0/BaseOS/%s/os" minor (string_of_arch arch)) - - | Ubuntu (_, dist), X86_64 -> - Location (sprintf "http://archive.ubuntu.com/ubuntu/dists/%s/main/installer-amd64" dist) - - | Ubuntu (_, dist), PPC64le -> - Location (sprintf "http://ports.ubuntu.com/ubuntu-ports/dists/%s/main/installer-ppc64el" dist) - - | FreeBSD (major, minor), X86_64 -> - let iso = sprintf "FreeBSD-%d.%d-RELEASE-amd64-disc1.iso" - major minor in - let iso_xz = sprintf "ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/%d.%d/%s.xz" - major minor iso in - let cmd = sprintf "wget -nc %s" (quote iso_xz) in - if Sys.command cmd <> 0 then exit 1; - let cmd = sprintf "unxz -f --keep %s.xz" iso in - if Sys.command cmd <> 0 then exit 1; - CDRom iso - - | Windows (major, minor, variant), arch -> - let iso_name = - match major, minor, variant, arch with - | 6, 1, Client, X86_64 -> (* Windows 7 *) - "en_windows_7_ultimate_with_sp1_x64_dvd_u_677332.iso" - | 6, 1, Server, X86_64 -> (* Windows 2008 R2 *) - "en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso" - | 6, 2, Server, X86_64 -> (* Windows Server 2012 *) - "en_windows_server_2012_x64_dvd_915478.iso" - | 6, 3, Server, X86_64 -> (* Windows Server 2012 R2 *) - "en_windows_server_2012_r2_with_update_x64_dvd_6052708.iso" - | 10, 0, Server, X86_64 -> (* Windows Server 2016 *) - "en_windows_server_2016_updated_feb_2018_x64_dvd_11636692.iso" - | _ -> - eprintf "%s: don't have an installer ISO for this version of Windows\n" - prog; - exit 1 in - CDRom (windows_installers // iso_name) - - | _ -> - eprintf "%s: don't know how to calculate the --location for this OS and architecture\n" prog; - exit 1 - -and print_install_notes = function - | Ubuntu _ -> - printf "\ -Some preseed functions are not automated. You may need to hit [Return] -a few times during the install.\n" - - | FreeBSD _ -> - printf "\ -The FreeBSD install is not automated. Select all defaults, except: - - - root password: builder - - timezone: UTC - - do not add any user accounts\n" - - | _ -> () - -(* If the install is not automated and we need a graphical console. *) -and needs_graphics = function - | CentOS _ | RHEL _ | Debian _ | Ubuntu _ | Fedora _ -> false - | FreeBSD _ | Windows _ -> true - -(* NB: Arguments do not need to be quoted, because we pass them - * directly to exec(2). - *) -and make_virt_install_command os arch ks tmpname tmpout tmpefivars - boot_media virtual_size_gb = - let args = ref [] in - let add arg = args := arg :: !args in - - add "virt-install"; - - (* This ensures the libvirt domain will be automatically deleted - * when virt-install exits. However it doesn't work for certain - * types of guest. - *) - (match os with - | Windows _ -> - printf "after Windows has installed, do:\n"; - printf " virsh shutdown %s\n virsh undefine %s\n%!" tmpname tmpname; - | _ -> add "--transient" - ); - - (* Don't try relabelling everything. This is particularly necessary - * for the Windows install ISOs which are located on NFS. - *) - (match os with - | Windows _ -> add "--security=type=none" - | _ -> () - ); - - add (sprintf "--name=%s" tmpname); - - (*add "--print-xml";*) - - add "--ram=4096"; - - (match arch with - | X86_64 -> - add "--arch=x86_64"; - add "--cpu=host"; - add "--vcpus=4" - | PPC64 -> - add "--arch=ppc64"; - add "--machine=pseries"; - add "--cpu=power7"; - add "--vcpus=1" - | PPC64le -> - add "--arch=ppc64le"; - add "--machine=pseries"; - add "--cpu=power8"; - add "--vcpus=1" - | arch -> - add (sprintf "--arch=%s" (string_of_arch arch)); - add "--vcpus=1" - ); - - add (sprintf "--os-variant=%s" (os_variant_of_os ~for_fedora:true os arch)); - - (match tmpefivars with - | Some (code, vars) -> - add "--boot"; - add (sprintf "loader=%s,loader_ro=yes,loader_type=pflash,nvram=%s" - code vars) - | _ -> () - ); - - (* --initrd-inject and --extra-args flags for Linux only. *) - (match os with - | Debian _ | Ubuntu _ - | Fedora _ | RHEL _ | CentOS _ -> - let ks = - match ks with None -> assert false | Some ks -> ks in - add (sprintf "--initrd-inject=%s" ks); - - let os_extra = - match os with - | Debian _ | Ubuntu _ -> "auto" - | Fedora _ | RHEL _ | CentOS _ -> - sprintf "ks=file:/%s" (Filename.basename ks) - | FreeBSD _ | Windows _ -> assert false in - let proxy = - let p = try Some (Sys.getenv "http_proxy") with Not_found -> None in - match p with - | None -> - (match os with - | Fedora _ | RHEL _ | CentOS _ | Ubuntu _ -> "" - | Debian _ -> "mirror/http/proxy=" - | FreeBSD _ | Windows _ -> assert false - ) - | Some p -> - match os with - | Fedora _ | RHEL _ | CentOS _ -> "proxy=" ^ p - | Debian _ | Ubuntu _ -> "mirror/http/proxy=" ^ p - | FreeBSD _ | Windows _ -> assert false in - - add (sprintf "--extra-args=%s %s %s" (* sic: does NOT need to be quoted *) - os_extra proxy (kernel_cmdline_of_os os arch)); - - (* doesn't need --initrd-inject *) - | FreeBSD _ | Windows _ -> () - ); - - add (sprintf "--disk=%s,size=%d,format=raw" - (Sys.getcwd () // tmpout) virtual_size_gb); - - (match boot_media with - | Location location -> add (sprintf "--location=%s" location) - | CDRom iso -> add (sprintf "--disk=%s,device=cdrom,boot_order=1" iso) - ); - - (* Windows requires one or two extra CDs! - * See: https://serverfault.com/questions/644437/unattended-installation-of-windows-server-2012-on-kvm - *) - (match os with - | Windows _ -> - let unattend_iso = - match ks with None -> assert false | Some ks -> ks in - (*add "--disk=/usr/share/virtio-win/virtio-win.iso,device=cdrom,boot_order=98";*) - add (sprintf "--disk=%s,device=cdrom,boot_order=99" unattend_iso) - | _ -> () - ); - - add "--serial=pty"; - if not (needs_graphics os) then add "--nographics"; - - (* Return the command line (list of arguments). *) - Array.of_list (List.rev !args) - -and print_virt_install_command chan vi = - Array.iter ( - fun arg -> - if arg.[0] = '-' then fprintf chan "\\\n %s " (quote arg) - else fprintf chan "%s " (quote arg) - ) vi; - fprintf chan "\n\n%!" - -(* The optional [?for_fedora] flag means that we only return - * libosinfo data as currently supported by the latest version of - * Fedora. - * - * This is because if you try to use [virt-install --os-variant=...] - * with an os-variant which the host doesn't support, it won't work, - * and I currently use Fedora, so whatever is supported there matters. - *) -and os_variant_of_os ?(for_fedora = false) os arch = - if not for_fedora then ( - match os with - | Fedora ver -> sprintf "fedora%d" ver - | CentOS (major, minor) -> sprintf "centos%d.%d" major minor - | RHEL (major, minor) -> sprintf "rhel%d.%d" major minor - | Debian (ver, _) -> sprintf "debian%d" ver - | Ubuntu (ver, _) -> sprintf "ubuntu%s" ver - | FreeBSD (major, minor) -> sprintf "freebsd%d.%d" major minor - - | Windows (6, 1, Client) -> "win7" - | Windows (6, 1, Server) -> "win2k8r2" - | Windows (6, 2, Server) -> "win2k12" - | Windows (6, 3, Server) -> "win2k12r2" - | Windows (10, 0, Server) -> "win2k16" - | Windows _ -> assert false - ) - else ( - match os, arch with - (* This special case for Fedora/ppc64{,le} is needed to work - * around a bug in virt-install: - * https://bugzilla.redhat.com/show_bug.cgi?id=1399083 - *) - | Fedora _, (PPC64|PPC64le) -> "fedora22" - | Fedora ver, _ when ver <= 23 -> - sprintf "fedora%d" ver - | Fedora _, _ -> "fedora26" (* max version known in Fedora 28 *) - - | CentOS (8, _), _ -> "rhel8.0" (* temporary until osinfo updated *) - | CentOS (major, minor), _ when (major, minor) <= (7,0) -> - sprintf "centos%d.%d" major minor - | CentOS _, _ -> "centos7.0" (* max version known in Fedora 31 *) - - | RHEL (6, minor), _ when minor <= 8 -> - sprintf "rhel6.%d" minor - | RHEL (6, _), _ -> "rhel6.9" (* max version known in Fedora 29 *) - | RHEL (7, minor), _ when minor <= 4 -> - sprintf "rhel7.%d" minor - | RHEL (7, _), _ -> "rhel7.5" (* max version known in Fedora 29 *) - | RHEL (8, _), _ -> "rhel8.0" (* temporary until osinfo updated *) - | RHEL (major, minor), _ -> - sprintf "rhel%d.%d" major minor - - | Debian (ver, _), _ when ver <= 8 -> sprintf "debian%d" ver - | Debian _, _ -> "debian8" (* max version known in Fedora 26 *) - - | Ubuntu (ver, _), _ when ver < "20.04" -> sprintf "ubuntu%s" ver - | Ubuntu ("20.04", _), _ -> "ubuntu19.10" - | Ubuntu _, _ -> assert false - - | FreeBSD (major, minor), _ -> sprintf "freebsd%d.%d" major minor - - | Windows (6, 1, Client), _ -> "win7" - | Windows (6, 1, Server), _ -> "win2k8r2" - | Windows (6, 2, Server), _ -> "win2k12" - | Windows (6, 3, Server), _ -> "win2k12r2" - | Windows (10, 0, Server), _ -> "win2k16" - | Windows _, _ -> assert false - ) - -and kernel_cmdline_of_os os arch = - match os, arch with - | _, X86_64 - | _, I686 - | _, S390X -> - "console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - | _, Aarch64 -> - "console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH" - | _, Armv7 -> - "console=tty0 console=ttyAMA0,115200 rd_NO_PLYMOUTH" - | (Debian _|Fedora _|Ubuntu _), (PPC64|PPC64le) -> - "console=tty0 console=hvc0 rd_NO_PLYMOUTH" - | (RHEL _|CentOS _), PPC64 - | (RHEL _|CentOS _), PPC64le -> - "console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - - | FreeBSD _, _ | Windows _, _ -> assert false - -and make_postinstall os arch = - match os with - | Debian _ | Ubuntu _ -> - Some ( - fun g -> - (* Remove apt proxy configuration (thanks: Daniel Miranda). *) - g#rm_f "/etc/apt/apt.conf"; - g#touch "/etc/apt/apt.conf" - ) - - | RHEL (major, minor) when major >= 5 -> - Some ( - fun g -> - (* RHEL guests require alternate yum configuration pointing to - * Red Hat's internal servers. - *) - let yum_conf = make_rhel_yum_conf major minor arch in - g#write "/etc/yum.repos.d/download.devel.redhat.com.repo" yum_conf - ) - - | RHEL _ | Fedora _ | CentOS _ | FreeBSD _ | Windows _ -> None - -and make_rhel_yum_conf major minor arch = - let buf = Buffer.create 4096 in - let bpf fs = bprintf buf fs in - - if major <= 8 then ( - let baseurl, srpms, optional = - match major, arch with - | 5, (I686|X86_64) -> - let arch = match arch with I686 -> "i386" | _ -> string_of_arch arch in - let topurl = - sprintf "http://download.devel.redhat.com/released/RHEL-5-Server/U%d" - minor in - sprintf "%s/%s/os/Server" topurl arch, - sprintf "%s/source/SRPMS" topurl, - None - | 6, (I686|X86_64) -> - let arch = match arch with I686 -> "i386" | _ -> string_of_arch arch in - let topurl = - sprintf "http://download.devel.redhat.com/released/RHEL-%d/%d.%d" - major major minor in - sprintf "%s/Server/%s/os" topurl arch, - sprintf "%s/source/SRPMS" topurl, - Some ("Optional", - sprintf "%s/Server/optional/%s/os" arch topurl, - sprintf "%s/Server/optional/source/SRPMS" topurl) - | 7, (X86_64|PPC64|PPC64le|S390X) -> - let topurl = - sprintf "http://download.devel.redhat.com/released/RHEL-%d/%d.%d" - major major minor in - sprintf "%s/Server/%s/os" topurl (string_of_arch arch), - sprintf "%s/Server/source/tree" topurl, - Some ("Optional", - sprintf "%s/Server-optional/%s/os" topurl (string_of_arch arch), - sprintf "%s/Server-optional/source/tree" topurl) - | 7, Aarch64 -> - let topurl = - sprintf "http://download.devel.redhat.com/released/RHEL-ALT-%d/%d.%d" - major major minor in - sprintf "%s/Server/%s/os" topurl (string_of_arch arch), - sprintf "%s/Server/source/tree" topurl, - Some ("Optional", - sprintf "%s/Server-optional/%s/os" topurl (string_of_arch arch), - sprintf "%s/Server-optional/source/tree" topurl) - | 8, arch -> - let topurl = - sprintf "http://download.devel.redhat.com/released/RHEL-%d/%d.%d.0" - major major minor in - sprintf "%s/BaseOS/%s/os" topurl (string_of_arch arch), - sprintf "%s/BaseOS/source/tree" topurl, - Some ("AppStream", - sprintf "%s/AppStream/%s/os" topurl (string_of_arch arch), - sprintf "%s/AppStream/source/tree" topurl) - | _ -> assert false in - - bpf "\ -# Yum configuration pointing to Red Hat servers. - -[rhel%d] -name=RHEL %d Server -baseurl=%s -enabled=1 -gpgcheck=0 -keepcache=0 - -[rhel%d-source] -name=RHEL %d Server Source -baseurl=%s -enabled=0 -gpgcheck=0 -keepcache=0 -" major major baseurl major major srpms; - - (match optional with - | None -> () - | Some (name, optionalbaseurl, optionalsrpms) -> - let lc_name = String.lowercase_ascii name in - bpf "\ - -[rhel%d-%s] -name=RHEL %d Server %s -baseurl=%s -enabled=1 -gpgcheck=0 -keepcache=0 - -[rhel%d-%s-source] -name=RHEL %d Server %s -baseurl=%s -enabled=0 -gpgcheck=0 -keepcache=0 -" major lc_name major lc_name optionalbaseurl - major lc_name major lc_name optionalsrpms - ) - ) else ( - assert false (* not implemented for RHEL major >= 9 *) - ); - - Buffer.contents buf - -and make_index_fragment os arch index_fragment output nvram revision - expandfs lvexpandfs virtual_size_gb = - let virtual_size = Int64.of_int virtual_size_gb in - let virtual_size = Int64.mul virtual_size 1024_L in - let virtual_size = Int64.mul virtual_size 1024_L in - let virtual_size = Int64.mul virtual_size 1024_L in - - let chan = open_out (index_fragment ^ ".new") in - let fpf fs = fprintf chan fs in - - fpf "[%s]\n" (string_of_os_noarch os); - fpf "name=%s\n" (long_name_of_os os arch); - fpf "osinfo=%s\n" (os_variant_of_os os arch); - fpf "arch=%s\n" (string_of_arch arch); - fpf "file=%s\n" output; - (match revision with - | None -> () - | Some i -> fpf "revision=%d\n" i - ); - fpf "checksum[sha512]=%s\n" (sha512sum_of_file output); - fpf "format=raw\n"; - fpf "size=%Ld\n" virtual_size; - fpf "compressed_size=%d\n" (size_of_file output); - fpf "expand=%s\n" expandfs; - (match lvexpandfs with - | None -> () - | Some fs -> fpf "lvexpand=%s\n" fs - ); - - let notes = notes_of_os os arch nvram in - (match notes with - | first :: notes -> - fpf "notes=%s\n" first; - List.iter (fpf " %s\n") notes - | [] -> assert false - ); - fpf "\n"; - - close_out chan; - let cmd = - sprintf "mv %s %s" - (quote (index_fragment ^ ".new")) (quote index_fragment) in - if Sys.command cmd <> 0 then exit 1 - -and long_name_of_os os arch = - match os, arch with - | CentOS (major, minor), X86_64 -> - sprintf "CentOS %d.%d" major minor - | CentOS (major, minor), arch -> - sprintf "CentOS %d.%d (%s)" major minor (string_of_arch arch) - | Debian (ver, dist), X86_64 -> - sprintf "Debian %d (%s)" ver dist - | Debian (ver, dist), arch -> - sprintf "Debian %d (%s) (%s)" ver dist (string_of_arch arch) - | Fedora ver, X86_64 -> - sprintf "Fedora® %d Server" ver - | Fedora ver, arch -> - sprintf "Fedora® %d Server (%s)" ver (string_of_arch arch) - | RHEL (major, minor), X86_64 -> - sprintf "Red Hat Enterprise Linux® %d.%d" major minor - | RHEL (major, minor), arch -> - sprintf "Red Hat Enterprise Linux® %d.%d (%s)" - major minor (string_of_arch arch) - | Ubuntu (ver, dist), X86_64 -> - sprintf "Ubuntu %s (%s)" ver dist - | Ubuntu (ver, dist), arch -> - sprintf "Ubuntu %s (%s) (%s)" ver dist (string_of_arch arch) - | FreeBSD (major, minor), X86_64 -> - sprintf "FreeBSD %d.%d" major minor - | FreeBSD (major, minor), arch -> - sprintf "FreeBSD %d.%d (%s)" major minor (string_of_arch arch) - - | Windows (6, 1, Client), arch -> - sprintf "Windows 7 (%s)" (string_of_arch arch) - | Windows (6, 1, Server), arch -> - sprintf "Windows Server 2008 R2 (%s)" (string_of_arch arch) - | Windows (6, 2, Server), arch -> - sprintf "Windows Server 2012 (%s)" (string_of_arch arch) - | Windows (6, 3, Server), arch -> - sprintf "Windows Server 2012 R2 (%s)" (string_of_arch arch) - | Windows (10, 0, Server), arch -> - sprintf "Windows Server 2016 (%s)" (string_of_arch arch) - | Windows _, _ -> assert false - -and notes_of_os os arch nvram = - let args = ref [] in - let add arg = args := arg :: !args in - - add (long_name_of_os os arch); - add ""; - - (match os with - | CentOS _ -> - add "This CentOS image contains only unmodified @Core group packages." - | Debian _ -> - add "This is a minimal Debian install." - | Fedora _ -> - add "This Fedora image contains only unmodified @Core group packages."; - add ""; - add "Fedora and the Infinity design logo are trademarks of Red Hat, Inc."; - add "Source and further information is available from http://fedoraproject.org/" - | RHEL _ -> assert false (* cannot happen, see caller *) - | Ubuntu _ -> - add "This is a minimal Ubuntu install." - | FreeBSD _ -> - add "This is an all-default FreeBSD install." - | Windows _ -> - add "This is an unattended Windows install."; - add ""; - add "You must have an MSDN subscription to use this image." - ); - add ""; - - (* Specific notes for particular versions. *) - let reconfigure_ssh_host_keys_debian () = - add "This image does not contain SSH host keys. To regenerate them use:"; - add ""; - add " --firstboot-command \"dpkg-reconfigure openssh-server\""; - add ""; - in - let fix_serial_console_debian () = - add "The serial console is not working in this image. To enable it, do:"; - add ""; - add " --edit '/etc/default/grub:"; - add " s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"console=tty0 console=ttyS0,115200n8\"/' \\"; - add " --run-command update-grub"; - add "" - in - let builder_account_warning () = - add "IMPORTANT WARNING:"; - add "It seems to be impossible to create an Ubuntu >= 14.04 image using"; - add "preseed without creating a user account. Therefore this image"; - add "contains a user account 'builder'. I have disabled it, so that"; - add "people who don't read release notes don't get caught out, but you"; - add "might still wish to delete it completely."; - add "" - in - (match os with - | CentOS (6, _) -> - add "‘virt-builder centos-6’ will always install the latest 6.x release."; - add "" - | Debian ((8|9), _) -> - reconfigure_ssh_host_keys_debian (); - | Debian _ -> - add "This image is so very minimal that it only includes an ssh server"; - reconfigure_ssh_host_keys_debian (); - | Ubuntu ("16.04", _) -> - builder_account_warning (); - fix_serial_console_debian (); - reconfigure_ssh_host_keys_debian (); - | Ubuntu (ver, _) when ver >= "14.04" -> - builder_account_warning (); - reconfigure_ssh_host_keys_debian (); - | Ubuntu _ -> - reconfigure_ssh_host_keys_debian (); - | _ -> () - ); - - (match nvram with - | Some vars -> - add "You will need to use the associated UEFI NVRAM variables file:"; - add (sprintf " http://libguestfs.org/download/builder/%s" vars); - add ""; - | None -> () - ); - - add "This template was generated by a script in the libguestfs source tree:"; - add " builder/templates/make-template.ml"; - add "Associated files used to prepare this template can be found in the"; - add "same directory."; - - List.rev !args - -and read_revision filename = - match (try Some (open_in filename) with Sys_error _ -> None) with - | None -> `No_file - | Some chan -> - let r = ref `No_revision in - let rex = Str.regexp "^revision=\\([0-9]+\\)$" in - (try - let rec loop () = - let line = input_line chan in - if Str.string_match rex line 0 then ( - r := `Revision (int_of_string (Str.matched_group 1 line)); - raise End_of_file - ); - loop () - in - loop () - with End_of_file -> () - ); - close_in chan; - !r - -and sha512sum_of_file filename = - let cmd = sprintf "sha512sum %s | awk '{print $1}'" (quote filename) in - let chan = Unix.open_process_in cmd in - let line = input_line chan in - let pstat = Unix.close_process_in chan in - check_process_status_for_errors pstat; - line - -and size_of_file filename = (Unix.stat filename).Unix.st_size - -and open_guest ?(mount = false) filename = - let g = new Guestfs.guestfs () in - g#add_drive_opts ~format:"raw" filename; - g#launch (); - - let roots = g#inspect_os () in - if Array.length roots = 0 then ( - eprintf "%s: cannot inspect this guest - this may mean guest installation failed\n" prog; - exit 1 - ); - - if mount then ( - let root = roots.(0) in - let mps = g#inspect_get_mountpoints root in - let cmp (a,_) (b,_) = compare (String.length a) (String.length b) in - let mps = List.sort cmp mps in - List.iter (fun (mp, dev) -> g#mount dev mp) mps - ); - - g - -and check_process_status_for_errors = function - | Unix.WEXITED 0 -> () - | Unix.WEXITED i -> - eprintf "command exited with %d\n%!" i; - exit 1 - | Unix.WSIGNALED i -> - eprintf "command killed by signal %d\n%!" i; - exit 1 - | Unix.WSTOPPED i -> - eprintf "command stopped by signal %d\n%!" i; - exit 1 - -and random8 = - let chars = "abcdefghijklmnopqrstuvwxyz0123456789" in - fun () -> - String.concat "" ( - List.map ( - fun _ -> - let c = Random.int 36 in - let c = chars.[c] in - String.make 1 c - ) [1;2;3;4;5;6;7;8] - ) - -let () = main () diff --git a/builder/templates/rhel-5.11-i686.ks b/builder/templates/rhel-5.11-i686.ks deleted file mode 100644 index 167c30397..000000000 --- a/builder/templates/rhel-5.11-i686.ks +++ /dev/null @@ -1,30 +0,0 @@ -# Kickstart file for rhel-5.11-i686 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing -key --skip - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -part /boot --fstype=ext2 --size=512 --asprimary -part swap --size=1024 --asprimary -part / --fstype=ext4 --size=1024 --grow --asprimary - -# Halt the system once configuration has finished. -poweroff - -%packages -@core - -# EOF diff --git a/builder/templates/rhel-6.10.ks b/builder/templates/rhel-6.10.ks deleted file mode 100644 index 65a7456db..000000000 --- a/builder/templates/rhel-6.10.ks +++ /dev/null @@ -1,30 +0,0 @@ -# Kickstart file for rhel-6.10 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -part /boot --fstype=ext4 --size=512 --asprimary -part swap --size=1024 --asprimary -part / --fstype=ext4 --size=1024 --grow --asprimary - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/rhel-6.10.virt-install-cmd b/builder/templates/rhel-6.10.virt-install-cmd deleted file mode 100644 index 838a90914..000000000 --- a/builder/templates/rhel-6.10.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-6.10' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-5p1v4wqu' \ - '--ram=2048' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel6.9' \ - '--initrd-inject=rhel-6.10.ks' \ - '--extra-args=ks=file:/rhel-6.10.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-5p1v4wqu.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/RHEL-6/6.10/Server/x86_64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-6.8-i686.ks b/builder/templates/rhel-6.8-i686.ks deleted file mode 100644 index 1a138c7b9..000000000 --- a/builder/templates/rhel-6.8-i686.ks +++ /dev/null @@ -1,30 +0,0 @@ -# Kickstart file for rhel-6.8-i686 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -part /boot --fstype=ext4 --size=512 --asprimary -part swap --size=1024 --asprimary -part / --fstype=ext4 --size=1024 --grow --asprimary - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/rhel-6.9.ks b/builder/templates/rhel-6.9.ks deleted file mode 100644 index e33fe1af3..000000000 --- a/builder/templates/rhel-6.9.ks +++ /dev/null @@ -1,30 +0,0 @@ -# Kickstart file for rhel-6.9 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -part /boot --fstype=ext4 --size=512 --asprimary -part swap --size=1024 --asprimary -part / --fstype=ext4 --size=1024 --grow --asprimary - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/rhel-6.9.virt-install-cmd b/builder/templates/rhel-6.9.virt-install-cmd deleted file mode 100644 index 97131e1c1..000000000 --- a/builder/templates/rhel-6.9.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-6.9' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-37m9g7in' \ - '--ram=2048' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel6.9' \ - '--initrd-inject=rhel-6.9.ks' \ - '--extra-args=ks=file:/rhel-6.9.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-37m9g7in.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/RHEL-6/6.9/Server/x86_64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.3-ppc64.ks b/builder/templates/rhel-7.3-ppc64.ks deleted file mode 100644 index 7909ee8d2..000000000 --- a/builder/templates/rhel-7.3-ppc64.ks +++ /dev/null @@ -1,41 +0,0 @@ -# Kickstart file for rhel-7.3-ppc64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=lvm - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+="virtio-blk virtio-scsi"' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/rhel-7.3-ppc64le.ks b/builder/templates/rhel-7.3-ppc64le.ks deleted file mode 100644 index e8fe947c9..000000000 --- a/builder/templates/rhel-7.3-ppc64le.ks +++ /dev/null @@ -1,41 +0,0 @@ -# Kickstart file for rhel-7.3-ppc64le -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=lvm - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+="virtio-blk virtio-scsi"' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/rhel-7.4-aarch64.ks b/builder/templates/rhel-7.4-aarch64.ks deleted file mode 100644 index 589b8bd67..000000000 --- a/builder/templates/rhel-7.4-aarch64.ks +++ /dev/null @@ -1,31 +0,0 @@ -# Kickstart file for rhel-7.4-aarch64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -%end - -# EOF diff --git a/builder/templates/rhel-7.4-ppc64.ks b/builder/templates/rhel-7.4-ppc64.ks deleted file mode 100644 index 7662b8c63..000000000 --- a/builder/templates/rhel-7.4-ppc64.ks +++ /dev/null @@ -1,41 +0,0 @@ -# Kickstart file for rhel-7.4-ppc64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/rhel-7.4-ppc64le.ks b/builder/templates/rhel-7.4-ppc64le.ks deleted file mode 100644 index e0dd1fbb0..000000000 --- a/builder/templates/rhel-7.4-ppc64le.ks +++ /dev/null @@ -1,41 +0,0 @@ -# Kickstart file for rhel-7.4-ppc64le -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/rhel-7.4.ks b/builder/templates/rhel-7.4.ks deleted file mode 100644 index 98e5980fe..000000000 --- a/builder/templates/rhel-7.4.ks +++ /dev/null @@ -1,31 +0,0 @@ -# Kickstart file for rhel-7.4 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -%end - -# EOF diff --git a/builder/templates/rhel-7.5-aarch64.ks b/builder/templates/rhel-7.5-aarch64.ks deleted file mode 100644 index e687eb375..000000000 --- a/builder/templates/rhel-7.5-aarch64.ks +++ /dev/null @@ -1,31 +0,0 @@ -# Kickstart file for rhel-7.5-aarch64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -%end - -# EOF diff --git a/builder/templates/rhel-7.5-aarch64.virt-install-cmd b/builder/templates/rhel-7.5-aarch64.virt-install-cmd deleted file mode 100644 index f5d0da701..000000000 --- a/builder/templates/rhel-7.5-aarch64.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.5-aarch64' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-vjwxeb6e' \ - '--ram=2048' \ - '--arch=aarch64' \ - '--vcpus=1' \ - '--os-variant=rhel7.2' \ - '--boot' 'loader=/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw,loader_ro=yes,loader_type=pflash,nvram=/home/rjones/d/libguestfs/builder/templates/tmp-vjwxeb6e.vars' \ - '--initrd-inject=rhel-7.5-aarch64.ks' \ - '--extra-args=ks=file:/rhel-7.5-aarch64.ks proxy=http://cache.home.annexia.org:3128 console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-vjwxeb6e.img,size=6,format=raw' \ - '--location=http://download.eng.bos.redhat.com/released/RHEL-ALT-7/7.5/Server/aarch64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.5-ppc64.ks b/builder/templates/rhel-7.5-ppc64.ks deleted file mode 100644 index baea0cf5e..000000000 --- a/builder/templates/rhel-7.5-ppc64.ks +++ /dev/null @@ -1,41 +0,0 @@ -# Kickstart file for rhel-7.5-ppc64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/rhel-7.5-ppc64.virt-install-cmd b/builder/templates/rhel-7.5-ppc64.virt-install-cmd deleted file mode 100644 index 5e028edea..000000000 --- a/builder/templates/rhel-7.5-ppc64.virt-install-cmd +++ /dev/null @@ -1,21 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.5-ppc64' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-ldt3vkig' \ - '--ram=4096' \ - '--arch=ppc64' \ - '--machine=pseries' \ - '--cpu=power7' \ - '--vcpus=1' \ - '--os-variant=rhel7.2' \ - '--initrd-inject=rhel-7.5-ppc64.ks' \ - '--extra-args=ks=file:/rhel-7.5-ppc64.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-ldt3vkig.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/RHEL-7/7.5/Server/ppc64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.5-ppc64le.ks b/builder/templates/rhel-7.5-ppc64le.ks deleted file mode 100644 index d40b231a8..000000000 --- a/builder/templates/rhel-7.5-ppc64le.ks +++ /dev/null @@ -1,41 +0,0 @@ -# Kickstart file for rhel-7.5-ppc64le -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/rhel-7.5-ppc64le.virt-install-cmd b/builder/templates/rhel-7.5-ppc64le.virt-install-cmd deleted file mode 100644 index b11dcd08a..000000000 --- a/builder/templates/rhel-7.5-ppc64le.virt-install-cmd +++ /dev/null @@ -1,21 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.5-ppc64le' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-se2odtvo' \ - '--ram=4096' \ - '--arch=ppc64le' \ - '--machine=pseries' \ - '--cpu=power8' \ - '--vcpus=1' \ - '--os-variant=rhel7.2' \ - '--initrd-inject=rhel-7.5-ppc64le.ks' \ - '--extra-args=ks=file:/rhel-7.5-ppc64le.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-se2odtvo.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/RHEL-7/7.5/Server/ppc64le/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.5-s390x.ks b/builder/templates/rhel-7.5-s390x.ks deleted file mode 100644 index 7ef2fb831..000000000 --- a/builder/templates/rhel-7.5-s390x.ks +++ /dev/null @@ -1,31 +0,0 @@ -# Kickstart file for rhel-7.5-s390x -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -%end - -# EOF diff --git a/builder/templates/rhel-7.5-s390x.virt-install-cmd b/builder/templates/rhel-7.5-s390x.virt-install-cmd deleted file mode 100644 index 336d04c16..000000000 --- a/builder/templates/rhel-7.5-s390x.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.5-s390x' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-xdgcuw2s' \ - '--ram=2048' \ - '--arch=s390x' \ - '--vcpus=1' \ - '--os-variant=rhel7.2' \ - '--initrd-inject=rhel-7.5-s390x.ks' \ - '--extra-args=ks=file:/rhel-7.5-s390x.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-xdgcuw2s.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/RHEL-7/7.5/Server/s390x/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.5.ks b/builder/templates/rhel-7.5.ks deleted file mode 100644 index 35778f3a2..000000000 --- a/builder/templates/rhel-7.5.ks +++ /dev/null @@ -1,31 +0,0 @@ -# Kickstart file for rhel-7.5 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -%end - -# EOF diff --git a/builder/templates/rhel-7.5.virt-install-cmd b/builder/templates/rhel-7.5.virt-install-cmd deleted file mode 100644 index 9b54563e9..000000000 --- a/builder/templates/rhel-7.5.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.5' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-o6zt4kx1' \ - '--ram=2048' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel7.2' \ - '--initrd-inject=rhel-7.5.ks' \ - '--extra-args=ks=file:/rhel-7.5.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-o6zt4kx1.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/RHEL-7/7.5/Server/x86_64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.6-aarch64.ks b/builder/templates/rhel-7.6-aarch64.ks deleted file mode 100644 index e7f0e8d20..000000000 --- a/builder/templates/rhel-7.6-aarch64.ks +++ /dev/null @@ -1,31 +0,0 @@ -# Kickstart file for rhel-7.6-aarch64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -%end - -# EOF diff --git a/builder/templates/rhel-7.6-aarch64.virt-install-cmd b/builder/templates/rhel-7.6-aarch64.virt-install-cmd deleted file mode 100644 index d1cb7201c..000000000 --- a/builder/templates/rhel-7.6-aarch64.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.6-aarch64' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-efk86xu4' \ - '--ram=2048' \ - '--arch=aarch64' \ - '--vcpus=1' \ - '--os-variant=rhel7.5' \ - '--boot' 'loader=/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw,loader_ro=yes,loader_type=pflash,nvram=/home/rjones/d/libguestfs/builder/templates/tmp-efk86xu4.vars' \ - '--initrd-inject=rhel-7.6-aarch64.ks' \ - '--extra-args=ks=file:/rhel-7.6-aarch64.ks proxy=http://cache.home.annexia.org:3128 console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-efk86xu4.img,size=6,format=raw' \ - '--location=http://download.eng.bos.redhat.com/released/RHEL-ALT-7/7.6/Server/aarch64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.6-ppc64.ks b/builder/templates/rhel-7.6-ppc64.ks deleted file mode 100644 index 50f9bfe06..000000000 --- a/builder/templates/rhel-7.6-ppc64.ks +++ /dev/null @@ -1,41 +0,0 @@ -# Kickstart file for rhel-7.6-ppc64 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/rhel-7.6-ppc64.virt-install-cmd b/builder/templates/rhel-7.6-ppc64.virt-install-cmd deleted file mode 100644 index 6b3a8d034..000000000 --- a/builder/templates/rhel-7.6-ppc64.virt-install-cmd +++ /dev/null @@ -1,21 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.6-ppc64' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-qo4kxx7g' \ - '--ram=4096' \ - '--arch=ppc64' \ - '--machine=pseries' \ - '--cpu=power7' \ - '--vcpus=1' \ - '--os-variant=rhel7.5' \ - '--initrd-inject=rhel-7.6-ppc64.ks' \ - '--extra-args=ks=file:/rhel-7.6-ppc64.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-qo4kxx7g.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/RHEL-7/7.6/Server/ppc64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.6-ppc64le.ks b/builder/templates/rhel-7.6-ppc64le.ks deleted file mode 100644 index 6fd7f162d..000000000 --- a/builder/templates/rhel-7.6-ppc64le.ks +++ /dev/null @@ -1,41 +0,0 @@ -# Kickstart file for rhel-7.6-ppc64le -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -# Enable virtio-scsi support. -pushd /etc/dracut.conf.d -echo 'add_drivers+=" virtio-blk virtio-scsi "' > virt-builder-virtio-scsi.conf -popd -# To make dracut config changes permanent, we need to rerun dracut. -# Rerun dracut for the installed kernel (not the running kernel). -# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and -# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 -KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | sort -V | tail -1)" -dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION -%end - -# EOF diff --git a/builder/templates/rhel-7.6-ppc64le.virt-install-cmd b/builder/templates/rhel-7.6-ppc64le.virt-install-cmd deleted file mode 100644 index abc890bde..000000000 --- a/builder/templates/rhel-7.6-ppc64le.virt-install-cmd +++ /dev/null @@ -1,21 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.6-ppc64le' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-3tcaiqoy' \ - '--ram=4096' \ - '--arch=ppc64le' \ - '--machine=pseries' \ - '--cpu=power8' \ - '--vcpus=1' \ - '--os-variant=rhel7.5' \ - '--initrd-inject=rhel-7.6-ppc64le.ks' \ - '--extra-args=ks=file:/rhel-7.6-ppc64le.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-3tcaiqoy.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/RHEL-7/7.6/Server/ppc64le/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.6.ks b/builder/templates/rhel-7.6.ks deleted file mode 100644 index e24e16438..000000000 --- a/builder/templates/rhel-7.6.ks +++ /dev/null @@ -1,31 +0,0 @@ -# Kickstart file for rhel-7.6 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -%end - -# EOF diff --git a/builder/templates/rhel-7.6.virt-install-cmd b/builder/templates/rhel-7.6.virt-install-cmd deleted file mode 100644 index 0abda2e6f..000000000 --- a/builder/templates/rhel-7.6.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.6' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-yjh8pgb0' \ - '--ram=2048' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel7.5' \ - '--initrd-inject=rhel-7.6.ks' \ - '--extra-args=ks=file:/rhel-7.6.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-yjh8pgb0.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/RHEL-7/7.6/Server/x86_64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.7.ks b/builder/templates/rhel-7.7.ks deleted file mode 100644 index 2e261ffbe..000000000 --- a/builder/templates/rhel-7.7.ks +++ /dev/null @@ -1,31 +0,0 @@ -# Kickstart file for rhel-7.7 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -%end - -# EOF diff --git a/builder/templates/rhel-7.7.virt-install-cmd b/builder/templates/rhel-7.7.virt-install-cmd deleted file mode 100644 index 06ff4a9bf..000000000 --- a/builder/templates/rhel-7.7.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.7' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-dqmdvual' \ - '--ram=2048' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel7.5' \ - '--initrd-inject=rhel-7.7.ks' \ - '--extra-args=ks=file:/rhel-7.7.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-dqmdvual.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/RHEL-7/7.7/Server/x86_64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.8.ks b/builder/templates/rhel-7.8.ks deleted file mode 100644 index 6aa710310..000000000 --- a/builder/templates/rhel-7.8.ks +++ /dev/null @@ -1,32 +0,0 @@ -# Kickstart file for rhel-7.8 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -%end - -# EOF diff --git a/builder/templates/rhel-7.8.virt-install-cmd b/builder/templates/rhel-7.8.virt-install-cmd deleted file mode 100644 index e8985d3a4..000000000 --- a/builder/templates/rhel-7.8.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.8' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-va1dntak' \ - '--ram=4096' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel7.5' \ - '--initrd-inject=rhel-7.8.ks' \ - '--extra-args=ks=file:/rhel-7.8.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-va1dntak.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/rhel-6-7-8/rhel-7/RHEL-7/7.8/Server/x86_64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-7.9.ks b/builder/templates/rhel-7.9.ks deleted file mode 100644 index eeb963394..000000000 --- a/builder/templates/rhel-7.9.ks +++ /dev/null @@ -1,32 +0,0 @@ -# Kickstart file for rhel-7.9 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -%post -%end - -# EOF diff --git a/builder/templates/rhel-7.9.virt-install-cmd b/builder/templates/rhel-7.9.virt-install-cmd deleted file mode 100644 index f720c2a08..000000000 --- a/builder/templates/rhel-7.9.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-7.9' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-pz9um7nm' \ - '--ram=4096' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel7.5' \ - '--initrd-inject=rhel-7.9.ks' \ - '--extra-args=ks=file:/rhel-7.9.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-pz9um7nm.img,size=6,format=raw' \ - '--location=http://download.devel.redhat.com/released/rhel-6-7-8/rhel-7/RHEL-7/7.9/Server/x86_64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-8.0.ks b/builder/templates/rhel-8.0.ks deleted file mode 100644 index 16ff99cc4..000000000 --- a/builder/templates/rhel-8.0.ks +++ /dev/null @@ -1,28 +0,0 @@ -# Kickstart file for rhel-8.0 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/rhel-8.0.virt-install-cmd b/builder/templates/rhel-8.0.virt-install-cmd deleted file mode 100644 index 9a2392498..000000000 --- a/builder/templates/rhel-8.0.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-8.0' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-ea74up2j' \ - '--ram=2048' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel8.0' \ - '--initrd-inject=rhel-8.0.ks' \ - '--extra-args=ks=file:/rhel-8.0.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-ea74up2j.img,size=6,format=raw' \ - '--location=http://download.eng.bos.redhat.com/released/RHEL-8/8.0.0/BaseOS/x86_64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-8.1.ks b/builder/templates/rhel-8.1.ks deleted file mode 100644 index e51f2cc85..000000000 --- a/builder/templates/rhel-8.1.ks +++ /dev/null @@ -1,29 +0,0 @@ -# Kickstart file for rhel-8.1 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/rhel-8.1.virt-install-cmd b/builder/templates/rhel-8.1.virt-install-cmd deleted file mode 100644 index 0423bd702..000000000 --- a/builder/templates/rhel-8.1.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-8.1' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-c58utbt5' \ - '--ram=4096' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel8.0' \ - '--initrd-inject=rhel-8.1.ks' \ - '--extra-args=ks=file:/rhel-8.1.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-c58utbt5.img,size=6,format=raw' \ - '--location=http://download.eng.bos.redhat.com/released/RHEL-8/8.1.0/BaseOS/x86_64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/rhel-8.2.ks b/builder/templates/rhel-8.2.ks deleted file mode 100644 index c6f18e937..000000000 --- a/builder/templates/rhel-8.2.ks +++ /dev/null @@ -1,29 +0,0 @@ -# Kickstart file for rhel-8.2 -# Generated by libguestfs.git/builder/templates/make-template.ml - -install -text -reboot -lang en_US.UTF-8 -keyboard us -network --bootproto dhcp -rootpw builder -firewall --enabled --ssh -timezone --utc America/New_York -selinux --enforcing - -bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" - - -zerombr -clearpart --all --initlabel --disklabel=gpt -autopart --type=plain - -# Halt the system once configuration has finished. -poweroff - -%packages -@core -%end - -# EOF diff --git a/builder/templates/rhel-8.2.virt-install-cmd b/builder/templates/rhel-8.2.virt-install-cmd deleted file mode 100644 index e1a15d76b..000000000 --- a/builder/templates/rhel-8.2.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'rhel-8.2' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-97b48a0f' \ - '--ram=4096' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=rhel8.0' \ - '--initrd-inject=rhel-8.2.ks' \ - '--extra-args=ks=file:/rhel-8.2.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-97b48a0f.img,size=6,format=raw' \ - '--location=http://download.eng.bos.redhat.com/released/rhel-6-7-8/rhel-8/RHEL-8/8.2.0/BaseOS/x86_64/os' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/scientificlinux-6.index-fragment b/builder/templates/scientificlinux-6.index-fragment deleted file mode 100644 index 25579c798..000000000 --- a/builder/templates/scientificlinux-6.index-fragment +++ /dev/null @@ -1,23 +0,0 @@ -[scientificlinux-6] -name=Scientific Linux 6.5 -osinfo=centos6.5 -arch=x86_64 -file=scientificlinux-6.xz -revision=5 -checksum=be42b0e97d256ab5476079fe71411bebf59abe9c6ff4a7d27330aa5383fac9507472c06d11ef061d3c0e6695bec5ac9cfb7fbfd86fdbb5649e5cb535e2ac5b88 -format=raw -size=6442450944 -compressed_size=191667880 -expand=/dev/sda3 -notes=Scientific Linux 6.5 - - This Scientific Linux image contains only unmodified @Core group packages. - - It is thus very minimal. The kickstart and install script can be - found in the libguestfs source tree: - - builder/website/scientificlinux.sh - - Note that ‘virt-builder scientificlinux-6’ will always install the - latest 6.x release. - diff --git a/builder/templates/ubuntu-10.04.index-fragment b/builder/templates/ubuntu-10.04.index-fragment deleted file mode 100644 index f3602614e..000000000 --- a/builder/templates/ubuntu-10.04.index-fragment +++ /dev/null @@ -1,25 +0,0 @@ -[ubuntu-10.04] -name=Ubuntu 10.04 (Lucid) -osinfo=ubuntulucid -arch=x86_64 -file=ubuntu-10.04.xz -checksum=9e322782bc77c740ce956d57d0d89ec9ac9f2b890c474ac937f400db848df3e164683eaf4631b989f8b4771f64e0c0972452d1555a15c65714b5ceefb295fb7e -format=raw -size=4294967296 -compressed_size=149728112 -expand=/dev/sda1 -notes=Ubuntu 10.04 (Lucid). - - This is a minimal Ubuntu 10.04 (Lucid) install. - - Only the openssh-server package is selected in tasksel. - The preseed and virt-install scripts that produced this image - can be found in the libguestfs source tree: - - builder/website/ubuntu.preseed - builder/website/ubuntu.sh - - This image does not contain SSH host keys. To regenerate them use: - - --firstboot-command "dpkg-reconfigure openssh-server" - diff --git a/builder/templates/ubuntu-12.04.index-fragment b/builder/templates/ubuntu-12.04.index-fragment deleted file mode 100644 index 23ee7b83b..000000000 --- a/builder/templates/ubuntu-12.04.index-fragment +++ /dev/null @@ -1,25 +0,0 @@ -[ubuntu-12.04] -name=Ubuntu 12.04 (Precise) -osinfo=ubuntuprecise -arch=x86_64 -file=ubuntu-12.04.xz -checksum=15eab4610a44bf28423c08982cec47f6c3d43f29834791440249916ed76cc2dfeaf0405fddc8627086257bbbdaa4016c8982ad9b269f57f8f625b0e70d09e4e0 -format=raw -size=4294967296 -compressed_size=168593316 -expand=/dev/sda1 -notes=Ubuntu 12.04 (Precise). - - This is a minimal Ubuntu 12.04 (Precise) install. - - Only the openssh-server package is selected in tasksel. - The preseed and virt-install scripts that produced this image - can be found in the libguestfs source tree: - - builder/website/ubuntu.preseed - builder/website/ubuntu.sh - - This image does not contain SSH host keys. To regenerate them use: - - --firstboot-command "dpkg-reconfigure openssh-server" - diff --git a/builder/templates/ubuntu-14.04.index-fragment b/builder/templates/ubuntu-14.04.index-fragment deleted file mode 100644 index 7cf3b98e1..000000000 --- a/builder/templates/ubuntu-14.04.index-fragment +++ /dev/null @@ -1,31 +0,0 @@ -[ubuntu-14.04] -name=Ubuntu 14.04 (Trusty) -osinfo=ubuntutrusty -arch=x86_64 -file=ubuntu-14.04.xz -checksum=dbc5505c7cfbfb48275b09e91f781dfd7f8d521db577f0c31e0a70b13fbd18c8bcec97b1e274b28062ebc3aba70d68e64c84b9c9690ff7dfca9e81f813047e8a -format=raw -size=4294967296 -compressed_size=206250764 -expand=/dev/sda1 -notes=Ubuntu 14.04 (Trusty). - - This is a minimal Ubuntu 14.04 (Trusty) install. - - Only the openssh-server package is selected in tasksel. - The preseed and virt-install scripts that produced this image - can be found in the libguestfs source tree: - - builder/website/ubuntu.preseed - builder/website/ubuntu.sh - - This image does not contain SSH host keys. To regenerate them use: - - --firstboot-command "dpkg-reconfigure openssh-server" - - IMPORTANT NOTE: It seems to be impossible to create an Ubuntu >= 14.04 - image using preseed without creating a user account. Therefore this - image contains a user account 'builder'. I have disabled it, so that - people who don't read release notes don't get caught out, but you might - still wish to delete it completely. - diff --git a/builder/templates/ubuntu-16.04.index-fragment b/builder/templates/ubuntu-16.04.index-fragment deleted file mode 100644 index 8c8596326..000000000 --- a/builder/templates/ubuntu-16.04.index-fragment +++ /dev/null @@ -1,38 +0,0 @@ -[ubuntu-16.04] -name=Ubuntu 16.04 (Xenial) -osinfo=ubuntuxenial -arch=x86_64 -file=ubuntu-16.04.xz -checksum=56f9f7621fc5f60a01d0c2471fcddaa449979871aeaacb4d936b733f031dd40bb3c29fe73f8636dcaceb6c1413ebb1feff7381f1b24695e9750d106e243884d1 -format=raw -size=4294967296 -compressed_size=232828552 -expand=/dev/sda1 -notes=Ubuntu 16.04 (Xenial). - - This is a minimal Ubuntu 16.04 (Xenial) install. - - Only the openssh-server package is selected in tasksel. - The preseed and virt-install scripts that produced this image - can be found in the libguestfs source tree: - - builder/website/ubuntu.preseed - builder/website/ubuntu.sh - - This image does not contain SSH host keys. To regenerate them use: - - --firstboot-command "dpkg-reconfigure openssh-server" - - The serial console is not working in this image (apparently a bug - in Ubuntu). To enable it, do: - - --edit '/etc/default/grub: - s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"/' \ - --run-command update-grub - - IMPORTANT NOTE: It seems to be impossible to create an Ubuntu >= 14.04 - image using preseed without creating a user account. Therefore this - image contains a user account 'builder'. I have disabled it, so that - people who don't read release notes don't get caught out, but you might - still wish to delete it completely. - diff --git a/builder/templates/ubuntu-18.04.index-fragment b/builder/templates/ubuntu-18.04.index-fragment deleted file mode 100644 index 7776f1a2d..000000000 --- a/builder/templates/ubuntu-18.04.index-fragment +++ /dev/null @@ -1,31 +0,0 @@ -[ubuntu-18.04] -name=Ubuntu 18.04 (bionic) -osinfo=ubuntu18.04 -arch=x86_64 -file=ubuntu-18.04.xz -revision=2 -checksum[sha512]=9de38f7c7abecf7f7a4e4e9e4373cd08ff8860a9ea7eedfd7bb2f00ed16b2c915357c8d40737470c84dbe7f3b0773f37cfc29d6c3e9aa9d1e0e1408cd1174478 -format=raw -size=6442450944 -compressed_size=303775568 -expand=/dev/sda1 -notes=Ubuntu 18.04 (bionic) - - This is a minimal Ubuntu install. - - IMPORTANT WARNING: - It seems to be impossible to create an Ubuntu >= 14.04 image using - preseed without creating a user account. Therefore this image - contains a user account 'builder'. I have disabled it, so that - people who don't read release notes don't get caught out, but you - might still wish to delete it completely. - - This image does not contain SSH host keys. To regenerate them use: - - --firstboot-command "dpkg-reconfigure openssh-server" - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/ubuntu-18.04.virt-install-cmd b/builder/templates/ubuntu-18.04.virt-install-cmd deleted file mode 100644 index f677fe135..000000000 --- a/builder/templates/ubuntu-18.04.virt-install-cmd +++ /dev/null @@ -1,19 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'ubuntu-18.04' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-msgb0g0m' \ - '--ram=2048' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=ubuntu17.04' \ - '--initrd-inject=/tmp/65iqip61.tmp/preseed.cfg' \ - '--extra-args=auto mirror/http/proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-msgb0g0m.img,size=6,format=raw' \ - '--location=http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/ubuntu-20.04.index-fragment b/builder/templates/ubuntu-20.04.index-fragment deleted file mode 100644 index 6c57b33d7..000000000 --- a/builder/templates/ubuntu-20.04.index-fragment +++ /dev/null @@ -1,30 +0,0 @@ -[ubuntu-20.04] -name=Ubuntu 20.04 (focal) -osinfo=ubuntu20.04 -arch=x86_64 -file=ubuntu-20.04.xz -checksum[sha512]=afa81516eb8388df6b96e2e45675fef894da10c1c6e28b24c2eb81b3e1f03878710f18c8bb0769fe2975f1cf0adc5601afa69fda020a402fb66ca712ac79ef89 -format=raw -size=6442450944 -compressed_size=351849464 -expand=/dev/sda5 -notes=Ubuntu 20.04 (focal) - - This is a minimal Ubuntu install. - - IMPORTANT WARNING: - It seems to be impossible to create an Ubuntu >= 14.04 image using - preseed without creating a user account. Therefore this image - contains a user account 'builder'. I have disabled it, so that - people who don't read release notes don't get caught out, but you - might still wish to delete it completely. - - This image does not contain SSH host keys. To regenerate them use: - - --firstboot-command "dpkg-reconfigure openssh-server" - - This template was generated by a script in the libguestfs source tree: - builder/templates/make-template.ml - Associated files used to prepare this template can be found in the - same directory. - diff --git a/builder/templates/ubuntu-20.04.virt-install-cmd b/builder/templates/ubuntu-20.04.virt-install-cmd deleted file mode 100644 index eb11e8b76..000000000 --- a/builder/templates/ubuntu-20.04.virt-install-cmd +++ /dev/null @@ -1,20 +0,0 @@ -# This is the virt-install command which was used to create -# the virt-builder template 'ubuntu-20.04' -# NB: This file is generated for documentation purposes ONLY! -# This script was never run, and is not intended to be run. - -'virt-install' \ - '--transient' \ - '--name=tmp-9v0642sj' \ - '--ram=4096' \ - '--arch=x86_64' \ - '--cpu=host' \ - '--vcpus=4' \ - '--os-variant=ubuntu19.10' \ - '--initrd-inject=/tmp/0h0s8yc8.tmp/preseed.cfg' \ - '--extra-args=auto console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ - '--disk=/home/rjones/d/libguestfs/builder/templates/tmp-9v0642sj.img,size=6,format=raw' \ - '--location=http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64' \ - '--serial=pty' \ - '--nographics' - diff --git a/builder/templates/ubuntu.preseed b/builder/templates/ubuntu.preseed deleted file mode 100644 index 595d897a6..000000000 --- a/builder/templates/ubuntu.preseed +++ /dev/null @@ -1,381 +0,0 @@ -#### Contents of the preconfiguration file (for &releasename;) -### Localization -# Locale sets language and country. -d-i debian-installer/locale string en_US - -# Keyboard selection. -# Disable automatic (interactive) keymap detection. -d-i console-setup/ask_detect boolean false -#d-i console-setup/modelcode string pc105 -d-i console-setup/layoutcode string us -# To select a variant of the selected layout (if you leave this out, the -# basic form of the layout will be used): -#d-i console-setup/variantcode string dvorak - -### Network configuration -# netcfg will choose an interface that has link if possible. This makes it -# skip displaying a list if there is more than one interface. -d-i netcfg/choose_interface select auto - -# To pick a particular interface instead: -#d-i netcfg/choose_interface select eth1 - -# If you have a slow dhcp server and the installer times out waiting for -# it, this might be useful. -#d-i netcfg/dhcp_timeout string 60 - -# If you prefer to configure the network manually, uncomment this line and -# the static network configuration below. -#d-i netcfg/disable_dhcp boolean true - -# If you want the preconfiguration file to work on systems both with and -# without a dhcp server, uncomment these lines and the static network -# configuration below. -#d-i netcfg/dhcp_failed note -#d-i netcfg/dhcp_options select Configure network manually - -# Static network configuration. -#d-i netcfg/get_nameservers string 192.168.1.1 -#d-i netcfg/get_ipaddress string 192.168.1.42 -#d-i netcfg/get_netmask string 255.255.255.0 -#d-i netcfg/get_gateway string 192.168.1.1 -#d-i netcfg/confirm_static boolean true - -# Any hostname and domain names assigned from dhcp take precedence over -# values set here. However, setting the values still prevents the questions -# from being shown, even if values come from dhcp. -d-i netcfg/get_hostname string unassigned-hostname -d-i netcfg/get_domain string unassigned-domain - -# If you want to force a hostname, regardless of what either the DHCP -# server returns or what the reverse DNS entry for the IP is, uncomment -# and adjust the following line. -d-i netcfg/hostname string unassigned-hostname.unassigned-domain - -# Disable that annoying WEP key dialog. -d-i netcfg/wireless_wep string -# The wacky dhcp hostname that some ISPs use as a password of sorts. -#d-i netcfg/dhcp_hostname string radish - -# If non-free firmware is needed for the network or other hardware, you can -# configure the installer to always try to load it, without prompting. Or -# change to false to disable asking. -#d-i hw-detect/load_firmware boolean true - -### Mirror settings -# If you select ftp, the mirror/country string does not need to be set. -#d-i mirror/protocol string ftp -#d-i mirror/country string manual -#d-i mirror/http/hostname string http.us.debian.org -#d-i mirror/http/directory string /ubuntu -#d-i mirror/http/proxy string - -# Alternatively: by default, the installer uses CC.archive.ubuntu.com where -# CC is the ISO-3166-2 code for the selected country. You can preseed this -# so that it does so without asking. -d-i mirror/http/mirror select uk.archive.ubuntu.com - -# Suite to install. -#d-i mirror/suite string &releasename; -# Suite to use for loading installer components (optional). -#d-i mirror/udeb/suite string &releasename; -# Components to use for loading installer components (optional). -#d-i mirror/udeb/components multiselect main, restricted - -### Clock and time zone setup -# Controls whether or not the hardware clock is set to UTC. -d-i clock-setup/utc boolean true - -# You may set this to any valid setting for $TZ; see the contents of -# /usr/share/zoneinfo/ for valid values. -d-i time/zone string US/Eastern - -# Controls whether to use NTP to set the clock during the install -d-i clock-setup/ntp boolean true -# NTP server to use. The default is almost always fine here. -#d-i clock-setup/ntp-server string ntp.example.com - -### Partitioning -# If the system has free space you can choose to only partition that space. -# Alternatives: custom, some_device, some_device_crypto, some_device_lvm. -#d-i partman-auto/init_automatically_partition select biggest_free - -# Alternatively, you can specify a disk to partition. The device name must -# be given in traditional non-devfs format. -# Note: A disk must be specified, unless the system has only one disk. -# For example, to use the first SCSI/SATA hard disk: -#d-i partman-auto/disk string /dev/sda -# In addition, you'll need to specify the method to use. -# The presently available methods are: "regular", "lvm" and "crypto" -d-i partman-auto/method string regular - -# If one of the disks that are going to be automatically partitioned -# contains an old LVM configuration, the user will normally receive a -# warning. This can be preseeded away... -d-i partman-lvm/device_remove_lvm boolean true -# The same applies to pre-existing software RAID array: -d-i partman-md/device_remove_md boolean true -# And the same goes for the confirmation to write the lvm partitions. -d-i partman-lvm/confirm boolean true - -# For LVM partitioning, you can select how much of the volume group to use -# for logical volumes. -#d-i partman-auto-lvm/guided_size string max -#d-i partman-auto-lvm/guided_size string 10GB -#d-i partman-auto-lvm/guided_size string 50% - -# You can choose one of the three predefined partitioning recipes: -# - atomic: all files in one partition -# - home: separate /home partition -# - multi: separate /home, /usr, /var, and /tmp partitions -d-i partman-auto/choose_recipe select atomic - -# Or provide a recipe of your own... -# The recipe format is documented in the file devel/partman-auto-recipe.txt. -# If you have a way to get a recipe file into the d-i environment, you can -# just point at it. -#d-i partman-auto/expert_recipe_file string /hd-media/recipe - -# If not, you can put an entire recipe into the preconfiguration file in one -# (logical) line. This example creates a small /boot partition, suitable -# swap, and uses the rest of the space for the root partition: -#d-i partman-auto/expert_recipe string \ -# boot-root :: \ -# 40 50 100 ext3 \ -# $primary{ } $bootable{ } \ -# method{ format } format{ } \ -# use_filesystem{ } filesystem{ ext3 } \ -# mountpoint{ /boot } \ -# . \ -# 500 10000 1000000000 ext3 \ -# method{ format } format{ } \ -# use_filesystem{ } filesystem{ ext3 } \ -# mountpoint{ / } \ -# . \ -# 64 512 300% linux-swap \ -# method{ swap } format{ } \ -# . - -# If you just want to change the default filesystem from ext3 to something -# else, you can do that without providing a full recipe. -#d-i partman/default_filesystem string ext4 - -# This makes partman automatically partition without confirmation, provided -# that you told it what to do using one of the methods above. -d-i partman/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - -### Controlling how partitions are mounted -# The default is to mount by UUID, but you can also choose "traditional" to -# use traditional device names, or "label" to try filesystem labels before -# falling back to UUIDs. -#d-i partman/mount_style select uuid - -### Base system installation -# The kernel image (meta) package to be installed; "none" can be used if no -# kernel is to be installed. -#d-i base-installer/kernel/image string linux-generic - -### Account setup -# Skip creation of a root account (normal user account will be able to -# use sudo). The default is false; preseed this to true if you want to set -# a root password. -#d-i passwd/root-login boolean false -# Alternatively, to skip creation of a normal user account. -d-i passwd/make-user boolean false - -# Root password, either in clear text -d-i passwd/root-password password builder -d-i passwd/root-password-again password builder -# or encrypted using an MD5 hash. -#d-i passwd/root-password-crypted password [MD5 hash] - -# To create a normal user account. -#d-i passwd/user-fullname string Ubuntu User -#d-i passwd/username string ubuntu -# Normal user's password, either in clear text -#d-i passwd/user-password password insecure -#d-i passwd/user-password-again password insecure -# or encrypted using an MD5 hash. -#d-i passwd/user-password-crypted password [MD5 hash] -# Create the first user with the specified UID instead of the default. -#d-i passwd/user-uid string 1010 -# The installer will warn about weak passwords. If you are sure you know -# what you're doing and want to override it, uncomment this. -#d-i user-setup/allow-password-weak boolean true - -# The user account will be added to some standard initial groups. To -# override that, use this. -#d-i passwd/user-default-groups string audio cdrom video - -# Set to true if you want to encrypt the first user's home directory. -d-i user-setup/encrypt-home boolean false - -### Apt setup -# You can choose to install restricted and universe software, or to install -# software from the backports repository. -#d-i apt-setup/restricted boolean true -#d-i apt-setup/universe boolean true -#d-i apt-setup/backports boolean true -# Uncomment this if you don't want to use a network mirror. -#d-i apt-setup/use_mirror boolean false -# Select which update services to use; define the mirrors to be used. -# Values shown below are the normal defaults. -#d-i apt-setup/services-select multiselect security -#d-i apt-setup/security_host string security.ubuntu.com -#d-i apt-setup/security_path string /ubuntu - -# Additional repositories, local[0-9] available -#d-i apt-setup/local0/repository string \ -# http://local.server/ubuntu &releasename; main -#d-i apt-setup/local0/comment string local server -# Enable deb-src lines -#d-i apt-setup/local0/source boolean true -# URL to the public key of the local repository; you must provide a key or -# apt will complain about the unauthenticated repository and so the -# sources.list line will be left commented out -#d-i apt-setup/local0/key string http://local.server/key - -# By default the installer requires that repositories be authenticated -# using a known gpg key. This setting can be used to disable that -# authentication. Warning: Insecure, not recommended. -#d-i debian-installer/allow_unauthenticated string true - -### Package selection -#tasksel tasksel/first multiselect ubuntu-desktop -#tasksel tasksel/first multiselect lamp-server, print-server -#tasksel tasksel/first multiselect kubuntu-desktop -tasksel tasksel/first multiselect openssh-server - -# Individual additional packages to install -#d-i pkgsel/include string openssh-server build-essential -# Whether to upgrade packages after debootstrap. -# Allowed values: none, safe-upgrade, full-upgrade -#d-i pkgsel/upgrade select none - -# Language pack selection -#d-i pkgsel/language-packs multiselect de, en, zh - -# Policy for applying updates. May be "none" (no automatic updates), -# "unattended-upgrades" (install security updates automatically), or -# "landscape" (manage system with Landscape). -#d-i pkgsel/update-policy select none - -# Some versions of the installer can report back on what software you have -# installed, and what software you use. The default is not to report back, -# but sending reports helps the project determine what software is most -# popular and include it on CDs. -#popularity-contest popularity-contest/participate boolean false - -# By default, the system's locate database will be updated after the -# installer has finished installing most packages. This may take a while, so -# if you don't want it, you can set this to "false" to turn it off. -#d-i pkgsel/updatedb boolean true - -### Boot loader installation -# Grub is the default boot loader (for x86). If you want lilo installed -# instead, uncomment this: -#d-i grub-installer/skip boolean true -# To also skip installing lilo, and install no bootloader, uncomment this -# too: -#d-i lilo-installer/skip boolean true - -# This is fairly safe to set, it makes grub install automatically to the MBR -# if no other operating system is detected on the machine. -d-i grub-installer/only_debian boolean true - -# This one makes grub-installer install to the MBR if it also finds some other -# OS, which is less safe as it might not be able to boot that other OS. -d-i grub-installer/with_other_os boolean true - -# Alternatively, if you want to install to a location other than the mbr, -# uncomment and edit these lines: -#d-i grub-installer/only_debian boolean false -#d-i grub-installer/with_other_os boolean false -#d-i grub-installer/bootdev string (hd0,0) -# To install grub to multiple disks: -#d-i grub-installer/bootdev string (hd0,0) (hd1,0) (hd2,0) - -# Optional password for grub, either in clear text -#d-i grub-installer/password password r00tme -#d-i grub-installer/password-again password r00tme -# or encrypted using an MD5 hash, see grub-md5-crypt(8). -#d-i grub-installer/password-crypted password [MD5 hash] - -### Finishing up the installation -# During installations from serial console, the regular virtual consoles -# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next -# line to prevent this. -#d-i finish-install/keep-consoles boolean true - -# Avoid that last message about the install being complete. -d-i finish-install/reboot_in_progress note - -# This will prevent the installer from ejecting the CD during the reboot, -# which is useful in some situations. -#d-i cdrom-detect/eject boolean false - -# This is how to make the installer shutdown when finished, but not -# reboot into the installed system. -#d-i debian-installer/exit/halt boolean true -# This will power off the machine instead of just halting it. -#d-i debian-installer/exit/poweroff boolean true - -### X configuration -# X can detect the right driver for some cards, but if you're preseeding, -# you override whatever it chooses. Still, vesa will work most places. -#xserver-xorg xserver-xorg/config/device/driver select vesa - -# A caveat with mouse autodetection is that if it fails, X will retry it -# over and over. So if it's preseeded to be done, there is a possibility of -# an infinite loop if the mouse is not autodetected. -#xserver-xorg xserver-xorg/autodetect_mouse boolean true - -# Monitor autodetection is recommended. -xserver-xorg xserver-xorg/autodetect_monitor boolean true -# Uncomment if you have an LCD display. -#xserver-xorg xserver-xorg/config/monitor/lcd boolean true -# X has three configuration paths for the monitor. Here's how to preseed -# the "medium" path, which is always available. The "simple" path may not -# be available, and the "advanced" path asks too many questions. -xserver-xorg xserver-xorg/config/monitor/selection-method \ - select medium -xserver-xorg xserver-xorg/config/monitor/mode-list \ - select 1024x768 @ 60 Hz - -### Preseeding other packages -# Depending on what software you choose to install, or if things go wrong -# during the installation process, it's possible that other questions may -# be asked. You can preseed those too, of course. To get a list of every -# possible question that could be asked during an install, do an -# installation, and then run these commands: -# debconf-get-selections --installer > file -# debconf-get-selections >> file - - -#### Advanced options -### Running custom commands during the installation -# d-i preseeding is inherently not secure. Nothing in the installer checks -# for attempts at buffer overflows or other exploits of the values of a -# preconfiguration file like this one. Only use preconfiguration files from -# trusted locations! To drive that home, and because it's generally useful, -# here's a way to run any shell command you'd like inside the installer, -# automatically. - -# This first command is run as early as possible, just after -# preseeding is read. -#d-i preseed/early_command string anna-install some-udeb - -# This command is run immediately before the partitioner starts. It may be -# useful to apply dynamic partitioner preseeding that depends on the state -# of the disks (which may not be visible when preseed/early_command runs). -#d-i partman/early_command string debconf-set partman-auto/disk "$(list-devices disk | head -n1)" - -# This command is run just before the install finishes, but when there is -# still a usable /target directory. You can chroot to /target and use it -# directly, or use the apt-install and in-target commands to easily install -# packages and run commands in the target system. -#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh - diff --git a/builder/templates/validate.sh b/builder/templates/validate.sh deleted file mode 100755 index 59b9b64ff..000000000 --- a/builder/templates/validate.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# libguestfs virt-builder validate index -# Copyright (C) 2013-2020 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. - -export LANG=C -set -e - -fn=test-filename-for-index-validate - -rm -f $fn -touch $fn - -$VG virt-index-validate "$top_srcdir/website/download/builder/index" -$VG virt-index-validate "$top_srcdir/website/download/builder/index.asc" -$VG virt-index-validate $fn - -rm $fn diff --git a/builder/test-config/virt-builder/repos.d/test-index.conf.in b/builder/test-config/virt-builder/repos.d/test-index.conf.in deleted file mode 100644 index 22e03c455..000000000 --- a/builder/test-config/virt-builder/repos.d/test-index.conf.in +++ /dev/null @@ -1,2 +0,0 @@ -[test-index] -uri=file://@abs_top_builddir@/builder/test-index diff --git a/builder/test-console.sh b/builder/test-console.sh deleted file mode 100755 index 8ef026c82..000000000 --- a/builder/test-console.sh +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/bash - -# Test serial console is present in templates. -# Copyright (C) 2016 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. - -# This slow test checks that the serial console works. -# -# NB. 'test-console.sh' runs the tests, but the various tests are -# run via the 'test-console-GUESTNAME.sh' wrappers. -# -# The script currently assumes a Linux guest. We should test Windows, -# FreeBSD in future (XXX). - -set -e - -$TEST_FUNCTIONS -slow_test -skip_if_skipped "$script" - -guestname="$1" -if [ -z "$guestname" ]; then - echo "$script: guestname parameter not set, don't run this test directly." - exit 1 -fi - -# If the guest doesn't exist in virt-builder, skip. This is because -# we test some RHEL guests which most users won't have access to. -skip_unless_virt_builder_guest "$guestname" - -# We can only run the tests on x86_64. -skip_unless_arch x86_64 - -# Check qemu is installed. -qemu=qemu-system-x86_64 -skip_unless $qemu -help - -# Some guests need special virt-builder parameters. -# See virt-builder --notes "$guestname" -declare -a extra -case "$guestname" in - debian-7) - extra[${#extra[*]}]='--edit' - extra[${#extra[*]}]='/etc/inittab: - s,^#([1-9].*respawn.*/sbin/getty.*),$1,' - ;; - debian-8|ubuntu-16.04|ubuntu-18.04) - # These commands are required to fix the serial console. - # See https://askubuntu.com/questions/763908/ubuntu-16-04-has-no-vmware-console-access-once-booted-on-vmware-vsphere-5-5-clus/764476#764476 - extra[${#extra[*]}]='--edit' - extra[${#extra[*]}]='/etc/default/grub: - s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"/' - extra[${#extra[*]}]='--run-command' - extra[${#extra[*]}]='update-grub' - ;; - *) - ;; -esac - -disk="console-$guestname.img" -rm -f "$disk" - -# Build a guest (using virt-builder). -virt-builder "$guestname" \ - --quiet \ - -o "$disk" \ - "${extra[@]}" - -out="console-$guestname.out" -rm -f "$out" - -# Boot the guest in qemu with a serial console. Allow it to run -# for a set amount of time, and then kill it. -$qemu \ - -no-user-config \ - -display none \ - -machine accel=kvm:tcg \ - -m 1024 \ - -boot c \ - -drive file="$disk",format=raw,if=ide \ - -serial stdio > "$out" & -pid=$! -sleep 180 -kill -9 $pid - -# Did we see console output? -err () -{ - set +e - echo "$script: didn't see $1 in serial console output" - echo "$script: full output from the serial console below" - echo - cat "$out" - exit 1 -} - -grub_rex="(highlighted|selected) entry will be (started|executed) automatically" - -case "$guestname" in - centos-7.*|rhel-7.*) - grep -Esq "$grub_rex" "$out" || - err "GRUB messages" - grep -Esq "Linux version [0-9]" "$out" || err "Linux kernel messages" - grep -sq "Reached target Basic System" "$out" || err "systemd messages" - grep -sq "^Kernel [0-9]" "$out" || err "login banner" - grep -sq "login:" "$out" || err "login prompt" - ;; - debian-*) - grep -Esq "$grub_rex" "$out" || - err "GRUB messages" - # Debian boots with 'quiet' so no kernel messages seen. - grep -sq "^Debian GNU/Linux" "$out" || err "login banner" - grep -sq "login:" "$out" || err "login prompt" - ;; - fedora-*) - grep -Esq "$grub_rex" "$out" || - err "GRUB messages" - grep -Esq "Linux version [0-9]" "$out" || err "Linux kernel messages" - grep -sq "Reached target Basic System" "$out" || err "systemd messages" - grep -sq "^Kernel.*(ttyS0)" "$out" || err "login banner" - grep -sq "login:" "$out" || err "login prompt" - ;; - ubuntu-*) - # Ubuntu boot is very quiet, but we should see a banner and - # a login prompt at the end. - grep -sq "^Ubuntu" "$out" || err "login banner" - grep -sq "login:" "$out" || err "login prompt" - ;; - *) - # Fall back to only checking we see a login prompt. - grep -sq "login:" "$out" || err "login prompt" - ;; -esac - -rm "$disk" "$out" diff --git a/builder/test-docs.sh b/builder/test-docs.sh deleted file mode 100755 index 95b16961e..000000000 --- a/builder/test-docs.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2016 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. - -set -e - -$TEST_FUNCTIONS -skip_if_skipped - -$top_srcdir/podcheck.pl "$srcdir/virt-builder.pod" virt-builder \ - --insert $top_srcdir/common/mlcustomize/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \ - --insert $top_srcdir/common/mlcustomize/customize-options.pod:__CUSTOMIZE_OPTIONS__ \ - --ignore=--check-signatures,--no-check-signatures - -$srcdir/../podcheck.pl "$srcdir/virt-builder-repository.pod" virt-builder-repository diff --git a/builder/test-index b/builder/test-index deleted file mode 100644 index 3efebc4cd..000000000 --- a/builder/test-index +++ /dev/null @@ -1,66 +0,0 @@ -[phony-debian] -name=Phony Debian -arch=x86_64 -file=debian.xz -format=raw -size=536870912 -expand=/dev/sda2 -lvexpand=/dev/debian/root -notes=Phony Debian look-alike used for testing. - -[phony-fedora] -name=Phony Fedora -arch=x86_64 -file=fedora.xz -format=raw -size=1073741824 -expand=/dev/sda2 -lvexpand=/dev/VG/Root -notes=Phony Fedora look-alike used for testing. - -[phony-fedora-qcow2] -name=Phony Fedora qcow2 -arch=x86_64 -file=fedora.qcow2.xz -format=qcow2 -size=1073741824 -expand=/dev/sda2 -lvexpand=/dev/VG/Root -notes=Phony Fedora look-alike used for testing. - -[phony-fedora-qcow2-uncompressed] -name=Phony Fedora qcow2 uncompressed -arch=x86_64 -file=fedora.qcow2 -format=qcow2 -size=1073741824 -expand=/dev/sda2 -lvexpand=/dev/VG/Root -notes=Phony Fedora look-alike used for testing. - -[phony-fedora-no-format] -name=Phony Fedora -arch=x86_64 -file=fedora.qcow2.xz -size=1073741824 -expand=/dev/sda2 -lvexpand=/dev/VG/Root -notes=Phony Fedora look-alike used for testing. - -[phony-ubuntu] -name=Phony Ubuntu -arch=x86_64 -file=ubuntu.xz -format=raw -size=536870912 -expand=/dev/sda2 -notes=Phony Ubuntu look-alike used for testing. - -[phony-windows] -name=Phony Windows -arch=x86_64 -file=windows.xz -format=raw -size=536870912 -expand=/dev/sda2 -notes=Phony Windows look-alike used for testing. diff --git a/builder/test-simplestreams/streams/v1/index.json b/builder/test-simplestreams/streams/v1/index.json deleted file mode 100644 index 2d241cd39..000000000 --- a/builder/test-simplestreams/streams/v1/index.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "format": "index:1.0", - "updated": "Fri, 08 May 2015 13:20:51 +0000", - "index": { - "net.cirros-cloud:released:download": { - "products": [ - "net.cirros-cloud:standard:0.3:i386", - "net.cirros-cloud:standard:0.3:x86_64", - "net.cirros-cloud:standard:0.3:powerpc", - "net.cirros-cloud:standard:0.3:arm" - ], - "datatype": "image-downloads", - "format": "products:1.0", - "updated": "Fri, 08 May 2015 13:20:51 +0000", - "path": "streams/v1/net.cirros-cloud_released_download.json" - } - } -} diff --git a/builder/test-simplestreams/streams/v1/net.cirros-cloud_released_download.json b/builder/test-simplestreams/streams/v1/net.cirros-cloud_released_download.json deleted file mode 100644 index 0fb57b405..000000000 --- a/builder/test-simplestreams/streams/v1/net.cirros-cloud_released_download.json +++ /dev/null @@ -1,429 +0,0 @@ -{ - "products": { - "net.cirros-cloud:standard:0.3:i386": { - "arch": "i386", - "versions": { - "20140908": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "785c524f55bf2493dcddeedba25172f1", - "sha256": "bc20b950cc20e66e0b915748ad6b1ea2360ec03f08ffe6c68dc1b4a82331ab66", - "size": 3204602, - "path": "0.3.3/cirros-0.3.3-i386-lxc.tar.gz" - }, - "disk.img": { - "ftype": "disk.img", - "md5": "283c77db6fc79b2d47c585ec241e7edc", - "sha256": "837cc3c79de14de62b8691c08a6913b7c0c62427870c7c1921ac43b9580748a9", - "size": 12268032, - "path": "0.3.3/cirros-0.3.3-i386-disk.img" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "861ef94d90ea220ae72b84d258ff5620", - "sha256": "5c7e685d42f0f1c5c70398e8b7388fc21b84dcbb4dc4a37c1c1645fe5c5ed3a4", - "size": 8231317, - "path": "0.3.3/cirros-0.3.3-i386-uec.tar.gz" - } - }, - "version": "0.3.3", - "pubname": "cirros-0.3.3-i386" - }, - "20150422": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "ffe02ef2b49cb34881f96e2b4c69383c", - "sha256": "5760cae9b9701dc09f495c3787f1da271800dcbc040eb793ddf4eb636689148a", - "size": 3210378, - "path": "0.3.4/cirros-0.3.4-i386-lxc.tar.gz" - }, - "disk.img": { - "ftype": "disk.img", - "md5": "79b4436412283bb63c2cba4ac796bcd9", - "sha256": "48c279ff502ea4c5e3e09d58c9e3a2ab615452dae2ed8fe347f68c136c6a5a0b", - "size": 12506112, - "path": "0.3.4/cirros-0.3.4-i386-disk.img" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "c1630b33986cc09df2e0cbca7f5c5346", - "sha256": "f1cad519da6632b1d0ebad2f892534b732b5f9dd54d27f532d2963a0748f246e", - "size": 8241360, - "path": "0.3.4/cirros-0.3.4-i386-uec.tar.gz" - } - }, - "version": "0.3.4", - "pubname": "cirros-0.3.4-i386" - }, - "20140317": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "55023b89a6121b30603859bb80f5c8d3", - "sha256": "136f8dfff85b8d509a0d0a0264aea79ae94d9b7c3ea5745fbd478ae600adeb20", - "size": 3201206, - "path": "0.3.2/cirros-0.3.2-i386-lxc.tar.gz" - }, - "disk.img": { - "ftype": "disk.img", - "md5": "b0a256d40e078d66576f7ae91c296e2b", - "sha256": "f0803c2d179c8a02d029239d35fc3e752cc81ad3436ea52b757e11685ca7c074", - "size": 12336128, - "path": "0.3.2/cirros-0.3.2-i386-disk.img" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "dcbcc559fc3bc468d9149bd7191aaa0c", - "sha256": "74ba8b67e0dce67f16a6bc5942bee90cbe31381f932aac1ba51bbc774aad5046", - "size": 8221995, - "path": "0.3.2/cirros-0.3.2-i386-uec.tar.gz" - } - }, - "version": "0.3.2", - "pubname": "cirros-0.3.2-i386" - }, - "20111020": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "e760bf470841f57c2c1bb426d407d169", - "sha256": "cac7887628527604b65a89e8caa34096d51c2dc1acfe405c15db2fc58495142a", - "size": 1845928, - "path": "0.3.0/cirros-0.3.0-i386-lxc.tar.gz" - }, - "disk.img": { - "ftype": "disk.img", - "md5": "90169ba6f09b5906a7f0755bd00bf2c3", - "sha256": "3309675d0d409128b1c2651d576bc8092ca9ab93e15f3d3aa458f40947569b61", - "size": 9159168, - "path": "0.3.0/cirros-0.3.0-i386-disk.img" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "115ca6afa47089dc083c0dc9f9b7ff03", - "sha256": "b57e0acb32852f89734ff11a511ae0897e8cecb41882d03551649289b6854a1b", - "size": 6596586, - "path": "0.3.0/cirros-0.3.0-i386-uec.tar.gz" - } - }, - "version": "0.3.0", - "pubname": "cirros-0.3.0-i386" - }, - "20130207": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "fc404d9fc9dc5f0eb33ebaa03920a046", - "sha256": "70a8c9c175589f7ac7054c6151cf2bb7eb9e210cefbe310446df2fb1a436b504", - "size": 3191593, - "path": "0.3.1/cirros-0.3.1-i386-lxc.tar.gz" - }, - "disk.img": { - "ftype": "disk.img", - "md5": "6ba617eafc992e33e7c141c679225e53", - "sha256": "b8aa1ce5d11939eaa01205fc31348532a31b82790921d45ceb397fbe76492787", - "size": 12251136, - "path": "0.3.1/cirros-0.3.1-i386-disk.img" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "52845de5142e58faf211e135d2b45721", - "sha256": "88dda2e505b862a95d0e0044013addcaa3200e602150c9d73e32c2e29345d6f3", - "size": 8197543, - "path": "0.3.1/cirros-0.3.1-i386-uec.tar.gz" - } - }, - "version": "0.3.1", - "pubname": "cirros-0.3.1-i386" - } - }, - "stream": "released" - }, - "net.cirros-cloud:standard:0.3:x86_64": { - "arch": "x86_64", - "versions": { - "20140908": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "600363faf89daa6adea87e2dd77263b4", - "sha256": "66255c2f9404484996e646bb825fd2f1fd9d66583fecd3e9e0789376cf055fd4", - "size": 3544884, - "path": "0.3.3/cirros-0.3.3-x86_64-lxc.tar.gz" - }, - "disk.img": { - "ftype": "disk.img", - "md5": "133eae9fb1c98f45894a4e60d8736619", - "sha256": "f11286e2bd317ee1a1d0469a6b182b33bda4af6f35ba224ca49d75752c81e20a", - "size": 13200896, - "path": "0.3.3/cirros-0.3.3-x86_64-disk.img" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "4f3371e52d60e5d47a6fbdd7d6a33973", - "sha256": "6bd27854862c30e25f0312defb9e86f9176b503751f040e323ab83322aa07dae", - "size": 8668951, - "path": "0.3.3/cirros-0.3.3-x86_64-uec.tar.gz" - } - }, - "version": "0.3.3", - "pubname": "cirros-0.3.3-x86_64" - }, - "20150422": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "6554ba2d15401c8caa90212ace985593", - "sha256": "e8172c603fad47f4c95e67bd2751c2977e07164c9ebdfcf3f9c1d7ff598ed217", - "size": 3555536, - "path": "0.3.4/cirros-0.3.4-x86_64-lxc.tar.gz" - }, - "disk.img": { - "ftype": "disk.img", - "md5": "ee1eca47dc88f4879d8a229cc70a07c6", - "sha256": "34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3394", - "size": 13287936, - "path": "0.3.4/cirros-0.3.4-x86_64-disk.img" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "067d511efcc4acd034f7d64b716273bf", - "sha256": "95e77c7deaf0f515f959ffe329918d5dd23e417503d1d45e926a888853c90710", - "size": 8683894, - "path": "0.3.4/cirros-0.3.4-x86_64-uec.tar.gz" - } - }, - "version": "0.3.4", - "pubname": "cirros-0.3.4-x86_64" - }, - "20140317": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "174a08e827f22b20ebd774f90f1c9181", - "sha256": "03eff2a3603164fa02c00ca76fdcbd611b2ae8a6a80406753ec35eb275648d2e", - "size": 3538286, - "path": "0.3.2/cirros-0.3.2-x86_64-lxc.tar.gz" - }, - "disk.img": { - "ftype": "disk.img", - "md5": "64d7c1cd2b6f60c92c14662941cb7913", - "sha256": "a2ca56aeded5a5bcaa6104fb14ec07b1ceb65222e2890bef8a89b8d2da729ad5", - "size": 13167616, - "path": "0.3.2/cirros-0.3.2-x86_64-disk.img" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "b369559e3ffa9208b4eb2224c949f579", - "sha256": "f462729fc2f071081dbc55932e07437e265263ef2e688306c353a1f152162b03", - "size": 8655821, - "path": "0.3.2/cirros-0.3.2-x86_64-uec.tar.gz" - } - }, - "version": "0.3.2", - "pubname": "cirros-0.3.2-x86_64" - }, - "20111020": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "1a480e5150db4d93be2aa3c9ced94fa1", - "sha256": "0e78796a30641dd7184f752c302a87d66f1eba9985c876911e4f26b4d8ba4a88", - "size": 2115217, - "path": "0.3.0/cirros-0.3.0-x86_64-lxc.tar.gz" - }, - "disk.img": { - "ftype": "disk.img", - "md5": "50bdc35edb03a38d91b1b071afb20a3c", - "sha256": "648782e9287288630250d07531fed9944ecc3986764a6664f0bf6c050ec06afd", - "size": 9761280, - "path": "0.3.0/cirros-0.3.0-x86_64-disk.img" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "f56d3cffa47b7d209d2b6905628f07b9", - "sha256": "043a3e090a5d76d23758a3919fcaff93f77ce7b97594d9d10fc8d00e85f83191", - "size": 6957349, - "path": "0.3.0/cirros-0.3.0-x86_64-uec.tar.gz" - } - }, - "version": "0.3.0", - "pubname": "cirros-0.3.0-x86_64" - }, - "20130207": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "38252f1a49fec0ebedebc820854497e0", - "sha256": "a086fcf2758468972d45957dc78ec6317c06f356930dbbc6cad6a8d1855f135e", - "size": 3534564, - "path": "0.3.1/cirros-0.3.1-x86_64-lxc.tar.gz" - }, - "disk.img": { - "ftype": "disk.img", - "md5": "d972013792949d0d3ba628fbe8685bce", - "sha256": "e01302fb2d2b13ae65226a0300335172e4487bbe60bb1e5c8b0843a25f126d34", - "size": 13147648, - "path": "0.3.1/cirros-0.3.1-x86_64-disk.img" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "e1849016cb71a00808093b7bf986f36a", - "sha256": "51eb03b83123a68d4f866c7c15b195204e62db9e33475509a38b79b3122cde38", - "size": 8633554, - "path": "0.3.1/cirros-0.3.1-x86_64-uec.tar.gz" - } - }, - "version": "0.3.1", - "pubname": "cirros-0.3.1-x86_64" - } - }, - "stream": "released" - }, - "net.cirros-cloud:standard:0.3:powerpc": { - "arch": "powerpc", - "versions": { - "20150422": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "7e3a147b5665a1e14fe6d0ffef9ca410", - "sha256": "b1ab58ebb2a3f253d15cfa13f0cd0de883ce6e80f42ce2e3889e880423e95462", - "size": 3603000, - "path": "0.3.4/cirros-0.3.4-powerpc-lxc.tar.gz" - }, - "disk.img": { - "ftype": "disk.img", - "md5": "453b21916c47c6ff8c615f8a5f7b76d2", - "sha256": "5445d77104d19ccdc2dbc943a3d0735c0dadd1227466a3f3e109c19671065f18", - "size": 17145856, - "path": "0.3.4/cirros-0.3.4-powerpc-disk.img" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "2f8a48928a6b0b2c9afbcb7255ff2aec", - "sha256": "80444c3ac8277d87eed0963567206ea5b009ecf4fdbc71fe8c4df020b42e3215", - "size": 12032417, - "path": "0.3.4/cirros-0.3.4-powerpc-uec.tar.gz" - } - } - } - }, - "version": "0.3.4", - "stream": "released", - "pubname": "cirros-0.3.4-powerpc" - }, - "net.cirros-cloud:standard:0.3:arm": { - "arch": "arm", - "versions": { - "20140908": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "7f2fe450d9a0b1688f2a4df6748690f5", - "sha256": "c839db36d5c96651d1dbcfc8a553678b010c7bb49416ac3099282858003fa021", - "size": 3482025, - "path": "0.3.3/cirros-0.3.3-arm-lxc.tar.gz" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "0437419d2371771b7406fade2d6db7d1", - "sha256": "4a0987818f3a834d9907b93729beb79426e58be9d46b3c207241bc4b1ceec52f", - "size": 7351177, - "path": "0.3.3/cirros-0.3.3-arm-uec.tar.gz" - } - }, - "version": "0.3.3", - "pubname": "cirros-0.3.3-arm" - }, - "20150422": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "5fd856d158dc6787264a1b4236126aab", - "sha256": "06c780e8c7166e16154bd0d3a6d1b0031e219269e990c5b8864a82925285486c", - "size": 3489736, - "path": "0.3.4/cirros-0.3.4-arm-lxc.tar.gz" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "1a2aea370f9f2d95d837f6b84bef658d", - "sha256": "6dd3bad904671aee13317c187d933b3efb1ac39a0d81fd5ac9a1fc694e3cb7ff", - "size": 7357906, - "path": "0.3.4/cirros-0.3.4-arm-uec.tar.gz" - } - }, - "version": "0.3.4", - "pubname": "cirros-0.3.4-arm" - }, - "20140317": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "bfb2ecb203cf27f4786b43a558b1ffe8", - "sha256": "a916b3d268793977001e2f09638e4a3e3953cc51d0d53d0bfb8c14cfa7105e86", - "size": 3474403, - "path": "0.3.2/cirros-0.3.2-arm-lxc.tar.gz" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "171719bfd4b3ec613f5fac321e4216de", - "sha256": "7f74826638e153ec58230bae9eb21805f875ed12eab299140f978e45597cb5cd", - "size": 7340357, - "path": "0.3.2/cirros-0.3.2-arm-uec.tar.gz" - } - }, - "version": "0.3.2", - "pubname": "cirros-0.3.2-arm" - }, - "20111020": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "91add49e56cbe6b5004015a4d2f51dbc", - "sha256": "fcd3723c956a1c232730dc28513b466657cbe984232ba2fcc30a4e1f55aa91e9", - "size": 2043822, - "path": "0.3.0/cirros-0.3.0-arm-lxc.tar.gz" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "c31e05f7829ad45f9d9995c35d232769", - "sha256": "b871823406f818430f57744333b1bb17ce0047e551a316f316641f1bd70d9152", - "size": 5761642, - "path": "0.3.0/cirros-0.3.0-arm-uec.tar.gz" - } - }, - "version": "0.3.0", - "pubname": "cirros-0.3.0-arm" - }, - "20130207": { - "items": { - "lxc.tar.gz": { - "ftype": "lxc.tar.gz", - "md5": "7ddea367ecb7ecb91554e18bed7c71bd", - "sha256": "2060e59e642b3b2bdf6e34aba3ed15f468bc6f9a8417fc196d01d29b2075493e", - "size": 3466149, - "path": "0.3.1/cirros-0.3.1-arm-lxc.tar.gz" - }, - "uec.tar.gz": { - "ftype": "uec.tar.gz", - "md5": "d04e6f26aed123bba2c096581b269e7f", - "sha256": "09dcd3ea6f1d48b3519232973e4dc00fc5e73cbea974cda6b5f7cfa380c6b428", - "size": 7314471, - "path": "0.3.1/cirros-0.3.1-arm-uec.tar.gz" - } - }, - "version": "0.3.1", - "pubname": "cirros-0.3.1-arm" - } - }, - "stream": "released" - } - }, - "datatype": "image-downloads", - "format": "products:1.0", - "updated": "Fri, 08 May 2015 13:20:51 +0000", - "content_id": "net.cirros-cloud:released:download" -} diff --git a/builder/test-simplestreams/virt-builder/repos.d/cirros.conf.in b/builder/test-simplestreams/virt-builder/repos.d/cirros.conf.in deleted file mode 100644 index a6f27651a..000000000 --- a/builder/test-simplestreams/virt-builder/repos.d/cirros.conf.in +++ /dev/null @@ -1,3 +0,0 @@ -[test-cirros] -uri=file://@abs_top_builddir@/builder/test-simplestreams -format=simplestreams diff --git a/builder/test-virt-builder-cacheall.sh b/builder/test-virt-builder-cacheall.sh deleted file mode 100755 index c80d9ecd2..000000000 --- a/builder/test-virt-builder-cacheall.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash - -# libguestfs virt-builder test script -# 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. - -set -e - -$TEST_FUNCTIONS -skip_if_skipped - -tmpdir="$(mktemp -d)" -echo "tmpdir= $tmpdir" -reposdir="$tmpdir/virt-builder/repos.d" -repodir="$tmpdir/repo" -indexfile="$repodir/index" -cachedir="$tmpdir/cache" - -mkdir -p "$reposdir" -mkdir -p "$repodir" - -# Create some fake images. -img1_path="$repodir/img1.raw" -img1_size=10485760 # 10G -qemu-img create -f raw "$img1_path" $img1_size -img1_csum=`do_sha256 "$img1_path"` - -img2_path="$repodir/img2.qcow2" -img2_size=5242880 # 5G -qemu-img create -f qcow2 "$img2_path" $img2_size -img2_csum=`do_sha256 "$img2_path"` - -# Create an index for the images. -cat > "$indexfile" < "$reposdir/repo1.conf" < $test_data/index << EOF -[fedora] -file=fedora.img -EOF - -# Run virt-builder-repository (no compression, interactive) -echo 'x86_64 -Fedora Test Image -fedora14 -/dev/sda1 -/dev/VG/Root -' | virt-builder-repository -v -x --no-compression -i $test_data - -assert_config () { - item=$1 - regex=$2 - - sed -n -e "/\[$item]/,/^$/p" $test_data/index | grep "$regex" -} - -# Check the generated index file -assert_config 'fedora' 'revision=1' -assert_config 'fedora' 'arch=x86_64' -assert_config 'fedora' 'name=Fedora Test Image' -assert_config 'fedora' 'osinfo=fedora14' -assert_config 'fedora' 'checksum' -assert_config 'fedora' 'format=raw' -assert_config 'fedora' '^size=' -assert_config 'fedora' 'compressed_size=' -assert_config 'fedora' 'expand=/dev/' - - -# Copy the debian image and add the minimal piece to index -cp ../test-data/phony-guests/debian.img $test_data - -cat >> $test_data/index << EOF - -[debian] -file=debian.img -EOF - -# Run virt-builder-repository again -echo 'x86_64 -Debian Test Image -debian9 - -' | virt-builder-repository --no-compression -i $test_data - -# Check that the new image is complete and the first one hasn't changed -assert_config 'fedora' 'revision=1' - -assert_config 'debian' 'revision=1' -assert_config 'debian' 'checksum' - -# Modify the fedora image -export EDITOR='echo newline >>' -virt-edit -a $test_data/fedora.img /etc/test3 - -# Rerun the tool (with compression) -virt-builder-repository -i $test_data - -# Check that the revision, file and size have been updated -assert_config 'fedora' 'revision=2' -assert_config 'fedora' 'file=fedora.img.xz' -test -e $test_data/fedora.img.xz -! test -e $test_data/fedora.img - -rm -rf $test_data diff --git a/builder/test-virt-builder.sh b/builder/test-virt-builder.sh deleted file mode 100755 index 18673874a..000000000 --- a/builder/test-virt-builder.sh +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/bash - -# libguestfs virt-builder test script -# Copyright (C) 2013 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. - -set -e - -$TEST_FUNCTIONS -skip_if_skipped - -export XDG_CONFIG_HOME= -export XDG_CONFIG_DIRS="$abs_builddir/test-config" - -if [ ! -f fedora.xz ]; then - echo "$0: test skipped because there is no fedora.xz in the build directory" - exit 77 -fi - -output=phony-fedora.img - -format=qcow2 -if [ "$(guestfish get-backend)" = "uml" ]; then - format=raw - - # XXX We specifically want virt-builder to work with the UML - # backend. However currently it fails with: - # error: uml backend does not support networking - # We should be able to make uml have a network backend, but in - # the meantime add this: - no_network=--no-network -fi - -rm -f $output - -# Test as many options as we can! -# -# Note we cannot test --install, --run since the phony Fedora doesn't -# have a real OS inside just some configuration files. Just about -# every other option is fair game. -# -# Don't use $VG here, because libtool (expanded from $VG) chokes -# on the multi-line parameters. (RHBZ#1420301) -virt-builder phony-fedora \ - -v --no-cache --no-check-signature $no_network \ - -o $output --size 2G --format $format \ - --arch x86_64 \ - --hostname test.example.com \ - --timezone Europe/London \ - --root-password password:123456 \ - --mkdir /etc/foo/bar/baz \ - --write '/etc/foo/bar/baz/foo:Hello World' \ - --upload Makefile:/Makefile \ - --edit '/Makefile: s{^#.*}{}' \ - --upload Makefile:/etc/foo/bar/baz \ - --delete /Makefile \ - --link /etc/foo/bar/baz/foo:/foo \ - --link /etc/foo/bar/baz/foo:/foo1:/foo2:/foo3 \ - --append-line '/etc/append1:hello' \ - --append-line '/etc/append2:line1' \ - --append-line '/etc/append2:line2' \ - --write '/etc/append3:line1' \ - --append-line '/etc/append3:line2' \ - --write '/etc/append4:line1 -' \ - --append-line '/etc/append4:line2' \ - --touch /etc/append5 \ - --append-line '/etc/append5:line1' \ - --write '/etc/append6: -' \ - --append-line '/etc/append6:line2' \ - --firstboot Makefile --firstboot-command 'echo "hello"' \ - --firstboot-install "minicom,inkscape" - -# Check that some modifications were made. -$VG guestfish --ro -i -a $output > test-virt-builder.out < string_of_int n - | Rev_string s -> s - -let increment_revision = function - | Rev_int n -> Rev_int (n + 1) - | Rev_string s -> Rev_int ((int_of_string s) + 1) - -let get_image_infos filepath = - let qemuimg_cmd = "qemu-img info --output json " ^ quote filepath in - let lines = external_command qemuimg_cmd in - let line = String.concat "\n" lines in - JSON_parser.json_parser_tree_parse line diff --git a/builder/utils.mli b/builder/utils.mli deleted file mode 100644 index 4f799e74a..000000000 --- a/builder/utils.mli +++ /dev/null @@ -1,37 +0,0 @@ -(* virt-builder - * Copyright (C) 2013-2020 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. - *) - -(** Utilities/common functions used in virt-builder only. *) - -type gpgkey_type = - | No_Key - | Fingerprint of string - | KeyFile of string -and revision = - | Rev_int of int - | Rev_string of string - -val string_of_revision : revision -> string -(** Convert a {!revision} into a string. *) - -val get_image_infos : string -> JSON.json_t -(** [get_image_infos path] Run qemu-img info on the image pointed at - path as JSON tree. *) - -val increment_revision : revision -> revision -(** Add one to the revision number *) diff --git a/builder/virt-builder-repository.pod b/builder/virt-builder-repository.pod deleted file mode 100644 index e849892a9..000000000 --- a/builder/virt-builder-repository.pod +++ /dev/null @@ -1,212 +0,0 @@ -=begin html - - - -=end html - -=head1 NAME - -virt-builder-repository - Build virt-builder source repository easily - -=head1 SYNOPSIS - - virt-builder-repository /path/to/repository - [-i|--interactive] [--gpg-key KEYID] - -=head1 DESCRIPTION - -Virt-builder is a tool for quickly building new virtual machines. It can -be configured to use template repositories. However creating and -maintaining a repository involves many tasks which can be automated. -virt-builder-repository is a tool helping to manage these repositories. - -Virt-builder-repository loops over the files in the directory specified -as argument, compresses the files with a name ending by C, C, -C or without extension, extracts data from them and creates or -updates the C file. - -Some of the image-related data needed for the index file can’t be -computed from the image file. virt-builder-repository first tries to -find them in the existing index file. If data are still missing after -this, they are prompted in interactive mode, otherwise an error will -be triggered. - -If a C is provided, the generated index file will be signed -with this GPG key. - -=head1 EXAMPLES - -=head2 Create the initial repository - -Create a folder and copy the disk image template files in it. Then -run a command like the following one: - - virt-builder-repository --gpg-key "joe@hacker.org" -i /path/to/folder - -Note that this example command runs in interactive mode. To run in -automated mode, a minimal index file needs to be created before running -the command containing sections like this one: - - [template_id] - file=template_filename.qcow.xz - -The file value needs to match the image name extended with the C<.xz> -suffix if the I<--no-compression> parameter is not provided or the -image name if no compression is involved. Other optional data can be -prefilled. Default values are computed by inspecting the disk image. -For more informations, see -L. - -=head2 Update images in an existing repository - -In this use case, a new image or a new revision of an existing image -needs to be added to the repository. Place the corresponding image -template files in the repository folder. - -To update the revision of an image, the file needs to have the same -name than the existing one (without the C extension). - -As in the repository creation use case, a minimal fragment can be -added to the index file for the automated mode. This can be done -on the signed index even if it may sound a strange idea: the index -will be signed again by the tool. - -To remove an image from the repository, just remove the corresponding -image file before running virt-builder-repository. - -Then running the following command will complete and update the index -file: - - virt-builder-repository --gpg-key "joe@hacker.org" -i /path/to/folder - -virt-builder-repository works in a temporary folder inside the repository -one. If anything wrong happens when running the tool, the repository is -left untouched. - -=head1 OPTIONS - -=over 4 - -=item B<--help> - -Display help. - -=item B<--gpg> GPG - -Specify an alternate L (GNU Privacy Guard) binary. You can -also use this to add gpg parameters, for example to specify an -alternate home directory: - - virt-builder-repository --gpg "gpg --homedir /tmp" [...] - -This can also be used to avoid gpg asking for the key passphrase: - - virt-builder-repository --gpg "gpg --passphrase-file /tmp/pass --batch" [...] - -=item B<-K> KEYID - -=item B<--gpg-key> KEYID - -Specify the GPG key to be used to sign the repository index file. -If not provided, the index will left unsigned. C is used to -identify the GPG key to use. This value is passed to gpg’s -I<--default-key> option and can thus be an email address or a -fingerprint. - -B: by default, virt-builder-repository searches for the key -in the user’s GPG keyring. - -=item B<-i> - -=item B<--interactive> - -Prompt for missing data. Default values are computed from the disk -image. - -When prompted for data, inputting C<-> corresponds to leaving the -value empty. This can be used to avoid setting the default computed value. - -=item B<--no-compression> - -Don’t compress the template images. - -=item B<--machine-readable> - -=item B<--machine-readable>=format - -This option is used to make the output more machine friendly -when being parsed by other programs. See -L below. - -=item B<--colors> - -=item B<--colours> - -Use ANSI colour sequences to colourize messages. This is the default -when the output is a tty. If the output of the program is redirected -to a file, ANSI colour sequences are disabled unless you use this -option. - -=item B<-q> - -=item B<--quiet> - -Don’t print ordinary progress messages. - -=item B<-v> - -=item B<--verbose> - -Enable debug messages and/or produce verbose output. - -When reporting bugs, use this option and attach the complete output to -your bug report. - -=item B<-V> - -=item B<--version> - -Display version number and exit. - -=item B<-x> - -Enable tracing of libguestfs API calls. - -=back - -=head1 MACHINE READABLE OUTPUT - -The I<--machine-readable> option can be used to make the output more -machine friendly, which is useful when calling virt-builder-repository from -other programs, GUIs etc. - -Use the option on its own to query the capabilities of the -virt-builder-repository binary. Typical output looks like this: - - $ virt-builder-repository --machine-readable - virt-builder-repository - -A list of features is printed, one per line, and the program exits -with status 0. - -It is possible to specify a format string for controlling the output; -see L. - -=head1 EXIT STATUS - -This program returns 0 if successful, or non-zero if there was an -error. - -=head1 SEE ALSO - -L -L. - -=head1 AUTHOR - -Cédric Bosdonnat L - -=head1 COPYRIGHT - -Copyright (C) 2016-2020 SUSE Inc. diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod deleted file mode 100644 index eddadc796..000000000 --- a/builder/virt-builder.pod +++ /dev/null @@ -1,1908 +0,0 @@ -=begin html - - - -=end html - -=head1 NAME - -virt-builder - Build virtual machine images quickly - -=head1 SYNOPSIS - - virt-builder os-version - [-o|--output DISKIMAGE] [--size SIZE] [--format raw|qcow2] - [--arch ARCHITECTURE] [--attach ISOFILE] -__CUSTOMIZE_SYNOPSIS__ - - virt-builder -l|--list [--long] [--list-format short|long|json] [os-version] - - virt-builder --notes os-version - - virt-builder --print-cache - - virt-builder --cache-all-templates - - virt-builder --delete-cache - - virt-builder --get-kernel DISKIMAGE - [--format raw|qcow2] [--output OUTPUTDIR] - -=head1 DESCRIPTION - -Virt-builder is a tool for quickly building new virtual machines. You -can build a variety of VMs for local or cloud use, usually within a -few minutes or less. Virt-builder also has many ways to customize -these VMs. Everything is run from the command line and nothing -requires root privileges, so automation and scripting is simple. - -Note that virt-builder does not install guests from scratch. It takes -cleanly prepared, digitally signed OS templates and customizes them. -This approach is used because it is much faster, but if you need to do -fresh installs you may want to look at L and -L. - -The easiest way to get started is by looking at the examples in the -next section. - -=head1 EXAMPLES - -=head2 List the virtual machines available - - virt-builder --list - -will list out the operating systems available to install. A selection -of freely redistributable OSes is available as standard. You can add -your own too (see below). - -After choosing a guest from the list, you may want to see if there -are any installation notes: - - virt-builder --notes fedora-27 - -=head2 Build a virtual machine - - virt-builder fedora-27 - -will build a Fedora 25 image for the same architecture as virt-builder -(so running it from an i686 installation will try to build an i686 -image, if available). This will have all default -configuration (minimal size, no user accounts, random root password, -only the bare minimum installed software, etc.). - -You I need to run this command as root. - -The first time this runs it has to download the template over the -network, but this gets cached (see L). - -The name of the output file is derived from the template name, so -above it will be F. You can change the output filename -using the I<-o> option: - - virt-builder fedora-27 -o mydisk.img - -You can also use the I<-o> option to write to existing devices or -logical volumes. - - virt-builder fedora-27 --format qcow2 - -As above, but write the output in qcow2 format to F. - - virt-builder fedora-27 --size 20G - -As above, but the output size will be 20 GB. The guest OS is resized -as it is copied to the output (automatically, using -L). - - virt-builder fedora-27 --arch i686 - -As above, but using an i686 template, if available. - -=head2 Setting the root password - - virt-builder fedora-27 --root-password file:/tmp/rootpw - -Create a Fedora 25 image. The root password is taken from the file -F. - -Note if you I set I<--root-password> then the guest is given -a I root password which is printed on stdout. - -You can also create user accounts. See L below. - -=head2 Set the hostname - - virt-builder fedora-27 --hostname virt.example.com - -Set the hostname to C. - -=head2 Installing software - -To install packages from the ordinary (guest) software repository -(eg. dnf or apt): - - virt-builder fedora-27 --install "inkscape,@Xfce Desktop" - -(In Fedora, C<@> is used to install groups of packages. On Debian -you would install a meta-package instead.) - -To update the installed packages to the latest version: - - virt-builder debian-7 --update - -For guests which use SELinux, like Fedora and Red Hat Enterprise -Linux, you may need to do SELinux relabelling after installing or -updating packages (see L below): - - virt-builder fedora-27 --update --selinux-relabel - -=head2 Customizing the installation - -There are many options that let you customize the installation. These -include: I<--run>/I<--run-command>, which run a shell script or -command while the disk image is being generated and lets you add or -edit files that go into the disk image. -I<--firstboot>/I<--firstboot-command>, which let you add -scripts/commands that are run the first time the guest boots. -I<--edit> to edit files. I<--upload> to upload files. - -For example: - - cat <<'EOF' > /tmp/dnf-update.sh - dnf -y --best update - EOF - - virt-builder fedora-27 --firstboot /tmp/dnf-update.sh - -or simply: - - virt-builder fedora-27 --firstboot-command 'dnf -y --best update' - -which makes the L C command run once the first time -the guest boots. - -Or: - - virt-builder fedora-27 \ - --edit '/etc/dnf/dnf.conf: - s/gpgcheck=1/gpgcheck=0/' - -which edits F inside the disk image (during disk -image creation, long before boot). - -You can combine these options, and have multiple options of all types. - -=head1 OPTIONS - -=over 4 - -=item B<--help> - -Display help. - -=item B<--arch> ARCHITECTURE - -Use the specified architecture for the output image. This means -there must be sources providing the requested template for the -requested architecture. - -See also L. - -=item B<--attach> ISOFILE - -During the customization phase, the given disk is attached to the -libguestfs appliance. This is used to provide extra software -repositories or other data for customization. - -You probably want to ensure the volume(s) or filesystems in the -attached disks are labelled (or use an ISO volume name) so that you -can mount them by label in your run-scripts: - - mkdir /tmp/mount - mount LABEL=EXTRA /tmp/mount - -You can have multiple I<--attach> options, and the format can be any -disk format (not just an ISO). - -See also: I<--run>, -L, -L, L. - -=item B<--attach-format> FORMAT - -Specify the disk format for the next I<--attach> option. The -C is usually C or C. Use C for ISOs. - -=item B<--cache> DIR - -=item B<--no-cache> - -I<--cache> DIR sets the directory to use/check for cached template -files. If not set, defaults to either -F<$XDG_CACHE_HOME/virt-builder/> or F<$HOME/.cache/virt-builder/>. - -I<--no-cache> disables template caching. - -=item B<--cache-all-templates> - -Download all templates to the cache and then exit. See L. - -Note this doesn't cache everything. More templates might be uploaded. -Also this doesn't cache packages (the I<--install>, I<--update> options). - -=item B<--check-signature> - -=item B<--no-check-signature> - -Check/don’t check the digital signature of the OS template. The -default is to check the signature and exit if it is not correct. -Using I<--no-check-signature> bypasses this check. - -See also I<--fingerprint>. - -=item B<--colors> - -=item B<--colours> - -Use ANSI colour sequences to colourize messages. This is the default -when the output is a tty. If the output of the program is redirected -to a file, ANSI colour sequences are disabled unless you use this -option. - -=item B<--curl> CURL - -Specify an alternate L binary. You can also use this to add -curl parameters, for example to disable https certificate checks: - - virt-builder --curl "curl --insecure" [...] - -=item B<--delete-cache> - -Delete the template cache. See L. - -=item B<--no-delete-on-failure> - -Don’t delete the output file on failure to build. You can use this to -debug failures to run scripts. See L for ways to -debug images. - -The default is to delete the output file if virt-builder fails (or, -for example, some script that it runs fails). - -=item B<--fingerprint> 'AAAA BBBB ...' - -Check that the index and templates are signed by the key with the -given fingerprint. (The fingerprint is a long string, usually written -as 10 groups of 4 hexadecimal digits). - -You can give this option multiple times. If you have multiple source -URLs, then you can have either no fingerprint, one fingerprint or -multiple fingerprints. If you have multiple, then each must -correspond 1-1 with a source URL. - -=item B<--format> qcow2 - -=item B<--format> raw - -For ordinary builds, this selects the output format. The default is I. - -With I<--get-kernel> this specifies the input format. - -To create an old-style qcow2 file (for compatibility with RHEL 6 or -very old qemu E 1.1), after running virt-builder, use this -command: - - qemu-img amend -f qcow2 -o compat=0.10 output.qcow2 - -=item B<--get-kernel> IMAGE - -This option extracts the kernel and initramfs from a previously built -disk image called C (in fact it works for any VM disk image, -not just ones built using virt-builder). - -Note this method is B: there is a separate tool for this, -L, which has more options for the file extraction. - -The kernel and initramfs are written to the current directory, unless -you also specify the I<--output> C B name. - -The format of the disk image is automatically detected unless you -specify it by using the I<--format> option. - -In the case where the guest contains multiple kernels, the one with -the highest version number is chosen. To extract arbitrary kernels -from the disk image, see L. To extract the entire -F directory of a guest, see L. - -=item B<--gpg> GPG - -Specify an alternate L (GNU Privacy Guard) binary. By default -virt-builder looks for either C or C in the C<$PATH>. - -You can also use this to add gpg parameters, for example to specify an -alternate home directory: - - virt-builder --gpg "gpg --homedir /tmp" [...] - -=item B<-l> [os-version] - -=item B<--list> [os-version] - -=item B<--list> B<--list-format> format [os-version] - -=item B<--list> B<--long> [os-version] - -List all the available templates if no guest is specified, or only for the -specified one. - -It is possible to choose with I<--list-format> the output format for the list -templates: - -=over 4 - -=item B - -The default format, prints only the template identifier and, next to it, -its short description. - -=item B - -Prints a textual list with the details of the available sources, followed -by the details of the available templates. - -=item B - -Prints a JSON object with the details of the available sources and -the details of the available templates. - -The C key in the main object represents the "compatibility version", -and it is bumped every time the resulting JSON output is incompatible with -the previous versions (for example the structure has changed, or non-optional -keys are no more present). - -=back - -I<--long> is a shorthand for the C format. - -See also: I<--source>, I<--notes>, L. - -=item B<--machine-readable> - -=item B<--machine-readable>=format - -This option is used to make the output more machine friendly -when being parsed by other programs. See -L below. - -=item B<-m> MB - -=item B<--memsize> MB - -Change the amount of memory allocated to I<--run> scripts. Increase -this if you find that I<--run> scripts or the I<--install> option are -running out of memory. - -The default can be found with this command: - - guestfish get-memsize - -=item B<--network> - -=item B<--no-network> - -Enable or disable network access from the guest during the installation. - -Enabled is the default. Use I<--no-network> to disable access. - -The network only allows outgoing connections and has other minor -limitations. See L. - -If you use I<--no-network> then certain other options such as -I<--install> will not work. - -This does not affect whether the guest can access the network once it -has been booted, because that is controlled by your hypervisor or -cloud environment and has nothing to do with virt-builder. - -Generally speaking you should I use I<--no-network>. But here -are some reasons why you might want to: - -=over 4 - -=item 1. - -Because the libguestfs backend that you are using doesn't support the -network. (See: L). - -=item 2. - -Any software you need to install comes from an attached ISO, so you -don't need the network. - -=item 3. - -You don’t want untrusted guest code trying to access your host network -when running virt-builder. This is particularly an issue when you -don't trust the source of the operating system templates. (See -L below). - -=item 4. - -You don’t have a host network (eg. in secure/restricted environments). - -=back - -=item B<--no-sync> - -Do not sync the output file on exit. - -Virt-builder Cs the output file or disk image when it exits. - -The reason is that qemu/KVM’s default caching mode is C or -C, both of which bypass the host page cache. Therefore -these would not work correctly if you immediately started the guest -after running virt-builder - they would not see the complete output -file. (Note that you should not use these caching modes - they are -fundamentally broken for this and other reasons.) - -If you are not using these broken caching modes, you can use -I<--no-sync> to avoid this unnecessary sync and gain considerable -extra performance. - -=item B<--notes> os-version - -List any notes associated with this guest, then exit (this does not do -the install). - -=item B<-o> filename - -=item B<--output> filename - -Write the output to F. If you don’t specify this option, -then the output filename is generated by taking the C -string and adding C<.img> (for raw format) or C<.qcow2> (for qcow2 -format). - -Note that the output filename could be a device, partition or logical -volume. - -When used with I<--get-kernel>, this option specifies the output -directory. - -=item B<--print-cache> - -Print information about the template cache. See L. - -=item B<-q> - -=item B<--quiet> - -Don’t print ordinary progress messages. - -=item B<--size> SIZE - -Select the size of the output disk, where the size can be specified -using common names such as C<32G> (32 gigabytes) etc. - -Virt-builder will resize filesystems inside the disk image -automatically. - -If the size is not specified, then one of two things happens. If the -output is a file, then the size is the same as the template. If the -output is a device, partition, etc then the size of that device is -used. - -To specify size in bytes, the number must be followed by the lowercase -letter I, eg: S>. - -=item B<--smp> N - -Enable N E 2 virtual CPUs for I<--run> scripts to use. - -=item B<--source> URL - -Set the source URL to look for indexes. - -You can give this option multiple times to specify multiple sources. - -See also L below. - -Note that you should not point I<--source> to sources that you don’t -trust (unless the source is signed by someone you do trust). See also -the I<--no-network> option. - -=item B<--no-warn-if-partition> - -Do not emit a warning if the output device is a partition. This -warning avoids a common user error when writing to a USB key or -external drive, when you should normally write to the whole device -(S>), not to a partition on the device -(S>). Use this option to I this -warning. - -=item B<-v> - -=item B<--verbose> - -Enable debug messages and/or produce verbose output. - -When reporting bugs, use this option and attach the complete output to -your bug report. - -=item B<-V> - -=item B<--version> - -Display version number and exit. - -=item B<-x> - -Enable tracing of libguestfs API calls. - -=back - -=head2 Customization options - -__CUSTOMIZE_OPTIONS__ - -=head1 REFERENCE - -=head2 INSTALLING PACKAGES - -There are several approaches to installing packages or applications in -the guest which have different trade-offs. - -=head3 Installing packages at build time - -If the guest OS you are installing is similar to the host OS (eg. -both are Linux), and if libguestfs supports network connections, then -you can use I<--install> to install packages like this: - - virt-builder fedora-27 --install inkscape - -This uses the guest’s package manager and the host’s network -connection. - -=head3 Updating packages at build time - -To update the installed packages in the template at build time: - - virt-builder fedora-27 --update - -Most of the templates that ship with virt-builder come with a very -minimal selection of packages (known as a "JEOS" or "Just Enough -Operating System"), which are up to date at the time the template is -created, but could be out of date by the time you come to install an -OS from the template. This option updates those template packages. - -=head3 Installing packages at first boot - -Another option is to install the packages when the guest first boots: - - virt-builder fedora-27 --firstboot-install inkscape - -This uses the guest’s package manager and the guest’s network -connection. - -The downsides are that it will take the guest a lot longer to boot -first time, and there’s nothing much you can do if package -installation fails (eg. if a network problem means the guest can't -reach the package repositories). - -=head3 Installing packages at build time from a side repository - -If the software you want to install is not available in the main -package repository of the guest, then you can add a side repository. -Usually this is presented as an ISO (CD disk image) file containing -extra packages. - -You can create the disk image using either L or -L. For genisoimage, use a command like this: - - genisoimage -o extra-packages.iso -R -J -V EXTRA cdcontents/ - -Create a script that mounts the ISO and sets up the repository. For -dnf, create /tmp/install.sh containing: - - mkdir /tmp/mount - mount LABEL=EXTRA /tmp/mount - - cat <<'EOF' > /etc/yum.repos.d/extra.repo - [extra] - name=extra - baseurl=file:///tmp/mount - enabled=1 - EOF - - dnf -y install famousdatabase - -For apt, create /tmp/install.sh containing: - - mkdir /tmp/mount - mount LABEL=EXTRA /tmp/mount - - apt-cdrom -d=/tmp/mount add - apt-get -y install famousdatabase - -Use the I<--attach> option to attach the CD / disk image and the -I<--run> option to run the script: - - virt-builder fedora-27 \ - --attach extra-packages.iso \ - --run /tmp/install.sh - -=head2 USERS AND PASSWORDS - -The I<--root-password> option is used to change the root password -(otherwise a random password is used). This option takes a password -C in one of the following formats: - -=over 4 - -=item B<--root-password> file:FILENAME - -Read the root password from C. The whole first line -of this file is the replacement password. Any other lines are -ignored. You should create the file with mode 0600 to ensure -no one else can read it. - -=item B<--root-password> password:PASSWORD - -Set the root password to the literal string C. - -B since any user on the same machine can -see the cleartext password using L. - -=item B<--root-password> random - -Choose a random password, which is printed on stdout. The password -has approximately 120 bits of randomness. - -This is the default. - -=item B<--root-password> disabled - -The root account password is disabled. This is like putting C<*> -in the password field. - -=item B<--root-password> locked:file:FILENAME - -=item B<--root-password> locked:password:PASSWORD - -=item B<--root-password> locked:random - -The root account is locked, but a password is placed on the -account. If first unlocked (using C) then logins will -use the given password. - -=item B<--root-password> locked - -=item B<--root-password> locked:disabled - -The root account is locked I password is disabled. - -=back - -=head3 Creating user accounts - -To create user accounts, use the L command with -L<--firstboot-command> like this: - - virt-builder --firstboot-command \ - 'useradd -m -p "" rjones ; chage -d 0 rjones' - -The above command will create an C account with no password, -and force the user to set a password when they first log in. There -are other ways to manage passwords, see L for details. - -=head2 KEYBOARD LAYOUT - -Because there are so many different ways to set the keyboard layout in -Linux distributions, virt-builder does not yet attempt to have a -simple command line option. This section describes how to set the -keyboard for some common Linux distributions. - -=head3 Keyboard layout with systemd - -For distros that use systemd C, use a command like this: - - virt-builder fedora-27 \ - --firstboot-command 'localectl set-keymap uk' - -See L and -L -for more details. - -=head3 Keyboard layout using F - -For RHEL E 6, Fedora E 18 and similar, upload or modify the -keyboard configuration file using the I<--upload>, I<--write> or -I<--edit> options. For example: - - virt-builder centos-6 \ - --edit '/etc/sysconfig/keyboard: s/^KEYTABLE=.*/KEYTABLE="uk"/' - -The format of this file can be found documented in many places online. - -=head3 Keyboard layout with Debian-derived distros - -For Debian-derived distros using F, upload or -modify the keyboard file using the I<--upload>, I<--write> or -I<--edit> options. For example: - - virt-builder debian-8 \ - --edit '/etc/default/keyboard: s/^XKBLAYOUT=.*/XKBLAYOUT="gb"/' - -See L. - -=head2 LANGUAGE - -Most Linux distributions support multiple locale settings so that you -can have guest messages printed in another language such as Russian. - -However there is no single setting which controls this, since extra -packages may need to be installed to support console and X fonts, and -keyboard input methods. The packages required, and their -configuration is highly distro-specific, and it is outside the scope -of virt-builder to do this. - -This section contains examples for some common Linux distributions. - -=head3 Setting Japanese in Fedora 25 - - virt-builder fedora-27 \ - --size 20G \ - --update \ - --install @japanese-support \ - --install @xfce \ - --install xorg-x11-server-Xorg,xorg-x11-drivers,rsyslog \ - --link /usr/lib/systemd/system/graphical.target:/etc/systemd/system/default.target \ - --firstboot-command 'localectl set-locale LANG=ja_JP.utf8' \ - --firstboot-command 'localectl set-keymap jp' \ - --firstboot-command 'systemctl isolate graphical.target' - -=head3 Setting Japanese in Debian 8 (Jessie) - -Note that although this enables Japanese in the text console too, it -is unlikely that you will see properly rendered Japanese there. -However Japanese is properly rendered in X applications and terminals. - - pkgs=locales,xfce4,\ - ibus,ibus-anthy,\ - fonts-ipafont-gothic,fonts-ipafont-mincho,\ - fonts-takao-mincho,\ - xfonts-intl-japanese,xfonts-intl-japanese-big,\ - iceweasel-l10n-ja,manpages-ja - - virt-builder debian-8 \ - --size 20G \ - --install $pkgs \ - --edit '/etc/locale.gen: s,^#\s*ja,ja,' \ - --write '/etc/default/locale:LANG="ja_JP.UTF-8"' \ - --run-command "locale-gen" - -=head2 LOG FILE - -Scripts and package installation that runs at build time (I<--run>, -I<--run-command>, I<--install>, I<--update>, but I firstboot) is -logged in one of the following locations: - -=over 4 - -=item F - -On Linux, BSD, and other non-Windows guests. - -=item F - -On Windows, DOS guests. - -=item F - -If F or F is missing. - -=back - -If you don’t want the log file to appear in the final image, then -use the I<--no-logfile> command line option. - -=head2 SSH KEYS - -The I<--ssh-inject> option is used to inject ssh keys for users in -the guest, so they can login without supplying a password. - -The C part of the option value is optional; in this case, -I<--ssh-inject> C means that we look in the I -user’s F<~/.ssh> directory to find the default public ID file. That -key is uploaded. "default public ID" is the I file -described in L. - -If specified, the C can be in one of the following formats: - -=over 4 - -=item B<--ssh-inject> USER:file:FILENAME - -Read the ssh key from F. F is usually a I<.pub> -file. - -=item B<--ssh-inject> USER:string:KEY_STRING - -Use the specified C. C is usually a public -string like I. - -=back - -In any case, the F<~USER/.ssh> directory and the -F<~USER/.ssh/authorized_keys> file will be created if not existing -already. - -=head2 FIRST BOOT SCRIPTS - -The I<--firstboot> and I<--firstboot-command> options allow you to -execute commands at the first boot of the guest. To do so, an init -script for the guest init system is installed, which takes care of -running all the added scripts and commands. - -Supported operating systems are: - -=over 4 - -=item Linux - -Init systems supported are: systemd, System-V init (known also as sysvinit), -and Upstart (using the System-V scripts). - -Note that usually init scripts run as root, but with a more limited -environment than what could be available from a normal shell: -for example, C<$HOME> may be unset or empty. - -The output of the first boot scripts is available in the guest as -F<~root/virt-sysprep-firstboot.log>. - -=item Windows - -F, available from sources at -L, or F, available -with SUSE VMDP is installed to run the -first boot scripts. It is required, and the setup of first boot -scripts will fail if it is not present. - -F or F is copied from the location pointed to by the -C environment variable; if not set, a compiled-in -default will be used (something like F). - -The output of the first boot scripts is available in the guest as -F. - -=back - -=head2 SUBSCRIPTION-MANAGER - -It is possible to automate the registration and attaching of the -system using C. This is typical on -Red Hat Enterprise Linux guests. There are few options which ease -this process, avoid executing commands manually and exposing -passwords on command line. - -I<--sm-register> starts the registration process, and requires -I<--sm-credentials> to be specified; the format of the C -of I<--sm-credentials> is one of the following formats: - -=over 4 - -=item B<--sm-credentials> USER:file:FILENAME - -Read the password for the specified C from F. - -=item B<--sm-credentials> USER:password:PASSWORD - -Use the literal string C for the specified C. - -=back - -I<--sm-attach> attaches the system to subscriptions; the format -of its C is one of the following: - -=over 4 - -=item B<--sm-attach> auto - -C attaches to the best-fitting subscriptions -for the system. - -=item B<--sm-attach> file:FILENAME - -Read the pool ID from F. - -=item B<--sm-attach> pool:POOL - -Use the literal string C as pool ID. - -=back - -I<--sm-remove> removes all the subscriptions from the guest, while -I<--sm-unregister> completely unregister the system. - -=head2 INSTALLATION PROCESS - -When you invoke virt-builder, installation proceeds as follows: - -=over 4 - -=item * - -The template image is downloaded. - -If the template image is present in the cache, the cached version -is used instead. (See L). - -=item * - -The template signature is checked. - -=item * - -The template is uncompressed to a tmp file. - -=item * - -The template image is resized into the destination, using -L. - -=item * - -Extra disks are attached (I<--attach>). - -=item * - -A new random seed is generated for the guest. - -=item * - -Guest customization is performed, in the order specified on the -command line. - -=item * - -SELinux relabelling is done (I<--selinux-relabel>). - -=back - -=head2 IMPORTING THE DISK IMAGE - -=head3 Importing into libvirt - -Import the disk image into libvirt using L -I<--import> option. - - virt-install --import \ - --name guest --ram 2048 \ - --disk path=disk.img,format=raw --os-variant fedora27 - -Notes: - -=over 4 - -=item 1. - -You I specify the correct format. The format is C unless -you used virt-builder’s I<--format> option. - -=item 2. - -I<--os-variant> is highly recommended, because it will present optimum -devices to enable the guest to run most efficiently. To get a list -of all variants, do: - - osinfo-query os - -The above tool is provided by libosinfo package. - -=item 3. - -You can run virt-install as root or non-root. Each works slightly -differently because libvirt manages a different set of virtual -machines for each user. In particular virt-manager normally shows the -root-owned VMs, whereas Boxes shows the user-owned VMs, and other -tools probably work differently as well. - -=back - -=head3 Importing into OpenStack - -Import the image into Glance (the OpenStack image store) by doing: - - glance image-create --name fedora-27-image --file fedora-27.img \ - --disk-format raw --container-format bare \ - --is-public True - -The I<--file> parameter is the virt-builder-generated disk image. It -should match virt-builder’s I<--output> option. The I<--disk-format> -parameter should match virt-builder’s I<--format> option (or C if -you didn't use that option). The I<--container-format> should always -be C since virt-builder doesn't put images into containers. - -You can use the S>> command to -display the properties of the image. - -To boot up an instance of your image on a Nova compute node, do: - - nova boot fedora-27-server --image fedora-27-image \ - --flavor m1.medium - -Use S> to list possible machine flavors. Use -S> to list running instances. - -=head3 Booting directly using qemu or KVM - -The qemu command line is not very stable or easy to use, hence libvirt -should be used if possible. However a command line similar to the -following could be used to boot the virtual machine: - - qemu-system-x86_64 \ - -machine accel=kvm:tcg \ - -cpu host \ - -m 2048 \ - -drive file=disk.img,format=raw,if=virtio - -As with libvirt, it is very important that the correct format is -chosen. It will be C unless the I<--format> option was used. - -=head2 CONFIGURATION MANAGEMENT - -=head3 Puppet - -To enable the Puppet agent in a guest, install the package, point -the configuration at your Puppetmaster, and ensure the agent runs -at boot. - -A typical virt-builder command would be: - - virt-builder fedora-27 \ - --hostname client.example.com \ - --update \ - --install puppet \ - --append-line '/etc/puppet/puppet.conf:[agent]' \ - --append-line '/etc/puppet/puppet.conf:server = puppetmaster.example.com/' \ - --run-command 'systemctl enable puppet' \ - --selinux-relabel - -The precise instructions vary according to the Linux distro. For -further information see: -L - -=head2 DEBUGGING BUILDS - -If virt-builder itself fails, then enable debugging (I<-v>) and report -a bug (see L below). - -If virt-builder fails because some script or package it is installing -fails, try using I<--no-delete-on-failure> to preserve the output -file, and continue reading this section. - -If virt-builder is successful but the image doesn't work, here are -some things to try: - -=over 4 - -=item Use virt-rescue - -Run L on the disk image: - - virt-rescue -a disk.img - -This gives you a rescue shell. You can mount the filesystems from the -disk image on F and examine them using ordinary Linux -commands. You can also chroot into the guest to reinstall the -bootloader. The virt-rescue man page has a lot more information and -examples. - -=item Use guestfish - -Run L on the disk image: - - guestfish -a disk.img -i - -Use guestfish commands like C and C to -examine directories and files. - -=item Use guestmount - -Mount the disk image safely on the host using FUSE and L: - - mkdir /tmp/mp - guestmount -a disk.img -i /tmp/mp - cd /tmp/mp - -To unmount the disk image do: - - fusermount -u /tmp/mp - -=item Add a serial console - -If the guest hangs during boot, it can be helpful to add a serial -console to the guest, and direct kernel messages to the serial -console. Adding the serial console will involve looking at the -documentation for your hypervisor. To direct kernel messages to the -serial console, add the following on the kernel command line: - - console=tty0 console=ttyS0,115200 - -=back - -=head2 SOURCES OF TEMPLATES - -virt-builder reads the available sources from configuration files, -with the I<.conf> extension and located in the following paths: - -=over 4 - -=item * - -$XDG_CONFIG_HOME/virt-builder/repos.d/ (C<$XDG_CONFIG_HOME> is -F<$HOME/.config> if not set). - -=item * - -$XDG_CONFIG_DIRS/virt-builder/repos.d/ (where C<$XDG_CONFIG_DIRS> -means any of the directories in that environment variable, or just F -if not set) - -=back - -Each I<.conf> file in those paths has a simple text format like the -following: - - [libguestfs.org] - uri=http://libguestfs.org/download/builder/index.asc - gpgkey=file:///etc/xdg/virt-builder/repos.d/libguestfs.gpg - -The part in square brackets is the repository identifier, which is -used as unique identifier. - -The following fields can appear: - -=over 4 - -=item C - -The URI of the index file which this repository refers to. - -This field is required. - -=item C - -This optional field represents the URI (although only I URIs -are accepted) of the key used to sign the index file. -If not present, the index file referred by I is not signed. - -=item C - -This optional field specifies the proxy mode, to be used when downloading -the index file of this repository. The possible values are: - -=over 4 - -=item B, B - -No proxy is being used at all, even overriding the system configuration. - -=item B - -The proxy used is the system one. - -=item I - -Specifies the actual proxy configuration to be used, overriding the system -configuration. - -=back - -If not present, the assumed value is to respect the proxy settings of the -system (i.e. as if B would be specified). - -=item C - -This optional field specifies the format of the repository. -The possible values are: - -=over 4 - -=item B - -The native format of the C repository. See also -L below. - -=item B - -The URI represents the root of a Simple Streams v1.0 tree of metadata. - -For more information about Simple Streams, see also -L. - -=back - -If not present, the assumed value is C. - -=back - -For serious virt-builder use, you may want to create your own -repository of templates. - -=head3 Libguestfs.org repository - -Out of the box, virt-builder downloads the file -L which is an index -of available templates plus some information about each one, wrapped -up in a digital signature. The command C lists -out the information in this index file. - -The templates hosted on libguestfs.org were created using shell -scripts, kickstart files and preseed files which can be found in the -libguestfs source tree, in C. - -=head3 Setting up the repository - -You can set up your own site containing an index file and some -templates, and then point virt-builder at the site by creating a -I<.conf> file pointing to it. - -Note that if your index is signed, you will need to properly fill -I in your I<.conf> file, making sure to deploy also the -GPG key file. - - virt-builder --source https://example.com/builder/index.asc \ - --fingerprint 'AAAA BBBB ...' \ - --list - -You can host this on any web or FTP server, or a local or network -filesystem. - -=head3 Setting up a GPG key - -If you don’t have a GnuPG key, you will need to set one up. (Strictly -speaking this is optional, but if your index and template files are -not signed then virt-builder users will have to use the -I<--no-check-signature> flag every time they use virt-builder.) - -To create a key, see the GPG manual -L. - -Export your GPG public key: - - gpg --export -a "you@example.com" > pubkey - -=head3 Create the templates - -There are many ways to create the templates. For example you could -clone existing guests (see L), or you could install a -guest by hand (L). To see how the templates were -created for virt-builder, look at the scripts in C - -Virt-builder supports any image format (e.g. raw, qcow2, etc) as -template, both as-is, and compressed as XZ. This way, existing images -(e.g. cleaned using L) can be used as templates. - -For best results when compressing the templates, use the following xz -options (see L for further explanation): - - xz --best --block-size=16777216 disk - -=head3 Creating and signing the index file - -The index file has a simple text format (shown here without the -digital signature): - - [fedora-18] - name=Fedora® 18 - osinfo=fedora18 - arch=x86_64 - file=fedora-18.xz - checksum[sha512]=... - format=raw - size=6442450944 - compressed_size=148947524 - expand=/dev/sda3 - - [fedora-19] - name=Fedora® 19 - osinfo=fedora19 - arch=x86_64 - file=fedora-19.xz - checksum[sha512]=... - revision=3 - format=raw - size=4294967296 - compressed_size=172190964 - expand=/dev/sda3 - -The part in square brackets is the C, which is the same -string that is used on the virt-builder command line to build that OS. - -The index file creation and signature can be eased with the -L tool. - -After preparing the C file in the correct format, clearsign it -using the following command: - - gpg --clearsign --armor index - -This will create the final file called F which can be -uploaded to the server (and is the I URL). As noted above, -signing the index file is optional, but recommended. - -The following fields can appear: - -=over 4 - -=item C - -The user-friendly name of this template. This is displayed in the -I<--list> output but is otherwise not significant. - -=item C - -This optional field maps the operating system to the associated -libosinfo ID. Virt-builder does not use it (yet). - -=item C - -The architecture of the operating system installed within the -template. This field is required. - -=item C - -The path (relative to the index) of the xz-compressed template. - -Note that absolute paths or URIs are B permitted here. This is -because virt-builder has a "same origin" policy for templates so they -cannot come from other servers. - -=item C - -B. Use the checksum field instead. - -The path (relative to the index) of the GPG detached signature of the -xz file. - -Note that absolute paths or URIs are B permitted here. This is -because virt-builder has a "same origin" policy for templates so they -cannot come from other servers. - -The file can be created as follows: - - gpg --detach-sign --armor -o disk.xz.sig disk.xz - -=item C - -The SHA-512 checksum of the file specified in I is checked -after it is downloaded. To work out the signature, do: - - sha512sum disk.xz - -Note if you use this, you don’t need to sign the file, ie. don’t use -C. This option overrides C. - -=item C - -C is an alias for C. - -If you need to interoperate with virt-builder = 1.24.0 then you have -to use C because that version would give a parse error with -square brackets and numbers in the key of a field. This is fixed in -virt-builder E 1.24.1. - -=item C - -The revision is an integer which is used to control the template -cache. Increasing the revision number causes clients to download the -template again even if they have a copy in the cache. - -The revision number is optional. If omitted it defaults to C<1>. - -=item C - -=item C - -Specify the format of the disk image; in case it is compressed, that -is the format before the compression. If not given, the format is -autodetected, but generally it is better to be explicit about the -intended format. - -Note this is the source format, which is different from the -I<--format> option (requested output format). Virt-builder does -on-the-fly conversion from the source format to the requested output -format. - -=item C - -The virtual size of the image in bytes. This is the size of the image -when uncompressed. If using a non-raw format such as qcow2 then it -means the virtual disk size, not the size of the qcow2 file. - -This field is required. - -Virt-builder also uses this as the minimum size that users can request -via the I<--size> option, or as the default size if there is no -I<--size> option. - -=item C - -The actual size of the disk image in bytes, i.e. what was specified -in I. This is just used for information (when using C, -and C formats of I<--list>). - -=item C - -When expanding the image to its final size, instruct L -to expand the named partition in the guest image to fill up all -available space. This works like the virt-resize I<--expand> option. - -You should usually put the device name of the guest’s root filesystem here. - -It’s a good idea to use this, but not required. If the field is -omitted then virt-resize will create an extra partition at the end of -the disk to cover the free space, which is much less user-friendly. - -=item C - -When expanding the image to its final size, instruct L -to expand the named logical volume in the guest image to fill up all -available space. This works like the virt-resize I<--lv-expand> option. - -If the guest uses LVM2 you should usually put the LV of the guest’s -root filesystem here. If the guest does not use LVM2 or its root -filesystem is not on an LV, don't use this option. - -=item C - -Any notes that go with this image, especially notes describing what -packages are in the image, how the image was prepared, and licensing -information. - -This information is shown in the I<--notes> and I<--list> I<--long> modes. - -You can use multi-line notes here by indenting each new line with at -least one character of whitespace (even on blank lines): - - notes=This image was prepared using - the following kickstart script: - <-- one space at beginning of line - part /boot --fstype ext3 - ... - -=item C - -Using the hidden flag prevents the template from being listed by the -I<--list> option (but it is still installable). This is used for test -images. - -=item C - -This optional field specifies a list of aliases, separated by spaces, -for the image. For example, an alias could be used to always point -to the latest version of a certain image, leaving the old versions -available in the index instead of updating the same image (see the -C field). - -=back - -=head3 Running virt-builder against multiple sources - -It is possible to use multiple sources with virt-builder. -The recommended way is to deploy I<.conf> files pointing to the -index files. Another way is to specify the sources using -multiple I<--source> and/or I<--fingerprint> options: - - virt-builder \ - --source http://example.com/s1/index.asc \ - --source http://example.com/s2/index.asc - -You can provide N or 1 fingerprints. In the case where you -provide N fingerprints, N = number of sources and there is a 1-1 -correspondence between each source and each fingerprint: - - virt-builder \ - --source http://example.com/s1/index.asc --fingerprint '0123 ...' \ - --source http://example.com/s2/index.asc --fingerprint '9876 ...' - -In the case where you provide 1 fingerprint, the same fingerprint -is used for all sources. - -You C provide at least 1 fingerprint. - -=head3 Licensing of templates - -You should be aware of the licensing of images that you distribute. -For open source guests, provide a link to the source code in the -C field and comply with other requirements (eg. around -trademarks). - -=head3 Formal specification of the index file - -The index file format has a formal specification defined by the flex -scanner and bison parser used to parse the file. This can be found in -the following files in the libguestfs source tree: - - builder/index-scan.l - builder/index-parse.y - -A tool called L is available to validate the -index file to ensure it is correct. - -Note that the parser and tool can work on either the signed or -unsigned index file (ie. F or F). - -The index is always encoded in UTF-8. - -=head2 CACHING - -=head3 Caching templates - -Since the templates are usually very large, downloaded templates are -cached in the user’s home directory. - -The location of the cache is F<$XDG_CACHE_HOME/virt-builder/> or -F<$HOME/.cache/virt-builder>. - -You can print out information about the cache directory, including -which guests are currently cached, by doing: - - virt-builder --print-cache - -The cache can be deleted if you want to save space by doing: - - virt-builder --delete-cache - -You can download all (current) templates to the local cache by doing: - - virt-builder --cache-all-templates - -To disable the template cache, use I<--no-cache>. - -Only templates are cached. The index and detached digital signatures -are not cached. - -=head3 Caching packages - -Virt-builder uses L to download files and it also uses the -current C (etc) settings when installing packages -(I<--install>, I<--update>). - -You may therefore want to set those environment variables in order to -maximize the amount of local caching that happens. See -L and L. - -=head3 Local mirrors - -To increase both speed and reliability of installing packages, you can -set up a local mirror of the target distribution, and point the guest -package manager at that. - -=head4 Using a local mirror with Fedora - -To install a Fedora guest using a local mirror: - - virt-builder fedora-27 \ - --edit '/etc/yum.repos.d/fedora.repo: - s{.*baseurl=.*}{baseurl=http://example.com/mirror/}; - s{.*metalink=.*}{}; - ' \ - --edit '/etc/yum.repos.d/fedora-updates.repo: - s{.*baseurl=.*}{baseurl=http://example.com/mirror-updates/}; - s{.*metalink=.*}{}; - ' \ - --run-command 'dnf -y update' \ - --install 'pkg1,pkg2,...' - -=head4 Using a local mirror with Debian - -Assuming that you are using C to mirror the repository, you -should create a new F file to point to your proxy (see -L) and then do: - - virt-builder debian-8 \ - --upload sources.list:/etc/apt/sources.list \ - --run-command 'apt-get -y update' \ - --install 'pkg1,pkg2,...' - -=head2 DIGITAL SIGNATURES - -Virt-builder uses GNU Privacy Guard (GnuPG or gpg) to verify that the -index and templates have not been tampered with. - -The source points to an index file, which is optionally signed. - -Virt-builder downloads the index and checks that the signature is -valid and the signer’s fingerprint matches the specified fingerprint -(ie. the one specified in I in the I<.conf>, or with -I<--fingerprint>, in that order). - -For checking against the built-in public key/fingerprint, this -requires importing the public key into the user’s local gpg keyring -(that’s just the way that gpg works). - -When a template is downloaded, its signature is checked in the same -way. - -Although the signatures are optional, if you don’t have them then -virt-builder users will have to use I<--no-check-signature> on the -command line. This prevents an attacker from replacing the signed -index file with an unsigned index file and having virt-builder -silently work without checking the signature. In any case it is -highly recommended that you always create signed index and templates. - -=head2 ARCHITECTURE - -Virt-builder can build a guest for any architecture no matter what the -host architecture is. For example an x86-64 guest on an ARM host. - -However certain options may not work, specifically options -that require running commands in the guest during the build process: -I<--install>, I<--update>, I<--run>, I<--run-command>. You may need -to replace these with their firstboot-equivalents. - -An x86-64 host building 32 bit i686 guests should work without any -special steps. - -=head2 SECURITY - -Virt-builder does not need to run as root (in fact, should not be run -as root), and doesn't use setuid, C or any similar mechanism. - -I<--install>, I<--update>, I<--run> and I<--run-command> are -implemented using an appliance (a small virtual machine) so these -commands do not run on the host. If you are using the libguestfs -libvirt backend and have SELinux enabled then the virtual machine is -additionally encapsulated in an SELinux container (sVirt). - -However these options will have access to the host’s network and since -the template may contain untrusted code, the code might try to access -host network resources which it should not. You can use -I<--no-network> to prevent this. - -Firstboot commands run in the context of the guest when it is booted, -and so the security of your hypervisor / cloud should be considered. - -Virt-builder injects a random seed into every guest which it builds. -This helps to ensure that TCP sequence numbers, UUIDs, ssh host keys -etc are truly random when the guest boots. - -You should check digital signatures and not ignore any signing errors. - -=head2 CLONES - -If you wish to create many new guests of the same type, it is tempting -to run virt-builder once and then copy the output file. You should -B do this. You should run virt-builder once for each new guest -you need. - -The reason is that each clone needs to have (at least) a separate -random seed, and possibly other unique features (such as filesystem -UUIDs) in future versions of virt-builder. - -Another thing you should I do is to boot the guest, then clone -the booted disk image. The reason is that some guests create unique -machine IDs, SSH host keys and so on at first boot, and you would not -want clones to have duplicate identities. - -See also: L. - -=head2 PERFORMANCE - -The most important aspect of getting good performance is caching. -Templates gets downloaded into the cache the first time they are used, -or if you use the I<--cache-all-templates> option. See L -above for further information. - -Packages required for the I<--install> and I<--update> options are -downloaded using the host network connection. Setting the -C, C and C environment variables -to point to a local web cache may ensure they only need to be -downloaded once. You can also try using a local package repository, -although this can be complex to set up and varies according to which -Linux distro you are trying to install. - -=head3 Using I<--no-sync> - -Use I<--no-sync>. However read the caveats in the L section -above, since this can cause disk corruption if not used correctly. - -=head3 Skipping virt-resize - -Virt-builder can skip the virt-resize step under certain conditions. -This makes virt-builder much faster. The conditions are: - -=over 4 - -=item * - -the output must be a regular file (not a block device), B - -=item * - -the user did B use the I<--size> option, B - -=item * - -the output format is the same as the template format (usually raw). - -=back - -=head3 pxzcat - -Virt-builder uses an internal implementation of pxzcat (parallel -xzcat) if liblzma was found at build time. If liblzma was not found -at build time, regular C is used which is single-threaded. - -=head3 User-Mode Linux - -You can use virt-builder with the User-Mode Linux (UML) backend. This -may be faster when running virt-builder inside a virtual machine -(eg. in the cloud). - -To enable the UML backend, read the instructions in -L. - -Currently you have to use the I<--no-network> option. This should be -fixed in a future version. - -The qcow2 output format is not supported by UML. You can only create -raw-format guests. - -=head2 SELINUX - -Guests which use SELinux (such as Fedora and Red Hat Enterprise Linux) -require that each file has a correct SELinux label. - -Virt-builder does not know how to give new files a label, so there are -two possible strategies it can use to ensure correct labelling: - -=over 4 - -=item Using I<--selinux-relabel> - -This runs L just before finalizing the guest, which sets -SELinux labels correctly in the disk image. - -This is the recommended method. - -=item I<--touch> F - -Guest templates may already contain a file called F or -you may touch it. - -For guests that use SELinux, this causes L to run at -first boot. Guests will reboot themselves once the first time you use -them, which is normal and harmless. - -=back - -Please note that if your guest uses SELinux, and you are doing operations -on it which might create new files or change existing ones, you are -recommended to use I<--selinux-relabel>. This will help in making sure -that files have the right SELinux labels. - -=head1 MACHINE READABLE OUTPUT - -The I<--machine-readable> option can be used to make the output more -machine friendly, which is useful when calling virt-builder from other -programs, GUIs etc. - -Use the option on its own to query the capabilities of the -virt-builder binary. Typical output looks like this: - - $ virt-builder --machine-readable - virt-builder - arch - config-file - customize - json-list - pxzcat - -A list of features is printed, one per line, and the program exits -with status 0. - -It is possible to specify a format string for controlling the output; -see L. - -=head1 ENVIRONMENT VARIABLES - -For other environment variables which affect all libguestfs programs, -see L. - -=over 4 - -=item C - -=item C - -=item C - -Set the proxy for downloads. These environment variables (and more) -are actually interpreted by L, not virt-builder. - -=item C - -Used to determine the location of the template cache, and the location -of the user' sources. See L and L. - -=item C - -This can point to the directory containing data files used for Windows -firstboot installation. - -Normally you do not need to set this. If not set, a compiled-in -default will be used (something like F). - -This directory may contain the following files: - -=over 4 - -=item F - -This is the RHSrvAny Windows binary, used to install a "firstboot" -script in Windows guests. It is required if you intend to use the -I<--firstboot> or I<--firstboot-command> options with Windows guests. - -See also: C - -=item F - -This is a Windows binary shipped with SUSE VMDP, used to install a "firstboot" -script in Windows guests. It is required if you intend to use the -I<--firstboot> or I<--firstboot-command> options with Windows guests. - -=back - -=item C - -Used to determine the location of the template cache. See L. - -=item C - -Used to determine the location of the user' sources. See -L. - -=item C - -Used to determine the location of the system sources. See -L. - -=back - -=head1 EXIT STATUS - -This program returns 0 if successful, or non-zero if there was an -error. - -=head1 SEE ALSO - -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L. - -=head1 AUTHOR - -Richard W.M. Jones L - -=head1 COPYRIGHT - -Copyright (C) 2013 Red Hat Inc. diff --git a/builder/virt-index-validate.pod b/builder/virt-index-validate.pod deleted file mode 100644 index 7a033e304..000000000 --- a/builder/virt-index-validate.pod +++ /dev/null @@ -1,90 +0,0 @@ -=head1 NAME - -virt-index-validate - Validate virt-builder index file - -=head1 SYNOPSIS - - virt-index-validate index - -=head1 DESCRIPTION - -L uses an index file to store metadata about templates -that it knows how to use. This index file has a specific format which -virt-index-validate knows how to validate. - -Note that virt-index-validate can validate either the signed or -unsigned index file (ie. either F or F). It can -only validate a local file, not a URL. - -=head1 OPTIONS - -=over 4 - -=item B<--compat-1.24.0> - -Check for compatibility with virt-builder 1.24.0. (Using this option -implies I<--compat-1.24.1>, so you don't need to use both.) - -In particular: - -=over 4 - -=item * - -This version of virt-builder could not handle C<[...]> -(square brackets) in field names (eg. C). - -=item * - -It required detached signatures (C). - -=back - -=item B<--compat-1.24.1> - -Check for compatibility with virt-builder E 1.24.1. - -In particular: - -=over 4 - -=item * - -This version of virt-builder could not handle C<.> (period) in field -names or C<,> (comma) in subfield names. - -=item * - -It could not handle comments appearing in the file. - -=back - -=item B<--help> - -Display help. - -=item B<-V> - -=item B<--version> - -Display version number and exit. - -=back - -=head1 EXIT STATUS - -This program returns 0 if the index file validates, or non-zero if -there was an error. - -=head1 SEE ALSO - -L, -L. - -=head1 AUTHOR - -Richard W.M. Jones L - -=head1 COPYRIGHT - -Copyright (C) 2013 Red Hat Inc. diff --git a/cat/Makefile.am b/cat/Makefile.am deleted file mode 100644 index f6253fbff..000000000 --- a/cat/Makefile.am +++ /dev/null @@ -1,272 +0,0 @@ -# libguestfs virt-cat, virt-filesystems, virt-log, virt-ls and virt-tail. -# Copyright (C) 2010-2020 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. - -include $(top_srcdir)/subdir-rules.mk - -EXTRA_DIST = \ - test-docs.sh \ - test-virt-cat.sh \ - virt-cat.pod \ - test-virt-filesystems.sh \ - virt-filesystems.pod \ - test-virt-log.sh \ - virt-log.pod \ - test-virt-ls.sh \ - virt-ls.pod \ - test-virt-tail.sh \ - virt-tail.pod - -bin_PROGRAMS = virt-cat virt-filesystems virt-log virt-ls virt-tail - -virt_cat_SOURCES = \ - cat.c - -virt_cat_CPPFLAGS = \ - -DGUESTFS_NO_DEPRECATED=1 \ - -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ - -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ - -I$(top_srcdir)/lib -I$(top_builddir)/lib \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ - -I$(srcdir)/../gnulib/lib -I../gnulib/lib - -virt_cat_CFLAGS = \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - $(LIBXML2_CFLAGS) - -virt_cat_LDADD = \ - $(top_builddir)/common/options/liboptions.la \ - $(top_builddir)/common/windows/libwindows.la \ - $(top_builddir)/common/structs/libstructs.la \ - $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/lib/libguestfs.la \ - $(LIBXML2_LIBS) \ - $(LIBVIRT_LIBS) \ - $(LTLIBINTL) \ - ../gnulib/lib/libgnu.la - -virt_filesystems_SOURCES = \ - filesystems.c - -virt_filesystems_CPPFLAGS = \ - -DGUESTFS_NO_DEPRECATED=1 \ - -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ - -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ - -I$(top_srcdir)/lib -I$(top_builddir)/lib \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ - -I$(srcdir)/../gnulib/lib -I../gnulib/lib - -virt_filesystems_CFLAGS = \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - $(LIBXML2_CFLAGS) - -virt_filesystems_LDADD = \ - $(top_builddir)/common/options/liboptions.la \ - $(top_builddir)/common/windows/libwindows.la \ - $(top_builddir)/common/structs/libstructs.la \ - $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/lib/libguestfs.la \ - $(LIBXML2_LIBS) \ - $(LIBVIRT_LIBS) \ - $(LTLIBINTL) \ - ../gnulib/lib/libgnu.la - -virt_log_SOURCES = \ - log.c - -virt_log_CPPFLAGS = \ - -DGUESTFS_NO_DEPRECATED=1 \ - -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ - -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ - -I$(top_srcdir)/lib -I$(top_builddir)/lib \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ - -I$(srcdir)/../gnulib/lib -I../gnulib/lib - -virt_log_CFLAGS = \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - $(LIBXML2_CFLAGS) - -virt_log_LDADD = \ - $(top_builddir)/common/options/liboptions.la \ - $(top_builddir)/common/structs/libstructs.la \ - $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/lib/libguestfs.la \ - $(LIBXML2_LIBS) \ - $(LIBVIRT_LIBS) \ - $(LTLIBINTL) \ - ../gnulib/lib/libgnu.la - -virt_ls_SOURCES = \ - ls.c - -virt_ls_CPPFLAGS = \ - -DGUESTFS_NO_DEPRECATED=1 \ - -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ - -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ - -I$(top_srcdir)/lib -I$(top_builddir)/lib \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/common/visit \ - -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ - -I$(srcdir)/../gnulib/lib -I../gnulib/lib - -virt_ls_CFLAGS = \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - $(LIBXML2_CFLAGS) - -virt_ls_LDADD = \ - $(top_builddir)/common/options/liboptions.la \ - $(top_builddir)/common/visit/libvisit.la \ - $(top_builddir)/common/structs/libstructs.la \ - $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/lib/libguestfs.la \ - $(LIBXML2_LIBS) \ - $(LIBVIRT_LIBS) \ - $(LTLIBINTL) \ - ../gnulib/lib/libgnu.la - -virt_tail_SOURCES = \ - tail.c - -virt_tail_CPPFLAGS = \ - -DGUESTFS_NO_DEPRECATED=1 \ - -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ - -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ - -I$(top_srcdir)/lib -I$(top_builddir)/lib \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ - -I$(srcdir)/../gnulib/lib -I../gnulib/lib - -virt_tail_CFLAGS = \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - $(LIBXML2_CFLAGS) - -virt_tail_LDADD = \ - $(top_builddir)/common/options/liboptions.la \ - $(top_builddir)/common/windows/libwindows.la \ - $(top_builddir)/common/structs/libstructs.la \ - $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/lib/libguestfs.la \ - $(LIBXML2_LIBS) \ - $(LIBVIRT_LIBS) \ - $(LTLIBINTL) \ - ../gnulib/lib/libgnu.la - -# Manual pages and HTML files for the website. -man_MANS = virt-cat.1 virt-filesystems.1 virt-log.1 virt-ls.1 virt-tail.1 - -noinst_DATA = \ - $(top_builddir)/website/virt-cat.1.html \ - $(top_builddir)/website/virt-filesystems.1.html \ - $(top_builddir)/website/virt-log.1.html \ - $(top_builddir)/website/virt-ls.1.html \ - $(top_builddir)/website/virt-tail.1.html - -virt-cat.1 $(top_builddir)/website/virt-cat.1.html: stamp-virt-cat.pod - -stamp-virt-cat.pod: virt-cat.pod - $(PODWRAPPER) \ - --man virt-cat.1 \ - --html $(top_builddir)/website/virt-cat.1.html \ - --path $(top_srcdir)/common/options \ - --license GPLv2+ \ - --warning safe \ - $< - touch $@ - -virt-filesystems.1 $(top_builddir)/website/virt-filesystems.1.html: stamp-virt-filesystems.pod - -stamp-virt-filesystems.pod: virt-filesystems.pod - $(PODWRAPPER) \ - --man virt-filesystems.1 \ - --html $(top_builddir)/website/virt-filesystems.1.html \ - --path $(top_srcdir)/common/options \ - --license GPLv2+ \ - --warning safe \ - $< - touch $@ - -virt-log.1 $(top_builddir)/website/virt-log.1.html: stamp-virt-log.pod - -stamp-virt-log.pod: virt-log.pod - $(PODWRAPPER) \ - --man virt-log.1 \ - --html $(top_builddir)/website/virt-log.1.html \ - --path $(top_srcdir)/common/options \ - --license GPLv2+ \ - --warning safe \ - $< - touch $@ - -virt-ls.1 $(top_builddir)/website/virt-ls.1.html: stamp-virt-ls.pod - -stamp-virt-ls.pod: virt-ls.pod - $(PODWRAPPER) \ - --man virt-ls.1 \ - --html $(top_builddir)/website/virt-ls.1.html \ - --path $(top_srcdir)/common/options \ - --license GPLv2+ \ - --warning safe \ - $< - touch $@ - -virt-tail.1 $(top_builddir)/website/virt-tail.1.html: stamp-virt-tail.pod - -stamp-virt-tail.pod: virt-tail.pod - $(PODWRAPPER) \ - --man virt-tail.1 \ - --html $(top_builddir)/website/virt-tail.1.html \ - --path $(top_srcdir)/common/options \ - --license GPLv2+ \ - --warning safe \ - $< - touch $@ - -# Tests. - -TESTS_ENVIRONMENT = $(top_builddir)/run --test - -TESTS = \ - test-docs.sh - -if ENABLE_APPLIANCE -TESTS += \ - test-virt-cat.sh \ - test-virt-filesystems.sh \ - test-virt-log.sh \ - test-virt-ls.sh \ - test-virt-tail.sh -endif ENABLE_APPLIANCE - -check-valgrind: - $(MAKE) VG="@VG@" check - -check-valgrind-local-guests: - for g in $(GUESTS); do \ - $(top_builddir)/run --test @VG@ virt-filesystems -c "$(libvirt_ro_uri)" -d "$$g" --all --long -h --uuid || exit $$?; \ - done diff --git a/cat/cat.c b/cat/cat.c deleted file mode 100644 index a968640ce..000000000 --- a/cat/cat.c +++ /dev/null @@ -1,314 +0,0 @@ -/* virt-cat - * Copyright (C) 2010-2012 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "getprogname.h" - -#include "guestfs.h" -#include "options.h" -#include "display-options.h" -#include "windows.h" - -/* Currently open libguestfs handle. */ -guestfs_h *g; - -int read_only = 1; -int live = 0; -int verbose = 0; -int keys_from_stdin = 0; -int echo_keys = 0; -const char *libvirt_uri = NULL; -int inspector = 1; -int in_guestfish = 0; -int in_virt_rescue = 0; - -static int do_cat (int argc, char *argv[]); - -static void __attribute__((noreturn)) -usage (int status) -{ - if (status != EXIT_SUCCESS) - fprintf (stderr, _("Try ‘%s --help’ for more information.\n"), - getprogname ()); - else { - printf (_("%s: display files in a virtual machine\n" - "Copyright (C) 2010 Red Hat Inc.\n" - "Usage:\n" - " %s [--options] -d domname file [file ...]\n" - " %s [--options] -a disk.img [-a disk.img ...] file [file ...]\n" - "Options:\n" - " -a|--add image Add image\n" - " --blocksize[=512|4096]\n" - " Set sector size of the disk for -a option\n" - " -c|--connect uri Specify libvirt URI for -d option\n" - " -d|--domain guest Add disks from libvirt guest\n" - " --echo-keys Don't turn off echo for passphrases\n" - " --format[=raw|..] Force disk format for -a option\n" - " --help Display brief help\n" - " --key selector Specify a LUKS key\n" - " --keys-from-stdin Read passphrases from stdin\n" - " -m|--mount dev[:mnt[:opts[:fstype]]]\n" - " Mount dev on mnt (if omitted, /)\n" - " -v|--verbose Verbose messages\n" - " -V|--version Display version and exit\n" - " -x Trace libguestfs API calls\n" - "For more information, see the manpage %s(1).\n"), - getprogname (), getprogname (), - getprogname (), getprogname ()); - } - exit (status); -} - -int -main (int argc, char *argv[]) -{ - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEBASEDIR); - textdomain (PACKAGE); - - enum { HELP_OPTION = CHAR_MAX + 1 }; - - static const char options[] = "a:c:d:m:vVx"; - static const struct option long_options[] = { - { "add", 1, 0, 'a' }, - { "blocksize", 2, 0, 0 }, - { "connect", 1, 0, 'c' }, - { "domain", 1, 0, 'd' }, - { "echo-keys", 0, 0, 0 }, - { "format", 2, 0, 0 }, - { "help", 0, 0, HELP_OPTION }, - { "key", 1, 0, 0 }, - { "keys-from-stdin", 0, 0, 0 }, - { "long-options", 0, 0, 0 }, - { "mount", 1, 0, 'm' }, - { "short-options", 0, 0, 0 }, - { "verbose", 0, 0, 'v' }, - { "version", 0, 0, 'V' }, - { 0, 0, 0, 0 } - }; - struct drv *drvs = NULL; - struct drv *drv; - struct mp *mps = NULL; - struct mp *mp; - char *p; - const char *format = NULL; - bool format_consumed = true; - int blocksize = 0; - bool blocksize_consumed = true; - int c; - int r; - int option_index; - struct key_store *ks = NULL; - - g = guestfs_create (); - if (g == NULL) - error (EXIT_FAILURE, errno, "guestfs_create"); - - for (;;) { - c = getopt_long (argc, argv, options, long_options, &option_index); - if (c == -1) break; - - switch (c) { - case 0: /* options which are long only */ - if (STREQ (long_options[option_index].name, "long-options")) - display_long_options (long_options); - else if (STREQ (long_options[option_index].name, "short-options")) - display_short_options (options); - else if (STREQ (long_options[option_index].name, "keys-from-stdin")) { - keys_from_stdin = 1; - } else if (STREQ (long_options[option_index].name, "echo-keys")) { - echo_keys = 1; - } else if (STREQ (long_options[option_index].name, "format")) { - OPTION_format; - } else if (STREQ (long_options[option_index].name, "blocksize")) { - OPTION_blocksize; - } else if (STREQ (long_options[option_index].name, "key")) { - OPTION_key; - } else - error (EXIT_FAILURE, 0, - _("unknown long option: %s (%d)"), - long_options[option_index].name, option_index); - break; - - case 'a': - OPTION_a; - break; - - case 'c': - OPTION_c; - break; - - case 'd': - OPTION_d; - break; - - case 'm': - OPTION_m; - inspector = 0; - break; - - case 'v': - OPTION_v; - break; - - case 'V': - OPTION_V; - break; - - case 'x': - OPTION_x; - break; - - case HELP_OPTION: - usage (EXIT_SUCCESS); - - default: - usage (EXIT_FAILURE); - } - } - - /* Old-style syntax? There were no -a or -d options in the old - * virt-cat which is how we detect this. - */ - if (drvs == NULL) { - /* argc - 1 because last parameter is the single filename. */ - while (optind < argc - 1) { - if (strchr (argv[optind], '/') || - access (argv[optind], F_OK) == 0) { /* simulate -a option */ - drv = calloc (1, sizeof (struct drv)); - if (!drv) - error (EXIT_FAILURE, errno, "calloc"); - drv->type = drv_a; - drv->a.filename = strdup (argv[optind]); - if (!drv->a.filename) - error (EXIT_FAILURE, errno, "strdup"); - drv->next = drvs; - drvs = drv; - } else { /* simulate -d option */ - drv = calloc (1, sizeof (struct drv)); - if (!drv) - error (EXIT_FAILURE, errno, "calloc"); - drv->type = drv_d; - drv->d.guest = argv[optind]; - drv->next = drvs; - drvs = drv; - } - - optind++; - } - } - - /* These are really constants, but they have to be variables for the - * options parsing code. Assert here that they have known-good - * values. - */ - assert (read_only == 1); - assert (inspector == 1 || mps != NULL); - assert (live == 0); - - /* User must specify at least one filename on the command line. */ - if (optind >= argc || argc - optind < 1) - usage (EXIT_FAILURE); - - CHECK_OPTION_format_consumed; - CHECK_OPTION_blocksize_consumed; - - /* User must have specified some drives. */ - if (drvs == NULL) { - fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"), - getprogname ()); - usage (EXIT_FAILURE); - } - - /* Add drives, inspect and mount. */ - add_drives (drvs); - - if (guestfs_launch (g) == -1) - exit (EXIT_FAILURE); - - if (mps != NULL) - mount_mps (mps); - else - inspect_mount (); - - /* Free up data structures, no longer needed after this point. */ - free_drives (drvs); - free_mps (mps); - free_key_store (ks); - - r = do_cat (argc - optind, &argv[optind]); - - guestfs_close (g); - - exit (r == 0 ? EXIT_SUCCESS : EXIT_FAILURE); -} - -static int -do_cat (int argc, char *argv[]) -{ - unsigned errors = 0; - int windows = 0; - int i; - char *root; - CLEANUP_FREE_STRING_LIST char **roots = NULL; - - if (inspector) { - /* Get root mountpoint. See: fish/inspect.c:inspect_mount */ - roots = guestfs_inspect_get_roots (g); - - assert (roots); - assert (roots[0] != NULL); - assert (roots[1] == NULL); - root = roots[0]; - - /* Windows? Special handling is required. */ - windows = is_windows (g, root); - } - - for (i = 0; i < argc; ++i) { - CLEANUP_FREE char *filename_to_free = NULL; - const char *filename = argv[i]; - - if (windows) { - filename = filename_to_free = windows_path (g, root, filename, - 1 /* readonly */); - if (filename == NULL) { - errors++; - continue; - } - } - - if (guestfs_download (g, filename, "/dev/stdout") == -1) - errors++; - } - - return errors == 0 ? 0 : -1; -} diff --git a/cat/filesystems.c b/cat/filesystems.c deleted file mode 100644 index 2b95d3112..000000000 --- a/cat/filesystems.c +++ /dev/null @@ -1,1100 +0,0 @@ -/* virt-filesystems - * Copyright (C) 2010-2012 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "c-ctype.h" -#include "human.h" -#include "intprops.h" -#include "getprogname.h" - -#include "guestfs.h" -#include "structs-cleanups.h" -#include "options.h" -#include "display-options.h" - -/* These globals are shared with options.c. */ -guestfs_h *g; - -int read_only = 1; -int live = 0; -int verbose = 0; -int keys_from_stdin = 0; -int echo_keys = 0; -const char *libvirt_uri = NULL; -int inspector = 0; -int in_guestfish = 0; -int in_virt_rescue = 0; - -static int csv = 0; /* --csv */ -static int human = 0; /* --human-readable|-h */ - -/* What is selected for output. */ -#define OUTPUT_FILESYSTEMS 1 -#define OUTPUT_FILESYSTEMS_EXTRA 2 -#define OUTPUT_PARTITIONS 4 -#define OUTPUT_BLOCKDEVS 8 -#define OUTPUT_LVS 16 -#define OUTPUT_VGS 32 -#define OUTPUT_PVS 64 -#define OUTPUT_ALL INT_MAX -static int output = 0; - -/* What columns to output. This is in display order. */ -#define COLUMN_NAME 1 /* always shown */ -#define COLUMN_TYPE 2 -#define COLUMN_VFS_TYPE 4 /* if --filesystems */ -#define COLUMN_VFS_LABEL 8 /* if --filesystems */ -#define COLUMN_MBR 16 -#define COLUMN_SIZE 32 /* bytes, or human-readable if -h */ -#define COLUMN_PARENTS 64 -#define COLUMN_UUID 128 /* if --uuid */ -#define NR_COLUMNS 8 -static int columns; - -static void do_output_title (void); -static void do_output (void); -static void do_output_end (void); - -static struct guestfs_lvm_pv_list *get_pvs (void); -static void free_pvs (void); - -static void __attribute__((noreturn)) -usage (int status) -{ - if (status != EXIT_SUCCESS) - fprintf (stderr, _("Try ‘%s --help’ for more information.\n"), - getprogname ()); - else { - printf (_("%s: list filesystems, partitions, block devices, LVM in a VM\n" - "Copyright (C) 2010 Red Hat Inc.\n" - "Usage:\n" - " %s [--options] -d domname\n" - " %s [--options] -a disk.img [-a disk.img ...]\n" - "Options:\n" - " -a|--add image Add image\n" - " --all Display everything\n" - " --blkdevs|--block-devices\n" - " Display block devices\n" - " --blocksize[=512|4096]\n" - " Set sector size of the disk for -a option\n" - " -c|--connect uri Specify libvirt URI for -d option\n" - " --csv Output as Comma-Separated Values\n" - " -d|--domain guest Add disks from libvirt guest\n" - " --echo-keys Don't turn off echo for passphrases\n" - " --extra Display swap and data filesystems\n" - " --filesystems Display mountable filesystems\n" - " --format[=raw|..] Force disk format for -a option\n" - " -h|--human-readable Human-readable sizes in --long output\n" - " --help Display brief help\n" - " --keys-from-stdin Read passphrases from stdin\n" - " -l|--long Long output\n" - " --lvs|--logvols|--logical-volumes\n" - " Display LVM logical volumes\n" - " --no-title No title in --long output\n" - " --parts|--partitions Display partitions\n" - " --pvs|--physvols|--physical-volumes\n" - " Display LVM physical volumes\n" - " --uuid|--uuids Add UUIDs to --long output\n" - " -v|--verbose Verbose messages\n" - " -V|--version Display version and exit\n" - " --vgs|--volgroups|--volume-groups\n" - " Display LVM volume groups\n" - " -x Trace libguestfs API calls\n" - "For more information, see the manpage %s(1).\n"), - getprogname (), getprogname (), - getprogname (), getprogname ()); - } - exit (status); -} - -int -main (int argc, char *argv[]) -{ - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEBASEDIR); - textdomain (PACKAGE); - - enum { HELP_OPTION = CHAR_MAX + 1 }; - - static const char options[] = "a:c:d:hlvVx"; - static const struct option long_options[] = { - { "add", 1, 0, 'a' }, - { "all", 0, 0, 0 }, - { "blkdevs", 0, 0, 0 }, - { "block-devices", 0, 0, 0 }, - { "blocksize", 2, 0, 0 }, - { "connect", 1, 0, 'c' }, - { "csv", 0, 0, 0 }, - { "domain", 1, 0, 'd' }, - { "echo-keys", 0, 0, 0 }, - { "extra", 0, 0, 0 }, - { "filesystems", 0, 0, 0 }, - { "format", 2, 0, 0 }, - { "help", 0, 0, HELP_OPTION }, - { "human-readable", 0, 0, 'h' }, - { "keys-from-stdin", 0, 0, 0 }, - { "logical-volumes", 0, 0, 0 }, - { "logvols", 0, 0, 0 }, - { "long", 0, 0, 'l' }, - { "long-options", 0, 0, 0 }, - { "lvs", 0, 0, 0 }, - { "no-title", 0, 0, 0 }, - { "parts", 0, 0, 0 }, - { "partitions", 0, 0, 0 }, - { "physical-volumes", 0, 0, 0 }, - { "physvols", 0, 0, 0 }, - { "pvs", 0, 0, 0 }, - { "short-options", 0, 0, 0 }, - { "uuid", 0, 0, 0 }, - { "uuids", 0, 0, 0 }, - { "verbose", 0, 0, 'v' }, - { "version", 0, 0, 'V' }, - { "vgs", 0, 0, 0 }, - { "volgroups", 0, 0, 0 }, - { "volume-groups", 0, 0, 0 }, - { 0, 0, 0, 0 } - }; - struct drv *drvs = NULL; - const char *format = NULL; - bool format_consumed = true; - int blocksize = 0; - bool blocksize_consumed = true; - int c; - int option_index; - int no_title = 0; /* --no-title */ - int long_mode = 0; /* --long|-l */ - int uuid = 0; /* --uuid */ - int title; - - g = guestfs_create (); - if (g == NULL) - error (EXIT_FAILURE, errno, "guestfs_create"); - - for (;;) { - c = getopt_long (argc, argv, options, long_options, &option_index); - if (c == -1) break; - - switch (c) { - case 0: /* options which are long only */ - if (STREQ (long_options[option_index].name, "long-options")) - display_long_options (long_options); - else if (STREQ (long_options[option_index].name, "short-options")) - display_short_options (options); - else if (STREQ (long_options[option_index].name, "keys-from-stdin")) { - keys_from_stdin = 1; - } else if (STREQ (long_options[option_index].name, "echo-keys")) { - echo_keys = 1; - } else if (STREQ (long_options[option_index].name, "format")) { - OPTION_format; - } else if (STREQ (long_options[option_index].name, "blocksize")) { - OPTION_blocksize; - } else if (STREQ (long_options[option_index].name, "all")) { - output = OUTPUT_ALL; - } else if (STREQ (long_options[option_index].name, "blkdevs") || - STREQ (long_options[option_index].name, "block-devices")) { - output |= OUTPUT_BLOCKDEVS; - } else if (STREQ (long_options[option_index].name, "csv")) { - csv = 1; - } else if (STREQ (long_options[option_index].name, "extra")) { - output |= OUTPUT_FILESYSTEMS; - output |= OUTPUT_FILESYSTEMS_EXTRA; - } else if (STREQ (long_options[option_index].name, "filesystems")) { - output |= OUTPUT_FILESYSTEMS; - } else if (STREQ (long_options[option_index].name, "logical-volumes") || - STREQ (long_options[option_index].name, "logvols") || - STREQ (long_options[option_index].name, "lvs")) { - output |= OUTPUT_LVS; - } else if (STREQ (long_options[option_index].name, "no-title")) { - no_title = 1; - } else if (STREQ (long_options[option_index].name, "parts") || - STREQ (long_options[option_index].name, "partitions")) { - output |= OUTPUT_PARTITIONS; - } else if (STREQ (long_options[option_index].name, "physical-volumes") || - STREQ (long_options[option_index].name, "physvols") || - STREQ (long_options[option_index].name, "pvs")) { - output |= OUTPUT_PVS; - } else if (STREQ (long_options[option_index].name, "uuid") || - STREQ (long_options[option_index].name, "uuids")) { - uuid = 1; - } else if (STREQ (long_options[option_index].name, "vgs") || - STREQ (long_options[option_index].name, "volgroups") || - STREQ (long_options[option_index].name, "volume-groups")) { - output |= OUTPUT_VGS; - } else - error (EXIT_FAILURE, 0, - _("unknown long option: %s (%d)"), - long_options[option_index].name, option_index); - break; - - case 'a': - OPTION_a; - break; - - case 'c': - OPTION_c; - break; - - case 'd': - OPTION_d; - break; - - case 'h': - human = 1; - break; - - case 'l': - long_mode = 1; - break; - - case 'v': - OPTION_v; - break; - - case 'V': - OPTION_V; - break; - - case 'x': - OPTION_x; - break; - - case HELP_OPTION: - usage (EXIT_SUCCESS); - - default: - usage (EXIT_FAILURE); - } - } - - /* These are really constants, but they have to be variables for the - * options parsing code. Assert here that they have known-good - * values. - */ - assert (read_only == 1); - assert (inspector == 0); - assert (live == 0); - - /* Must be no extra arguments on the command line. */ - if (optind != argc) { - fprintf (stderr, _("%s: error: extra argument ‘%s’ on command line.\n" - "Make sure to specify the argument for --format " - "like '--format=%s'.\n"), - getprogname (), argv[optind], argv[optind]); - usage (EXIT_FAILURE); - } - - CHECK_OPTION_format_consumed; - CHECK_OPTION_blocksize_consumed; - - /* -h and --csv doesn't make sense. Spreadsheets will corrupt these - * fields. (RHBZ#600977). - */ - if (human && csv) - error (EXIT_FAILURE, 0, - _("you cannot use -h and --csv options together.")); - - /* Nothing selected for output, means --filesystems is implied. */ - if (output == 0) - output = OUTPUT_FILESYSTEMS; - - /* What columns will be displayed? */ - columns = COLUMN_NAME; - if (long_mode) { - columns |= COLUMN_TYPE; - columns |= COLUMN_SIZE; - if ((output & OUTPUT_FILESYSTEMS)) { - columns |= COLUMN_VFS_TYPE; - columns |= COLUMN_VFS_LABEL; - } - columns |= COLUMN_PARENTS; - if ((output & OUTPUT_PARTITIONS)) - columns |= COLUMN_MBR; - if (uuid) - columns |= COLUMN_UUID; - } - - /* Display title by default only in long mode. */ - title = long_mode; - if (no_title) - title = 0; - - /* User must have specified some drives. */ - if (drvs == NULL) { - fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"), - getprogname ()); - usage (EXIT_FAILURE); - } - - /* Add drives. */ - add_drives (drvs); - - if (guestfs_launch (g) == -1) - exit (EXIT_FAILURE); - - /* Free up data structures, no longer needed after this point. */ - free_drives (drvs); - - if (title) - do_output_title (); - do_output (); - do_output_end (); - - free_pvs (); - - guestfs_close (g); - - exit (EXIT_SUCCESS); -} - -static void do_output_filesystems (void); -static void do_output_lvs (void); -static void do_output_vgs (void); -static void do_output_pvs (void); -static void do_output_partitions (void); -static void do_output_blockdevs (void); - -static void write_row (const char *name, const char *type, const char *vfs_type, const char *vfs_label, int mbr_id, int64_t size, char **parents, const char *uuid); -static void write_row_strings (char **strings, size_t len); - -static char **no_parents (void); -static int is_md (char *device); -static char **parents_of_md (char *device); -static char **parents_of_vg (char *vg); - -static void -do_output_title (void) -{ - const char *headings[NR_COLUMNS]; - size_t len = 0; - - /* NB. These strings are not localized and must not contain spaces. */ - if ((columns & COLUMN_NAME)) - headings[len++] = "Name"; - if ((columns & COLUMN_TYPE)) - headings[len++] = "Type"; - if ((columns & COLUMN_VFS_TYPE)) - headings[len++] = "VFS"; - if ((columns & COLUMN_VFS_LABEL)) - headings[len++] = "Label"; - if ((columns & COLUMN_MBR)) - headings[len++] = "MBR"; - if ((columns & COLUMN_SIZE)) - headings[len++] = "Size"; - if ((columns & COLUMN_PARENTS)) - headings[len++] = "Parent"; - if ((columns & COLUMN_UUID)) - headings[len++] = "UUID"; - assert (len <= NR_COLUMNS); - - write_row_strings ((char **) headings, len); -} - -static void -do_output (void) -{ - /* The ordering here is trying to be most specific -> least specific, - * although that is not required or guaranteed. - */ - if ((output & OUTPUT_FILESYSTEMS)) - do_output_filesystems (); - - if ((output & OUTPUT_LVS)) - do_output_lvs (); - - if ((output & OUTPUT_VGS)) - do_output_vgs (); - - if ((output & OUTPUT_PVS)) - do_output_pvs (); - - if ((output & OUTPUT_PARTITIONS)) - do_output_partitions (); - - if ((output & OUTPUT_BLOCKDEVS)) - do_output_blockdevs (); -} - -static void -do_output_filesystems (void) -{ - size_t i; - - CLEANUP_FREE_STRING_LIST char **fses = guestfs_list_filesystems (g); - if (fses == NULL) - exit (EXIT_FAILURE); - - for (i = 0; fses[i] != NULL; i += 2) { - CLEANUP_FREE char *dev = NULL, *vfs_label = NULL, *vfs_uuid = NULL; - CLEANUP_FREE_STRING_LIST char **parents = NULL; - int64_t size = -1; - - /* Skip swap and unknown, unless --extra flag was given. */ - if (!(output & OUTPUT_FILESYSTEMS_EXTRA) && - (STREQ (fses[i+1], "swap") || STREQ (fses[i+1], "unknown"))) - continue; - - dev = guestfs_canonical_device_name (g, fses[i]); - if (dev == NULL) - exit (EXIT_FAILURE); - - /* Only bother to look these up if we will be displaying them, - * otherwise pass them as NULL. - */ - if ((columns & COLUMN_VFS_LABEL)) { - guestfs_push_error_handler (g, NULL, NULL); - vfs_label = guestfs_vfs_label (g, fses[i]); - guestfs_pop_error_handler (g); - if (vfs_label == NULL) { - vfs_label = strdup (""); - if (!vfs_label) - error (EXIT_FAILURE, errno, "strdup"); - } - } - if ((columns & COLUMN_UUID)) { - guestfs_push_error_handler (g, NULL, NULL); - vfs_uuid = guestfs_vfs_uuid (g, fses[i]); - guestfs_pop_error_handler (g); - if (vfs_uuid == NULL) { - vfs_uuid = strdup (""); - if (!vfs_uuid) - error (EXIT_FAILURE, errno, "strdup"); - } - } - if ((columns & COLUMN_SIZE)) { - CLEANUP_FREE char *device = guestfs_mountable_device (g, fses[i]); - CLEANUP_FREE char *subvolume = NULL; - - guestfs_push_error_handler (g, NULL, NULL); - - subvolume = guestfs_mountable_subvolume (g, fses[i]); - if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) { - fprintf (stderr, - _("%s: cannot determine the subvolume for %s: %s: %s\n"), - getprogname (), fses[i], - guestfs_last_error (g), - strerror (guestfs_last_errno (g))); - exit (EXIT_FAILURE); - } - - guestfs_pop_error_handler (g); - - if (!device || !subvolume) { - /* Try mounting and stating the device. This might reasonably - * fail, so don't show errors. - */ - guestfs_push_error_handler (g, NULL, NULL); - - if (guestfs_mount_ro (g, fses[i], "/") == 0) { - CLEANUP_FREE_STATVFS struct guestfs_statvfs *stat = NULL; - - stat = guestfs_statvfs (g, "/"); - size = stat->blocks * stat->bsize; - guestfs_umount_all (g); - } else { - size = guestfs_blockdev_getsize64 (g, fses[i]); - } - - guestfs_pop_error_handler (g); - - if (size == -1) - exit (EXIT_FAILURE); - } - } - - if (is_md (fses[i])) - parents = parents_of_md (fses[i]); - else - parents = no_parents (); - - write_row (dev, "filesystem", - fses[i+1], vfs_label, -1, size, parents, vfs_uuid); - } -} - -static void -do_output_lvs (void) -{ - size_t i; - - CLEANUP_FREE_STRING_LIST char **lvs = guestfs_lvs (g); - if (lvs == NULL) - exit (EXIT_FAILURE); - - for (i = 0; lvs[i] != NULL; ++i) { - CLEANUP_FREE char *uuid = NULL, *parent_name = NULL; - const char *parents[2]; - int64_t size = -1; - - if ((columns & COLUMN_SIZE)) { - size = guestfs_blockdev_getsize64 (g, lvs[i]); - if (size == -1) - exit (EXIT_FAILURE); - } - if ((columns & COLUMN_UUID)) { - uuid = guestfs_lvuuid (g, lvs[i]); - if (uuid == NULL) - exit (EXIT_FAILURE); - } - if ((columns & COLUMN_PARENTS)) { - parent_name = strdup (lvs[i]); - if (parent_name == NULL) - error (EXIT_FAILURE, errno, "strdup"); - char *p = strrchr (parent_name, '/'); - if (p) - *p = '\0'; - parents[0] = parent_name; - parents[1] = NULL; - } - - write_row (lvs[i], "lv", - NULL, NULL, -1, size, (char **) parents, uuid); - } -} - -static void -do_output_vgs (void) -{ - size_t i; - - CLEANUP_FREE_LVM_VG_LIST struct guestfs_lvm_vg_list *vgs = - guestfs_vgs_full (g); - if (vgs == NULL) - exit (EXIT_FAILURE); - - for (i = 0; i < vgs->len; ++i) { - CLEANUP_FREE char *name = NULL; - char uuid[33]; - CLEANUP_FREE_STRING_LIST char **parents = NULL; - - if (asprintf (&name, "/dev/%s", vgs->val[i].vg_name) == -1) - error (EXIT_FAILURE, errno, "asprintf"); - - memcpy (uuid, vgs->val[i].vg_uuid, 32); - uuid[32] = '\0'; - - parents = parents_of_vg (vgs->val[i].vg_name); - - write_row (name, "vg", - NULL, NULL, -1, (int64_t) vgs->val[i].vg_size, parents, uuid); - } -} - -/* Cache the output of guestfs_pvs_full, since we use it in a few places. */ -static struct guestfs_lvm_pv_list *pvs_ = NULL; - -static struct guestfs_lvm_pv_list * -get_pvs (void) -{ - if (pvs_) - return pvs_; - - pvs_ = guestfs_pvs_full (g); - if (pvs_ == NULL) - exit (EXIT_FAILURE); - - return pvs_; -} - -static void -free_pvs (void) -{ - if (pvs_) - guestfs_free_lvm_pv_list (pvs_); - - pvs_ = NULL; -} - -static void -do_output_pvs (void) -{ - size_t i; - struct guestfs_lvm_pv_list *pvs = get_pvs (); - - for (i = 0; i < pvs->len; ++i) { - char uuid[33]; - const char *parents[1] = { NULL }; - - CLEANUP_FREE char *dev = - guestfs_canonical_device_name (g, pvs->val[i].pv_name); - if (!dev) - exit (EXIT_FAILURE); - - memcpy (uuid, pvs->val[i].pv_uuid, 32); - uuid[32] = '\0'; - write_row (dev, "pv", - NULL, NULL, -1, (int64_t) pvs->val[i].pv_size, - (char **) parents, uuid); - } -} - -static int -get_mbr_id (const char *dev, const char *parent_name) -{ - CLEANUP_FREE char *parttype = NULL; - int mbr_id = -1, partnum; - - guestfs_push_error_handler (g, NULL, NULL); - - parttype = guestfs_part_get_parttype (g, parent_name); - - if (parttype && STREQ (parttype, "msdos")) { - partnum = guestfs_part_to_partnum (g, dev); - if (partnum >= 0) - mbr_id = guestfs_part_get_mbr_id (g, parent_name, partnum); - } - - guestfs_pop_error_handler (g); - - return mbr_id; -} - -static void -do_output_partitions (void) -{ - size_t i; - - CLEANUP_FREE_STRING_LIST char **parts = guestfs_list_partitions (g); - if (parts == NULL) - exit (EXIT_FAILURE); - - for (i = 0; parts[i] != NULL; ++i) { - CLEANUP_FREE char *dev = NULL, *parent_name = NULL, *canonical_name = NULL; - const char *parents[2]; - int64_t size = -1; - int mbr_id = -1; - - dev = guestfs_canonical_device_name (g, parts[i]); - if (!dev) - exit (EXIT_FAILURE); - - if ((columns & COLUMN_SIZE)) { - size = guestfs_blockdev_getsize64 (g, parts[i]); - if (size == -1) - exit (EXIT_FAILURE); - } - if ((columns & COLUMN_PARENTS)) { - parent_name = guestfs_part_to_dev (g, parts[i]); - if (parent_name == NULL) - exit (EXIT_FAILURE); - - if ((columns & COLUMN_MBR)) - mbr_id = get_mbr_id (parts[i], parent_name); - - canonical_name = guestfs_canonical_device_name (g, parent_name); - if (!canonical_name) - exit (EXIT_FAILURE); - - parents[0] = canonical_name; - parents[1] = NULL; - } - - write_row (dev, "partition", - NULL, NULL, mbr_id, size, (char **) parents, NULL); - } -} - -static void -do_output_blockdevs (void) -{ - size_t i; - - CLEANUP_FREE_STRING_LIST char **devices = guestfs_list_devices (g); - if (devices == NULL) - exit (EXIT_FAILURE); - - for (i = 0; devices[i] != NULL; ++i) { - int64_t size = -1; - CLEANUP_FREE_STRING_LIST char **parents = NULL; - CLEANUP_FREE char *dev = NULL; - - dev = guestfs_canonical_device_name (g, devices[i]); - if (!dev) - exit (EXIT_FAILURE); - - if ((columns & COLUMN_SIZE)) { - size = guestfs_blockdev_getsize64 (g, devices[i]); - if (size == -1) - exit (EXIT_FAILURE); - } - - if (is_md (devices[i])) - parents = parents_of_md (devices[i]); - else - parents = no_parents (); - - write_row (dev, "device", - NULL, NULL, -1, size, parents, NULL); - } -} - -/* Returns an empty list of parents. Note this must be freed. */ -static char ** -no_parents (void) -{ - char **ret; - - ret = malloc (sizeof (char *)); - if (!ret) - error (EXIT_FAILURE, errno, "malloc"); - - ret[0] = NULL; - - return ret; -} - -/* XXX Should be a better test than this. */ -static int -is_md (char *device) -{ - char *p; - - if (!STRPREFIX (device, "/dev/md")) - return 0; - - p = device + 7; - while (*p) { - if (!c_isdigit (*p)) - return 0; - p++; - } - - return 1; -} - -static char ** -parents_of_md (char *device) -{ - char **ret; - size_t i; - - CLEANUP_FREE_MDSTAT_LIST struct guestfs_mdstat_list *stats = - guestfs_md_stat (g, device); - if (!stats) - exit (EXIT_FAILURE); - - ret = malloc ((stats->len + 1) * sizeof (char *)); - if (!ret) - error (EXIT_FAILURE, errno, "malloc"); - - for (i = 0; i < stats->len; ++i) { - ret[i] = guestfs_canonical_device_name (g, stats->val[i].mdstat_device); - if (!ret[i]) - exit (EXIT_FAILURE); - } - - ret[stats->len] = NULL; - - return ret; -} - -/* Specialized PV UUID comparison function. - * pvuuid1: from vgpvuuids, this may contain '-' characters which - * should be ignored. - * pvuuid2: from pvs-full, this is 32 characters long and NOT - * terminated by \0 - */ -static int -compare_pvuuids (const char *pvuuid1, const char *pvuuid2) -{ - size_t i; - const char *p = pvuuid1; - - for (i = 0; i < 32; ++i) { - while (*p && !c_isalnum (*p)) - p++; - if (!*p) - return 0; - if (*p != pvuuid2[i]) - return 0; - } - - return 1; -} - -static char ** -parents_of_vg (char *vg) -{ - struct guestfs_lvm_pv_list *pvs = get_pvs (); - char **ret; - size_t n, i, j; - - CLEANUP_FREE_STRING_LIST char **pvuuids = guestfs_vgpvuuids (g, vg); - if (!pvuuids) - exit (EXIT_FAILURE); - - n = guestfs_int_count_strings (pvuuids); - - ret = malloc ((n + 1) * sizeof (char *)); - if (!ret) - error (EXIT_FAILURE, errno, "malloc"); - - /* Resolve each PV UUID back to a PV. */ - for (i = 0; i < n; ++i) { - for (j = 0; j < pvs->len; ++j) { - if (compare_pvuuids (pvuuids[i], pvs->val[j].pv_uuid) == 0) - break; - } - - if (j < pvs->len) { - ret[i] = guestfs_canonical_device_name (g, pvs->val[j].pv_name); - if (!ret[i]) - exit (EXIT_FAILURE); - } - else { - fprintf (stderr, "%s: warning: unknown PV UUID ignored\n", __func__); - ret[i] = strndup (pvuuids[i], 32); - if (!ret[i]) - error (EXIT_FAILURE, errno, "strndup"); - } - } - - ret[i] = NULL; - - return ret; -} - -static void -write_row (const char *name, const char *type, - const char *vfs_type, const char *vfs_label, int mbr_id, - int64_t size, char **parents, const char *uuid) -{ - const char *strings[NR_COLUMNS]; - CLEANUP_FREE char *parents_str = NULL; - size_t len = 0; - char hum[LONGEST_HUMAN_READABLE]; - char num[256]; - char mbr_id_str[INT_BUFSIZE_BOUND (mbr_id)]; - - if ((columns & COLUMN_NAME)) - strings[len++] = name; - if ((columns & COLUMN_TYPE)) - strings[len++] = type; - if ((columns & COLUMN_VFS_TYPE)) - strings[len++] = vfs_type; - if ((columns & COLUMN_VFS_LABEL)) - strings[len++] = vfs_label; - if ((columns & COLUMN_MBR)) { - if (mbr_id >= 0) { - snprintf (mbr_id_str, sizeof mbr_id_str, "%02x", (unsigned) mbr_id); - strings[len++] = mbr_id_str; - } else - strings[len++] = NULL; - } - if ((columns & COLUMN_SIZE)) { - if (size >= 0) { - if (human) { - strings[len++] = - human_readable ((uintmax_t) size, hum, - human_round_to_nearest|human_autoscale| - human_base_1024|human_SI, - 1, 1); - } - else { - snprintf (num, sizeof num, "%" PRIi64, size); - strings[len++] = num; - } - } - else - strings[len++] = NULL; - } - if ((columns & COLUMN_PARENTS)) { - /* Internally comma-separated field. */ - parents_str = guestfs_int_join_strings (",", parents); - strings[len++] = parents_str; - } - if ((columns & COLUMN_UUID)) - strings[len++] = uuid; - assert (len <= NR_COLUMNS); - - write_row_strings ((char **) strings, len); -} - -static void add_row (char **strings, size_t len); -static void write_csv_field (const char *field); - -static void -write_row_strings (char **strings, size_t len) -{ - if (!csv) { - /* Text mode. Because we want the columns to line up, we can't - * output directly, but instead need to save up the rows and - * output them at the end. - */ - add_row (strings, len); - } - else { /* CSV mode: output it directly, quoted */ - size_t i; - - for (i = 0; i < len; ++i) { - if (i > 0) - putchar (','); - if (strings[i] != NULL) - write_csv_field (strings[i]); - } - putchar ('\n'); - } -} - -/* Function to quote CSV fields on output without requiring an - * external module. - */ -static void -write_csv_field (const char *field) -{ - size_t i, len; - int needs_quoting = 0; - - len = strlen (field); - - for (i = 0; i < len; ++i) { - if (field[i] == ' ' || field[i] == '"' || - field[i] == '\n' || field[i] == ',') { - needs_quoting = 1; - break; - } - } - - if (!needs_quoting) { - printf ("%s", field); - return; - } - - /* Quoting for CSV fields. */ - putchar ('"'); - for (i = 0; i < len; ++i) { - if (field[i] == '"') { - putchar ('"'); - putchar ('"'); - } else - putchar (field[i]); - } - putchar ('"'); -} - -/* This code is only used in text mode (non-CSV output). */ -static char ***rows = NULL; -static size_t nr_rows = 0; -static size_t max_width[NR_COLUMNS]; - -static void -add_row (char **strings, size_t len) -{ - size_t i, slen; - char **row; - - assert (len <= NR_COLUMNS); - - row = malloc (sizeof (char *) * len); - if (row == NULL) - error (EXIT_FAILURE, errno, "malloc"); - - for (i = 0; i < len; ++i) { - if (strings[i]) { - row[i] = strdup (strings[i]); - if (row[i] == NULL) - error (EXIT_FAILURE, errno, "strdup"); - - /* Keep a running total of the max width of each column. */ - slen = strlen (strings[i]); - if (slen == 0) - slen = 1; /* because "" is printed as "-" */ - if (slen > max_width[i]) - max_width[i] = slen; - } - else - row[i] = NULL; - } - - rows = realloc (rows, sizeof (char **) * (nr_rows + 1)); - if (rows == NULL) - error (EXIT_FAILURE, errno, "realloc"); - rows[nr_rows] = row; - nr_rows++; -} - -/* In text mode we saved up all the output so that we can print the - * columns aligned. - */ -static void -do_output_end (void) -{ - size_t i, j, k, len, space_btwn; - - if (csv) - return; - - /* How much space between columns? Try 2 spaces between columns, but - * if that just pushes us over 72 columns, use 1 space. - */ - space_btwn = 2; - i = 0; - for (j = 0; j < NR_COLUMNS; ++j) - i += max_width[j] + space_btwn; - if (i > 72) - space_btwn = 1; - - for (i = 0; i < nr_rows; ++i) { - char **row = rows[i]; - - k = 0; - - for (j = 0; j < NR_COLUMNS; ++j) { - /* Ignore columns which are completely empty. This also deals - * with the fact that we didn't remember the length of each row - * in add_row above. - */ - if (max_width[j] == 0) - continue; - - while (k) { - putchar (' '); - k--; - } - - if (row[j] == NULL || STREQ (row[j], "")) { - printf ("-"); - len = 1; - } else { - printf ("%s", row[j]); - len = strlen (row[j]); - } - free (row[j]); - - assert (len <= max_width[j]); - k = max_width[j] - len + space_btwn; - } - - putchar ('\n'); - free (row); - } - free (rows); -} diff --git a/cat/log.c b/cat/log.c deleted file mode 100644 index 4d2cd49e0..000000000 --- a/cat/log.c +++ /dev/null @@ -1,504 +0,0 @@ -/* virt-log - * Copyright (C) 2010-2020 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "getprogname.h" - -#include "guestfs.h" -#include "structs-cleanups.h" -#include "options.h" -#include "display-options.h" - -/* Currently open libguestfs handle. */ -guestfs_h *g; - -int read_only = 1; -int live = 0; -int verbose = 0; -int keys_from_stdin = 0; -int echo_keys = 0; -const char *libvirt_uri = NULL; -int inspector = 1; -int in_guestfish = 0; -int in_virt_rescue = 0; - -#define JOURNAL_DIR "/var/log/journal" - -static int do_log (void); -static int do_log_journal (void); -static int do_log_text_file (const char *filename); -static int do_log_windows_evtx (void); - -static void __attribute__((noreturn)) -usage (int status) -{ - if (status != EXIT_SUCCESS) - fprintf (stderr, _("Try ‘%s --help’ for more information.\n"), - getprogname ()); - else { - printf (_("%s: display log files in a virtual machine\n" - "Copyright (C) 2010-2020 Red Hat Inc.\n" - "Usage:\n" - " %s [--options] -d domname\n" - " %s [--options] -a disk.img [-a disk.img ...]\n" - "Options:\n" - " -a|--add image Add image\n" - " --blocksize[=512|4096]\n" - " Set sector size of the disk for -a option\n" - " -c|--connect uri Specify libvirt URI for -d option\n" - " -d|--domain guest Add disks from libvirt guest\n" - " --echo-keys Don't turn off echo for passphrases\n" - " --format[=raw|..] Force disk format for -a option\n" - " --help Display brief help\n" - " --key selector Specify a LUKS key\n" - " --keys-from-stdin Read passphrases from stdin\n" - " -v|--verbose Verbose messages\n" - " -V|--version Display version and exit\n" - " -x Trace libguestfs API calls\n" - "For more information, see the manpage %s(1).\n"), - getprogname (), getprogname (), - getprogname (), getprogname ()); - } - exit (status); -} - -int -main (int argc, char *argv[]) -{ - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEBASEDIR); - textdomain (PACKAGE); - - enum { HELP_OPTION = CHAR_MAX + 1 }; - - static const char options[] = "a:c:d:vVx"; - static const struct option long_options[] = { - { "add", 1, 0, 'a' }, - { "blocksize", 2, 0, 0 }, - { "connect", 1, 0, 'c' }, - { "domain", 1, 0, 'd' }, - { "echo-keys", 0, 0, 0 }, - { "format", 2, 0, 0 }, - { "help", 0, 0, HELP_OPTION }, - { "key", 1, 0, 0 }, - { "keys-from-stdin", 0, 0, 0 }, - { "long-options", 0, 0, 0 }, - { "short-options", 0, 0, 0 }, - { "verbose", 0, 0, 'v' }, - { "version", 0, 0, 'V' }, - { 0, 0, 0, 0 } - }; - struct drv *drvs = NULL; - const char *format = NULL; - bool format_consumed = true; - int blocksize = 0; - bool blocksize_consumed = true; - int c; - int r; - int option_index; - struct key_store *ks = NULL; - - g = guestfs_create (); - if (g == NULL) - error (EXIT_FAILURE, errno, "guestfs_create"); - - for (;;) { - c = getopt_long (argc, argv, options, long_options, &option_index); - if (c == -1) break; - - switch (c) { - case 0: /* options which are long only */ - if (STREQ (long_options[option_index].name, "long-options")) - display_long_options (long_options); - else if (STREQ (long_options[option_index].name, "short-options")) - display_short_options (options); - else if (STREQ (long_options[option_index].name, "keys-from-stdin")) { - keys_from_stdin = 1; - } else if (STREQ (long_options[option_index].name, "echo-keys")) { - echo_keys = 1; - } else if (STREQ (long_options[option_index].name, "format")) { - OPTION_format; - } else if (STREQ (long_options[option_index].name, "blocksize")) { - OPTION_blocksize; - } else if (STREQ (long_options[option_index].name, "key")) { - OPTION_key; - } else - error (EXIT_FAILURE, 0, - _("unknown long option: %s (%d)"), - long_options[option_index].name, option_index); - break; - - case 'a': - OPTION_a; - break; - - case 'c': - OPTION_c; - break; - - case 'd': - OPTION_d; - break; - - case 'v': - OPTION_v; - break; - - case 'V': - OPTION_V; - break; - - case 'x': - OPTION_x; - break; - - case HELP_OPTION: - usage (EXIT_SUCCESS); - - default: - usage (EXIT_FAILURE); - } - } - - /* These are really constants, but they have to be variables for the - * options parsing code. Assert here that they have known-good - * values. - */ - assert (read_only == 1); - assert (inspector == 1); - assert (live == 0); - - /* User must not specify more arguments on the command line. */ - if (optind != argc) { - fprintf (stderr, _("%s: error: extra argument ‘%s’ on command line.\n" - "Make sure to specify the argument for --format " - "like '--format=%s'.\n"), - getprogname (), argv[optind], argv[optind]); - usage (EXIT_FAILURE); - } - - CHECK_OPTION_format_consumed; - CHECK_OPTION_blocksize_consumed; - - /* User must have specified some drives. */ - if (drvs == NULL) { - fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"), - getprogname ()); - usage (EXIT_FAILURE); - } - - /* Add drives, inspect and mount. Note that inspector is always true, - * and there is no -m option. - */ - add_drives (drvs); - - if (guestfs_launch (g) == -1) - exit (EXIT_FAILURE); - - inspect_mount (); - - /* Free up data structures, no longer needed after this point. */ - free_drives (drvs); - free_key_store (ks); - - r = do_log (); - - guestfs_close (g); - - exit (r == 0 ? EXIT_SUCCESS : EXIT_FAILURE); -} - -static int -do_log (void) -{ - CLEANUP_FREE_STRING_LIST char **roots = NULL; - char *root; - CLEANUP_FREE char *type = NULL; - CLEANUP_FREE_STRING_LIST char **journal_files = NULL; - - /* Get root mountpoint. fish/inspect.c guarantees the assertions - * below. - */ - roots = guestfs_inspect_get_roots (g); - assert (roots); - assert (roots[0] != NULL); - assert (roots[1] == NULL); - root = roots[0]; - - type = guestfs_inspect_get_type (g, root); - if (!type) - return -1; - - /* Windows needs special handling. */ - if (STREQ (type, "windows")) { - if (guestfs_inspect_get_major_version (g, root) >= 6) - return do_log_windows_evtx (); - - fprintf (stderr, - _("%s: Windows Event Log for pre-Vista guests is not supported.\n"), - getprogname ()); - return -1; - } - - /* systemd journal? */ - guestfs_push_error_handler (g, NULL, NULL); - journal_files = guestfs_ls (g, JOURNAL_DIR); - guestfs_pop_error_handler (g); - if (STREQ (type, "linux") && - journal_files != NULL && journal_files[0] != NULL) - return do_log_journal (); - - /* Regular /var/log text files with different names. */ - if (STRNEQ (type, "windows")) { - const char *logfiles[] = { "/var/log/syslog", "/var/log/messages", NULL }; - size_t i; - - for (i = 0; logfiles[i] != NULL; ++i) { - if (guestfs_is_file_opts (g, logfiles[i], - GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, - -1) == 1) - return do_log_text_file (logfiles[i]); - } - } - - /* Otherwise, there are no log files. Hmm, is this right? XXX */ - return 0; -} - -/* Find the value of the named field from the list of attributes. If - * not found, returns NULL (not an error). If found, returns a - * pointer to the field, and the length of the field. NOTE: The field - * is NOT \0-terminated, so you have to print it using "%.*s". - * - * There may be multiple fields with the same name. In this case, the - * function returns the first entry. - */ -static const char * -get_journal_field (const struct guestfs_xattr_list *xattrs, const char *name, - size_t *len_rtn) -{ - uint32_t i; - - for (i = 0; i < xattrs->len; ++i) { - if (STREQ (name, xattrs->val[i].attrname)) { - *len_rtn = xattrs->val[i].attrval_len; - return xattrs->val[i].attrval; - } - } - - return NULL; /* not found */ -} - -static const char *const log_level_table[] = { - [LOG_EMERG] = "emerg", - [LOG_ALERT] = "alert", - [LOG_CRIT] = "crit", - [LOG_ERR] = "err", - [LOG_WARNING] = "warning", - [LOG_NOTICE] = "notice", - [LOG_INFO] = "info", - [LOG_DEBUG] = "debug" -}; - -static int -do_log_journal (void) -{ - int r; - unsigned errors = 0; - - if (guestfs_journal_open (g, JOURNAL_DIR) == -1) - return -1; - - while ((r = guestfs_journal_next (g)) > 0) { - CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL; - const char *priority_str, *identifier, *comm, *pid, *message; - size_t priority_len, identifier_len, comm_len = 0, pid_len, message_len; - int priority = LOG_INFO; - int64_t ts; - - /* The question is what fields to display. We should probably - * make this configurable, but for now use the "short" format from - * journalctl. (XXX) - */ - - xattrs = guestfs_journal_get (g); - if (xattrs == NULL) - return -1; - - ts = guestfs_journal_get_realtime_usec (g); /* error checked below */ - - priority_str = get_journal_field (xattrs, "PRIORITY", &priority_len); - //hostname = get_journal_field (xattrs, "_HOSTNAME", &hostname_len); - identifier = get_journal_field (xattrs, "SYSLOG_IDENTIFIER", - &identifier_len); - comm = get_journal_field (xattrs, "_COMM", &comm_len); - pid = get_journal_field (xattrs, "_PID", &pid_len); - message = get_journal_field (xattrs, "MESSAGE", &message_len); - - /* Timestamp. */ - if (ts >= 0) { - char buf[64]; - time_t t = ts / 1000000; - struct tm tm; - - if (strftime (buf, sizeof buf, "%b %d %H:%M:%S", - localtime_r (&t, &tm)) <= 0) { - fprintf (stderr, _("%s: could not format journal entry timestamp\n"), - getprogname ()); - errors++; - continue; - } - fputs (buf, stdout); - } - - /* Hostname. */ - /* We don't print this because it is assumed each line from the - * guest will have the same hostname. (XXX) - */ - //if (hostname) - // printf (" %.*s", (int) hostname_len, hostname); - - /* Identifier. */ - if (identifier) - printf (" %.*s", (int) identifier_len, identifier); - else if (comm) - printf (" %.*s", (int) comm_len, comm); - - /* PID */ - if (pid) - printf ("[%.*s]", (int) pid_len, pid); - - /* Log level. */ - if (priority_str && *priority_str >= '0' && *priority_str <= '7') - priority = *priority_str - '0'; - - printf (" %s:", log_level_table[priority]); - - /* Message. */ - if (message) - printf (" %.*s", (int) message_len, message); - - printf ("\n"); - } - if (r == -1) /* error from guestfs_journal_next */ - return -1; - - if (guestfs_journal_close (g) == -1) - return -1; - - return errors > 0 ? -1 : 0; -} - -static int -do_log_text_file (const char *filename) -{ - return guestfs_download (g, filename, "/dev/stdout"); -} - -/* For Windows >= Vista, if evtxdump.py is installed then we can - * use it to dump the System.evtx log. - */ -static int -do_log_windows_evtx (void) -{ - CLEANUP_FREE char *filename = NULL; - CLEANUP_FREE char *tmpdir = guestfs_get_tmpdir (g); - CLEANUP_UNLINK_FREE char *localfile = NULL; - CLEANUP_FREE char *cmd = NULL; - char dev_fd[64]; - int fd, status; - - if (system ("evtxdump.py -h >/dev/null 2>&1") != 0) { - fprintf (stderr, _("%s: you need to install ‘evtxdump.py’ (from the python-evtx package)\n" - "in order to parse Windows Event Logs. If you cannot install this, then\n" - "use virt-copy-out(1) to copy the contents of /Windows/System32/winevt/Logs\n" - "from this guest, and examine in a binary file viewer.\n"), - getprogname ()); - return -1; - } - - /* Check if System.evtx exists. XXX Allow the filename to be - * configurable, since there are many logs. - */ - filename = guestfs_case_sensitive_path (g, "/Windows/System32/winevt/Logs/System.evtx"); - if (filename == NULL) - return -1; - - /* Note that guestfs_case_sensitive_path does NOT check for existence. */ - if (guestfs_is_file_opts (g, filename, - GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, - -1) <= 0) { - fprintf (stderr, _("%s: Windows Event Log file (%s) not found\n"), - getprogname (), filename); - return -1; - } - - /* Download the file to a temporary. Python-evtx wants to mmap - * the file so we cannot use a pipe. - */ - if (asprintf (&localfile, "%s/virtlogXXXXXX", tmpdir) == -1) { - perror ("asprintf"); - return -1; - } - if ((fd = mkstemp (localfile)) == -1) { - perror ("mkstemp"); - return -1; - } - - snprintf (dev_fd, sizeof dev_fd, "/dev/fd/%d", fd); - - if (guestfs_download (g, filename, dev_fd) == -1) - return -1; - close (fd); - - /* This should be safe as long as $TMPDIR is not set to something wild. */ - if (asprintf (&cmd, "evtxdump.py '%s'", localfile) == -1) { - perror ("asprintf"); - return -1; - } - - status = system (cmd); - if (status) { - char buf[256]; - fprintf (stderr, "%s: %s\n", - getprogname (), - guestfs_int_exit_status_to_string (status, "evtxdump.py", - buf, sizeof buf)); - return -1; - } - - return 0; -} diff --git a/cat/ls.c b/cat/ls.c deleted file mode 100644 index c113bcaa2..000000000 --- a/cat/ls.c +++ /dev/null @@ -1,770 +0,0 @@ -/* virt-ls - * Copyright (C) 2010-2012 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if MAJOR_IN_MKDEV -#include -#elif MAJOR_IN_SYSMACROS -#include -#else -#include -#endif - -#include "human.h" -#include "getprogname.h" - -#include "guestfs.h" - -#include "options.h" -#include "display-options.h" -#include "guestfs-utils.h" -#include "visit.h" - -/* Currently open libguestfs handle. */ -guestfs_h *g; - -int read_only = 1; -int live = 0; -int verbose = 0; -int keys_from_stdin = 0; -int echo_keys = 0; -const char *libvirt_uri = NULL; -int inspector = 1; -int in_guestfish = 0; -int in_virt_rescue = 0; - -static int csv = 0; -static int human = 0; -static int enable_uids = 0; -static int enable_times = 0; -static int time_t_output = 0; -static int time_relative = 0; /* 1 = seconds, 2 = days */ -static int enable_extra_stats = 0; -static const char *checksum = NULL; - -static time_t now; - -static int do_ls (const char *dir); -static int do_ls_l (const char *dir); -static int do_ls_R (const char *dir); -static int do_ls_lR (const char *dir); - -static void output_start_line (void); -static void output_end_line (void); -static void output_int64 (int64_t); -static void output_int64_dev (int64_t); -static void output_int64_perms (int64_t); -static void output_int64_size (int64_t); -static void output_int64_time (int64_t secs, int64_t nsecs); -static void output_int64_uid (int64_t); -static void output_string (const char *); -static void output_string_link (const char *); - -static void __attribute__((noreturn)) -usage (int status) -{ - if (status != EXIT_SUCCESS) - fprintf (stderr, _("Try ‘%s --help’ for more information.\n"), - getprogname ()); - else { - printf (_("%s: list files in a virtual machine\n" - "Copyright (C) 2010-2012 Red Hat Inc.\n" - "Usage:\n" - " %s [--options] -d domname dir [dir ...]\n" - " %s [--options] -a disk.img [-a disk.img ...] dir [dir ...]\n" - "Options:\n" - " -a|--add image Add image\n" - " --blocksize[=512|4096]\n" - " Set sector size of the disk for -a option\n" - " --checksum[=...] Display file checksums\n" - " -c|--connect uri Specify libvirt URI for -d option\n" - " --csv Comma-Separated Values output\n" - " -d|--domain guest Add disks from libvirt guest\n" - " --echo-keys Don't turn off echo for passphrases\n" - " --extra-stats Display extra stats\n" - " --format[=raw|..] Force disk format for -a option\n" - " --help Display brief help\n" - " -h|--human-readable Human-readable sizes in output\n" - " --key selector Specify a LUKS key\n" - " --keys-from-stdin Read passphrases from stdin\n" - " -l|--long Long listing\n" - " -m|--mount dev[:mnt[:opts[:fstype]]]\n" - " Mount dev on mnt (if omitted, /)\n" - " -R|--recursive Recursive listing\n" - " --times Display file times\n" - " --time-days Display file times as days before now\n" - " --time-relative Display file times as seconds before now\n" - " --time-t Display file times as time_t's\n" - " --uids Display UID, GID\n" - " -v|--verbose Verbose messages\n" - " -V|--version Display version and exit\n" - " -x Trace libguestfs API calls\n" - "For more information, see the manpage %s(1).\n"), - getprogname (), getprogname (), - getprogname (), getprogname ()); - } - exit (status); -} - -int -main (int argc, char *argv[]) -{ - /* Current time for --time-days, --time-relative output. */ - time (&now); - - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEBASEDIR); - textdomain (PACKAGE); - - enum { HELP_OPTION = CHAR_MAX + 1 }; - - static const char options[] = "a:c:d:hlm:RvVx"; - static const struct option long_options[] = { - { "add", 1, 0, 'a' }, - { "blocksize", 2, 0, 0 }, - { "checksum", 2, 0, 0 }, - { "checksums", 2, 0, 0 }, - { "csv", 0, 0, 0 }, - { "connect", 1, 0, 'c' }, - { "domain", 1, 0, 'd' }, - { "echo-keys", 0, 0, 0 }, - { "extra-stat", 0, 0, 0 }, - { "extra-stats", 0, 0, 0 }, - { "format", 2, 0, 0 }, - { "help", 0, 0, HELP_OPTION }, - { "human-readable", 0, 0, 'h' }, - { "key", 1, 0, 0 }, - { "keys-from-stdin", 0, 0, 0 }, - { "long", 0, 0, 'l' }, - { "long-options", 0, 0, 0 }, - { "mount", 1, 0, 'm' }, - { "recursive", 0, 0, 'R' }, - { "short-options", 0, 0, 0 }, - { "time", 0, 0, 0 }, - { "times", 0, 0, 0 }, - { "time-days", 0, 0, 0 }, - { "time-relative", 0, 0, 0 }, - { "time-t", 0, 0, 0 }, - { "uid", 0, 0, 0 }, - { "uids", 0, 0, 0 }, - { "verbose", 0, 0, 'v' }, - { "version", 0, 0, 'V' }, - { 0, 0, 0, 0 } - }; - struct drv *drvs = NULL; - struct drv *drv; - struct mp *mps = NULL; - struct mp *mp; - char *p; - const char *format = NULL; - bool format_consumed = true; - int blocksize = 0; - bool blocksize_consumed = true; - int c; - int option_index; -#define MODE_LS_L 1 -#define MODE_LS_R 2 -#define MODE_LS_LR (MODE_LS_L|MODE_LS_R) - int mode = 0; - struct key_store *ks = NULL; - - g = guestfs_create (); - if (g == NULL) - error (EXIT_FAILURE, errno, "guestfs_create"); - - for (;;) { - c = getopt_long (argc, argv, options, long_options, &option_index); - if (c == -1) break; - - switch (c) { - case 0: /* options which are long only */ - if (STREQ (long_options[option_index].name, "long-options")) - display_long_options (long_options); - else if (STREQ (long_options[option_index].name, "short-options")) - display_short_options (options); - else if (STREQ (long_options[option_index].name, "keys-from-stdin")) { - keys_from_stdin = 1; - } else if (STREQ (long_options[option_index].name, "echo-keys")) { - echo_keys = 1; - } else if (STREQ (long_options[option_index].name, "format")) { - OPTION_format; - } else if (STREQ (long_options[option_index].name, "blocksize")) { - OPTION_blocksize; - } else if (STREQ (long_options[option_index].name, "checksum") || - STREQ (long_options[option_index].name, "checksums")) { - if (!optarg || STREQ (optarg, "")) - checksum = "md5"; - else - checksum = optarg; - } else if (STREQ (long_options[option_index].name, "csv")) { - csv = 1; - } else if (STREQ (long_options[option_index].name, "extra-stat") || - STREQ (long_options[option_index].name, "extra-stats")) { - enable_extra_stats = 1; - } else if (STREQ (long_options[option_index].name, "time") || - STREQ (long_options[option_index].name, "times")) { - enable_times = 1; - } else if (STREQ (long_options[option_index].name, "time-t")) { - enable_times = 1; - time_t_output = 1; - } else if (STREQ (long_options[option_index].name, "time-relative")) { - enable_times = 1; - time_t_output = 1; - time_relative = 1; - } else if (STREQ (long_options[option_index].name, "time-days")) { - enable_times = 1; - time_t_output = 1; - time_relative = 2; - } else if (STREQ (long_options[option_index].name, "uid") || - STREQ (long_options[option_index].name, "uids")) { - enable_uids = 1; - } else if (STREQ (long_options[option_index].name, "key")) { - OPTION_key; - } else - error (EXIT_FAILURE, 0, - _("unknown long option: %s (%d)"), - long_options[option_index].name, option_index); - break; - - case 'a': - OPTION_a; - break; - - case 'c': - OPTION_c; - break; - - case 'd': - OPTION_d; - break; - - case 'h': - human = 1; - break; - - case 'l': - mode |= MODE_LS_L; - break; - - case 'm': - OPTION_m; - inspector = 0; - break; - - case 'R': - mode |= MODE_LS_R; - break; - - case 'v': - OPTION_v; - break; - - case 'V': - OPTION_V; - break; - - case 'x': - OPTION_x; - break; - - case HELP_OPTION: - usage (EXIT_SUCCESS); - - default: - usage (EXIT_FAILURE); - } - } - - /* Old-style syntax? There were no -a or -d options in the old - * virt-ls which is how we detect this. - */ - if (drvs == NULL) { - /* argc - 1 because last parameter is the single directory name. */ - while (optind < argc - 1) { - if (strchr (argv[optind], '/') || - access (argv[optind], F_OK) == 0) { /* simulate -a option */ - drv = calloc (1, sizeof (struct drv)); - if (!drv) - error (EXIT_FAILURE, errno, "calloc"); - drv->type = drv_a; - drv->a.filename = strdup (argv[optind]); - if (!drv->a.filename) - error (EXIT_FAILURE, errno, "strdup"); - drv->next = drvs; - drvs = drv; - } else { /* simulate -d option */ - drv = calloc (1, sizeof (struct drv)); - if (!drv) - error (EXIT_FAILURE, errno, "calloc"); - drv->type = drv_d; - drv->d.guest = argv[optind]; - drv->next = drvs; - drvs = drv; - } - - optind++; - } - } - - /* These are really constants, but they have to be variables for the - * options parsing code. Assert here that they have known-good - * values. - */ - assert (read_only == 1); - assert (inspector == 1 || mps != NULL); - assert (live == 0); - - CHECK_OPTION_format_consumed; - CHECK_OPTION_blocksize_consumed; - - /* Many flags only apply to -lR mode. */ - if (mode != MODE_LS_LR && - (csv || human || enable_uids || enable_times || enable_extra_stats || - checksum)) - error (EXIT_FAILURE, 0, - _("used a flag which can only be combined with -lR mode\nFor more information, read the virt-ls(1) man page.")); - - /* CSV && human is unsafe because spreadsheets fail to parse these - * fields correctly. (RHBZ#600977). - */ - if (human && csv) - error (EXIT_FAILURE, 0, - _("you cannot use -h and --csv options together.")); - - /* User must specify at least one directory name on the command line. */ - if (optind >= argc || argc - optind < 1) - usage (EXIT_FAILURE); - - /* User must have specified some drives. */ - if (drvs == NULL) { - fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"), - getprogname ()); - usage (EXIT_FAILURE); - } - - /* Add drives, inspect and mount. */ - add_drives (drvs); - - if (guestfs_launch (g) == -1) - exit (EXIT_FAILURE); - - if (mps != NULL) - mount_mps (mps); - else - inspect_mount (); - - /* Free up data structures, no longer needed after this point. */ - free_drives (drvs); - free_mps (mps); - free_key_store (ks); - - unsigned errors = 0; - - while (optind < argc) { - const char *dir = argv[optind]; - - switch (mode) { - case 0: /* no -l or -R option */ - if (do_ls (dir) == -1) - errors++; - break; - - case MODE_LS_L: /* virt-ls -l */ - if (do_ls_l (dir) == -1) - errors++; - break; - - case MODE_LS_R: /* virt-ls -R */ - if (do_ls_R (dir) == -1) - errors++; - break; - - case MODE_LS_LR: /* virt-ls -lR */ - if (do_ls_lR (dir) == -1) - errors++; - break; - - default: - abort (); /* can't happen */ - } - - optind++; - } - - guestfs_close (g); - - exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE); -} - -static int -do_ls (const char *dir) -{ - size_t i; - CLEANUP_FREE_STRING_LIST char **lines = guestfs_ls (g, dir); - - if (lines == NULL) - return -1; - - for (i = 0; lines[i] != NULL; ++i) - printf ("%s\n", lines[i]); - - return 0; -} - -static int -do_ls_l (const char *dir) -{ - CLEANUP_FREE char *out = guestfs_ll (g, dir); - - if (out == NULL) - return -1; - - printf ("%s", out); - - return 0; -} - -static int -do_ls_R (const char *dir) -{ - size_t i; - CLEANUP_FREE_STRING_LIST char **dirs = guestfs_find (g, dir); - - if (dirs == NULL) - return -1; - - for (i = 0; dirs[i] != NULL; ++i) - puts (dirs[i]); - - return 0; -} - -static int show_file (const char *dir, const char *name, const struct guestfs_statns *stat, const struct guestfs_xattr_list *xattrs, void *unused); - -static int -do_ls_lR (const char *dir) -{ - return visit (g, dir, show_file, NULL); -} - -/* This is the function which is called to display all files and - * directories, and it's where the magic happens. We are called with - * full stat and extended attributes for each file, so there is no - * penalty for displaying anything in those structures. However if we - * need other things (eg. checksum) we may have to go back to the - * appliance and then there can be a very large penalty. - */ -static int -show_file (const char *dir, const char *name, - const struct guestfs_statns *stat, - const struct guestfs_xattr_list *xattrs, - void *unused) -{ - const char *filetype; - CLEANUP_FREE char *path = NULL, *csum = NULL, *link = NULL; - - /* Display the basic fields. */ - output_start_line (); - - if (guestfs_int_is_reg (stat->st_mode)) - filetype = "-"; - else if (guestfs_int_is_dir (stat->st_mode)) - filetype = "d"; - else if (guestfs_int_is_chr (stat->st_mode)) - filetype = "c"; - else if (guestfs_int_is_blk (stat->st_mode)) - filetype = "b"; - else if (guestfs_int_is_fifo (stat->st_mode)) - filetype = "p"; - else if (guestfs_int_is_lnk (stat->st_mode)) - filetype = "l"; - else if (guestfs_int_is_sock (stat->st_mode)) - filetype = "s"; - else - filetype = "u"; - output_string (filetype); - output_int64_perms (stat->st_mode & 07777); - - output_int64_size (stat->st_size); - - /* Display extra fields when enabled. */ - if (enable_uids) { - output_int64_uid (stat->st_uid); - output_int64_uid (stat->st_gid); - } - - if (enable_times) { - output_int64_time (stat->st_atime_sec, stat->st_atime_nsec); - output_int64_time (stat->st_mtime_sec, stat->st_mtime_nsec); - output_int64_time (stat->st_ctime_sec, stat->st_ctime_nsec); - } - - if (enable_extra_stats) { - output_int64_dev (stat->st_dev); - output_int64 (stat->st_ino); - output_int64 (stat->st_nlink); - output_int64_dev (stat->st_rdev); - output_int64 (stat->st_blocks); - } - - /* Disabled for now -- user would definitely want these to be interpreted. - if (enable_xattrs) - output_xattrs (xattrs); - */ - - path = guestfs_int_full_path (dir, name); - if (!path) - error (EXIT_FAILURE, errno, "guestfs_int_full_path"); - - if (checksum) { - if (guestfs_int_is_reg (stat->st_mode)) { - csum = guestfs_checksum (g, checksum, path); - if (!csum) - exit (EXIT_FAILURE); - - output_string (csum); - } else if (csv) - output_string (""); - } - - output_string (path); - - if (guestfs_int_is_lnk (stat->st_mode)) - /* XXX Fix this for NTFS. */ - link = guestfs_readlink (g, path); - if (link) - output_string_link (link); - - output_end_line (); - - return 0; -} - -/* Output functions. - * - * Note that we have to be careful to check return values from printf - * in these functions, because we want to catch ENOSPC errors. - */ -static int field; -static void -next_field (void) -{ - const int c = csv ? ',' : ' '; - - field++; - if (field == 1) return; - - if (putchar (c) == EOF) - error (EXIT_FAILURE, errno, "putchar"); -} - -static void -output_start_line (void) -{ - field = 0; -} - -static void -output_end_line (void) -{ - if (printf ("\n") < 0) - error (EXIT_FAILURE, errno, "printf"); -} - -static void -output_string (const char *s) -{ - next_field (); - - if (!csv) { - print_no_quoting: - if (printf ("%s", s) < 0) - error (EXIT_FAILURE, errno, "printf"); - } - else { - /* Quote CSV string without requiring an external module. */ - size_t i, len; - int needs_quoting = 0; - - len = strlen (s); - - for (i = 0; i < len; ++i) { - if (s[i] == ' ' || s[i] == '"' || - s[i] == '\n' || s[i] == ',') { - needs_quoting = 1; - break; - } - } - - if (!needs_quoting) - goto print_no_quoting; - - /* Quoting for CSV fields. */ - if (putchar ('"') == EOF) - error (EXIT_FAILURE, errno, "putchar"); - for (i = 0; i < len; ++i) { - if (s[i] == '"') { - if (putchar ('"') == EOF || putchar ('"') == EOF) - error (EXIT_FAILURE, errno, "putchar"); - } else { - if (putchar (s[i]) == EOF) - error (EXIT_FAILURE, errno, "putchar"); - } - } - if (putchar ('"') == EOF) - error (EXIT_FAILURE, errno, "putchar"); - } -} - -static void -output_string_link (const char *link) -{ - if (csv) - output_string (link); - else { - next_field (); - - if (printf ("-> %s", link) < 0) - error (EXIT_FAILURE, errno, "printf"); - } -} - -static void -output_int64 (int64_t i) -{ - next_field (); - /* csv doesn't need escaping */ - if (printf ("%" PRIi64, i) < 0) - error (EXIT_FAILURE, errno, "printf"); -} - -static void -output_int64_size (int64_t size) -{ - char buf[LONGEST_HUMAN_READABLE]; - const int hopts = - human_round_to_nearest|human_autoscale|human_base_1024|human_SI; - int r; - - next_field (); - - if (!csv) { - if (!human) - r = printf ("%10" PRIi64, size); - else - r = printf ("%10s", - human_readable ((uintmax_t) size, buf, hopts, 1, 1)); - } else { - /* CSV is the same as non-CSV but we don't need to right-align. */ - if (!human) - r = printf ("%" PRIi64, size); - else - r = printf ("%s", - human_readable ((uintmax_t) size, buf, hopts, 1, 1)); - } - - if (r < 0) - error (EXIT_FAILURE, errno, "printf"); -} - -static void -output_int64_perms (int64_t i) -{ - next_field (); - /* csv doesn't need escaping */ - if (printf ("%04" PRIo64, (uint64_t) i) < 0) - error (EXIT_FAILURE, errno, "printf"); -} - -static void -output_int64_time (int64_t secs, int64_t nsecs) -{ - int r; - - next_field (); - - /* csv doesn't need escaping */ - if (time_t_output) { - switch (time_relative) { - case 0: /* --time-t */ - r = printf ("%10" PRIi64, secs); - break; - case 1: /* --time-relative */ - r = printf ("%8" PRIi64, now - secs); - break; - case 2: /* --time-days */ - default: - r = printf ("%3" PRIi64, (now - secs) / 86400); - break; - } - } - else { - time_t t = (time_t) secs; - char buf[64]; - struct tm *tm; - - tm = localtime (&t); - if (tm == NULL) - error (EXIT_FAILURE, errno, "localtime"); - - if (strftime (buf, sizeof buf, "%F %T", tm) == 0) - error (EXIT_FAILURE, errno, "strftime"); - - r = printf ("%s", buf); - } - - if (r < 0) - error (EXIT_FAILURE, errno, "printf"); -} - -static void -output_int64_uid (int64_t i) -{ - next_field (); - /* csv doesn't need escaping */ - if (printf ("%4" PRIi64, i) < 0) - error (EXIT_FAILURE, errno, "printf"); -} - -static void -output_int64_dev (int64_t i) -{ - dev_t dev = i; - - next_field (); - - /* csv doesn't need escaping */ - if (printf ("%ju:%ju", - (uintmax_t) major (dev), (uintmax_t) minor (dev)) < 0) - error (EXIT_FAILURE, errno, "printf"); -} diff --git a/cat/tail.c b/cat/tail.c deleted file mode 100644 index e80dab836..000000000 --- a/cat/tail.c +++ /dev/null @@ -1,522 +0,0 @@ -/* virt-tail - * Copyright (C) 2016 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "getprogname.h" -#include "ignore-value.h" - -#include "guestfs.h" -#include "structs-cleanups.h" -#include "options.h" -#include "display-options.h" -#include "windows.h" - -/* Currently open libguestfs handle. */ -guestfs_h *g; - -int read_only = 1; -int live = 0; -int verbose = 0; -int keys_from_stdin = 0; -int echo_keys = 0; -const char *libvirt_uri = NULL; -int inspector = 1; -int in_guestfish = 0; -int in_virt_rescue = 0; - -static int do_tail (int argc, char *argv[], struct drv *drvs, struct mp *mps, struct key_store *ks); -static time_t disk_mtime (struct drv *drvs); -static int reopen_handle (void); - -static void __attribute__((noreturn)) -usage (int status) -{ - if (status != EXIT_SUCCESS) - fprintf (stderr, _("Try ‘%s --help’ for more information.\n"), - getprogname ()); - else { - printf (_("%s: follow (tail) files in a virtual machine\n" - "Copyright (C) 2016 Red Hat Inc.\n" - "Usage:\n" - " %s [--options] -d domname file [file ...]\n" - " %s [--options] -a disk.img [-a disk.img ...] file [file ...]\n" - "Options:\n" - " -a|--add image Add image\n" - " --blocksize[=512|4096]\n" - " Set sector size of the disk for -a option\n" - " -c|--connect uri Specify libvirt URI for -d option\n" - " -d|--domain guest Add disks from libvirt guest\n" - " --echo-keys Don't turn off echo for passphrases\n" - " -f|--follow Ignored for compatibility with tail\n" - " --format[=raw|..] Force disk format for -a option\n" - " --help Display brief help\n" - " --key selector Specify a LUKS key\n" - " --keys-from-stdin Read passphrases from stdin\n" - " -m|--mount dev[:mnt[:opts[:fstype]]]\n" - " Mount dev on mnt (if omitted, /)\n" - " -v|--verbose Verbose messages\n" - " -V|--version Display version and exit\n" - " -x Trace libguestfs API calls\n" - "For more information, see the manpage %s(1).\n"), - getprogname (), getprogname (), - getprogname (), getprogname ()); - } - exit (status); -} - -int -main (int argc, char *argv[]) -{ - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEBASEDIR); - textdomain (PACKAGE); - - enum { HELP_OPTION = CHAR_MAX + 1 }; - - static const char options[] = "a:c:d:fm:vVx"; - static const struct option long_options[] = { - { "add", 1, 0, 'a' }, - { "blocksize", 2, 0, 0 }, - { "connect", 1, 0, 'c' }, - { "domain", 1, 0, 'd' }, - { "echo-keys", 0, 0, 0 }, - { "follow", 0, 0, 'f' }, - { "format", 2, 0, 0 }, - { "help", 0, 0, HELP_OPTION }, - { "key", 1, 0, 0 }, - { "keys-from-stdin", 0, 0, 0 }, - { "long-options", 0, 0, 0 }, - { "mount", 1, 0, 'm' }, - { "short-options", 0, 0, 0 }, - { "verbose", 0, 0, 'v' }, - { "version", 0, 0, 'V' }, - { 0, 0, 0, 0 } - }; - struct drv *drvs = NULL; - struct mp *mps = NULL; - struct mp *mp; - char *p; - const char *format = NULL; - bool format_consumed = true; - int blocksize = 0; - bool blocksize_consumed = true; - int c; - int r; - int option_index; - struct key_store *ks = NULL; - - g = guestfs_create (); - if (g == NULL) - error (EXIT_FAILURE, errno, "guestfs_create"); - - for (;;) { - c = getopt_long (argc, argv, options, long_options, &option_index); - if (c == -1) break; - - switch (c) { - case 0: /* options which are long only */ - if (STREQ (long_options[option_index].name, "long-options")) - display_long_options (long_options); - else if (STREQ (long_options[option_index].name, "short-options")) - display_short_options (options); - else if (STREQ (long_options[option_index].name, "keys-from-stdin")) { - keys_from_stdin = 1; - } else if (STREQ (long_options[option_index].name, "echo-keys")) { - echo_keys = 1; - } else if (STREQ (long_options[option_index].name, "format")) { - OPTION_format; - } else if (STREQ (long_options[option_index].name, "blocksize")) { - OPTION_blocksize; - } else if (STREQ (long_options[option_index].name, "key")) { - OPTION_key; - } else - error (EXIT_FAILURE, 0, - _("unknown long option: %s (%d)"), - long_options[option_index].name, option_index); - break; - - case 'a': - OPTION_a; - break; - - case 'c': - OPTION_c; - break; - - case 'd': - OPTION_d; - break; - - case 'f': - /* ignored */ - break; - - case 'm': - OPTION_m; - inspector = 0; - break; - - case 'v': - OPTION_v; - break; - - case 'V': - OPTION_V; - break; - - case 'x': - OPTION_x; - break; - - case HELP_OPTION: - usage (EXIT_SUCCESS); - - default: - usage (EXIT_FAILURE); - } - } - - /* These are really constants, but they have to be variables for the - * options parsing code. Assert here that they have known-good - * values. - */ - assert (read_only == 1); - assert (inspector == 1 || mps != NULL); - assert (live == 0); - - /* User must specify at least one filename on the command line. */ - if (optind >= argc || argc - optind < 1) { - fprintf (stderr, _("%s: error: missing filenames on command line.\n" - "Please specify at least one file to follow.\n"), - getprogname ()); - usage (EXIT_FAILURE); - } - - CHECK_OPTION_format_consumed; - CHECK_OPTION_blocksize_consumed; - - /* User must have specified some drives. */ - if (drvs == NULL) { - fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"), - getprogname ()); - usage (EXIT_FAILURE); - } - - r = do_tail (argc - optind, &argv[optind], drvs, mps, ks); - - free_drives (drvs); - free_mps (mps); - free_key_store (ks); - - guestfs_close (g); - - exit (r == 0 ? EXIT_SUCCESS : EXIT_FAILURE); -} - -struct follow { - int64_t mtime; /* For each file, last mtime. */ - int64_t size; /* For each file, last size. */ -}; - -static sig_atomic_t quit = 0; - -static void -user_cancel (int sig) -{ - quit = 1; - ignore_value (guestfs_user_cancel (g)); -} - -static int -do_tail (int argc, char *argv[], /* list of files in the guest */ - struct drv *drvs, struct mp *mps, struct key_store *ks) -{ - struct sigaction sa; - time_t drvt; - int first_iteration = 1; - int prev_file_displayed = -1; - CLEANUP_FREE struct follow *file = NULL; - - /* Allocate storage to track each file. */ - file = calloc (argc, sizeof (struct follow)); - - /* We loop until the user hits ^C. */ - memset (&sa, 0, sizeof sa); - sa.sa_handler = user_cancel; - sa.sa_flags = SA_RESTART; - sigaction (SIGINT, &sa, NULL); - sigaction (SIGQUIT, &sa, NULL); - - if (guestfs_set_pgroup (g, 1) == -1) - exit (EXIT_FAILURE); - - drvt = disk_mtime (drvs); - if (drvt == (time_t)-1) - return -1; - - while (!quit) { - time_t t; - int i; - int windows = 0; - char *root; - CLEANUP_FREE_STRING_LIST char **roots = NULL; - int processed; - - /* Add drives, inspect and mount. */ - add_drives (drvs); - - if (guestfs_launch (g) == -1) - return -1; - - if (mps != NULL) - mount_mps (mps); - else - inspect_mount (); - - if (inspector) { - /* Get root mountpoint. See: fish/inspect.c:inspect_mount */ - roots = guestfs_inspect_get_roots (g); - - assert (roots); - assert (roots[0] != NULL); - assert (roots[1] == NULL); - root = roots[0]; - - /* Windows? Special handling is required. */ - windows = is_windows (g, root); - } - - /* Check files here. */ - processed = 0; - for (i = 0; i < argc; ++i) { - CLEANUP_FREE char *filename = NULL; - CLEANUP_FREE_STATNS struct guestfs_statns *stat = NULL; - - if (windows) { - filename = windows_path (g, root, argv[i], 1 /* readonly */); - if (filename == NULL) - return -1; /* windows_path printed an error */ - } - else { - filename = strdup (argv[i]); - if (filename == NULL) { - perror ("malloc"); - return -1; - } - } - - guestfs_push_error_handler (g, NULL, NULL); - stat = guestfs_statns (g, filename); - guestfs_pop_error_handler (g); - if (stat == NULL) { - /* There's an error. Treat ENOENT as if the file was empty size. */ - if (guestfs_last_errno (g) == ENOENT) { - time (&t); - file[i].mtime = t; - file[i].size = 0; - } - else { - fprintf (stderr, "%s: %s: %s\n", - getprogname (), filename, guestfs_last_error (g)); - return -1; - } - } - else { - CLEANUP_FREE_STRING_LIST char **lines = NULL; - CLEANUP_FREE char *content = NULL; - - processed++; - - /* We believe the guest mtime to mean the file changed. This - * can include the file changing but the size staying the same, - * so be careful. - */ - if (file[i].mtime != stat->st_mtime_sec || - file[i].size != stat->st_size) { - /* If we get here, the file changed and we're going to display - * something. If there is more than one file, and the file - * displayed is different from previously, then display the - * filename banner. - */ - if (i != prev_file_displayed) - printf ("\n\n--- %s ---\n\n", filename); - prev_file_displayed = i; - - /* If the file grew, display all the new content unless - * it's a lot, in which case display the last few lines. - * If the file shrank, display the last few lines. - * If the file stayed the same size [note that the file - * has changed -- see above], redisplay the last few lines. - */ - if (stat->st_size > file[i].size + 10000) { /* grew a lot */ - goto show_tail; - } - else if (stat->st_size > file[i].size) { /* grew a bit */ - int count = stat->st_size - file[i].size; - size_t r; - guestfs_push_error_handler (g, NULL, NULL); - content = guestfs_pread (g, filename, count, file[i].size, &r); - guestfs_pop_error_handler (g); - if (content) { - size_t j; - for (j = 0; j < r; ++j) - putchar (content[j]); - } - } - else if (stat->st_size <= file[i].size) { /* shrank or same size */ - show_tail: - guestfs_push_error_handler (g, NULL, NULL); - lines = guestfs_tail (g, filename); - guestfs_pop_error_handler (g); - if (lines) { - size_t j; - for (j = 0; lines[j] != NULL; ++j) - puts (lines[j]); - } - } - - fflush (stdout); - - file[i].mtime = stat->st_mtime_sec; - file[i].size = stat->st_size; - } - } - } - - /* If no files were found, exit. If this is the first iteration - * of the loop, then this is an error, otherwise it's an ordinary - * exit when all files get deleted (see man page). - */ - if (processed == 0) { - if (first_iteration) { - fprintf (stderr, - _("%s: error: none of the files were found in the disk image\n"), - getprogname ()); - return -1; - } - else { - printf (_("%s: all files deleted, exiting\n"), getprogname ()); - return 0; - } - } - - /* Do nothing until something happens on the disk image. Even if - * the drive changes, always wait min. 30 seconds. For libvirt - * (-d) and remote sources we cannot check this so we have to use - * a fixed (5 minute) delay instead. Also we recheck every so - * often even if nothing seems to have changed. (XXX Can we do - * better?) - */ - for (i = 0; i < 10 /* 30 seconds * 10 = 5 mins */; ++i) { - time (&t); - sleep (30); - drvt = disk_mtime (drvs); - if (drvt == (time_t)-1) - return -1; - if (drvt-t < 30) break; - } - - if (reopen_handle () == -1) - return -1; - - first_iteration = 0; - } - - return 0; -} - -/* Return the latest (highest) mtime of any local drive in the list of - * drives passed on the command line. If there are no such drives - * (eg. the guest is libvirt or remote) then this returns 0. If there - * is an error it returns (time_t)-1. - */ -static time_t -disk_mtime (struct drv *drvs) -{ - time_t ret; - - if (drvs == NULL) - return 0; - - ret = disk_mtime (drvs->next); - if (ret == (time_t)-1) - return -1; - - if (drvs->type == drv_a) { - struct stat statbuf; - - if (stat (drvs->a.filename, &statbuf) == -1) { - error (0, errno, "stat: %s", drvs->a.filename); - return -1; - } - - if (statbuf.st_mtime > ret) - ret = statbuf.st_mtime; - } - /* XXX "look into" libvirt guests for local drives. */ - - return ret; -} - -/* Reopen the handle. Open the new handle first and copy some - * settings across. We only need to copy settings which are set - * somewhere in the code above, eg by OPTION_v. Settings from - * environment variables will be recreated by guestfs_create. - * - * The global 'g' must never be unset or NULL (visible to code outside - * this function). - */ -static int -reopen_handle (void) -{ - guestfs_h *g2; - - g2 = guestfs_create (); - if (g2 == NULL) { - perror ("guestfs_create"); - return -1; - } - - guestfs_set_verbose (g2, guestfs_get_verbose (g)); - guestfs_set_trace (g2, guestfs_get_trace (g)); - if (guestfs_set_pgroup (g2, guestfs_get_pgroup (g)) == -1) { - perror ("guestfs_set_pgroup"); - return -1; - } - - guestfs_close (g); - g = g2; - - return 0; -} diff --git a/cat/test-docs.sh b/cat/test-docs.sh deleted file mode 100755 index cf6a40262..000000000 --- a/cat/test-docs.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2016 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. - -set -e - -$TEST_FUNCTIONS -skip_if_skipped - -$top_srcdir/podcheck.pl "$srcdir/virt-cat.pod" virt-cat \ - --path $top_srcdir/common/options -$top_srcdir/podcheck.pl "$srcdir/virt-filesystems.pod" virt-filesystems \ - --path $top_srcdir/common/options -$top_srcdir/podcheck.pl "$srcdir/virt-log.pod" virt-log \ - --path $top_srcdir/common/options -$top_srcdir/podcheck.pl "$srcdir/virt-ls.pod" virt-ls \ - --path $top_srcdir/common/options \ - --ignore=--checksums,--extra-stat,--time,--uid -$top_srcdir/podcheck.pl "$srcdir/virt-tail.pod" virt-tail \ - --path $top_srcdir/common/options diff --git a/cat/test-virt-cat.sh b/cat/test-virt-cat.sh deleted file mode 100755 index 89ffc94ad..000000000 --- a/cat/test-virt-cat.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2009-2020 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. - -set -e - -$TEST_FUNCTIONS -skip_if_skipped - -# Read out the test files from the image using virt-cat. -if [ "$($VG virt-cat --format=raw -a ../test-data/phony-guests/fedora.img /etc/test1)" != "abcdefg" ]; then - echo "$0: error: mismatch in file test1" - exit 1 -fi -if [ "$($VG virt-cat --format=raw -a ../test-data/phony-guests/fedora.img /etc/test2)" != "" ]; then - echo "$0: error: mismatch in file test2" - exit 1 -fi diff --git a/cat/test-virt-filesystems.sh b/cat/test-virt-filesystems.sh deleted file mode 100755 index 5fccadad9..000000000 --- a/cat/test-virt-filesystems.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2009-2020 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. - -set -e - -$TEST_FUNCTIONS -skip_if_skipped - -output="$($VG virt-filesystems --format=raw -a ../test-data/phony-guests/fedora.img | sort)" -expected="/dev/VG/LV1 -/dev/VG/LV2 -/dev/VG/LV3 -/dev/VG/Root -/dev/sda1" - -if [ "$output" != "$expected" ]; then - echo "$0: error: mismatch in test 1" - echo "$output" - exit 1 -fi - -output="$($VG virt-filesystems --format=raw -a ../test-data/phony-guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)" -expected="/dev/VG -/dev/VG/LV1 -/dev/VG/LV2 -/dev/VG/LV3 -/dev/VG/Root -/dev/sda -/dev/sda1 -/dev/sda2" - -if [ "$output" != "$expected" ]; then - echo "$0: error: mismatch in test 2" - echo "$output" - exit 1 -fi diff --git a/cat/test-virt-log.sh b/cat/test-virt-log.sh deleted file mode 100755 index 957c8fafe..000000000 --- a/cat/test-virt-log.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2009-2020 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. - -set -e - -$TEST_FUNCTIONS -skip_if_skipped - -can_handle () -{ - fn=$(basename $1) - case "$fn" in - fedora.img) - guestfish -a /dev/null run : available journal - ;; - *) - return 0 - ;; - esac -} - -tmpfile=`mktemp` - -# Read out the log files from the image using virt-log. -for f in ../test-data/phony-guests/{fedora,debian,ubuntu}.img; do - echo "Trying $f ..." - if [ ! -s "$f" ]; then - echo "SKIP: empty file" - echo - continue - fi - if ! can_handle "$f"; then - echo "SKIP: cannot handle $f" - echo - continue - fi - $VG virt-log --format=raw -a "$f" &> $tmpfile - cat $tmpfile - echo -done - -rm -f $tmpfile diff --git a/cat/test-virt-ls.sh b/cat/test-virt-ls.sh deleted file mode 100755 index 02e1f0285..000000000 --- a/cat/test-virt-ls.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2012 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. - -set -e - -$TEST_FUNCTIONS -skip_if_skipped - -# Read out the test directory using virt-ls. -if [ "$($VG virt-ls --format=raw -a ../test-data/phony-guests/fedora.img /bin)" != "ls -test1 -test2 -test3 -test4 -test5 -test6 -test7" ]; then - echo "$0: error: unexpected output from virt-ls" - exit 1 -fi - -# Try the -lR option. -output="$($VG virt-ls -lR --format=raw -a ../test-data/phony-guests/fedora.img /boot | awk '{print $1 $2 $4}')" -expected="d0755/boot -d0755/boot/grub --0644/boot/grub/grub.conf -d0700/boot/lost+found" -if [ "$output" != "$expected" ]; then - echo "$0: error: unexpected output from virt-ls -lR" - echo "output: ------------------------------------------" - echo "$output" - echo "expected: ----------------------------------------" - echo "$expected" - echo "--------------------------------------------------" - exit 1 -fi - -# Try the -l and -R options. XXX Should check the output. -$VG virt-ls -l ../test-data/phony-guests/fedora.img / -$VG virt-ls -R ../test-data/phony-guests/fedora.img / diff --git a/cat/test-virt-tail.sh b/cat/test-virt-tail.sh deleted file mode 100755 index c091eafd6..000000000 --- a/cat/test-virt-tail.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2016 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. - -# To test virt-tail, we run a guestfish instance which creates a disk -# and a file in that disk. We then run virt-tail in parallel. Back -# in the guestfish instance we append to the file, and we check that -# the addenda are displayed by virt-tail. - -set -e -set -x - -$TEST_FUNCTIONS -skip_if_skipped - -# Libvirt screws with the SELinux labels, preventing guestfish from -# continuing to write to the original disk. Therefore only run this -# test when using direct access. -skip_unless_backend direct - -out=test-virt-tail.out -disk=test-virt-tail.disk - -rm -f $out $disk - -tailpid=0 - -eval `guestfish --listen` - -# Clean up if the script is killed or exits early. -cleanup () -{ - status=$? - set +e - guestfish --remote exit - if [ "$tailpid" -gt 0 ]; then kill "$tailpid"; fi - - # Don't delete the output files if non-zero exit. - if [ "$status" -eq 0 ]; then rm -f $disk $out; fi - - exit $status -} -trap cleanup INT QUIT TERM EXIT ERR - -# Create the output disk. -guestfish --remote sparse $disk 10M -guestfish --remote run -guestfish --remote part-disk /dev/sda mbr -guestfish --remote mkfs ext2 /dev/sda1 -guestfish --remote mount /dev/sda1 / - -# Create the file to be tailed with a single full line of content. -guestfish --remote write /tail 'line 1 -' -guestfish --remote sync - -# Run virt-tail in the background -$VG virt-tail -a $disk -m /dev/sda1 /tail > $out & -tailpid=$! - -# Wait for the first line of the tailed file to appear. -# Note we can wait up to 10 minutes here to deal with slow machines. -for retry in `seq 0 60`; do - if grep -sq "line 1" $out; then break; fi - sleep 10; -done -if [ "$retry" -ge 60 ]; then - echo "$0: error: initial line of output did not appear" - exit 1 -fi - -# Write some more lines to the file. -guestfish --remote write-append /tail 'line 2 -line 3 -' -guestfish --remote sync - -# Wait for new content to appear. -for retry in `seq 0 60`; do - if grep -sq "line 3" $out; then break; fi - sleep 10; -done -if [ "$retry" -ge 60 ]; then - echo "$0: error: continued output did not appear" - exit 1 -fi - -# Delete the file. This should cause virt-tail to exit gracefully. -guestfish --remote rm /tail -guestfish --remote sync - -# Wait for virt-tail to finish and check the status. -wait "$tailpid" -tailstatus=$? -tailpid=0 -if [ "$tailstatus" -ne 0 ]; then - echo "$0: error: non-zero exit status from virt-tail: $tailstatus" - exit 1 -fi - -# cleanup() is called implicitly which cleans up everything. -exit 0 diff --git a/cat/virt-cat.pod b/cat/virt-cat.pod deleted file mode 100644 index aabe08517..000000000 --- a/cat/virt-cat.pod +++ /dev/null @@ -1,293 +0,0 @@ -=head1 NAME - -virt-cat - Display files in a virtual machine - -=head1 SYNOPSIS - - virt-cat [--options] -d domname file [file ...] - - virt-cat [--options] -a disk.img [-a disk.img ...] file [file ...] - -Old-style: - - virt-cat domname file - - virt-cat disk.img file - -=head1 DESCRIPTION - -C is a command line tool to display the contents of C -where C exists in the named virtual machine (or disk image). - -Multiple filenames can be given, in which case they are concatenated -together. Each filename must be a full path, starting at the root -directory (starting with '/'). - -C can be used to quickly view a file. To edit a file, use -C. For more complex cases you should look at the -L tool (see L below). - -=head1 EXAMPLES - -Display F file from inside the libvirt VM called -C: - - virt-cat -d mydomain /etc/fstab - -Find out what packages were recently installed: - - virt-cat -d mydomain /var/log/yum.log | tail - -Find out who is logged on inside a virtual machine: - - virt-cat -d mydomain /var/run/utmp > /tmp/utmp - who /tmp/utmp - -or who was logged on: - - virt-cat -d mydomain /var/log/wtmp > /tmp/wtmp - last -f /tmp/wtmp - -=head1 OPTIONS - -=over 4 - -=item B<--help> - -Display brief help. - -=item B<-a> file - -=item B<--add> file - -Add I which should be a disk image from a virtual machine. If -the virtual machine has multiple block devices, you must supply all of -them with separate I<-a> options. - -The format of the disk image is auto-detected. To override this and -force a particular format use the I<--format=..> option. - -=item B<-a URI> - -=item B<--add URI> - -Add a remote disk. See L. - -__INCLUDE:blocksize-option.pod__ - -=item B<-c> URI - -=item B<--connect> URI - -If using libvirt, connect to the given I. If omitted, then we -connect to the default libvirt hypervisor. - -If you specify guest block devices directly (I<-a>), then libvirt is -not used at all. - -=item B<-d> guest - -=item B<--domain> guest - -Add all the disks from the named libvirt guest. Domain UUIDs can be -used instead of names. - -=item B<--echo-keys> - -When prompting for keys and passphrases, virt-cat normally turns -echoing off so you cannot see what you are typing. If you are not -worried about Tempest attacks and there is no one else in the room you -can specify this flag to see what you are typing. - -=item B<--format=raw|qcow2|..> - -=item B<--format> - -The default for the I<-a> option is to auto-detect the format of the -disk image. Using this forces the disk format for I<-a> options which -follow on the command line. Using I<--format> with no argument -switches back to auto-detection for subsequent I<-a> options. - -For example: - - virt-cat --format=raw -a disk.img file - -forces raw format (no auto-detection) for F. - - virt-cat --format=raw -a disk.img --format -a another.img file - -forces raw format (no auto-detection) for F and reverts to -auto-detection for F. - -If you have untrusted raw-format guest disk images, you should use -this option to specify the disk format. This avoids a possible -security problem with malicious guests (CVE-2010-3851). - -__INCLUDE:key-option.pod__ - -__INCLUDE:keys-from-stdin-option.pod__ - -=item B<-m> dev[:mountpoint[:options[:fstype]]] - -=item B<--mount> dev[:mountpoint[:options[:fstype]]] - -Mount the named partition or logical volume on the given mountpoint. - -If the mountpoint is omitted, it defaults to F. - -Specifying any mountpoint disables the inspection of the guest and -the mount of its root and all of its mountpoints, so make sure -to mount all the mountpoints needed to work with the filenames -given as arguments. - -If you don’t know what filesystems a disk image contains, you can -either run guestfish without this option, then list the partitions, -filesystems and LVs available (see L, -L and L commands), or you can use the -L program. - -The third (and rarely used) part of the mount parameter is the list of -mount options used to mount the underlying filesystem. If this is not -given, then the mount options are either the empty string or C -(the latter if the I<--ro> flag is used). By specifying the mount -options, you override this default choice. Probably the only time you -would use this is to enable ACLs and/or extended attributes if the -filesystem can support them: - - -m /dev/sda1:/:acl,user_xattr - -Using this flag is equivalent to using the C command. - -The fourth part of the parameter is the filesystem driver to use, such -as C or C. This is rarely needed, but can be useful if -multiple drivers are valid for a filesystem (eg: C and C), -or if libguestfs misidentifies a filesystem. - -=item B<-v> - -=item B<--verbose> - -Enable verbose messages for debugging. - -=item B<-V> - -=item B<--version> - -Display version number and exit. - -=item B<-x> - -Enable tracing of libguestfs API calls. - -=back - -=head1 OLD-STYLE COMMAND LINE ARGUMENTS - -Previous versions of virt-cat allowed you to write either: - - virt-cat disk.img [disk.img ...] file - -or - - virt-cat guestname file - -whereas in this version you should use I<-a> or I<-d> respectively -to avoid the confusing case where a disk image might have the same -name as a guest. - -For compatibility the old style is still supported. - -=head1 LOG FILES - -To list out the log files from guests, see the related tool -L. It understands binary log formats such as the systemd -journal. - -To follow (tail) text log files, use L. - -=head1 WINDOWS PATHS - -C has a limited ability to understand Windows drive letters -and paths (eg. F). - -If and only if the guest is running Windows then: - -=over 4 - -=item * - -Drive letter prefixes like C are resolved against the -Windows Registry to the correct filesystem. - -=item * - -Any backslash (C<\>) characters in the path are replaced -with forward slashes so that libguestfs can process it. - -=item * - -The path is resolved case insensitively to locate the file -that should be displayed. - -=back - -There are some known shortcomings: - -=over 4 - -=item * - -Some NTFS symbolic links may not be followed correctly. - -=item * - -NTFS junction points that cross filesystems are not followed. - -=back - -=head1 USING GUESTFISH - -L is a more powerful, lower level tool which you can use -when C doesn't work. - -Using C is approximately equivalent to doing: - - guestfish --ro -i -d domname download file - - -where C is the name of the libvirt guest, and C is the -full path to the file. Note the final C<-> (meaning "output to -stdout"). - -The command above uses libguestfs’s guest inspection feature and so -does not work on guests that libguestfs cannot inspect, or on things -like arbitrary disk images that don't contain guests. To display a -file from a disk image directly, use: - - guestfish --ro -a disk.img -m /dev/sda1 download file - - -where F is the disk image, F is the filesystem -within the disk image, and C is the full path to the file. - -=head1 EXIT STATUS - -This program returns 0 if successful, or non-zero if there was an -error. - -=head1 SEE ALSO - -L, -L, -L, -L, -L, -L, -L, -L. - -=head1 AUTHOR - -Richard W.M. Jones L - -=head1 COPYRIGHT - -Copyright (C) 2010-2012 Red Hat Inc. diff --git a/cat/virt-filesystems.pod b/cat/virt-filesystems.pod deleted file mode 100644 index 5e9ae6658..000000000 --- a/cat/virt-filesystems.pod +++ /dev/null @@ -1,402 +0,0 @@ -=head1 NAME - -virt-filesystems - List filesystems, partitions, block devices, LVM in a virtual machine or disk image - -=head1 SYNOPSIS - - virt-filesystems [--options] -d domname - - virt-filesystems [--options] -a disk.img [-a disk.img ...] - -=head1 DESCRIPTION - -This tool allows you to discover filesystems, partitions, logical -volumes, and their sizes in a disk image or virtual machine. It is a -replacement for L and -L. - -One use for this tool is from shell scripts to iterate over all -filesystems from a disk image: - - for fs in $(virt-filesystems -a disk.img); do - # ... - done - -Another use is to list partitions before using another tool to modify -those partitions (such as L). If you are curious -about what an unknown disk image contains, use this tool along with -L. - -Various command line options control what this program displays. You -need to give either I<-a> or I<-d> options to specify the disk image -or libvirt guest respectively. If you just specify that then the -program shows filesystems found, one per line, like this: - - $ virt-filesystems -a disk.img - /dev/sda1 - /dev/vg_guest/lv_root - -If you add I<-l> or I<--long> then the output includes extra -information: - - $ virt-filesystems -a disk.img -l - Name Type VFS Label Size - /dev/sda1 filesystem ext4 boot 524288000 - /dev/vg_guest/lv_root filesystem ext4 root 10212081664 - -If you add I<--extra> then non-mountable (swap, unknown) filesystems -are shown as well: - - $ virt-filesystems -a disk.img --extra - /dev/sda1 - /dev/vg_guest/lv_root - /dev/vg_guest/lv_swap - /dev/vg_guest/lv_data - -If you add I<--partitions> then partitions are shown instead of filesystems: - - $ virt-filesystems -a disk.img --partitions - /dev/sda1 - /dev/sda2 - -Similarly you can use I<--logical-volumes>, I<--volume-groups>, -I<--physical-volumes>, I<--block-devices> to list those items. - -You can use these options in combination as well (if you want a -combination including filesystems, you have to add I<--filesystems>). -Notice that some items fall into several categories (eg. F -might be both a partition and a filesystem). These items are listed -several times. To get a list which includes absolutely everything -that virt-filesystems knows about, use the I<--all> option. - -UUIDs (because they are quite long) are not shown by default. Add the -I<--uuid> option to display device and filesystem UUIDs in the long -output. - -I<--all --long --uuid> is a useful combination to display all possible -information about everything. - - $ virt-filesystems -a win.img --all --long --uuid -h - Name Type VFS Label Size Parent UUID - /dev/sda1 filesystem ntfs System Reserved 100M - F81C92571C92112C - /dev/sda2 filesystem ntfs - 20G - F2E8996AE8992E3B - /dev/sda1 partition - - 100M /dev/sda - - /dev/sda2 partition - - 20G /dev/sda - - /dev/sda device - - 20G - - - -For machine-readable output, use I<--csv> to get Comma-Separated Values. - -=head1 OPTIONS - -=over 4 - -=item B<--help> - -Display brief help. - -=item B<-a> file - -=item B<--add> file - -Add I which should be a disk image from a virtual machine. If -the virtual machine has multiple block devices, you must supply all of -them with separate I<-a> options. - -The format of the disk image is auto-detected. To override this and -force a particular format use the I<--format=..> option. - -=item B<-a URI> - -=item B<--add URI> - -Add a remote disk. See L. - -=item B<--all> - -Display everything. This is currently the same as specifying these -options: I<--filesystems>, I<--extra>, I<--partitions>, -I<--block-devices>, I<--logical-volumes>, I<--volume-groups>, -I<--physical-volumes>. (More may be added to this list in future). - -See also I<--long>. - -=item B<--blkdevs> - -=item B<--block-devices> - -Display block devices. - -__INCLUDE:blocksize-option.pod__ - -=item B<-c> URI - -=item B<--connect> URI - -If using libvirt, connect to the given I. If omitted, then we -connect to the default libvirt hypervisor. - -If you specify guest block devices directly (I<-a>), then libvirt is -not used at all. - -=item B<--csv> - -Write out the results in CSV format (comma-separated values). This -format can be imported easily into databases and spreadsheets, but -read L below. - -=item B<-d> guest - -=item B<--domain> guest - -Add all the disks from the named libvirt guest. Domain UUIDs can be -used instead of names. - -=item B<--echo-keys> - -When prompting for keys and passphrases, virt-filesystems normally -turns echoing off so you cannot see what you are typing. If you are -not worried about Tempest attacks and there is no one else in the room -you can specify this flag to see what you are typing. - -=item B<--extra> - -This causes filesystems that are not ordinary, mountable filesystems -to be displayed. This category includes swapspace, and filesystems -that are empty or contain unknown data. - -This option implies I<--filesystems>. - -=item B<--filesystems> - -Display mountable filesystems. If no display option was selected then -this option is implied. - -With I<--extra>, non-mountable filesystems are shown too. - -=item B<--format=raw|qcow2|..> - -=item B<--format> - -The default for the I<-a> option is to auto-detect the format of the -disk image. Using this forces the disk format for I<-a> options which -follow on the command line. Using I<--format> with no argument -switches back to auto-detection for subsequent I<-a> options. - -For example: - - virt-filesystems --format=raw -a disk.img - -forces raw format (no auto-detection) for F. - - virt-filesystems --format=raw -a disk.img --format -a another.img - -forces raw format (no auto-detection) for F and reverts to -auto-detection for F. - -If you have untrusted raw-format guest disk images, you should use -this option to specify the disk format. This avoids a possible -security problem with malicious guests (CVE-2010-3851). - -=item B<-h> - -=item B<--human-readable> - -In I<--long> mode, display sizes in human-readable format. - -__INCLUDE:keys-from-stdin-option.pod__ - -=item B<-l> - -=item B<--long> - -Display extra columns of data ("long format"). - -A title row is added unless you also specify I<--no-title>. - -The extra columns displayed depend on what output you select, and the -ordering of columns may change in future versions. Use the title row, -I<--csv> output and/or L to match columns to data in -external programs. - -Use I<-h> if you want sizes to be displayed in human-readable format. -The default is to show raw numbers of I. - -Use I<--uuid> to display UUIDs too. - -=item B<--lvs> - -=item B<--logvols> - -=item B<--logical-volumes> - -Display LVM logical volumes. In this mode, these are displayed -irrespective of whether the LVs contain filesystems. - -=item B<--no-title> - -In I<--long> mode, don’t add a title row. - -Note that the order of the columns is not fixed, and may change in -future versions of virt-filesystems, so using this option may give you -unexpected surprises. - -=item B<--parts> - -=item B<--partitions> - -Display partitions. In this mode, these are displayed -irrespective of whether the partitions contain filesystems. - -=item B<--pvs> - -=item B<--physvols> - -=item B<--physical-volumes> - -Display LVM physical volumes. - -=item B<--uuid> - -=item B<--uuids> - -In I<--long> mode, display UUIDs as well. - -=item B<-v> - -=item B<--verbose> - -Enable verbose messages for debugging. - -=item B<-V> - -=item B<--version> - -Display version number and exit. - -=item B<--vgs> - -=item B<--volgroups> - -=item B<--volume-groups> - -Display LVM volume groups. - -=item B<-x> - -Enable tracing of libguestfs API calls. - -=back - -=head1 COLUMNS - -Note that columns in the output are subject to reordering and change -in future versions of this tool. - -=over 4 - -=item B - -The filesystem, partition, block device or LVM name. - -For device and partition names these are displayed as canonical -libguestfs names, so that for example F is the second -partition on the first device. - -If the I<--long> option is B specified, then only the name column -is shown in the output. - -=item B - -The object type, for example C, C, C etc. - -=item B - -If there is a filesystem, then this column displays the filesystem -type if one could be detected, eg. C. - -=item B