-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added enable_external_network_adapter.sh
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
enable_external_network_adapter/enable_external_network_adapter.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/sh | ||
# Checks to see if the Mac is either a MacBook Pro Retina or MacBook Air | ||
# If it's either of these machines, the script will then check for External Network Adapters | ||
# If either adapter is present, it will add the adapter to network services | ||
# Resolves an issue with USB & Thunderbolt Ethernet adapters with DeployStudio 1.6.3 | ||
|
||
mbpr=`system_profiler SPHardwareDataType | grep "Model Identifier" | awk '{print $3}' | cut -f1 -d ","` | ||
mba=`system_profiler SPHardwareDataType | grep "Model Identifier" | awk '{print $3}' | cut -c-10` | ||
usbAdapter=`/usr/sbin/networksetup -listallhardwareports | grep "Hardware Port: USB Ethernet"` | ||
tbAdapter=`/usr/sbin/networksetup -listallhardwareports | grep "Hardware Port: Thunderbolt Ethernet"` | ||
|
||
/usr/sbin/networksetup -detectnewhardware | ||
|
||
if [ $mbpr = "MacBookPro10" -o $mbpr = "MacBookPro11" ]; then | ||
if [ "$usbAdapter" != "" ]; then | ||
/usr/sbin/networksetup -createnetworkservice USB\ Ethernet 'USB Ethernet' | ||
echo "USB Ethernet added to Network Services" | ||
else | ||
echo "No USB Adapter connected" | ||
fi | ||
if [ "$tbAdapter" != "" ]; then | ||
/usr/sbin/networksetup -createnetworkservice Thunderbolt\ Ethernet 'Thunderbolt Ethernet' | ||
echo "Thunderbolt Ethernet added to Network Services" | ||
else | ||
echo "No Thunderbolt Adapter connected" | ||
fi | ||
elif [ $mba = "MacBookAir" ]; then | ||
if [ "$usbAdapter" != "" ]; then | ||
/usr/sbin/networksetup -createnetworkservice USB\ Ethernet 'USB Ethernet' | ||
echo "USB Ethernet added to Network Services" | ||
else | ||
echo "No USB Adapter connected" | ||
fi | ||
if [ "$tbAdapter" != "" ]; then | ||
/usr/sbin/networksetup -createnetworkservice Thunderbolt\ Ethernet 'Thunderbolt Ethernet' | ||
echo "Thunderbolt Ethernet added to Network Services" | ||
else | ||
echo "No Thunderbolt Adapter connected" | ||
fi | ||
else | ||
echo "This machine does not use external network adapters" | ||
fi | ||
|
||
exit 0 |