<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Aug 19, 2014 at 8:16 PM, Ryan Schmidt <span dir="ltr">&lt;<a href="mailto:ryandesign@macports.org" target="_blank">ryandesign@macports.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I&#39;m experimenting with running a proxy server on my network, which I would like MacPorts to use while on that network, while not interfering with my ability to use MacPorts while connected to other networks. What&#39;s the best way to do this in an automated way? Editing macports.conf proxy settings every time I switch networks is cumbersome. Similarly manually setting and unsetting environment variables. I&#39;m currently thinking of wrapping the &quot;port&quot; command in a shell function (which I already do) and using the IP address or AirPort network name to determine whether I&#39;m on the home network and setting the environment variables accordingly. I&#39;m also dimly aware of OS X&#39;s network locations feature, but way back when those were introduced I remember you had to manually select which location you wanted to use.<br>
</blockquote><div><br></div><div>A more clever setup might use the NetworkState key in the launchd KeepAlive dictionary to launch a script that writes appropriate proxy values into a file somewhere based on the default route / IP address / whatever, then sleep and remove or save defaults in that file on SIGTERM. (Conceivably that file might be macports.conf itself....)</div>
</div><div><br></div>-- <br><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div>
<div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div>
</div></div>