summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-03-03 11:01:37 +0100
committerJonas Smedegaard <dr@jones.dk>2014-03-03 11:01:37 +0100
commit8946c6ad43d5a36cf08d94e7f202c5d910a69211 (patch)
tree5a2a343e95b69f9dc20c9c32827affce0c75a8bc /bin
parent7dc24d5c4a76c444972f66e844d7faa7132dda22 (diff)
Separate tweaks from skeleton file. Fix syntax of tweak functions (code inside {} must end with ; ).
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pkglist2preseed24
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