Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- is_available ()
- {
- LC_ALL= LANG= ip -o link | grep -q $1
- [ "$?" = "1" ] || return 0
- alias=`modprobe -c | awk "/^(alias|install)[[:space:]]+$1[[:space:]]/ { print \\$3 }"`
- if [ -z "$alias" -o "$alias" = "off" -o "$alias" = "/bin/true" ]; then
- return 2
- fi
- HOTPLUG=`cat /proc/sys/kernel/hotplug`
- echo "/etc/hotplug/firmware.agent" > /proc/sys/kernel/hotplug
- modprobe $1 > /dev/null 2>&1 || {
- echo "$HOTPLUG" > /proc/sys/kernel/hotplug
- return 1
- }
- echo "$HOTPLUG" > /proc/sys/kernel/hotplug
- # if it is a mainframe ccwgroup device, configure it before
- # trying to rename it:
- configure_ccwgroup_device
- if [ -n "$HWADDR" ]; then
- local curdev=`ip -o link | awk -F ':' -vIGNORECASE=1 "/$HWADDR/ { print \\$2 }"`
- if [ -z "$curdev" ]; then
- return 1
- fi
- rename_device "$1" "$HWADDR" "$curdev"
- fi
- LC_ALL= LANG= ip -o link | grep -q $1
- return $?
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement