tech-pkg archive

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

Re: Unprivileged rc.d-boot on Darwin



> Le 2 déc. 2022 à 14:51, Greg Troxel <gdt%lexort.com@localhost> a écrit :
> Frédéric Fauberteau <triaxx%NetBSD.org@localhost> writes:
>> +.if empty(UNPRIVILEGED:M[Yy][Ee][Ss])
>> +DARWIN_LAUNCHD_PATH= ${SLASH_TO_MOLLIFY_PKGLINT}Library/LaunchDaemons
>> +.else
>> +DARWIN_LAUNCHD_PATH= ${HOME}/Library/LaunchAgents
>> +.endif
> 
> I understand what you are trying to do (and should have been described
> in the commit message that you didn't include :-)
You are totally right. My commit message should have been:
rc.d-boot: fix some issues with unprivileged install

pkgsrc changes:
  * Change hardcoded /etc to PKG_SYSCONFDIR in rc.d-boot script.
  * Update INSTALL script to install org.pkgsrc.rc.d-boot.plist in a subdirectory
    in home directory of the unprivileged user who installs the package on MacOS. 

>  for privileged installs, make no change
> 
>  for unprivileged installs, use PKG_SYSCONFDIR instead of /etc (this is
>  fine and not controversial; a simple bug fix I think)
> 
>  for unprivileged installs, don't try to write to /System, because it
>  is wrong and won't work
> 
>  instead, *assume* that the user running the build is the user that
>  will install the packages, and use that user's homedir
What I would like to do is actually:
+.if empty(UNPRIVILEGED:M[Yy][Ee][Ss])
+DARWIN_LAUNCHD_PATH= ${SLASH_TO_MOLLIFY_PKGLINT}Library/LaunchDaemons
+.else
+DARWIN_LAUNCHD_PATH= \$${HOME}/Library/LaunchAgents
+.endif

DARWIN_LAUNCHD_PATH is only used in INSTALL file. This installs org.pkgsrc.rc.d-boot.plist in the home directory of the user who installs the package.

> Comments from review (and I am not an expert.launchfoo.macos):
> 
>  Using $HOME, rather than adding a dir to use as part of bootstrap,
>  seems awkward.  Maybe this is ok, and bootstrap is too much pain.
>  Maybe a new variable for mk.conf which can default to HOME if not set.
>  But the big point is to work well with binary packages, and not get
>  tangled up in wrong assumptions.
> 
>  I am not sure we have a requirement that HOME is set when doing pkgsrc
>  builds.
> 
>  This is a bit subtle and rc.d-boot should probably have a few
>  comments about the big picture, especially the $HOME issue.
> 
>  This uses /System/LaunchDaemons now and $HOME/Library/LaunchAgents in
>  the user case.  That seems obviously not right as failing parallel
>  structure, and if it is right (which I am now thinking it probably is)
>  it deserves a comment.

If I am correct, $HOME is no more used in the pkgsrc build. The only assumption I make is that the user who installs the package has $HOME defined in its environment.

Thank you for your review!


Home | Main Index | Thread Index | Old Index