2014-03-19 13:11:12 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (C) 2014 Robert Milasan <rmilasan@suse.com>
|
|
|
|
#
|
2014-03-19 15:06:11 +01:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2014-04-10 11:02:21 +02:00
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2014-03-19 15:06:11 +01:00
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2014-04-10 11:02:21 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-03-19 13:11:12 +01:00
|
|
|
#
|
|
|
|
# This script run manually by user, will generate a persistent rule for
|
|
|
|
# a given network interface to rename it to new interface name.
|
|
|
|
#
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
_prj="$(basename $0 2>/dev/null)"
|
|
|
|
prj="${_prj%.*}"
|
|
|
|
ver="0.2"
|
2014-03-19 13:11:12 +01:00
|
|
|
|
|
|
|
log_info()
|
|
|
|
{
|
|
|
|
local msg="$1"
|
|
|
|
echo "$prj: $msg"
|
|
|
|
}
|
|
|
|
|
|
|
|
log_error()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local msg="$1"
|
2014-03-19 13:11:12 +01:00
|
|
|
echo "$prj: $msg" >&2
|
|
|
|
}
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat << EOF
|
2014-04-10 11:02:21 +02:00
|
|
|
$prj: udev persistent rule generator script
|
2014-03-19 13:11:12 +01:00
|
|
|
|
|
|
|
Usage: $prj [OPTION] ...
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
-h Show this help
|
|
|
|
-l List available interfaces
|
|
|
|
-m Generate the persistent rule based on interface MAC address
|
|
|
|
default option, if nothing is specified
|
|
|
|
-p Generate the persistent rule based on interface PCI slot
|
|
|
|
-v Be more verbose
|
|
|
|
-V Output the version number
|
|
|
|
-c [INTERFACE] Current interface name (ex: ip link)
|
|
|
|
only needed for retrieving information
|
|
|
|
-n [INTERFACE] New interface name (ex: net0)
|
|
|
|
-o [FILE] Where to write the new generate rule (default: /dev/stdout)
|
|
|
|
prefered location is /etc/udev/rules.d/70-persistent-net.rules
|
2014-03-19 13:11:12 +01:00
|
|
|
|
|
|
|
Example:
|
2014-04-10 11:02:21 +02:00
|
|
|
$prj -v -c enp0s4 -n lan0
|
|
|
|
or
|
2014-03-19 13:11:12 +01:00
|
|
|
$prj -m -c enp0s4 -n net0 -o /etc/udev/rules.d/70-persistent-net.rules
|
|
|
|
or
|
|
|
|
$prj -p -c wlp3s0 -n wlan0 -o /etc/udev/rules.d/50-mynet.rules
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
display_note()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
cat << EOF
|
2014-03-19 13:11:12 +01:00
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
NOTE: Using the generate persistent rule might mean you will need to do extra work to ensure
|
|
|
|
that it will work accordingly. This mean, regenerating the initramfs/initrd image and/or using
|
|
|
|
'net.ifnames=0' option at boot time.
|
|
|
|
In openSUSE/SUSE, the user will need to regenerate the initramfs/initrd image, but usually there
|
|
|
|
is no need for 'net.ifnames=0' option if the persistent rule is available in initramfs/initrd image.
|
2014-03-19 13:11:12 +01:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
get_pci()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local path="$1"
|
2014-03-19 13:11:12 +01:00
|
|
|
local pci=""
|
|
|
|
|
|
|
|
if [ -L "$path/device" ]; then
|
|
|
|
local pci_link="$(readlink -f $path/device 2>/dev/null)"
|
|
|
|
pci="$(basename $pci_link 2>/dev/null)"
|
|
|
|
fi
|
|
|
|
echo $pci
|
|
|
|
}
|
|
|
|
|
|
|
|
get_pci_id()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local path="$1"
|
2014-03-19 13:11:12 +01:00
|
|
|
local pci_id=""
|
|
|
|
|
|
|
|
if [ -r "$path/device/uevent" ]; then
|
|
|
|
local _pci_id="$(cat $path/device/uevent|grep ^PCI_ID 2>/dev/null)"
|
|
|
|
pci_id="${_pci_id#*=}"
|
|
|
|
fi
|
|
|
|
echo $pci_id
|
|
|
|
}
|
|
|
|
|
|
|
|
get_macaddr()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local path="$1"
|
2014-03-19 13:11:12 +01:00
|
|
|
local macaddr=""
|
|
|
|
|
|
|
|
if [ -r "$path/address" ]; then
|
|
|
|
macaddr="$(cat $path/address 2>/dev/null)"
|
|
|
|
fi
|
|
|
|
echo $macaddr
|
|
|
|
}
|
|
|
|
|
|
|
|
get_type()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local path="$1"
|
2014-03-19 13:11:12 +01:00
|
|
|
local dev_type=""
|
|
|
|
|
|
|
|
if [ -r "$path/type" ]; then
|
|
|
|
dev_type="$(cat $path/type 2>/dev/null)"
|
|
|
|
fi
|
|
|
|
echo $dev_type
|
|
|
|
}
|
|
|
|
|
|
|
|
get_dev_id()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local path="$1"
|
2014-03-19 13:11:12 +01:00
|
|
|
local dev_id=""
|
|
|
|
|
|
|
|
if [ -r "$path/dev_id" ]; then
|
|
|
|
dev_id="$(cat $path/dev_id 2>/dev/null)"
|
|
|
|
fi
|
|
|
|
echo $dev_id
|
|
|
|
}
|
|
|
|
|
|
|
|
get_devtype()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local path="$1"
|
2014-03-19 13:11:12 +01:00
|
|
|
local devtype=""
|
|
|
|
if [ -r "$path/uevent" ]; then
|
|
|
|
local _devtype="$(cat $path/uevent|grep ^DEVTYPE 2>/dev/null)"
|
|
|
|
devtype="${_devtype#*=}"
|
|
|
|
fi
|
|
|
|
echo $devtype
|
|
|
|
}
|
|
|
|
|
|
|
|
get_subsystem()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local path="$1"
|
2014-03-19 13:11:12 +01:00
|
|
|
local subsystem=""
|
|
|
|
|
|
|
|
if [ -L "$path/subsystem" ]; then
|
|
|
|
local subsystem_link="$(readlink -f $path/subsystem 2>/dev/null)"
|
|
|
|
subsystem="$(basename $subsystem_link 2>/dev/null)"
|
|
|
|
fi
|
|
|
|
echo $subsystem
|
|
|
|
}
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
get_parent_subsystem()
|
|
|
|
{
|
|
|
|
local path="$1"
|
|
|
|
local subsystem=""
|
|
|
|
|
|
|
|
if [ -L "$path/device/subsystem" ]; then
|
|
|
|
local subsystem_link="$(readlink -f $path/device/subsystem 2>/dev/null)"
|
|
|
|
subsystem="$(basename $subsystem_link 2>/dev/null)"
|
|
|
|
fi
|
|
|
|
echo $subsystem
|
|
|
|
}
|
|
|
|
|
2014-03-19 13:11:12 +01:00
|
|
|
get_driver()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local path="$1"
|
2014-03-19 13:11:12 +01:00
|
|
|
local driver=""
|
|
|
|
|
|
|
|
if [ -L "$path/device/driver" ]; then
|
|
|
|
local driver_link="$(readlink -f $path/device/driver 2>/dev/null)"
|
|
|
|
driver="$(basename $driver_link 2>/dev/null)"
|
|
|
|
fi
|
|
|
|
echo $driver
|
|
|
|
}
|
|
|
|
|
|
|
|
valid_mac()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local macaddr="$1"
|
2014-03-19 13:11:12 +01:00
|
|
|
local valid_macaddr=""
|
|
|
|
|
|
|
|
if [ -n "$macaddr" ]; then
|
|
|
|
valid_macaddr="$(echo $macaddr | sed -n '/^\([0-9a-z][0-9a-z]:\)\{5\}[0-9a-z][0-9a-z]$/p')"
|
|
|
|
fi
|
|
|
|
echo $valid_macaddr
|
|
|
|
}
|
|
|
|
|
|
|
|
generate_comment()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local pci_id="$1"
|
|
|
|
local driver="$2"
|
|
|
|
local output="$3"
|
|
|
|
local device_type="$4"
|
|
|
|
local _type=""
|
2014-03-19 13:11:12 +01:00
|
|
|
|
|
|
|
if [ -z "$pci_id" ]; then
|
|
|
|
log_error "\$pci_id empty."
|
|
|
|
exit 1
|
|
|
|
elif [ -z "$driver" ]; then
|
|
|
|
log_error "\$driver empty."
|
|
|
|
exit 1
|
|
|
|
elif [ -z "$output" ]; then
|
|
|
|
log_error "\$output empty."
|
|
|
|
exit 1
|
|
|
|
else
|
2014-04-10 11:02:21 +02:00
|
|
|
if [ "$device_type" == "pci" ]; then
|
|
|
|
_type="PCI"
|
|
|
|
elif [ "$device_type" == "usb" ]; then
|
|
|
|
_type="USB"
|
|
|
|
else
|
|
|
|
_type="Unknown"
|
|
|
|
fi
|
|
|
|
echo "# $_type device $pci_id ($driver)" >> $output
|
2014-03-19 13:11:12 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
generate_rule()
|
|
|
|
{
|
2014-04-10 11:02:21 +02:00
|
|
|
local _subsystem="$1"
|
|
|
|
local _mac="$2"
|
|
|
|
local _pci="$3"
|
|
|
|
local _dev_id="$4"
|
|
|
|
local _dev_type="$5"
|
|
|
|
local _kernel="$6"
|
|
|
|
local _interface="$7"
|
|
|
|
local output="$8"
|
2014-03-19 13:11:12 +01:00
|
|
|
|
|
|
|
if [ -z "$_subsystem" ]; then
|
|
|
|
log_error "\$_subsystem empty."
|
|
|
|
exit 1
|
|
|
|
elif [ -z "$_dev_id" ]; then
|
|
|
|
log_error "\$_dev_id empty."
|
|
|
|
exit 1
|
|
|
|
elif [ -z "$_dev_type" ]; then
|
|
|
|
log_error "\$_dev_type empty."
|
|
|
|
exit 1
|
|
|
|
elif [ -z "$_kernel" ]; then
|
|
|
|
log_error "\$_kernel empty."
|
|
|
|
exit 1
|
|
|
|
elif [ -z "$_interface" ]; then
|
|
|
|
log_error "\$_interface empty."
|
|
|
|
exit 1
|
|
|
|
elif [ -z "$output" ]; then
|
|
|
|
output="/dev/stdout"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$_mac" != "none" ]; then
|
|
|
|
echo "SUBSYSTEM==\"$_subsystem\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"$_mac\", \
|
|
|
|
ATTR{dev_id}==\"$_dev_id\", ATTR{type}==\"$_dev_type\", KERNEL==\"$_kernel\", NAME=\"$_interface\"" >> ${output}
|
|
|
|
elif [ "$_pci" != "none" ]; then
|
|
|
|
echo "SUBSYSTEM==\"$_subsystem\", ACTION==\"add\", DRIVERS==\"?*\", KERNELS==\"$_pci\", \
|
|
|
|
ATTR{dev_id}==\"$_dev_id\", ATTR{type}==\"$_dev_type\", KERNEL==\"$_kernel\", NAME=\"$_interface\"" >> ${output}
|
|
|
|
else
|
|
|
|
log_error "MAC address or PCI slot information missing."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
list_adapters()
|
|
|
|
{
|
|
|
|
declare -a netdev
|
|
|
|
local count=0
|
|
|
|
local _netdev=""
|
|
|
|
local _dev=""
|
|
|
|
|
|
|
|
for _dev in $SYSPATH/*; do
|
|
|
|
if [ -L "$_dev/device" ]; then
|
|
|
|
_dev="$(basename $_dev 2>/dev/null)"
|
|
|
|
netdev[$count]="$_dev"
|
|
|
|
count=$((count + 1))
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Found $count network interfaces:"
|
|
|
|
for _netdev in "${netdev[@]}"; do
|
|
|
|
_macaddr="$(get_macaddr $SYSPATH/$_netdev)"
|
|
|
|
_pcislot="$(get_pci $SYSPATH/$_netdev)"
|
|
|
|
echo "I: INTERFACE: $_netdev"
|
|
|
|
echo "I: MACADDR: $_macaddr"
|
|
|
|
echo "I: PCI: $_pcislot"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2014-03-19 13:11:12 +01:00
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
usage
|
|
|
|
log_error "missing option(s)."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
SYSPATH="/sys/class/net"
|
|
|
|
|
2014-03-19 13:11:12 +01:00
|
|
|
use_mac=0
|
|
|
|
use_pci=0
|
|
|
|
use_verbose=0
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
while getopts "hlmpvVc:n:o:" opt; do
|
2014-03-19 13:11:12 +01:00
|
|
|
case "$opt" in
|
|
|
|
h)
|
|
|
|
usage; exit 0;;
|
2014-04-10 11:02:21 +02:00
|
|
|
l)
|
|
|
|
list_adapters; exit 0;;
|
2014-03-19 13:11:12 +01:00
|
|
|
m)
|
|
|
|
use_mac=1 ;;
|
|
|
|
p)
|
|
|
|
use_pci=1 ;;
|
|
|
|
v)
|
|
|
|
use_verbose=1 ;;
|
2014-04-10 11:02:21 +02:00
|
|
|
V)
|
|
|
|
echo "$prj $ver"; exit 0;;
|
2014-03-19 13:11:12 +01:00
|
|
|
c)
|
|
|
|
ifcur="$OPTARG" ;;
|
|
|
|
n)
|
|
|
|
ifnew="$OPTARG" ;;
|
|
|
|
o)
|
|
|
|
output="$OPTARG" ;;
|
|
|
|
\?)
|
|
|
|
exit 1 ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
if [[ "$use_mac" -eq 0 ]] && [[ "$use_pci" -eq 0 ]]; then
|
|
|
|
use_mac=1
|
|
|
|
fi
|
|
|
|
|
2014-03-19 13:11:12 +01:00
|
|
|
if [[ "$use_mac" -eq 1 ]] && [[ "$use_pci" -eq 1 ]]; then
|
|
|
|
log_error "generating a persistent rule can be done only using one of the option, -m or -p, not both."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
outfile="$output"
|
2014-03-19 13:11:12 +01:00
|
|
|
if [ -z "$output" ]; then
|
2014-04-10 11:02:21 +02:00
|
|
|
outfile="/dev/stdout"
|
2014-03-19 13:11:12 +01:00
|
|
|
else
|
|
|
|
dir="$(dirname $outfile 2>/dev/null)"
|
|
|
|
tmpfile="$dir/.tmp_file"
|
|
|
|
if [ -d "$dir" ]; then
|
|
|
|
touch "$tmpfile" >/dev/null 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
log_error "no write access for $outfile. make sure you have write permissions to $dir."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
rm -f "$tmpfile" >/dev/null 2>&1
|
|
|
|
else
|
|
|
|
log_error "$dir not a directory."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
interface="$ifcur"
|
2014-03-19 13:11:12 +01:00
|
|
|
if [ -z "$interface" ]; then
|
|
|
|
log_error "current interface must be specified."
|
|
|
|
exit 1
|
|
|
|
elif [ "$interface" == "lo" ]; then
|
|
|
|
log_error "loopback interface is not a valid interface."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: INTERFACE=$interface"
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
new_interface="$ifnew"
|
2014-03-19 13:11:12 +01:00
|
|
|
if [ -z "$new_interface" ]; then
|
|
|
|
log_error "new interface must be specified."
|
|
|
|
exit 1
|
|
|
|
elif [ "$new_interface" == "lo" ]; then
|
|
|
|
log_error "new interface cant be named loopback interface."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: INTERFACE_NEW=$new_interface"
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
path="$SYSPATH/$interface"
|
2014-03-19 13:11:12 +01:00
|
|
|
if [ ! -d "$path" ]; then
|
|
|
|
log_error "devpath $path not a directory."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: DEVPATH=$path"
|
|
|
|
|
|
|
|
devtype="$(get_devtype $path)"
|
|
|
|
if [ -n "$devtype" ]; then
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: DEVTYPE=$devtype"
|
|
|
|
fi
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
parent_subsystem="$(get_parent_subsystem $path)"
|
|
|
|
if [ -z "$parent_subsystem" ]; then
|
|
|
|
log_error "unable to retrieve parent subsystem for interface $interface."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: PARENT_SUBSYSTEM=$parent_subsystem"
|
|
|
|
|
2014-03-19 13:11:12 +01:00
|
|
|
subsystem="$(get_subsystem $path)"
|
|
|
|
if [ -z "$subsystem" ]; then
|
|
|
|
log_error "unable to retrieve subsystem for interface $interface."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: SUBSYSTEM=$subsystem"
|
|
|
|
|
|
|
|
pci_id="$(get_pci_id $path)"
|
|
|
|
if [ -z "$pci_id" ]; then
|
2014-04-10 11:02:21 +02:00
|
|
|
pci_id="0x:0x"
|
2014-03-19 13:11:12 +01:00
|
|
|
fi
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: PCI_ID=$pci_id"
|
|
|
|
|
|
|
|
driver="$(get_driver $path)"
|
|
|
|
if [ -z "$driver" ]; then
|
|
|
|
log_error "unable to retrieve driver for interface $interface."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: DRIVER=$driver"
|
|
|
|
|
|
|
|
if [ "$use_mac" -eq 1 ]; then
|
|
|
|
macaddr="$(get_macaddr $path)"
|
|
|
|
if [ -z "$macaddr" ]; then
|
|
|
|
log_error "unable to retrieve MAC address for interface $interface."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ "$(valid_mac $macaddr)" != "$macaddr" ]; then
|
|
|
|
log_error "$macaddr invalid MAC address."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: MACADDR=$macaddr"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$use_pci" -eq 1 ]; then
|
|
|
|
pci="$(get_pci $path)"
|
|
|
|
if [ -z "$pci" ]; then
|
|
|
|
log_error "unable to retrieve PCI slot for interface $interface."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: KERNELS=$pci"
|
|
|
|
fi
|
|
|
|
|
|
|
|
dev_id="$(get_dev_id $path)"
|
|
|
|
if [ -z "$dev_id" ]; then
|
|
|
|
log_error "unable to retrieve dev_id for interface $interface."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: DEV_ID=$dev_id"
|
|
|
|
|
|
|
|
dev_type="$(get_type $path)"
|
|
|
|
if [ -z "$dev_type" ]; then
|
|
|
|
log_error "unable to retrieve dev_type for interface $interface."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
[ "$use_verbose" -eq 1 ] && echo "I: TYPE=$dev_type"
|
|
|
|
|
2014-04-10 11:02:21 +02:00
|
|
|
kernel="eth*"
|
|
|
|
if [ -n "$devtype" ]; then
|
|
|
|
if [ "$devtype" == "wlan" ]; then
|
|
|
|
kernel="wlan*"
|
|
|
|
fi
|
2014-03-19 13:11:12 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$output" ]; then
|
2014-04-10 11:02:21 +02:00
|
|
|
echo "Persistent rule written to "$outfile""
|
|
|
|
generate_comment "$pci_id" "$driver" "$outfile" "$parent_subsystem"
|
2014-03-19 13:11:12 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$use_mac" -eq 1 ]; then
|
|
|
|
generate_rule "$subsystem" "$macaddr" "none" "$dev_id" "$dev_type" "$kernel" "$new_interface"
|
|
|
|
if [ -n "$output" ]; then
|
2014-04-10 11:02:21 +02:00
|
|
|
generate_rule "$subsystem" "$macaddr" "none" "$dev_id" "$dev_type" "$kernel" "$new_interface" "$outfile"
|
2014-03-19 13:11:12 +01:00
|
|
|
fi
|
|
|
|
elif [ "$use_pci" -eq 1 ]; then
|
|
|
|
generate_rule "$subsystem" "none" "$pci" "$dev_id" "$dev_type" "$kernel" "$new_interface"
|
|
|
|
if [ -n "$output" ]; then
|
|
|
|
generate_rule "$subsystem" "none" "$pci" "$dev_id" "$dev_type" "$kernel" "$new_interface" "$outfile"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$output" ]; then
|
|
|
|
display_note
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|