Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Aug 2006 11:38:44 +0200
From:      =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= <gabor@FreeBSD.org>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        ports@FreeBSD.org, John E Hein <jhein@timing.com>
Subject:   Re: support for DESTDIR: security/openssh-portable
Message-ID:  <44DC5024.2050709@FreeBSD.org>
In-Reply-To: <20060810140529.GB20275@lor.one-eyed-alien.net>
References:  <17626.25183.846983.515718@gromit.timing.com> <17626.25444.563099.956775@gromit.timing.com> <44DA6FC9.3040404@FreeBSD.org> <17626.29481.909830.326948@gromit.timing.com> <17626.30422.650339.960580@gromit.timing.com> <20060810132105.GA20275@lor.one-eyed-alien.net> <44DB33D2.4070308@FreeBSD.org> <20060810140529.GB20275@lor.one-eyed-alien.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Brooks Davis wrote:
> On Thu, Aug 10, 2006 at 03:25:38PM +0200, G?bor K?vesd?n wrote:
>   
>> Brooks Davis wrote:
>>     
>>> On Wed, Aug 09, 2006 at 05:59:18PM -0600, John E Hein wrote:
>>>  
>>>       
>>>> John E Hein wrote at 17:43 -0600 on Aug  9, 2006:
>>>>         
>>>>> Well, the part that makes it annoying to duplicate in all ports is not
>>>>> the two separate words (CHROOT DESTDIR), but that you have to test
>>>>> defined(DESTDIR) && !empty(DESTDIR) before you can figure out whether
>>>>> to use ${CHROOT} ${DESTDIR} or not.
>>>>>
>>>>> So having that test to assign CHROOTDESTDIR or leave it empty in
>>>>> bsd.port.mk allows the port writer to just always invoke it without
>>>>> having to worry about testing for DESTDIR.
>>>>>           
>>>> You could pass this var to pkg-install scripts, too (put it in the
>>>> standard *SUB* lists).
>>>>
>>>> That way you don't have to do the dance that was added to
>>>> security/clamav/files/pkg-install.in:
>>>>
>>>> if [ -n "%%DESTDIR%%" ]; then
>>>>        PW="/usr/sbin/chroot %%DESTDIR%% pw"
>>>>        CHOWN="/usr/sbin/chroot %%DESTDIR%% chown"
>>>>        MKDIR="/usr/sbin/chroot %%DESTDIR%% mkdir -p"
>>>> else
>>>>        PW="pw"
>>>>        CHOWN="chown"
>>>>        MKDIR="mkdir -p"
>>>> fi
>>>>
>>>> but rather just:
>>>>
>>>> PW="%%CHROOTDESTDIR%% pw"
>>>> CHOWN="%%CHROOTDESTDIR%% chown"
>>>> MKDIR="%%CHROOTDESTDIR%% mkdir -p"
>>>>    
>>>>         
>>> This seems bogus.  I can't think of any good reason why packages should
>>> differ based on the valid of DESTDIR.  Instead the pkg-install script
>>> should be run inside the chroot.
>>>
>>> -- Brooks
>>>  
>>>       
>> We wanted to go that way with garga when working on security/clamav, but 
>> we realized that we can't just do chroot /foo pkg-install, since the 
>> script is not located in the chroot itself. Do you have an another idea, 
>> how to chroot those scripts?
>>     
>
> My inclination would be something like:
>
> 	PKG_INSTALL_TEMP=`mktemp ${DESTDIR}/tmp/pkg_install` && \
> 	    (${CAT} ${PKG_INSTALL} > ${PKG_INSTALL_TEMP}; \
> 	     ${SH} ${PKG_INSTALL_TEMP}; \
> 	     ${RM} ${PKG_INSTALL_TEMP})
>
> I think we should ideally introduce a feature to allow ports to
> automatically run pkg-install and stuff the code in bsd.port.mk so ports
> don't have to know about DESTDIR in this case.  Actually, ports where
> pkg-install and the pre/post-install targets duplicate code (often
> slightly differently) drive me nuts so I'd prefer a NO_AUTOPKGINSTALL,
> but that would take some real work so a positive flag is probably better
> initially.
>
> -- Brooks
>   
This is a good idea, but there's a big mess in this area as you already 
said, so I think it would be a long term goal. I find John's solution 
pretty good for now. An another item for automatization would be to 
install PORTDOCS into DOCSDIR in post-install phase. and introduce 
NO_PORTDOCSINSTALL or something like that to turn this off. But both of 
them needs a lot of modification in affected ports as well.

-- 
Cheers,

Gabor




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44DC5024.2050709>