| 1 |
#!/usr/bin/perl
|
| 2 |
# Outputs a list of udebs to install. Pass it the type of image to build as
|
| 3 |
# the first parameter, and the kernel version(s) as the rest of the
|
| 4 |
# parameters. Reads the lists in pkg-lists.
|
| 5 |
|
| 6 |
use warnings;
|
| 7 |
use strict;
|
| 8 |
|
| 9 |
my $type=shift;
|
| 10 |
my $kernel_flavour=shift;
|
| 11 |
my @kernel_versions=@ARGV;
|
| 12 |
|
| 13 |
if (! @kernel_versions || ! length $kernel_flavour || ! length $type) {
|
| 14 |
die "Usage: $0 type KERNEL_FLAVOUR KERNEL_VERSION [KERNEL_VERSION ...]\n";
|
| 15 |
}
|
| 16 |
|
| 17 |
my $deb_host_arch=`dpkg-architecture -qDEB_HOST_ARCH`;
|
| 18 |
chomp $deb_host_arch;
|
| 19 |
|
| 20 |
my @lists = ("pkg-lists/$type/common", "pkg-lists/$type/$deb_host_arch");
|
| 21 |
while (@lists) {
|
| 22 |
my $list=pop @lists;
|
| 23 |
if (! -e $list) {
|
| 24 |
print STDERR "warning: missing list, $list, for type $type\n";
|
| 25 |
}
|
| 26 |
else {
|
| 27 |
open (LIST, $list) || die "open $list $!";
|
| 28 |
while (<LIST>) {
|
| 29 |
chomp;
|
| 30 |
|
| 31 |
# includes
|
| 32 |
if (/^#include \"(.*)\"/) {
|
| 33 |
push @lists, "pkg-lists/$1";
|
| 34 |
}
|
| 35 |
|
| 36 |
# comments
|
| 37 |
s/^#.*//;
|
| 38 |
next unless length;
|
| 39 |
|
| 40 |
# kernel version substitution
|
| 41 |
if (/\${kernel:Version}/) {
|
| 42 |
foreach my $v (@kernel_versions) {
|
| 43 |
my $l=$_;
|
| 44 |
$l=~s/\${kernel:Version}/$v-$kernel_flavour/g;
|
| 45 |
print "$l\n";
|
| 46 |
}
|
| 47 |
}
|
| 48 |
else {
|
| 49 |
print "$_\n";
|
| 50 |
}
|
| 51 |
}
|
| 52 |
close LIST;
|
| 53 |
}
|
| 54 |
}
|