#!/bin/sh if [ $# != 1 ]; then echo "Usage: ${0##*/} " echo " where is the full path name to the 'src'" echo " directory within the extracted e1000-7.3.xx package." echo " The operation will replace the files in the local directory." echo " It must be started from linux-2.4.XX/drivers/net/e1000/." exit 1 fi echo "Checking current directory..." if [ ! -s "Makefile" -o ! -s "e1000.h" ]; then echo "Error: ${0##*/} not started from a valid directory." echo "It must be started from linux-2.4.XX/drivers/net/e1000/." exit 2 fi echo "Checking source directory..." if [ ! -d "$1/." ]; then echo "Error: $1 is not a valid source directory." exit 2 fi echo "Replacing files..." for file in e1000.h e1000_ethtool.c e1000_hw.c e1000_hw.h \ e1000_main.c e1000_osdep.h e1000_param.c kcompat.h \ kcompat.c kcompat_ethtool.c do [ -e "${file}" -a ! -e "${file}~" ] && mv "${file}" "${file}~" cp "$1/$file" "$file" done echo "Patching Makefile..." [ -e "Makefile~" ] || cp Makefile Makefile~ sed -e 's/^obj-y.*param.o$/\0 kcompat.o/' Makefile > Makefile.new [ $? == 0 ] && mv Makefile.new Makefile || rm -f Makefile.new echo "Done. You can remove old files when needed : rm -f *~"