summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 );