#!/bin/bash
cd /usr/src/net-tools-*/ ||exit

#Fix some occurrences of syntax that GCC 3.4 doesn't like:
patch -p 1 <../net-tools-1.60-gcc34-2.patch
#fix ipv6 lookup:
patch -p 1 <../net-tools-1.60-ipv6-1.patch
#show correct interface info:
patch -p 1 <../net-tools-1.60-nameif-1.patch
#old:my own patch if_tunnel usage:
#patch -p 1 <../net-tools-1.60-linux-libc-headers-2651-1.patch
patch -p 1 <../net-tools-1.60-kernel_headers-3.patch

#rawhide update:
patch -p 1 <../net-tools-1.60-mii_ioctl-1.patch

#my own optimization patch:
sed -i 's@-D_GNU_SOURCE -O2 -Wall@-D_GNU_SOURCE $(MYCFLAGS) -Wall@g' Makefile



#make will ask lots of questions. this is usefull!!!
make config &&
#yes "" | make config &&
MYCFLAGS=$CFLAGS make &&
make update

# make update: This does the same as a make install with the exception that
# make update doesn't make backups of files it's replacing. One of the
# things net-tools replaces is sh-utils's version of /bin/hostname
# (net-tools's version is far better than sh-utils's version).
# Also, if you decide to reinstall this package at some point in the future,
# a make update won't backup all the files from a previous net-tools
# installation.
