summaryrefslogtreecommitdiffstats
path: root/debian/platform-subst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:52 +0000
commitca67b09c015d4af3ae3cce12aa72e60941dbb8b5 (patch)
treeb7316d7b06c373e08dabb79a2c866c568e08f49e /debian/platform-subst
parentAdding upstream version 2.06. (diff)
downloadgrub2-debian.tar.xz
grub2-debian.zip
Adding debian version 2.06-13+deb12u1.debian/2.06-13+deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/platform-subst')
-rwxr-xr-xdebian/platform-subst38
1 files changed, 38 insertions, 0 deletions
diff --git a/debian/platform-subst b/debian/platform-subst
new file mode 100755
index 0000000..436ffca
--- /dev/null
+++ b/debian/platform-subst
@@ -0,0 +1,38 @@
+#! /usr/bin/perl
+use warnings;
+use strict;
+
+my %subst = ();
+while ($ARGV[0] =~ /(.*?)=(.*)/) {
+ $subst{$1} = $2;
+ shift;
+}
+
+die "no package specified\n" unless exists $subst{PACKAGE};
+(my $package = $subst{PACKAGE}) =~ s/-(?:bin|dbg)$//;
+
+my $grub_dir_path = "debian/tmp-$package/usr/lib/grub";
+opendir my $grub_dir, $grub_dir_path or die "can't opendir $grub_dir_path: $!";
+my @cpu_platforms = grep { !/^\./ } readdir $grub_dir;
+closedir $grub_dir;
+
+$subst{FIRST_CPU_PLATFORM} = $cpu_platforms[0];
+
+sub emit ($) {
+ my $line = shift;
+ while (my ($key, $value) = each %subst) {
+ $line =~ s/\@$key\@/$value/g;
+ }
+ print $line;
+}
+
+while (<>) {
+ if (/\@CPU_PLATFORM\@/) {
+ for my $cpu_platform (@cpu_platforms) {
+ (my $line = $_) =~ s/\@CPU_PLATFORM\@/$cpu_platform/g;
+ emit($line);
+ }
+ } else {
+ emit($_);
+ }
+}