Re: Preferred way to do a chown on package's dirs ?
On Thu, Aug 07, 2008 at 03:12:42PM +0200, Olivier Berger wrote:
> I'm not sure I can find authoritative information on how a packager
> should change the ownership (chown) of a shipped directory.
> Of course this can be done in the package's postinst.
As already noted, it *has* to be in the postinst if:
. the user is a dynamic system user (100<UID<1000)
. the directory previously existed as a different user; in this case
dpkg won't change it automatically.
If you change permissions in postinst, you should use
dpkg-statoverride (see policy for an example). This guarantees that
(for regular files) the new permissions are in place even when the
package is upgraded, and not just chown()d afterwards, with some
window of time with the wrong permissions.
> install -m 750 -o www-data -g www-data -d debian/whatever_package/var/lib/mypackage/somedir
> chown -R www-data:www-data debian/whatever_package/var/lib/mypackage/somedir
If you call dh_fixperms afterwards, these changes will be lost.
> When doing so, it seems that dpk-buildpackage -rfakeroot won't respect
> that user definition (btw, that user may not exist on the machine the
> package is build from, right ?).
User www-data (and everything else with UID<100) is guaranteed to exist with
globally constant UID on a Debian system.