blob: b9d530488d9ef25eba8c66b4ccd02188a20fe320 (
plain)
- #!/bin/sh
- set -eu
- infile="$1"
- outfile="$2"
- pkgfiles="$3"
- tweakfiles="$4"
- pkgdesc=$(perl -nE '/^[#]{2} (.*)/ and say "# $1"; /^[#]{1} (.*)/ and say "# * $1"' $pkgfiles) #'
- pkglist=$(perl -ne 'chomp; /^[^#]+/ and print "$_ "' $pkgfiles)
- 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 -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
|