staging without root privileges

Anton Shterenlikht mexas at bris.ac.uk
Wed May 14 11:49:00 UTC 2014


>Am 13.05.2014 19:18, schrieb Anton Shterenlikht:
>> https://wiki.freebsd.org/ports/StageDir
>> says 
>> 
>> Make sure you tested make package as a normal user (not root).
>> 
>> Does this refer specifically to the package target?
>
>build targets ("make all", "make stage", "make check-plist") and
>packaging ("make package").
>
>> Or to all targets up to and including package?
>> 
>> I'm asked for root passwd on make config,
>> and then I get an error on build:
>> 
>> mkdir: /usr/ports/devel/robodoc/work: Permission denied
>> 
>> which makes sense.
>
>Setting WRKDIRPREFIX to a directory you can write to can fix that, and
>PACKAGES specifies where the package should end up. PORT_DBDIR can be
>diverted to a directory so you can run even "make config" without root
>privileges.
>
>With that, and the distfiles already downloaded ("make checksum"), you
>should be able to build most ports without privileges.  A few set
>NEED_ROOT, those won't do without...

Ok, thanks, so I'm building with:

 make WRKDIRPREFIX=/tmp PACKAGES=/tmp all check-stage package

and get to:

===>  Staging for slatec-4.1_2
===>   slatec-4.1_2 depends on executable: gfortran47 - found
===>   Generating temporary packing list
install -C -o root -g wheel -m 444   libslatec.a /tmp/usr/ports/math/slatec/work/stage/usr/local/lib
install: /tmp/usr/ports/math/slatec/work/stage/usr/local/lib/libslatec.a: chown/chgrp: Operation not permitted
*** Error code 71

I guess I need to refer to this point of the staging wiki:

Replace commands like ${CHMOD} ... and ${INSTALL_PROGRAM} -m mode -o user -g group with corresponding pkg-plist entries: @mode mode, @owner user, @group group. 
/!\ These operators work until being overridden, so do not forget to reset them with @mode, @owner root, @group wheel keywords afterwards.
To set specific mode/user/group for a directory, use these operators before @dirrm(try) directory. For pkg_tools compatibility add: @exec install -d -o user -g group -m mode %D/directory.

However, I don't have pkg-plist for this port,
it only installs 5 or 6 files. CAn I set this
in the Makefile?

I have:

PLIST_FILES=    lib/libslatec.a lib/libslatec.so lib/libslatec.so.${SHLIB_MAJOR}
PORTDOCS=       guide toc

Thanks

Anton



More information about the freebsd-ports mailing list