From 4ff794b11ab4085df262312ca54e6bfd0ddc1d13 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 21 Mar 2011 10:07:38 +0100 Subject: [PATCH] __file now supports --preseed (including the documentation) Signed-off-by: Nico Schottelius --- conf/type/__package_apt/gencode-remote | 8 +++++++- conf/type/__package_apt/man.text | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/conf/type/__package_apt/gencode-remote b/conf/type/__package_apt/gencode-remote index 370f0102..b2c7179d 100755 --- a/conf/type/__package_apt/gencode-remote +++ b/conf/type/__package_apt/gencode-remote @@ -27,8 +27,14 @@ else name="$__object_id" fi -state="$(cat "$__object/parameter/state")" +# Check for preseeding and add preseed as here document +if [ -f "$__object/parameter/preseed" ]; then + echo "debconf-set-selections << __file-eof" + cat "$(cat "$__object/parameter/preseed")" + echo "__file-eof" +fi +state="$(cat "$__object/parameter/state")" is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status" || true)" case "$state" in diff --git a/conf/type/__package_apt/man.text b/conf/type/__package_apt/man.text index 0780124d..8b7476b4 100644 --- a/conf/type/__package_apt/man.text +++ b/conf/type/__package_apt/man.text @@ -25,6 +25,9 @@ OPTIONAL PARAMETERS name:: If supplied, use the name and not the object id as the package name. +preseed:: + If supplied, use the given filename as input for debconf-set-selections(1) + EXAMPLES -------- @@ -36,6 +39,9 @@ __package_apt zsh --state installed # In case you only want *a* webserver, but don't care which one __package_apt webserver --state installed --name nginx +# Install package with defaults (from a type) +__package_apt postfix --state installed --preseed "$__type/files/postfix-seed" + # Remove obsolete package __package_apt puppet --state deinstalled --------------------------------------------------------------------------------