Prevent MacPorts editing .bash_profile over and over again...

Barry Scott barry at barrys-emacs.org
Tue Jan 31 12:27:54 UTC 2017


Here is a pull request that fixes the issue for me.

https://github.com/macports/macports-base/pull/16 <https://github.com/macports/macports-base/pull/16>

"Fix the detection of /opt/local/bin in user's PATH

The postflight script was using the SHELL variable, which is root's shell
and not USHELL, which is the user's shell.

The test for MacPorts paths in the users PATH can be made more robust.
The old code will match on /opt/locale for example.

Spit the PATH into one path per line with tr and then grep for an exact match
with /opt/local/bin.”

I tested this for bash and checked the logs of the installed for unexpected messages.

Barry

> On 30 Jan 2017, at 20:48, Clemens Lang <cal at macports.org> wrote:
> 
> Hi,
> 
> On Mon, Jan 30, 2017 at 05:37:41PM +0000, Barry Scott wrote:
>>> On 30 Jan 2017, at 12:44, Barry Scott <barry at barrys-emacs.org> wrote:
>>> 
>>> When I run the postinstall as me it works are intended for my
>>> .bash_profile. When I run via sudo it looks at root’s file and
>>> states tit does not support the “sh” shell. I suspect that the
>>> environment that postinstall is running in is a strange in some way.
>>> (I have seen Mac specific oddities when developing python based apps
>>> like no LANG env var.)
> 
> That may very well be the problem. I suspect the installer is run as
> root, and $USER is actually root for the installer.
> 
> You should be able to see the debug output of the script in installer
> using Window > Installer Log and switching the detail level to 'Show All
> Logs'.
> 
>> I found the sudo port -d pkg MacPorts command. But that does not use
>> my git tree.
> 
> We use sudo port pkg MacPorts to create the installer. You can modify
> the MacPorts port file to point to your source tree. Instead of
> 
> github.setup macports macports-base v2.4.0
> ...
> distname ${name}-${version}
> github.tarball_from releases
> ...
> checksums ...
> 
> use
> 
> fetch.type git
> git.url file:///absolute/path/to/your/working/dir/.git
> git.branch $latest_commit_hash (or just HEAD for testing)
> 
> Note that this will only pick up committed changes, so you'll have to
> commit things for this to work. Also note that the 'macports' user must
> be able to read the path.
> 
> Since the installer won't be signed using this method you may have to
> open it using right click > open.
> 
> -- 
> Clemens
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20170131/223790ed/attachment.html>


More information about the macports-users mailing list