summaryrefslogtreecommitdiff
path: root/bin/pkglist2preseed
blob: 0e78b562bd05a5a0444161b6fa17d1acd5768894 (plain)
  1. #!/bin/sh
  2. set -eu
  3. infile="$1"; shift
  4. outfile="$1"; shift
  5. # remaining arguments are packagelist files
  6. pkgdesc=$(perl -nE '/^[#]{2} (.*)/ and say "# $1"; /^[#]{1} (.*)/ and say "# * $1"' "$@") #'
  7. pkglist=$(perl -ne 'chomp; /^[^#]+/ and print "$_ "' "$@")
  8. export pkgdesc pkglist
  9. mkdir -p $(dirname $outfile)
  10. perl -pe 's,__PKGDESC__,$ENV{"pkgdesc"},;s,__PKGLIST__,$ENV{"pkglist"},' < $infile > $outfile~
  11. mv -f $outfile~ $outfile