support --file - in __debconf_set_selections

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2014-01-27 14:17:51 +01:00
parent 78be159eb7
commit 9049a1421c
2 changed files with 14 additions and 3 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# 2011 Nico Schottelius (nico-cdist at schottelius.org) # 2011-2014 Nico Schottelius (nico-cdist at schottelius.org)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -21,6 +21,12 @@
# Setup selections # Setup selections
# #
filename"$(cat "$__object/parameter/file")"
if [ "$filename" = "-" ]; then
filename="$__object/stdin"
fi
echo "debconf-set-selections << __file-eof" echo "debconf-set-selections << __file-eof"
cat "$(cat "$__object/parameter/file")" cat "$(cat "$filename")"
echo "__file-eof" echo "__file-eof"

View file

@ -18,6 +18,7 @@ REQUIRED PARAMETERS
------------------- -------------------
file:: file::
Use the given filename as input for debconf-set-selections(1) Use the given filename as input for debconf-set-selections(1)
If filename is "-", read from stdin.
EXAMPLES EXAMPLES
@ -29,6 +30,10 @@ __debconf_set_selections nslcd --file /path/to/file
# Setup configuration for nslcd from another type # Setup configuration for nslcd from another type
__debconf_set_selections nslcd --file "$__type/files/preseed/nslcd" __debconf_set_selections nslcd --file "$__type/files/preseed/nslcd"
__debconf_set_selections nslcd --file - << eof
gitolite gitolite/gituser string git
eof
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -41,5 +46,5 @@ SEE ALSO
COPYING COPYING
------- -------
Copyright \(C) 2011-2013 Nico Schottelius. Free use of this software is Copyright \(C) 2011-2014 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3). granted under the terms of the GNU General Public License version 3 (GPLv3).