Bug#848064: radicale: Add debconf support for basic configuration
Here's a new patch, which supersedes the others I sent to this bug report. In this one, the upstream config file is not used at all. Instead, /etc/radicale/config is entirely generated in postinst. Note: This patch is for radicale 2.1.x series. - There are many debconf questions added, with medium or low priority, covering nearly all of the available configs supported by radicale. I left out a few that aren't useful in Debian. - The 2001_debianize_config patch is no longer needed, but is taken into account for debconf template defaults. - awk is used to read current config from disk in radicale.config. - augeas-tools is used to modify the config in postinst. - Only one debconf question has high priority, which is to ask whether to automatically handle config upgrades. - If there is an existing /etc/radicale/config file, first, any settings will be read into debconf database by radicale.config. If automatic config upgrade is selected, then in postinst, the file is moved to /etc/radicale/config.orig, and a new /etc/radicale/config is generated. -- James From 56c39daac1cd09f16899b60dee19bdffc37dac29 Mon Sep 17 00:00:00 2001 From: James ValleroyDate: Sat, 19 Aug 2017 16:17:24 -0400 Subject: [PATCH] Add option for automatic config upgrade --- debian/control | 5 +- debian/control.in | 4 +- debian/patches/2001_debianize_config.patch | 19 -- debian/patches/series | 1 - debian/po/POTFILES.in | 1 + debian/po/templates.pot| 480 + debian/radicale.config | 106 +++ debian/radicale.install| 1 - debian/radicale.postinst | 120 +++- debian/radicale.postrm | 2 + debian/radicale.templates | 202 11 files changed, 909 insertions(+), 32 deletions(-) delete mode 100644 debian/patches/2001_debianize_config.patch create mode 100644 debian/po/POTFILES.in create mode 100644 debian/po/templates.pot create mode 100644 debian/radicale.config create mode 100644 debian/radicale.templates diff --git a/debian/control b/debian/control index d1ff4a2..8b2f38d 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,7 @@ Build-Depends: cdbs, python3, debhelper, dh-buildinfo, + po-debconf, python3-setuptools, python3-vobject (>= 0.9.5), python3-atomicwrites, @@ -25,7 +26,9 @@ Depends: ${misc:Depends}, ${python:Depends}, python3-radicale (= ${binary:Version}), python3, - adduser + adduser, + augeas-tools, + debconf, Recommends: ssl-cert Suggests: ${cdbs:Suggests} Provides: ${python:Provides} diff --git a/debian/control.in b/debian/control.in index 3fefba8..e0750d0 100644 --- a/debian/control.in +++ b/debian/control.in @@ -15,7 +15,9 @@ Depends: ${misc:Depends}, ${python:Depends}, python3-radicale (= ${binary:Version}), python3, - adduser + adduser, + augeas-tools, + debconf, Recommends: ssl-cert Suggests: ${cdbs:Suggests} Provides: ${python:Provides} diff --git a/debian/patches/2001_debianize_config.patch b/debian/patches/2001_debianize_config.patch deleted file mode 100644 index 3170fd5..000 --- a/debian/patches/2001_debianize_config.patch +++ /dev/null @@ -1,19 +0,0 @@ -Description: Adapt config to use snakeoil certificate. -Author: Jonas Smedegaard -Last-Update: 2017-06-27 - a/config -+++ b/config -@@ -36,10 +36,10 @@ - #ssl = False - - # SSL certificate path --#certificate = /etc/ssl/radicale.cert.pem -+certificate = /etc/ssl/certs/ssl-cert-snakeoil.pem - - # SSL private key --#key = /etc/ssl/radicale.key.pem -+key = /etc/ssl/private/ssl-cert-snakeoil.key - - # CA certificate for validating clients. This can be used to secure - # TCP traffic between Radicale and a reverse proxy diff --git a/debian/patches/series b/debian/patches/series index 7483774..63bd2d7 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1 @@ -2001_debianize_config.patch 2002_avoid_missing_pytest_ext.patch diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in new file mode 100644 index 000..6089075 --- /dev/null +++ b/debian/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] radicale.templates diff --git a/debian/po/templates.pot b/debian/po/templates.pot new file mode 100644 index 000..becc2d4 --- /dev/null +++ b/debian/po/templates.pot @@ -0,0 +1,480 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the radicale package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: radicale\n" +"Report-Msgid-Bugs-To: radic...@packages.debian.org\n" +"POT-Creation-Date: 2017-08-12 21:27-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language:
Bug#848064: radicale: Add debconf support for basic configuration
On 01/24/2017 01:20 PM, Jonas Smedegaard wrote: > Quoting James Valleroy (2017-01-23 23:48:00) >> On Tue, 13 Dec 2016 12:14:52 -0500 James Valleroy >>wrote: >>> The attached patch set implements this, by adding several debconf >>> questions to set the server hostnames, base url, well-known paths, >>> authentication type, and rights type. These questions all have low >>> priority. I used augtool (from augeas-tools) to read/modify the >>> config file, and ucf to merge user settings with updates to the >>> packaged file. >> >> After sending this patch, I discovered this rule given in the Debconf >> Programmer's Tutorial: >> "Note that the config script is run before the package is unpacked. It >> should only use commands that are in essential packages." >> >> But in the patch I submitted (part 0002), I used augtool in >> debian/radicale.config to parse the ini-file config and read current >> settings from disk. So that is a problem for the 0002 and 0003 patches >> above. I'm attaching another patch that switches debian/radicale.config to use awk to read the current configuration. This should resolve the issue mentioned above. From 4274c6ac412b536cda4e909e65563a71c09c5248 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sat, 25 Feb 2017 14:45:49 -0500 Subject: [PATCH 4/4] Use awk to read config in config script --- debian/radicale.config | 25 - 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/debian/radicale.config b/debian/radicale.config index 4699cff..e95f84e 100644 --- a/debian/radicale.config +++ b/debian/radicale.config @@ -6,23 +6,22 @@ CONF=/etc/radicale/config . /usr/share/debconf/confmodule -aug_get () { -cat < signature.asc Description: OpenPGP digital signature
Bug#848064: radicale: Add debconf support for basic configuration
Quoting James Valleroy (2017-01-23 23:48:00) > On Tue, 13 Dec 2016 12:14:52 -0500 James Valleroy >wrote: >> The attached patch set implements this, by adding several debconf >> questions to set the server hostnames, base url, well-known paths, >> authentication type, and rights type. These questions all have low >> priority. I used augtool (from augeas-tools) to read/modify the >> config file, and ucf to merge user settings with updates to the >> packaged file. > > After sending this patch, I discovered this rule given in the Debconf > Programmer's Tutorial: > "Note that the config script is run before the package is unpacked. It > should only use commands that are in essential packages." > > But in the patch I submitted (part 0002), I used augtool in > debian/radicale.config to parse the ini-file config and read current > settings from disk. So that is a problem for the 0002 and 0003 patches > above. Ah, that might explain why augeas hasn't been in more widespread use. > Patch 0001, which only adds ucf to improve merging changes to the > config, should still be ok. Ok, but patch 0001 alone does not really help address the requirement of Debian Policy ยง 10.7.4, further clarified in release notes like the most recent https://release.debian.org/stretch/rc_policy.txt: > Packages must not modify other packages' configuration files except by > an agreed upon APIs (eg, a /usr/sbin/update-foo command). For an old and long read about this issue, see bug#311188. - Jonas -- * Jonas Smedegaard - idealist & Internet-arkitekt * Tlf.: +45 40843136 Website: http://dr.jones.dk/ [x] quote me freely [ ] ask before reusing [ ] keep private signature.asc Description: signature
Bug#848064: radicale: Add debconf support for basic configuration
On Tue, 13 Dec 2016 12:14:52 -0500 James Valleroywrote: > The attached patch set implements this, by adding several debconf > questions to set the server hostnames, base url, well-known paths, > authentication type, and rights type. These questions all have low > priority. I used augtool (from augeas-tools) to read/modify the config > file, and ucf to merge user settings with updates to the packaged file. After sending this patch, I discovered this rule given in the Debconf Programmer's Tutorial: "Note that the config script is run before the package is unpacked. It should only use commands that are in essential packages." But in the patch I submitted (part 0002), I used augtool in debian/radicale.config to parse the ini-file config and read current settings from disk. So that is a problem for the 0002 and 0003 patches above. Patch 0001, which only adds ucf to improve merging changes to the config, should still be ok. signature.asc Description: OpenPGP digital signature
Bug#848064: radicale: Add debconf support for basic configuration
Source: radicale Severity: wishlist Tags: patch Radicale is currently being used as the CalDAV/CardDAV server on FreedomBox. It is configured by Plinth after the package is installed: https://github.com/freedombox/Plinth/blob/master/actions/radicale#L54 However, /etc/radicale/config is a conffile, so our modifications will cause confusing prompts during upgrades, and block unattended upgrades. To solve this, I suggest that /etc/radicale/config can be generated/merged in postinst, with debconf questions that cover the settings we need. The attached patch set implements this, by adding several debconf questions to set the server hostnames, base url, well-known paths, authentication type, and rights type. These questions all have low priority. I used augtool (from augeas-tools) to read/modify the config file, and ucf to merge user settings with updates to the packaged file. Note that if these changes are merged, we should send a call for translations before the release. -- James From b348018d7de667c1296af15382699b60402d713d Mon Sep 17 00:00:00 2001 From: James ValleroyDate: Mon, 12 Dec 2016 22:54:08 -0500 Subject: [PATCH 1/3] Use ucf to manage config --- debian/control | 3 ++- debian/control.in| 3 ++- debian/radicale.install | 2 +- debian/radicale.postinst | 3 +++ debian/radicale.postrm | 9 + 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index 97b73af..441bb85 100644 --- a/debian/control +++ b/debian/control @@ -24,7 +24,8 @@ Depends: ${misc:Depends}, ${python:Depends}, python3-radicale (= ${binary:Version}), python3, - adduser + adduser, + ucf Suggests: apache2-utils, python3-passlib, Provides: ${python:Provides} diff --git a/debian/control.in b/debian/control.in index 6a8e07b..973974d 100644 --- a/debian/control.in +++ b/debian/control.in @@ -15,7 +15,8 @@ Depends: ${misc:Depends}, ${python:Depends}, python3-radicale (= ${binary:Version}), python3, - adduser + adduser, + ucf Suggests: apache2-utils, python3-passlib, Provides: ${python:Provides} diff --git a/debian/radicale.install b/debian/radicale.install index d164637..5d80a80 100644 --- a/debian/radicale.install +++ b/debian/radicale.install @@ -1,5 +1,5 @@ usr/bin -config /etc/radicale/ logging /etc/radicale/ +config /usr/share/radicale/ radicale.wsgi /usr/share/radicale/ radicale.fcgi /usr/share/radicale/ diff --git a/debian/radicale.postinst b/debian/radicale.postinst index 93d7596..6cc557e 100644 --- a/debian/radicale.postinst +++ b/debian/radicale.postinst @@ -10,6 +10,7 @@ DAEMON_GID=$ACCOUNTNAME CALDIR=/var/lib/$NAME ACCOUNTHOME=$CALDIR GECOS="Radicale CalDAV server" +CONF=/etc/radicale/config case "$1" in configure) @@ -18,6 +19,8 @@ case "$1" in --gecos "$GECOS" --group --disabled-password \ --quiet $ACCOUNTNAME fi + ucf --three-way /usr/share/radicale/config $CONF + ucfr radicale $CONF ;; esac diff --git a/debian/radicale.postrm b/debian/radicale.postrm index 4f1ff38..083d634 100644 --- a/debian/radicale.postrm +++ b/debian/radicale.postrm @@ -6,6 +6,7 @@ set -e NAME=radicale RUNDIR=/var/run/$NAME LOGDIR=/var/log/$NAME +CONF=/etc/radicale/config case "$1" in remove) @@ -13,6 +14,14 @@ case "$1" in ;; purge) + if [ -x "$(which ucf 2>/dev/null)" ]; then + ucf --purge $CONF + fi + if [ -x "$(which ucfr 2>/dev/null)" ]; then + ucfr --purge radicale $CONF + fi + rm -f $CONF + rm -rf $LOGDIR # We do NOT remove the system user. -- 2.10.2 From 54bbc5267ea9495417ffe155e6b2094ccef13b40 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Tue, 13 Dec 2016 08:38:29 -0500 Subject: [PATCH 2/3] Add debconf questions, using augeas to modify config --- debian/control| 2 ++ debian/control.in | 2 ++ debian/radicale.config| 43 +++ debian/radicale.postinst | 45 - debian/radicale.postrm| 4 debian/radicale.templates | 25 + 6 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 debian/radicale.config create mode 100644 debian/radicale.templates diff --git a/debian/control b/debian/control index 441bb85..eef9a0a 100644 --- a/debian/control +++ b/debian/control @@ -25,6 +25,8 @@ Depends: ${misc:Depends}, python3-radicale (= ${binary:Version}), python3, adduser, + augeas-tools, + debconf, ucf Suggests: apache2-utils, python3-passlib, diff --git a/debian/control.in b/debian/control.in index 973974d..e460d44 100644 --- a/debian/control.in +++ b/debian/control.in @@ -16,6 +16,8 @@ Depends: ${misc:Depends}, python3-radicale (= ${binary:Version}), python3, adduser, + augeas-tools, + debconf, ucf Suggests: apache2-utils, python3-passlib, diff --git a/debian/radicale.config b/debian/radicale.config new file mode 100644 index 000..4699cff --- /dev/null +++