isdn4linux/std2kern

162 lines
3.7 KiB
Bash
Executable File

#!/bin/sh
KERNELDIR=/usr/src/linux
DOCP=docpd
docpd() {
if ! cmp -s $1 $2 ; then
echo Copying $1 ...
mkdir -p `dirname $2`
cp $1 $2
# else
# echo $2 is up to date, NOT converted
fi
}
docp() {
if [ $1 -nt $2 -o ! -f $2 ] ; then
echo Copying $1 ...
mkdir -p `dirname $2`
cp $1 $2
# else
# echo $2 is up to date, NOT converted
fi
}
#
# Print usage and exit
#
usage() {
cat<<EOM
std2kern is used for updating your kernel-tree from within
this directory.
std2kern [-d] [-h] [-k DIR] [files ...]
Options:
-h This Text.
-d Copy depends on modification date instead of file-compare.
-k DIR Kerneltree is in DIR instead of /usr/src/linux
Without any files given, within the whole tree, the "right"
files are copied. When any files are given in the commandline,
only those are copied.
EOM
exit
}
#
# Check, if argument is a linux kernel dir
#
checkkernel() {
if [ -f $1/Makefile ] ; then
if [ "`grep ^vmlinux: $1/Makefile | grep vmlinux`" != "" ] ; then
return 0
fi
fi
echo "The given argument does not look like a kernel dir"
exit 1
}
while getopts :dhk: a ; do
case $a in
\?) case $OPTARG in
k) echo "-k requires Kernel directory parameter"
;;
*) echo "Unknown option: -$OPTARG"
echo "Try std2kern -h"
;;
esac
exit 1
;;
k) checkkernel $OPTARG
KERNELDIR=$OPTARG
;;
d) DOCP=docp
;;
h) usage
;;
esac
done
shift `expr $OPTIND - 1`
if [ $# != 0 ]; then
for i in $* ; do
$DOCP $i $KERNELDIR/$i
done
else
for i in drivers/isdn/isdn_*.[ch] ; do
$DOCP $i $KERNELDIR/$i
done
for i in drivers/isdn/icn/icn.[ch] ; do
$DOCP $i $KERNELDIR/$i
done
for i in drivers/isdn/pcbit/*.[ch] ; do
$DOCP $i $KERNELDIR/$i
done
for i in drivers/isdn/hisax/*.[ch] drivers/isdn/hisax/md5sums.asc ; do
$DOCP $i $KERNELDIR/$i
done
for i in drivers/isdn/sc/*.[ch] ; do
$DOCP $i $KERNELDIR/$i
done
for i in drivers/isdn/avmb1/*.[ch] ; do
$DOCP $i $KERNELDIR/$i
done
for i in drivers/isdn/act2000/*.[ch] ; do
$DOCP $i $KERNELDIR/$i
done
for i in drivers/isdn/isdnloop/*.[ch] ; do
$DOCP $i $KERNELDIR/$i
done
if [ ! -d $KERNELDIR/drivers/isdn/divert ] ; then
mkdir $KERNELDIR/drivers/isdn/divert
fi
for i in drivers/isdn/divert/*.[ch] drivers/isdn/divert/Makefile ; do
$DOCP $i $KERNELDIR/$i
done
if [ -f $KERNELDIR/Documentation/Configure.help ] ; then
grep -q CONFIG_ISDN_DIVERSION $KERNELDIR/Documentation/Configure.help
if [ $? != 0 ] ; then
patch -d $KERNELDIR/Documentation < Documentation/Configure.help.divert.diff
fi
fi
if [ -f $KERNELDIR/Documentation/Configure.help ] ; then
grep -q CONFIG_ISDN_DRV_EICON $KERNELDIR/Documentation/Configure.help
if [ $? != 0 ] ; then
patch -d $KERNELDIR/Documentation < Documentation/Configure.help.eicon.diff
fi
fi
mkdir -p -m 755 $KERNELDIR/drivers/isdn/eicon
for i in drivers/isdn/eicon/*.[ch] ; do
$DOCP $i $KERNELDIR/$i
done
for i in include/linux/*.h ; do
$DOCP $i $KERNELDIR/$i
done
for i in Documentation/isdn/CREDITS Documentation/isdn/README* \
Documentation/isdn/*.FAQ Documentation/isdn/INTERFACE \
Documentation/isdn/HiSax* Documentation/isdn/00-INDEX ; do
$DOCP $i $KERNELDIR/$i
done
for i in drivers/isdn/Config.in ; do
$DOCP $i $KERNELDIR/$i
done
for i in drivers/isdn/Makefile drivers/isdn/icn/Makefile \
drivers/isdn/hisax/Makefile \
drivers/isdn/pcbit/Makefile drivers/isdn/sc/Makefile \
drivers/isdn/act2000/Makefile \
drivers/isdn/isdnloop/Makefile \
drivers/isdn/eicon/Makefile \
drivers/isdn/avmb1/Makefile; do
if [ -f $i.kernel ] ; then
$DOCP $i.kernel $KERNELDIR/$i
else
$DOCP $i $KERNELDIR/$i
fi
done
fi