Advertisement
Guest User

RHEL4.4

a guest
Mar 9th, 2011
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.96 KB | None | 0 0
  1. is_available ()
  2. {
  3.     LC_ALL= LANG= ip -o link | grep -q $1
  4.     [ "$?" = "1" ] || return 0
  5.  
  6.     alias=`modprobe -c | awk "/^(alias|install)[[:space:]]+$1[[:space:]]/ { print \\$3 }"`
  7.     if [ -z "$alias" -o "$alias" = "off" -o "$alias" = "/bin/true" ]; then
  8.         return 2
  9.     fi
  10.     HOTPLUG=`cat /proc/sys/kernel/hotplug`
  11.     echo "/etc/hotplug/firmware.agent" > /proc/sys/kernel/hotplug
  12.     modprobe $1 > /dev/null 2>&1 || {
  13.       echo "$HOTPLUG" > /proc/sys/kernel/hotplug
  14.       return 1
  15.     }
  16.     echo "$HOTPLUG"  > /proc/sys/kernel/hotplug
  17.     # if it is a mainframe ccwgroup device, configure it before
  18.     # trying to rename it:
  19.     configure_ccwgroup_device
  20.     if [ -n "$HWADDR" ]; then
  21.        local curdev=`ip -o link | awk -F ':' -vIGNORECASE=1 "/$HWADDR/ { print \\$2 }"`
  22.        if [ -z "$curdev" ]; then
  23.           return 1
  24.        fi
  25.        rename_device "$1" "$HWADDR" "$curdev"
  26.     fi
  27.     LC_ALL= LANG= ip -o link | grep -q $1
  28.     return $?
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement