diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/pkglist2preseed | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/bin/pkglist2preseed b/bin/pkglist2preseed index 0e78b56..b9d5304 100755 --- a/bin/pkglist2preseed +++ b/bin/pkglist2preseed @@ -2,15 +2,25 @@ set -eu -infile="$1"; shift -outfile="$1"; shift -# remaining arguments are packagelist files +infile="$1" +outfile="$2" +pkgfiles="$3" +tweakfiles="$4" -pkgdesc=$(perl -nE '/^[#]{2} (.*)/ and say "# $1"; /^[#]{1} (.*)/ and say "# * $1"' "$@") #' -pkglist=$(perl -ne 'chomp; /^[^#]+/ and print "$_ "' "$@") +pkgdesc=$(perl -nE '/^[#]{2} (.*)/ and say "# $1"; /^[#]{1} (.*)/ and say "# * $1"' $pkgfiles) #' +pkglist=$(perl -ne 'chomp; /^[^#]+/ and print "$_ "' $pkgfiles) -export pkgdesc pkglist +tweakdesc=$(perl -nE '/^[#]{2} (.*)/ and say "# $1"; /^[#]{1} (.*)/ and say "# * $1"' $tweakfiles) #' +tweaklist=$(perl -ne 'chomp; /^(?!#)\s*(.+)/ and print "$1;"' $tweakfiles) + +export pkgdesc pkglist tweakdesc tweaklist mkdir -p $(dirname $outfile) -perl -pe 's,__PKGDESC__,$ENV{"pkgdesc"},;s,__PKGLIST__,$ENV{"pkglist"},' < $infile > $outfile~ +perl -p \ + -e 's,__PKGDESC__,$ENV{"pkgdesc"},;'\ + -e 's,__PKGLIST__,$ENV{"pkglist"},;'\ + -e 's,__TWEAKDESC__,$ENV{"tweakdesc"},;'\ + -e 's,__TWEAKLIST__,$ENV{"tweaklist"},;'\ + < $infile \ + > $outfile~ mv -f $outfile~ $outfile |