Helical Alpha Code

airkext: airport kernel extension loader/unloader


#!/bin/sh
#####################
#
# name: airkext (airkext.sh)
# vers: 0.2a
# date: 050106
# auth: "Keith Beckman" <kbeckm@alphahelical.com>
# site: http://alphahelical.com/code/osx/airkext
# desc: airkext is a simple toggle script to load and unload the OS X
# AirPort kernel extension.
#
#####################

####configuration####

kext_id='com.apple.driver.AppleAirPort'
#kext_id='/System/Library/Extensions/AppleAirPort.kext'
verstring='airkext/0.2a Keith Beckman'

##end configuration##

ak_usage () {
 cat <<!
Usage: air_kext -[h|v] | [on|off]
    airkext loads and unloads the Apple AirPort driver.
!
 }

if [[ -r "$kext_id" ]]; then
 kext_cmd=$kext_id
elif [ $(echo $kext_id | grep "\w*\.\w*\.\w*\.") ]; then
 kext_cmd="-b $kext_id"
else
 echo "Error: $kext_id is an invalid kext ID."
 exit
fi

case $1 in
 'on')
  sudo kextload $kext_cmd && echo "already loaded"
  ;;
 'off')
  sudo kextunload $kext_cmd
  ;;
 '-v'|'--version')
  echo $verstring
  ;;
 '-h'|'--help'|'-u'|'--usage'|*)
  ak_usage
  ;;
esac

Generated by GNU enscript 1.6.1 and enscriptclean.

airkext | Download Source | View Source