Installomator and Proxy server

Ojok
New Contributor II

We decided to take installomator for a test drive after JNUC last year and all worked really well until we realised that we could get it to work on our CORP wifi.

After several goes my colleague came up with a perfect fit for our environment which is demonstrated by adding a few lines to the installomator script shown down below in case anyone has the same challenge...(the orange text is the required proxy setting) if anyone has a better solution would like to know...

 

#!/bin/zsh

label="" # if no label is sent to the script, this will be used

 

# Installomator

#

# Downloads and installs Applications

# 2020-2021 Installomator

#

# inspired by the download scripts from William Smith and Sander Schram

#

# Contributers:

#    Armin Briegel - @scriptingosx

#    Isaac Ordonez - @issacatmann

#    Søren Theilgaard - @Theile

#    Adam Codega - @acodega

#

# with contributions from many others

 

export PATH=/usr/bin:/bin:/usr/sbin:/sbin

 

#start yourcompany  PROXY

connectedSSID=$(networksetup -getairportnetwork $(networksetup -listallhardwareports | awk '/AirPort|Wi-Fi/{getline; print $NF}') | awk -F'Network: ' '{print $NF}')

# Check for CORP SSID to use proxy or not

/bin/echo "`date` - Check for CORP SSID Connection..."

/bin/echo "`date` - Connected SSID is $connectedSSID"

if [[ $connectedSSID =~ "CORP" ]]; then

  /bin/echo "`date` - connected to CORP, using proxy"

  export http_proxy=http://yourcompany.proxy:80

  export https_proxy=http://yourcompany.proxy:80

  NO_PROXY="*.yourcompany.proxy"

  /bin/echo "`date` - proxy applied"

else

  /bin/echo "`date` - not connected to Tesco network, no proxy"  

fi

#end yourcompany  PROXY

 

# NOTE: adjust these variables:

 

# set to 0 for production, 1 or 2 for debugging

0 REPLIES 0