#!/bin/sh
#filename:autopack.sh

sudo cp -R /asix_temp/AppleUSBEthernet.kext /System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns
sudo rm -rf /asix_temp/AppleUSBEthernet.kext

if [ -d /System/Library/Extensions/AX88772.kext ]
then
sudo kextunload  /System/Library/Extensions/AX88772.kext
sudo rm -rf /System/Library/Extensions/AX88772.kext
fi

if [ -d /System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/AX88772.kext ]
then
sudo kextunload  /System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/AX88772.kext
sudo rm -rf /System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/AX88772.kext
fi

sudo chmod -R 755 /System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/AppleUSBEthernet.kext
sudo chown -R root:wheel /System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/AppleUSBEthernet.kext
sudo touch /System/Library/Extensions