creating /var/www/var/www in PLIST is not ideal, some people already have
a symlink from /var/www/var -> .. to cope with similar situations in locally
installed software, and IIRC if you include that as a directory in PLIST it
may replace the existing symlink

perhaps better to patch the scripts that are run from httpd to strip the
/var/www prefix if necessary (but a user might of course be running without
chroot anyway)



On 2022/06/06 17:45, Aisha Tammy wrote:
> 
> 
> On 6/6/22 14:14, Omar Polo wrote:
> > aisha <[email protected]> wrote:
> > > On 22/05/27 06:31PM, A Tammy wrote:
> > > > Hi,
> > > > 
> > > > ?? I found that the port for monica needed a symlink
> > > > `/var/www/var/www/monica -> /var/www/monica` (which I had setup on my 
> > > > server
> > > > but forgot to add to PLIST).
> > > > 
> > > > The reason this is needed is because the initial setup for monica needs 
> > > > to
> > > > run the command `cd /var/www/monica && php-8.0 artisan 
> > > > setup:production`,
> > > > which sets up a few configuration files which hardcode paths to 
> > > > locations
> > > > for storage and cache and things. Now these locations are absolute, so 
> > > > they
> > > > look like `/var/www/monica/xxx/yyy`, which php-fpm can't find when 
> > > > running
> > > > in the chroot. The simplest solution is the one mentioned above, to 
> > > > create a
> > > > symlink, and things work perfectly. I am not super sure how to replicate
> > > > this inside the Makefile for the port.
> > > > 
> > > > I'm thinking something like
> > > > 
> > > > ln -s ${PREFIX}/www/${TRUEPREFIX}/www/monica -> ../../monica
> > > > 
> > > > But I don't know how many levels that TRUEPREFIX can have.
> > > > Maybe just use /var for PREFIX instead of LOCALSTATEDIR and make things
> > > > easier ?
> > > > 
> > > > Any suggestions?
> > There isn't a way to avoid the symlink?  seems fragile.
> I agree :(
> > 
> > it's not possible to, say, fix this at build time somehow?  can't we (in
> > the worst case) run a sed to replace ${PREFIX}/www with / ?
> Unfortunately not anything I can see.
> This is done at configure time (by end user when they want to do setup) so
> no sed on port side (at least nothing trivial which I can guarantee won't
> break stuff, my PHP knowledge is meager).
> 
> The symlink while fragile, at least keeps things simple, so its easier to
> debug than other stuff we can do.
> > > > Aisha
> > > > 
> > > patch attempting to fix this (also adds the README)
> > > 
> > > 
> > > diff --git a/productivity/monica/Makefile b/productivity/monica/Makefile
> > > index 2b0a16b7b99..8c43d40d2cf 100644
> > > --- a/productivity/monica/Makefile
> > > +++ b/productivity/monica/Makefile
> > > @@ -3,6 +3,7 @@ COMMENT = self hosted personal CRM system
> > >   CATEGORIES =    productivity
> > >   VERSION =       3.7.0
> > > +REVISION =       0
> > >   PKGNAME =       monica-${VERSION}
> > >   MASTER_SITES =  
> > > https://github.com/monicahq/monica/releases/download/v${VERSION}/
> > > @@ -32,12 +33,13 @@ RUN_DEPENDS = lang/php/${MODPHP_VERSION},-curl \
> > >   NO_TEST =       Yes
> > >   NO_BUILD =      Yes
> > > -PREFIX = ${LOCALSTATEDIR}
> > > +PREFIX = /var
> > >   INSTDIR =       ${PREFIX}/www/monica
> > >   do-install:
> > > - ${INSTALL_DATA_DIR} ${INSTDIR}
> > > + ${INSTALL_DATA_DIR} ${INSTDIR} ${PREFIX}/www/var/www
> > >           cp -a ${WRKSRC}/. ${INSTDIR}
> > >           rm ${INSTDIR}/vendor/sabre/dav/bin/googlecode_upload.py
> > > + ln -s ../../monica ${PREFIX}/www/var/www/monica
> > >   .include <bsd.port.mk>
> > > diff --git a/productivity/monica/pkg/PLIST b/productivity/monica/pkg/PLIST
> > > index d9600c56c9e..8c4cb65f611 100644
> > > --- a/productivity/monica/pkg/PLIST
> > > +++ b/productivity/monica/pkg/PLIST
> > > @@ -717,7 +717,7 @@ www/monica/app/ViewHelpers/ContactHelper.php
> > >   www/monica/artisan
> > >   www/monica/bootstrap/
> > >   www/monica/bootstrap/app.php
> > > -@mode 775
> > > +@mode 770
> > >   @owner www
> > >   @group www
> > >   www/monica/bootstrap/cache/
> > > @@ -20335,3 +20335,8 @@ 
> > > www/monica/vendor/xantios/mimey/tests/src/MimeMappingGeneratorTest.php
> > >   www/monica/vendor/xantios/mimey/tests/src/MimeTypesTest.php
> > >   www/monica/webpack.mix.js
> > >   www/monica/yarn.lock
> > > +www/var/
> > > +www/var/www/
> > > +www/var/www/monica
> > > +@cwd ${LOCALBASE}
> > > +share/doc/pkg-readmes/${PKGSTEM}
> > 
> 

Reply via email to