From f8f3f4b98091bdfd99d5856c1ec10ee92a33e526 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 4 Dec 2016 02:46:32 +0100 Subject: Adding debconf handling for irc notifications. Signed-off-by: Daniel Baumann --- debian/open-infrastructure-container-tools.config | 13 ++++ .../open-infrastructure-container-tools.postinst | 30 ++++++++++ .../open-infrastructure-container-tools.templates | 14 +++++ debian/po/fr.po | 69 ++++++++++++++++------ debian/po/nl.po | 38 +++++++++++- debian/po/pt_BR.po | 38 +++++++++++- debian/po/templates.pot | 36 ++++++++++- 7 files changed, 217 insertions(+), 21 deletions(-) diff --git a/debian/open-infrastructure-container-tools.config b/debian/open-infrastructure-container-tools.config index a8b9ad5..ad0569c 100644 --- a/debian/open-infrastructure-container-tools.config +++ b/debian/open-infrastructure-container-tools.config @@ -2,6 +2,8 @@ set -e +CONFFILE="/etc/default/container-tools" + . /usr/share/debconf/confmodule db_settitle open-infrastructure-container-tools/title @@ -46,4 +48,15 @@ db_settitle open-infrastructure-container-tools/title db_input low open-infrastructure-container-tools/script || true db_go +if [ -e "${CONFFILE}" ] +then + . ${CONFFILE} || true + + db_set open-infrastructure-container-tools/irc "${IRK_TARGETS}" +fi + +db_settitle open-infrastructure-container-tools/title +db_input low open-infrastructure-container-tools/irc || true +db_go + db_stop diff --git a/debian/open-infrastructure-container-tools.postinst b/debian/open-infrastructure-container-tools.postinst index 3ba287e..4273247 100755 --- a/debian/open-infrastructure-container-tools.postinst +++ b/debian/open-infrastructure-container-tools.postinst @@ -2,6 +2,8 @@ set -e +CONFFILE="/etc/default/container-tools" + Install () { DEFAULT="${1}" @@ -60,6 +62,9 @@ case "${1}" in db_get open-infrastructure-container-tools/script SCRIPT="${RET:-debian}" # string (w/o empty) + db_get open-infrastructure-container-tools/irc + IRK_TARGETS="${RET}" # string (w/ empty) + db_stop Install "/var/lib/machines" "${MACHINES}" @@ -68,6 +73,31 @@ case "${1}" in Install "/var/cache/container-tools" "${CACHE}" update-alternatives --quiet --set container-tools_script "/usr/share/container-tools/scripts/${SCRIPT}" + + if [ ! -e "${CONFFILE}" ] + then + +cat > "${CONFFILE}" << EOF +# /etc/default/container-tools + +IRK_TARGETS="${IRK_TARGETS}" +EOF + + fi + + cp -a -f "${CONFFILE}" "${CONFFILE}.tmp" + + # If the admin deleted or commented some variables but then set + # them via debconf, (re-)add them to the config file. + + test -z "${IRK_TARGETS}" || \ + grep -Eq '^ *IRK_TARGETS=' "${CONFFILE}" || \ + echo "IRK_TARGETS=" >> "${CONFFILE}" + + sed -e "s|^ *IRK_TARGETS=.*|IRK_TARGETS=\"${IRK_TARGETS}\"|" \ + < "${CONFFILE}" > "${CONFFILE}.tmp" + + mv -f "${CONFFILE}.tmp" "${CONFFILE}" ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/debian/open-infrastructure-container-tools.templates b/debian/open-infrastructure-container-tools.templates index 97281d9..1d50080 100644 --- a/debian/open-infrastructure-container-tools.templates +++ b/debian/open-infrastructure-container-tools.templates @@ -50,3 +50,17 @@ _Description: create script: containers. . If unsure, use debian (default). + +Template: open-infrastructure-container-tools/irc +Type: string +_Default: +_Description: IRC notifications: + The container command can send IRC notifications via irker to one or more + (whitespace separated) IRC channels. + . + The following example will send IRC notifications to the + open-infrastructure channel on irc.oftc.net: + . + irc://irc.oftc.net:6668/open-infrastructure + . + If unsure, leave empty (default). diff --git a/debian/po/fr.po b/debian/po/fr.po index c5c65f6..56489a0 100644 --- a/debian/po/fr.po +++ b/debian/po/fr.po @@ -5,9 +5,9 @@ msgid "" msgstr "" "Project-Id-Version: open-infrastructure-container-tools\n" -"Report-Msgid-Bugs-To: open-infrastructure-container-tools@packages.debian.org" -"\n" -"POT-Creation-Date: 2016-06-14 21:22+0200\n" +"Report-Msgid-Bugs-To: open-infrastructure-container-tools@packages.debian." +"org\n" +"POT-Creation-Date: 2016-12-04 02:44+0100\n" "PO-Revision-Date: 2016-08-09 15:23+0100\n" "Last-Translator: Jean-Pierre Giraud \n" "Language-Team: French \n" @@ -40,8 +40,7 @@ msgstr "Répertoire des machines :" #: ../open-infrastructure-container-tools.templates:2002 msgid "Please specify the directory that will be used to store the containers." msgstr "" -"Veuillez indiquer le répertoire qui sera utilisé pour stocker " -"les conteneurs." +"Veuillez indiquer le répertoire qui sera utilisé pour stocker les conteneurs." #. Type: string #. Description @@ -50,8 +49,8 @@ msgid "" "If unsure, use /var/lib/machines (default) or /srv/container when using " "shared storage." msgstr "" -"En cas de doute, utilisez /var/lib/machines (répertoire " -"par défaut) ou /srv/container si vous utilisez un stockage partagé." +"En cas de doute, utilisez /var/lib/machines (répertoire par défaut) ou /srv/" +"container si vous utilisez un stockage partagé." #. Type: string #. Default @@ -72,8 +71,8 @@ msgid "" "Please specify the directory that will be used to store the container " "configuration files." msgstr "" -"Veuillez indiquer le répertoire qui sera utilisé pour stocker les " -"fichiers de configuration du conteneur." +"Veuillez indiquer le répertoire qui sera utilisé pour stocker les fichiers " +"de configuration du conteneur." #. Type: string #. Description @@ -82,8 +81,8 @@ msgid "" "If unsure, use /etc/container-tools/config (default) or /srv/container/" "container-tools/config when using shared storage." msgstr "" -"En cas de doute, utilisez /etc/container-tools/config (répertoire " -"par défaut) ou /srv/container/container-tools/config si vous utilisez un " +"En cas de doute, utilisez /etc/container-tools/config (répertoire par " +"défaut) ou /srv/container/container-tools/config si vous utilisez un " "stockage partagé." #. Type: string @@ -105,8 +104,8 @@ msgid "" "Please specify the directory that will be used to store the container " "preseed files." msgstr "" -"Veuillez indiquer le répertoire qui sera utilisé pour stocker les " -"fichiers préconfigurés du conteneur." +"Veuillez indiquer le répertoire qui sera utilisé pour stocker les fichiers " +"préconfigurés du conteneur." #. Type: string #. Description @@ -115,8 +114,8 @@ msgid "" "If unsure, use /etc/container-tools/debconf (default) or /srv/container/" "container-tools/debconf when using shared storage." msgstr "" -"En cas de doute, utilisez /etc/container-tools/debconf (répertoire " -"par défaut) ou /srv/container/container-tools/debconf si vous utilisez un " +"En cas de doute, utilisez /etc/container-tools/debconf (répertoire par " +"défaut) ou /srv/container/container-tools/debconf si vous utilisez un " "stockage partagé." #. Type: string @@ -148,9 +147,8 @@ msgid "" "If unsure, use /var/cache/container-tools (default) or /srv/container/" "container-tools/cache when using shared storage." msgstr "" -"En cas de doute, utilisez /var/cache/container-tools (répertoire par " -"défaut) ou /srv/container/container-tools/cache si vous utilisez un " -"stockage partagé." +"En cas de doute, utilisez /var/cache/container-tools (répertoire par défaut) " +"ou /srv/container/container-tools/cache si vous utilisez un stockage partagé." #. Type: select #. Choices @@ -179,3 +177,38 @@ msgstr "" msgid "If unsure, use debian (default)." msgstr "En cas de doute, utilisez debian (par défaut)." +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid "IRC notifications:" +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid "" +"The container command can send IRC notifications via irker to one or more " +"(whitespace separated) IRC channels." +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid "" +"The following example will send IRC notifications to the open-infrastructure " +"channel on irc.oftc.net:" +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid " irc://irc.oftc.net:6668/open-infrastructure" +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +#, fuzzy +#| msgid "If unsure, use debian (default)." +msgid "If unsure, leave empty (default)." +msgstr "En cas de doute, utilisez debian (par défaut)." diff --git a/debian/po/nl.po b/debian/po/nl.po index 28d1a7b..1f550b5 100644 --- a/debian/po/nl.po +++ b/debian/po/nl.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: open-infrastructure-container-tools\n" "Report-Msgid-Bugs-To: open-infrastructure-container-tools@packages.debian." "org\n" -"POT-Creation-Date: 2016-06-14 21:22+0200\n" +"POT-Creation-Date: 2016-12-04 02:44+0100\n" "PO-Revision-Date: 2016-08-02 21:35+0200\n" "Last-Translator: Frans Spiesschaert \n" "Language-Team: Debian Dutch l10n Team \n" @@ -176,3 +176,39 @@ msgstr "" #: ../open-infrastructure-container-tools.templates:6002 msgid "If unsure, use debian (default)." msgstr "Indien u twijfelt, gebruik dan debian (standaard)." + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid "IRC notifications:" +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid "" +"The container command can send IRC notifications via irker to one or more " +"(whitespace separated) IRC channels." +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid "" +"The following example will send IRC notifications to the open-infrastructure " +"channel on irc.oftc.net:" +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid " irc://irc.oftc.net:6668/open-infrastructure" +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +#, fuzzy +#| msgid "If unsure, use debian (default)." +msgid "If unsure, leave empty (default)." +msgstr "Indien u twijfelt, gebruik dan debian (standaard)." diff --git a/debian/po/pt_BR.po b/debian/po/pt_BR.po index aafb466..977b6f4 100644 --- a/debian/po/pt_BR.po +++ b/debian/po/pt_BR.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: open-infrastructure-container-tools\n" "Report-Msgid-Bugs-To: open-infrastructure-container-tools@packages.debian." "org\n" -"POT-Creation-Date: 2016-06-14 21:22+0200\n" +"POT-Creation-Date: 2016-12-04 02:44+0100\n" "PO-Revision-Date: 2016-08-25 22:07-0300\n" "Last-Translator: Adriano Rafael Gomes \n" "Language-Team: Brazilian Portuguese \n" "Language-Team: LANGUAGE \n" @@ -158,3 +158,37 @@ msgstr "" #: ../open-infrastructure-container-tools.templates:6002 msgid "If unsure, use debian (default)." msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid "IRC notifications:" +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid "" +"The container command can send IRC notifications via irker to one or more " +"(whitespace separated) IRC channels." +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid "" +"The following example will send IRC notifications to the open-infrastructure " +"channel on irc.oftc.net:" +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid " irc://irc.oftc.net:6668/open-infrastructure" +msgstr "" + +#. Type: string +#. Description +#: ../open-infrastructure-container-tools.templates:7002 +msgid "If unsure, leave empty (default)." +msgstr "" -- cgit v1.2.3