Add support for producing disks with (optional) extra variants
This patch from Ian Cambell adds the generic support code: * CONF.sh: Add $(VARIANTS) configuration variable. * eash-build.sh: Add command line parameter to enable variants. * Makefile: Define VARIANT_xxx when preprocessing package list. * boot/?/common.sh: Add a function for checking if a variant is enabled. * generate_di_list: Allow variant overrides in udeb exclusion list. Variant support is documented in docs/README.variants The intention is to use this support to add support for installing a Xen guest from an ISO image. The approach to use varriants was originally suggested by Frans Pop.
This commit is contained in:
parent
204ab4e96f
commit
e9c608e6b7
3
CONF.sh
3
CONF.sh
|
@ -189,6 +189,9 @@ export DISKTYPE=CD
|
||||||
# included. See tasks/README.tasksel for further info.
|
# included. See tasks/README.tasksel for further info.
|
||||||
export TASK_LANGLIST=tasksel_d-i.languages
|
export TASK_LANGLIST=tasksel_d-i.languages
|
||||||
|
|
||||||
|
# Extra variants to enable. See docs/README.variants for more information.
|
||||||
|
export VARIANTS=
|
||||||
|
|
||||||
# We don't want certain packages to take up space on CD1...
|
# We don't want certain packages to take up space on CD1...
|
||||||
#export EXCLUDE1=exclude
|
#export EXCLUDE1=exclude
|
||||||
# ...but they are okay for other CDs (UNEXCLUDEx == may be included
|
# ...but they are okay for other CDs (UNEXCLUDEx == may be included
|
||||||
|
|
5
Makefile
5
Makefile
|
@ -311,9 +311,12 @@ $(BDIR)/rawlist:
|
||||||
ARCHDEFS="$$ARCHDEFS -D ARCH_$(subst -,_,$$ARCH)"; \
|
ARCHDEFS="$$ARCHDEFS -D ARCH_$(subst -,_,$$ARCH)"; \
|
||||||
ARCHUNDEFS="$$ARCHUNDEFS -U $$ARCH"; \
|
ARCHUNDEFS="$$ARCHUNDEFS -U $$ARCH"; \
|
||||||
done; \
|
done; \
|
||||||
|
for VARIANT in $(VARIANTS); do \
|
||||||
|
VARIANTDEFS="$$VARIANTDEFS -D VARIANT_$$VARIANT"; \
|
||||||
|
done; \
|
||||||
if [ "$(SOURCEONLY)"x != "yes"x ] ; then \
|
if [ "$(SOURCEONLY)"x != "yes"x ] ; then \
|
||||||
cat $(TASKDIR)/$(TASK) | \
|
cat $(TASKDIR)/$(TASK) | \
|
||||||
cpp -nostdinc -nostdinc++ -P -undef $$ARCHDEFS \
|
cpp -nostdinc -nostdinc++ -P -undef $$ARCHDEFS $$VARIANTDEFS\
|
||||||
$$ARCHUNDEFS -U i386 -U linux -U unix \
|
$$ARCHUNDEFS -U i386 -U linux -U unix \
|
||||||
-DFORCENONUSONCD1=0 \
|
-DFORCENONUSONCD1=0 \
|
||||||
-I $(TASKDIR) - - >> $(BDIR)/rawlist; \
|
-I $(TASKDIR) - - >> $(BDIR)/rawlist; \
|
||||||
|
|
|
@ -18,6 +18,10 @@ debian-cd (3.1.3) UNRELEASED; urgency=low
|
||||||
[ Steve McIntyre ]
|
[ Steve McIntyre ]
|
||||||
* Remove bashism in tools/apt-selection. Closes: #530972
|
* Remove bashism in tools/apt-selection. Closes: #530972
|
||||||
|
|
||||||
|
[ Ian Campbell ]
|
||||||
|
* Add support for "variants". A variant allows to include/exclude additional
|
||||||
|
packages or D-I components relative to a regular image.
|
||||||
|
|
||||||
-- Frans Pop <fjp@debian.org> Tue, 04 Aug 2009 22:32:08 +0200
|
-- Frans Pop <fjp@debian.org> Tue, 04 Aug 2009 22:32:08 +0200
|
||||||
|
|
||||||
debian-cd (3.1.2) unstable; urgency=low
|
debian-cd (3.1.2) unstable; urgency=low
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
Introduction
|
||||||
|
------------
|
||||||
|
|
||||||
|
Variants enable debian-cd to include extra functionality in a built
|
||||||
|
image which is somewhat orthogonal to the usual DISKTYPE and ARCH
|
||||||
|
configurations.
|
||||||
|
|
||||||
|
Variants are enabled by setting the VARIANTS environment variable to a
|
||||||
|
space separated list of the variants to enable or by passing the -V
|
||||||
|
option (multiple times if desired) to the easy-build.sh script.
|
||||||
|
|
||||||
|
Available Variants
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Implementation
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Variants impact several aspects of the debian-cd infrastructure:
|
||||||
|
|
||||||
|
environment variable
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
The $VARIANTS environment variable is available to any scripts etc
|
||||||
|
which are run as part of the build process and is a space separated
|
||||||
|
list of the variants which are enabled.
|
||||||
|
|
||||||
|
In particular this maybe used by the per-archtecture
|
||||||
|
tools/boot/<distro>/boot-* scripts which make an image bootable on a
|
||||||
|
particular architecure. To facilitate this
|
||||||
|
tools/boot/<distro>/common.sh defines a function `variant_enabled'
|
||||||
|
which takes a variant name as an argument and returns true if that
|
||||||
|
variant is enabled.
|
||||||
|
|
||||||
|
deb package lists
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
A variant may wish to include extra .deb packages in the image. The
|
||||||
|
package lists are preprocessed using `cpp' as part of the build
|
||||||
|
process and a C-preprocessor variable `VARIANT_<x>' will be defined
|
||||||
|
to 1 for each variant which is enabled.
|
||||||
|
|
||||||
|
udeb package lists
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Similarly a variant may which to include extra .udeb packages in the
|
||||||
|
image. The list of udebs to include in an image is generated using
|
||||||
|
tools/generate_di_list which reads one or more udeb exclude files
|
||||||
|
from data/<distribution>/*. The syntax of these exclude files allows
|
||||||
|
a udeb to be excluded or included based on which variants are
|
||||||
|
enabled.
|
||||||
|
|
||||||
|
Each line in an exclude file specifies a glob pattern, a udeb whose
|
||||||
|
name matches the glob will _not_ be included in the image. After the
|
||||||
|
udeb glob each line can optionally contain on or more space
|
||||||
|
separated conditions. At least one of these conditions must be met
|
||||||
|
in order to exclude the udeb. A condition may either be:
|
||||||
|
- a positive `variant' condition, in which case the udeb is
|
||||||
|
excluded when that variant is enabled
|
||||||
|
- a negative `!variant' condition, in which case the udeb is
|
||||||
|
excluded when that variant is not enabled.
|
|
@ -9,6 +9,7 @@ show_usage() {
|
||||||
echo "Usage: $(basename $0) [OPTIONS] BC|NETINST|CD|DVD [<ARCH> ...]"
|
echo "Usage: $(basename $0) [OPTIONS] BC|NETINST|CD|DVD [<ARCH> ...]"
|
||||||
echo " Options:"
|
echo " Options:"
|
||||||
echo " -d gnome|kde|lxde|xfce|light|all : desktop variant (task) to use"
|
echo " -d gnome|kde|lxde|xfce|light|all : desktop variant (task) to use"
|
||||||
|
echo " -V <variant> : extra image variants to enable"
|
||||||
echo " -h : help"
|
echo " -h : help"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +29,8 @@ if [ $# -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
desktop=
|
desktop=
|
||||||
while getopts d:h OPT; do
|
VARIANTS=
|
||||||
|
while getopts d:hV: OPT; do
|
||||||
case $OPT in
|
case $OPT in
|
||||||
d)
|
d)
|
||||||
case $OPTARG in
|
case $OPTARG in
|
||||||
|
@ -41,6 +43,9 @@ while getopts d:h OPT; do
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac ;;
|
esac ;;
|
||||||
|
V)
|
||||||
|
VARIANTS="${VARIANTS:+$VARIANTS }$OPTARG"
|
||||||
|
;;
|
||||||
h)
|
h)
|
||||||
show_usage
|
show_usage
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -53,6 +58,7 @@ while getopts d:h OPT; do
|
||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
|
export VARIANTS
|
||||||
export DISKTYPE="$1"
|
export DISKTYPE="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
|
|
@ -48,3 +48,10 @@ add_mkisofs_opt() {
|
||||||
echo -n "$NEW_OPT " >> $OPTS_FILE
|
echo -n "$NEW_OPT " >> $OPTS_FILE
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variant_enabled() {
|
||||||
|
VARIANT=$1
|
||||||
|
|
||||||
|
echo "$VARIANTS" | grep -qw "$VARIANT"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@ if ( $ENV{ARCHES} ) {
|
||||||
}
|
}
|
||||||
@ARCHES = qw{i386 amd64} unless @ARCHES;
|
@ARCHES = qw{i386 amd64} unless @ARCHES;
|
||||||
|
|
||||||
|
@VARIANTS = split(" ", $ENV{VARIANTS});
|
||||||
|
|
||||||
my $DATE=`date`;
|
my $DATE=`date`;
|
||||||
chomp $DATE;
|
chomp $DATE;
|
||||||
open(OUT, ">debian-installer") || die "write: $!";
|
open(OUT, ">debian-installer") || die "write: $!";
|
||||||
|
@ -78,9 +80,19 @@ sub read_exclude {
|
||||||
chomp;
|
chomp;
|
||||||
s/^#.*//;
|
s/^#.*//;
|
||||||
next unless length;
|
next unless length;
|
||||||
$_=quotemeta($_);
|
my ($pkg,@cond) = split(" ", $_);
|
||||||
$_=~s/\\\*/.*/g;
|
my $skip = 0;
|
||||||
push @ret, $_;
|
foreach my $cond ( @cond ) {
|
||||||
|
if ($cond =~ /^!(.*)/) {
|
||||||
|
$skip = 1 if grep { $_ eq $1 } @VARIANTS;
|
||||||
|
} else {
|
||||||
|
$skip = 1 unless grep { $_ eq $cond } @VARIANTS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next if $skip;
|
||||||
|
$pkg=quotemeta($pkg);
|
||||||
|
$pkg=~s/\\\*/.*/g;
|
||||||
|
push @ret, $pkg;
|
||||||
}
|
}
|
||||||
close IN;
|
close IN;
|
||||||
return @ret;
|
return @ret;
|
||||||
|
|
Loading…
Reference in New Issue