#!/bin/bash
#
# This script installs the serial driver into a Linux kernel tree.
#

ARG=$1

if [ "$ARG"x = x ]; then
	ARG=$DESTDIR
fi

if [ "$ARG"x = x ]; then
	ARG=/usr/src/linux
fi

install_file () {
    file=$1
    destdir=$2
    if [ "$3"x = x ] ; then
    	destfile=$destdir/$file
    else
    	destfile=$destdir/$3
    fi
    
    if [ ! -f $destfile ] || ! cmp -s $file $destfile ; then
    	echo "Installing $file as $destfile"
	cp $file $destfile
    fi
}

# We modify and install the following files:
# 
#FILES="drivers/char/serial.c include/linux/serial.h \
#    include/linux/serial_reg.h include/linux/serialP.h \
#    include/asm-i386/serial.h"
#NEW_FILES="drivers/char/serial_compat.h include/linux/circ_buf.h"

install_file serial.c $ARG/drivers/char
install_file serial_compat.h $ARG/drivers/char

install_file serial.h $ARG/include/linux
install_file serial_reg.h $ARG/include/linux
install_file serialP.h $ARG/include/linux
install_file circ_buf.h $ARG/include/linux

install_file i386_serial.h $ARG/include/asm-i386 serial.h


