480c09e328f794fdc3b1bb2b5b3803c35385ae43 max Tue Jul 15 02:37:36 2014 -0700 Adding scripts for Windows/OSX that create the network name "genome.ucsc.local", rm #12843 diff --git src/browserbox/clientInstall/addLocalMac.applescript src/browserbox/clientInstall/addLocalMac.applescript new file mode 100644 index 0000000..ea09f27 --- /dev/null +++ src/browserbox/clientInstall/addLocalMac.applescript @@ -0,0 +1,46 @@ +# UCSC Browserbox install helper script +display dialog "UCSC Browserbox network config helper: This program adds an entry 'ucsc.local' to your network configuration (/etc/hosts) and directs port 1234 to it. To do this, you will need the adminstrator password" +do shell script "if grep -q ucsc.local /etc/hosts ; then true; else echo 127.0.0.1 genome.ucsc.local; fi >> /etc/hosts" with administrator privileges +# flush the DNS cache to activate the localhost entry +do shell script "dscacheutil -flushcache" + +# setup a plist file to create firewall rule on every reboot that redirects local host 1234 to port 80 +set plistStr to "<?xml version=\"1.0\" encoding=\"UTF-8\"?> +<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd > +<plist version=\"1.0\"> +<dict> + <key>Label</key> + <string>edu.ucsc.genome.portRedir</string> + <key>ProgramArguments</key> + <array> + <string>/sbin/ipfw</string> + <string>add</string> + <string>100</string> + <string>fwd</string> + <string>127.0.0.1,1234</string> + <string>tcp</string> + <string>from</string> + <string>any</string> + <string>to</string> + <string>me</string> + <string>80</string> + </array> + <key>RunAtLoad</key> + <true/> + <key>Nice</key> + <integer>10</integer> + <key>KeepAlive</key> + <false/> + <key>AbandonProcessGroup</key> + <true/> +</dict> +</plist> +" +# create the plist file for the firewall rule +do shell script "echo " & quoted form of plistStr & " > /System/Library/LaunchDaemons/edu.ucsc.genome.portRedir.plist" with administrator privileges + +# activate the plist file now +do shell script "launchctl load /System/Library/LaunchDaemons/edu.ucsc.genome.portRedir.plist" with administrator privileges + +#do shell script "ipfw add 100 fwd 127.0.0.1,1234 tcp from any to me 80" with administrator privileges +display dialog "Added entry for genome.ucsc.local to hosts file. Redirected port 80 to port 1234, by creating the file /System/Library/LaunchDaemons/edu.ucsc.genome.portRedir.plist which is run on every reboot" buttons "OK" default button "OK"