Le jeudi 28 janvier 2010, Tanguy Ortolo a écrit :
> I may suggest not to rename /usr/share/dokuwiki/.htaccess.dist, to
> rename its friends /var/lib/dokuwiki/data/.htaccess and company by
> adding them a .inst suffix, and to rewrite the ucf calls accordingly.
> I shall test that and submit a patch in a few days.

So, here is my patch, against the debian/ directory of the source
package. Basically, this is what it does:
* debian/rules install:
  name the .htaccess files .htaccess.inst in the package;
* debian/postinst configure:
  call ucf .htaccess.inst .htaccess, so that ucf does not manage files
  that are part of the package itself any more;
* debian/postrm purge:
  remove the ucf files.

With only this modification, there was a problem on upgrading: the
.htaccess files were removed, as part of the old version but not of the
new one, before debian/postinst configure was called. Then, ucf found
the target configuration files, already managed since the old
debian/postinst configure, were not here. It assumed they were removed
by the user and did not install them!

So I also added some modifications for this transition:
* debian/preinst upgrade:
  if needed, backup the configuration files with names
  .htaccess.upgrade;
* debian/postrm abort-upgrade:
  remove these backups;
* debian/postinst configure:
  if the configuration files are not found, and the backups are found,
  resore these backups before calling ucf.

As a bonus, I also added ucfr commands to register the configuration
files, as it is recommended in ucf(1). And commands to unregister them
on purge, of course.

I tested my modifications on upgrading from the previous version, on
reinstalling from my version to my version and on removing my version
and installing it again: the .htaccess files are correctly preserved. On
downgrading, and on removing previous version and installing mine, they
are overwritten.

-- 
Tanguy Ortolo

Attachment: debian.patch.gz
Description: Binary data

Attachment: signature.asc
Description: Digital signature

Reply via email to