You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.6 KiB
68 lines
1.6 KiB
#!/bin/sh |
|
|
|
setup_interface() { |
|
ip=$new_ip_address |
|
mtu=$new_interface_mtu |
|
mask=$new_subnet_mask |
|
bcast=$new_broadcast_address |
|
gw=${new_routers%%,*} |
|
domain=$new_domain_name |
|
search=$(printf "$new_domain_search") |
|
namesrv=$new_domain_name_servers |
|
hostname=$new_host_name |
|
|
|
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override |
|
|
|
if [ -n "$mtu" ] ; then |
|
echo ip link set $netif down |
|
echo ip link set $netif mtu $mtu |
|
echo ip link set $netif up |
|
fi > /tmp/net.$netif.up |
|
|
|
echo ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif >> /tmp/net.$netif.up |
|
|
|
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw |
|
|
|
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/resolv.conf |
|
if [ -n "$namesrv" ] ; then |
|
for s in $namesrv; do |
|
echo nameserver $s |
|
done |
|
fi >> /tmp/resolv.conf |
|
|
|
[ -n "$hostname" ] && echo hostname $hostname > /tmp/net.$netif.hostname |
|
} |
|
|
|
PATH=$PATH:/sbin:/usr/sbin |
|
|
|
. /lib/dracut-lib.sh |
|
|
|
if getarg rdnetdebug ; then |
|
exec >/tmp/dhclient.$interface.$$.out |
|
exec 2>>/tmp/dhclient.$interface.$$.out |
|
set -x |
|
fi |
|
|
|
# We already need a set netif here |
|
netif=$interface |
|
|
|
# Huh? Interface configured? |
|
[ -f "/tmp/net.$netif.up" ] && exit 0 |
|
|
|
case $reason in |
|
PREINIT) |
|
ip link set $netif up |
|
;; |
|
BOUND) |
|
setup_interface |
|
set | while read line; do |
|
[ "${line#new_}" = "$line" ] && continue |
|
echo "$line" |
|
done >/tmp/dhclient.$netif.dhcpopts |
|
echo online > /sys/class/net/$netif/uevent |
|
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif |
|
;; |
|
*) ;; |
|
esac |
|
|
|
exit 0
|
|
|