Created
January 5, 2019 21:53
-
-
Save rmanly/3dffdf710ba8494d10dfa181d27fbb64 to your computer and use it in GitHub Desktop.
change repo for building
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# for a munki-discuss thread 2019-01-05 | |
b1() { | |
echo "Building 1" | |
/usr/bin/defaults write /l/p/mi sru "http://b1.munki.repo" | |
} | |
b2() { | |
echo "Building 2" | |
/usr/bin/defaults write /l/p/mi sru "http://b2.munki.repo" | |
} | |
remote() { | |
echo "Computer is off-site" | |
/usr/bin/defaults write /l/p/mi sru "http://cloud.munki.repo" | |
} | |
devices=($(networksetup -listnetworkserviceorder | awk -F': ' '/Port/{ gsub(/\)$/,""); print $3 }')); | |
for iface in "${devices[@]}"; do | |
if ! addr=$(ipconfig getifaddr "$iface"); then | |
continue; | |
else | |
case "$addr" in | |
10.30.32.*) b1 ;; | |
10.30.36.*) b2 ;; | |
*) remote ;; | |
esac | |
break; | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment