summaryrefslogtreecommitdiff
path: root/bin/pkglist2preseed
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-07-30 13:46:35 +0200
committerJonas Smedegaard <dr@jones.dk>2014-07-30 13:46:35 +0200
commitf7ea0e336396a21bee6f16a33be14c8b798c512f (patch)
tree5288e496907f7a527d51152e2fbc817ac4d48fd7 /bin/pkglist2preseed
parent8721b1978656c5daee03e57995395f74a8a5ed5f (diff)
Rewrite hint file parsing.
Diffstat (limited to 'bin/pkglist2preseed')
-rwxr-xr-xbin/pkglist2preseed31
1 files changed, 15 insertions, 16 deletions
diff --git a/bin/pkglist2preseed b/bin/pkglist2preseed
index 0162726..b0d7902 100755
--- a/bin/pkglist2preseed
+++ b/bin/pkglist2preseed
@@ -15,27 +15,26 @@ my $outdir = $outfile->parent;
my $altinfile = path( $infile->parent, 'script.sh.in' );
my $altoutfile = path( $outdir, 'script.sh' );
-my ($pkgdesc, @pkg);
+my (@pkglines, $pkgdesc, @pkg);
foreach (@pkgfiles) {
- foreach (path($_)->lines) {
- chomp;
- /^[#]{2} (.*)/ and $pkgdesc .= "# $1\n";
- /^[#]{1} (.*)/ and $pkgdesc .= "# * $1\n";
- /^[^#]+/ and push @pkg, $_;
- };
+ push @pkglines, path($_)->lines;
};
-chomp $pkgdesc;
+grep { chomp } @pkglines;
+grep { s/^[#]{1} (.*)/# * $1/ } @pkglines;
+grep { s/^[#]{2} (.*)/# $1/ } @pkglines;
+$pkgdesc = join "\n", grep { /^[#] / } @pkglines;
+@pkg = grep { /^[^#]/ } @pkglines;
-my ($tweakdesc, $tweaklist);
+my (@tweaklines, $tweakdesc, $tweaklist);
foreach (@tweakfiles) {
- foreach (path($_)->lines) {
- chomp;
- /^[#]{2} (.*)/ and $tweakdesc .= "# $1\n";
- /^[#]{1} (.*)/ and $tweakdesc .= "# * $1\n";
- /^(?!#)\s*(.+)/ and $tweaklist .= "$1;"
- };
+ push @tweaklines, path($_)->lines;
};
-chomp $tweakdesc;
+grep { chomp } @tweaklines;
+grep { s/^[#]{1} (.*)/# * $1/ } @tweaklines;
+grep { s/^[#]{2} (.*)/# $1/ } @tweaklines;
+$tweakdesc = join "\n", grep { /^[#] / } @tweaklines;
+$tweaklist = join ";", grep { s/^(?!#)\s*(.+)/$1/ } @tweaklines;
+$tweaklist .= ';';
my $pkglist = join( ' ', @pkg );