Add support for components override
authorIustin Pop <iustin@google.com>
Mon, 29 Oct 2012 16:12:47 +0000 (17:12 +0100)
committerIustin Pop <iustin@google.com>
Tue, 30 Oct 2012 11:16:49 +0000 (12:16 +0100)
This fixes issue 254. I've took a slightly different approach (never
pass --components if the variable is empty, to not override builtin
debootstrap default).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

NEWS
README
common.sh.in
create
defaults

diff --git a/NEWS b/NEWS
index a7b9046..aa8695d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ A few small bugfixes:
 
 - the defaults file is now installed automatically; even though all
   settings are commented out, this allows for easier configuration
+- it is now possible to override the "components" argument to
+  debootstrap, to be able to install more packages (e.g. from contrib,
+  or from universe) (fixes issue 254)
 - all existing hooks are now distributed in the archive and also
   installed via `make install' (fixes issue 283)
 - the console activation for xen-pvm hypervisor has been corrected;
diff --git a/README b/README
index 893804f..3fe7dfb 100644 (file)
--- a/README
+++ b/README
@@ -58,6 +58,9 @@ named 'defaults' in the source distribution for more details):
 - EXTRAPKGS: most OSes will need some extra packages installed to make
   them work nicely under Xen; the example file containts a few
   suggestions
+- COMPONENTS: if defined, overrides the default debootstrap components
+  ("main"); this can be helpful e.g. by using "main,contrib,nonfree" for
+  Debian, or "main,universe" for Ubuntu
 - CUSTOMIZE_DIR: a directory containing customization script for the
   instance.  (by default $sysconfdir/ganeti/instance-debootstrap/hooks)
   See "Customization of the instance" below.
index 04d339f..fd1b448 100644 (file)
@@ -145,6 +145,7 @@ fi
 : ${SUITE:="squeeze"}
 : ${ARCH:=""}
 : ${EXTRA_PKGS:=""}
+: ${COMPONENTS:=""}
 : ${CUSTOMIZE_DIR:="@sysconfdir@/ganeti/instance-debootstrap/hooks"}
 : ${VARIANTS_DIR:="@sysconfdir@/ganeti/instance-debootstrap/variants"}
 : ${GENERATE_CACHE:="yes"}
diff --git a/create b/create
index ff54976..d07c274 100755 (executable)
--- a/create
+++ b/create
@@ -80,9 +80,11 @@ else
   # INCLUDE will be empty if EXTRA_PKGS is null/empty, otherwise we
   # build the full parameter format from it
   INCLUDE=${EXTRA_PKGS:+"--include=$EXTRA_PKGS"}
+  COMP=${COMPONENTS:+"--components=$COMPONENTS"}
   debootstrap \
     --arch "$DPKG_ARCH" \
     $INCLUDE \
+    $COMP \
     "$SUITE" $TMPDIR $MIRROR
 
   # remove the downloaded debs, as they are no longer needed
index 19df420..fdf28e5 100644 (file)
--- a/defaults
+++ b/defaults
 # EXTRA_PKGS="acpi-support-base,console-tools,udev,linux-image-686"
 # KVM, for squeeze/wheezy amd64:
 # EXTRA_PKGS="acpi-support-base,console-tools,udev,linux-image-amd64"
-#
+
+# COMPONENTS: if defined, overrides the default debootstrap components
+# ("main"); when not defined, it will not passed to debootstrap
+# Debian example:
+# COMPONENTS="main,contrib,non-free"
+# Ubuntu example:
+# COMPONENTS="main,universe"
+# Default:
+# COMPONENTS=""
 
 # CUSTOMIZE_DIR: a directory containing scripts to customize the installation.
 # The scripts are executed using run-parts