| 1 |
joeyh |
4608 |
#!/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 |
joeyh |
4842 |
|
| 6 |
|
|
use warnings; |
| 7 |
|
|
use strict; |
| 8 |
|
|
|
| 9 |
joeyh |
4608 |
my $type=shift; |
| 10 |
joeyh |
4842 |
my $kernel_flavour=shift; |
| 11 |
joeyh |
4608 |
my @kernel_versions=@ARGV; |
| 12 |
|
|
|
| 13 |
joeyh |
4842 |
if (! @kernel_versions || ! length $kernel_flavour || ! length $type) { |
| 14 |
|
|
die "Usage: $0 type KERNEL_FLAVOUR KERNEL_VERSION [KERNEL_VERSION ...]\n"; |
| 15 |
|
|
} |
| 16 |
|
|
|
| 17 |
joeyh |
4608 |
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 |
joeyh |
5492 |
print STDERR "warning: missing list, $list, for type $type\n"; |
| 25 |
joeyh |
4608 |
} |
| 26 |
joeyh |
5492 |
else { |
| 27 |
|
|
open (LIST, $list) || die "open $list $!"; |
| 28 |
|
|
while (<LIST>) { |
| 29 |
|
|
chomp; |
| 30 |
joeyh |
4608 |
|
| 31 |
joeyh |
5492 |
# includes |
| 32 |
|
|
if (/^#include \"(.*)\"/) { |
| 33 |
|
|
push @lists, "pkg-lists/$1"; |
| 34 |
joeyh |
4608 |
} |
| 35 |
joeyh |
5492 |
|
| 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 |
joeyh |
4608 |
} |
| 52 |
joeyh |
5492 |
close LIST; |
| 53 |
joeyh |
4608 |
} |
| 54 |
|
|
} |