From 8946c6ad43d5a36cf08d94e7f202c5d910a69211 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Mon, 3 Mar 2014 11:01:37 +0100 Subject: Separate tweaks from skeleton file. Fix syntax of tweak functions (code inside {} must end with ; ). --- bin/pkglist2preseed | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'bin') 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 -- cgit v1.2.3