[arch-projects] [PATCH 7/7] Use iproute2 tools instead of net-tools
Tom Gundersen
teg at jklm.no
Sat Mar 26 19:02:37 EDT 2011
This patch did not apply due to a problem with PKGBUILD. I fixed it up
manually.
I did not test this at all, but at first glance it looks like the right
approach.
What userintervention does this require?
I guess those who use nisdomainname, must install yp-tools and enable them in
the DAEMONS array. Is that correct? Does any configuration files need
adjustment?
Anything else?
Cheers,
Tom
On Saturday 26 March 2011 16:32:03 Dave Reisner wrote:
> At this point, coreutils should be providing /bin/hostname instead of
> net-tools. If users wish to set an NIS/YS domain name, they should use
> core/yptools.
>
> Signed-off-by: Dave Reisner <d at falconindy.com>
> ---
> PKGBUILD | 2 +-
> network | 45 ++++++++++++++++-----------------------------
> rc.conf | 17 ++++++++++-------
> rc.sysinit | 10 ++--------
> 4 files changed, 29 insertions(+), 45 deletions(-)
>
> diff --git a/PKGBUILD b/PKGBUILD
> index 6f862e8..206f41b 100644
> --- a/PKGBUILD
> +++ b/PKGBUILD
> @@ -10,7 +10,7 @@ conflicts=('initscripts')
> provides=('initscripts=9999')
> backup=(etc/inittab etc/rc.conf etc/rc.local etc/rc.local.shutdown)
> depends=('glibc' 'bash' 'grep' 'coreutils' 'udev>=139-1'
> - 'net-tools' 'ncurses' 'kbd' 'findutils' 'sysvinit')
> + 'iproute2' 'ncurses' 'kbd' 'findutils' 'sysvinit')
> optdepends=('bridge-utils: Network bridging support'
> 'dhcpcd: DHCP network configuration'
> 'ifenslave: Networking bonding support'
> diff --git a/network b/network
> index 27df68a..aeddef2 100755
> --- a/network
> +++ b/network
> @@ -8,31 +8,25 @@ for s in wireless bonding bridges dhcpcd; do
> done
>
> ifup() {
> - local ifcfg=${!1}
> + local ifname ifcfg=${!1}
>
> if [[ ! $1 ]]; then
> echo "usage: $0 ifup <interface_name>"
> return 1
> fi
>
> - # Get the name of the interface from the first token in the string
> - if [[ $ifcfg = dhcp ]]; then
> - ifname=$1
> - else
> - ifname=${ifcfg%% *}
> - fi
> -
> - /sbin/ifconfig $ifname up
> + # Split the config string into interface name and config
> + read -r ifname ifcfg <<< "$ifcfg"
>
> + /usr/sbin/ip link set up dev $ifname || return 1
> wi_up $1 || return 1
>
> - if [[ $ifcfg = dhcp ]]; then
> + if [[ "$ifcfg" = dhcp ]]; then
> # remove the .pid file if it exists
> - /bin/rm -f /var/run/dhcpcd-${1}.pid >/dev/null 2>&1
> - /bin/rm -f /var/run/dhcpcd-${1}.cache >/dev/null 2>&1
> - /sbin/dhcpcd $DHCPCD_ARGS ${1}
> + /bin/rm -f /var/run/dhcpcd-$ifname.{pid,cache} >/dev/null 2>&1
> + /sbin/dhcpcd $DHCPCD_ARGS $ifname
> else
> - /sbin/ifconfig $ifcfg
> + /usr/sbin/ip addr add $ifcfg dev $ifname
> fi
> }
>
> @@ -42,8 +36,7 @@ wi_up() {
> [[ ${!iwcfg} ]] || return 0
>
> /usr/sbin/iwconfig ${!iwcfg}
> - [[ $WIRELESS_TIMEOUT ]] || WIRELESS_TIMEOUT=2
> - sleep $WIRELESS_TIMEOUT
> + sleep ${WIRELESS_TIMEOUT:-2}
>
> bssid=$(iwgetid $1 -ra)
> if [[ $bssid = 00:00:00:00:00:00 ]]; then
> @@ -64,8 +57,10 @@ ifdown() {
> if [[ $ifcfg = dhcp && -f /var/run/dhcpcd-${1}.pid ]]; then
> /sbin/dhcpcd -k ${1} >/dev/null 2>&1
> fi
> +
> # Always bring the interface itself down
> - /sbin/ifconfig ${1} down >/dev/null 2>&1
> + /usr/sbin/ip addr flush dev $1
> + /usr/sbin/ip link set down dev $1
> }
>
> iflist() {
> @@ -87,11 +82,7 @@ rtup() {
> return 1
> fi
>
> - if [[ $routecfg =~ :: ]]; then
> - /sbin/route -A inet6 add $routecfg
> - else
> - /sbin/route add $routecfg
> - fi
> + /usr/sbin/ip route add $routecfg
> }
>
> rtdown() {
> @@ -102,11 +93,7 @@ rtdown() {
> return 1
> fi
>
> - if [[ $routecfg =~ :: ]]; then
> - /sbin/route -A inet6 del $routecfg
> - else
> - /sbin/route del $routecfg
> - fi
> + /usr/sbin/ip route del $routecfg
> }
>
> rtlist() {
> @@ -144,8 +131,8 @@ bridge_up() {
> for br in "${BRIDGE_INTERFACES[@]}"; do
> if [[ "$br" = ${br#!} ]]; then
> # if the bridge already exists, remove it
> - if [[ $(/sbin/ifconfig $br 2>/dev/null) ]]; then
> - /sbin/ifconfig $br down
> + if [[ -d /sys/class/net/$br ]]; then
> + ifdown $br
> /usr/sbin/brctl delbr $br
> fi
> /usr/sbin/brctl addbr $br
> diff --git a/rc.conf b/rc.conf
> index d2b0517..d96bea6 100644
> --- a/rc.conf
> +++ b/rc.conf
> @@ -59,29 +59,32 @@ USELVM="no"
> #
> HOSTNAME="myhost"
>
> -# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available
> interfaces. +# Use 'ip addr' or 'ls /sys/class/net/' to see all available
> interfaces. #
> # Interfaces to start at boot-up (in this order)
> # Declare each interface then list in INTERFACES
> # - prefix an entry in INTERFACES with a ! to disable it
> # - no hyphens in your interface names - Bash doesn't like it
> -#
> +#
> # DHCP: Set your interface to "dhcp" (eth0="dhcp")
> # Wireless: See network profiles below
> #
>
> -#Static IP example
> -#eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
> -eth0="dhcp"
> +# Static IP example
> +#eth0="eth0 192.168.0.2/24"
> +
> +# Dynamic IP example
> +eth0="eth0 dhcp"
> +
> INTERFACES=(eth0)
>
> # Routes to start at boot-up (in this order)
> # Declare each route then list in ROUTES
> # - prefix an entry in ROUTES with a ! to disable it
> #
> -gateway="default gw 192.168.0.1"
> +gateway="default via 192.168.0.1"
> ROUTES=(!gateway)
> -
> +
> # Setting this to "yes" will skip network shutdown.
> # This is required if your root device is on NFS.
> NETWORK_PERSIST="no"
> diff --git a/rc.sysinit b/rc.sysinit
> index bf2f83e..08a0768 100755
> --- a/rc.sysinit
> +++ b/rc.sysinit
> @@ -111,8 +111,8 @@ fi
> run_hook sysinit_udevsettled
>
> # bring up the loopback interface
> -[[ -d /sys/class/net/lo ]] && \
> - status "Bringing up loopback interface" /sbin/ifconfig lo 127.0.0.1 up
> +[[ -d /sys/class/net/lo ]] &&
> + status "Bringing up loopback interface" /usr/sbin/ip link set up dev
lo
>
> # SoftRAID devices detection
> if [[ "$USEMDADM" = yes && -x /sbin/mdadm ]]; then
> @@ -351,12 +351,6 @@ if [[ $HOSTNAME ]]; then
> status "Setting Hostname: $HOSTNAME" /bin/hostname "$HOSTNAME"
> fi
>
> -# Set the NIS domain name, if necessary
> -[[ -f /etc/conf.d/nisdomainname ]] && . /etc/conf.d/nisdomainname
> -if [[ $NISDOMAINNAME ]]; then
> - status "Setting NIS Domain Name: $NISDOMAINNAME" /bin/nisdomainname
> "$NISDOMAINNAME" -fi
> -
> status "Updating Module Dependencies" /sbin/depmod -A
>
> # Flush old locale settings
More information about the arch-projects
mailing list