[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: on the use of chmod/chown in maintainer scripts



On Sat, May 12, 2012 at 03:55:24PM +0200, Guillem Jover wrote:
> On Sat, 2012-05-12 at 12:28:27 +0100, Roger Leigh wrote:
> > On Sat, May 12, 2012 at 12:23:49PM +0200, Peter Palfrader wrote:
> > With the above approach, the only hard question is how to set the
> > ownership during the package build.  fakeroot handles this just fine,
> > but it does require the user/group to be present on the build
> > system, which will not always be the case.  Is there an alternative
> > means to set/override the ownership during packing of a tarfile?
> 
> One option would be to make dpkg-deb use an internal tar implementation,
> and add a file describing the attributes of the to be packaged files.
> That might make needing root privs (either through fakeroot or sudo)
> unneeded in most of the cases too.

I found that this functionality is already present in BSD tar,
according to the manpage.  You can provide a file containing
all the files to pack, plus their ownership and perms etc.,
rather than just specifying the files on the command-line.

----bsdtar(1)----
An input file in mtree(5) format can be used to create an output archive
with arbitrary ownership, permissions, or names that differ from existing
data on disk:

     $ cat input.mtree
     #mtree
     usr/bin uid=0 gid=0 mode=0755 type=dir
     usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls
     $ tar -cvf output.tar @input.mtree
-----------------

I can't see an equivalent in GNU tar.  But BSD tar is available
in Debian.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800


Reply to: