summaryrefslogtreecommitdiff
path: root/bin/pkglist2preseed
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-03-02 21:53:02 +0100
committerJonas Smedegaard <dr@jones.dk>2014-03-02 21:53:02 +0100
commit53cd6ff1c597e75f94ea9ffc5f0c319e3fd92283 (patch)
tree37298ba8dd5ad5aedc1e5dd956c423301108493b /bin/pkglist2preseed
parenta7c53d6bc0e83ebea70aada89c593efe21507caa (diff)
Handle outfile and creation of dirs in preseed generator.
Diffstat (limited to 'bin/pkglist2preseed')
-rwxr-xr-xbin/pkglist2preseed8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/pkglist2preseed b/bin/pkglist2preseed
index 1691f4e..0e78b56 100755
--- a/bin/pkglist2preseed
+++ b/bin/pkglist2preseed
@@ -2,11 +2,15 @@
set -eu
-skelfile="$1"; shift
+infile="$1"; shift
+outfile="$1"; shift
+# remaining arguments are packagelist files
pkgdesc=$(perl -nE '/^[#]{2} (.*)/ and say "# $1"; /^[#]{1} (.*)/ and say "# * $1"' "$@") #'
pkglist=$(perl -ne 'chomp; /^[^#]+/ and print "$_ "' "$@")
export pkgdesc pkglist
-perl -pe 's,__PKGDESC__,$ENV{"pkgdesc"},;s,__PKGLIST__,$ENV{"pkglist"},' < $skelfile
+mkdir -p $(dirname $outfile)
+perl -pe 's,__PKGDESC__,$ENV{"pkgdesc"},;s,__PKGLIST__,$ENV{"pkglist"},' < $infile > $outfile~
+mv -f $outfile~ $outfile