Allow user install

Marcel Moolenaar marcel at xcllnt.net
Mon Jul 2 14:53:43 UTC 2012


On Jul 2, 2012, at 7:34 AM, Brooks Davis wrote:

> On Sun, Jul 01, 2012 at 02:12:07PM -0700, Marcel Moolenaar wrote:
>> 
>> On Jun 27, 2012, at 4:59 PM, Brooks Davis wrote:
>> 
>>> On Tue, Jun 26, 2012 at 09:16:05AM -0700, Simon J. Gerraty wrote:
>>>> 
>>>> On Tue, 26 Jun 2012 08:18:05 -0700, Tim Kientzle writes:
>>>>> Better idea:  have the build write a textual description of the
>>>>> tar entries.  That description can then be fed to tar to build
>>>>> the actual tarball.
>>>> 
>>>> Yes, that's what we do - manifest files that tar and other tools use to
>>>> produce the install images.
>>>> 
>>>>> The description format that tar already supports is a variant
>>>>> mtree format borrowed from NetBSD.  Each line specifies
>>>>> the tar entry fields (filename, owner, permissions, etc) and
>>>>> the filename where the file contents are stored.
>>>> 
>>>> Yes, we've added that support to makefs - I believe it is already in
>>>> -current.  There's still quite a bit to do.
>>> 
>>> It's there except that makefs uses the FreeBSD mtree code which doesn't
>>> support the crucial absolute path support in NetBSD's mtree.
>> 
>> ?
>> 
>> I wrote the code and no, it doesn't use FreeBSD mtree code and yes,
>> it supports absolute pathnames:
>> 
>> 		:
>>        cp = strchr(pathspec, '/');   
>>        if (cp != NULL) {
>>                /* Absolute pathname */
>>                mtree_current = mtree_root;
>> 
>> 		:
>> 
>> The code should be compatible with libarchive.
>> Maybe there's a bug?
> 
> On the first point, two files are used from ../mtree:
> 
> $ ident makefs | grep mtree
>     $FreeBSD: head/usr.sbin/makefs/mtree.c 223306 2011-06-19 18:34:49Z marcel $
>     $FreeBSD: head/usr.sbin/mtree/misc.c 160083 2006-07-03 10:55:22Z maxim $
>     $FreeBSD: head/usr.sbin/mtree/spec.c 229403 2012-01-03 18:51:58Z ed $
> 
> Here's the failure:
> 
> $ mkdir foo
> $ touch foo/bar
> $ cd foo
> $ tar cf ../foo.mtree --format mtree --options mtree:use-set .
> $ cd ..
> $ cat foo.mtree
> #mtree
> /set type=file uname=brooks uid=1001 gname=brooks gid=1001 mode=644
> . time=1341239212.0 mode=755 type=dir
> ./bar time=1341239166.0 size=0
> ./ormat time=1341239212.0 size=2048
> $ makefs  -s 1m -F foo.mtree foo.img foo
> makefs: line 4: slash character in file name
> 
> and the source of the failure.
> 
> $ grep "slash character in file name" /usr/src/usr.sbin/mtree/*
> /usr/src/usr.sbin/mtree/spec.c:			errx(1, "line %d: slash character in file name",
> 

Your invocations is still based on directory scanning and with
the -F option you can provide overrides. This is not the mtree
support I added -- that eliminates directory scanning and the
-F option has no effect. Use as follows:

	makefs -s 1m foo.img foo.mtree

See also man makefs
FYI,

-- 
Marcel Moolenaar
marcel at xcllnt.net




More information about the freebsd-arch mailing list