#!/bin/tcsh -f
# JLdL 18Nov11.
#
# List the patches found here and compear them with
# _ the corresponding kernel files.
#
# Do the 2.4 case.
#
# Build a list of the 2.4 files in this directory.
#set tdir = $cwd
#\ls disable-init-param-2.4*.diff | \
#    cut -d- -f4 | \
#    cut -dd -f1 | \
#    sed -e 's|\.$||g' | \
#    sort -t . -n -k 3 > $tdir/local.2.4.list
#
# Build a list of the 2.4 files in the kernel directory.
#cd /sft/kernel/v2.4/
#\ls linux-2.4*.tar.bz2 | \
#    cut -d- -f2 | \
#    cut -dt -f1 | \
#    sed -e 's|\.$||g' | \
#    sort -t . -n -k 3 | \
#    tail -n +27 > $tdir/kernel.2.4.list
#cd -
#
# Compare the two lists and build a list of the differences.
#set list = \
#    `diff $tdir/kernel.2.4.list $tdir/local.2.4.list | \
#	grep '^< ' | \
#	cut -d' ' -f2`
#
# Remove the temporary 2.4 list files.
#rm -f $tdir/kernel.2.4.list $tdir/local.2.4.list
#
# Write out the current 2.4 situation.
#echo "Versions of the 2.4 kernel missing from this directory:"
#echo "	(Note: 2.4 support starts with 2.4.26)"
#if ( "$list" == "" ) then
#    echo none
#else
#    echo $list
#endif
#
# Do the 2.6 case.
#
# Build a list of the 2.6 files in this directory.
set tdir = $cwd
\ls disable-init-param-2.6*.diff | \
    cut -d- -f4 | \
    cut -dd -f1 | \
    sed -e 's|\.$||g' | \
    sort -t . -n -k 3 > $tdir/local.2.6.list
#
# Build a list of the 2.6 files in the kernel directory.
cd /sft/kernel/v2.6/
\ls linux-2.6*.tar.bz2 | \
    cut -d- -f2 | \
    cut -dt -f1 | \
    sed -e 's|\.$||g' | \
    sort -t . -n -k 3 | \
    tail -n +9 > $tdir/kernel.2.6.list
cd -
#
# Compare the two lists and build a list of the differences.
set list = \
    `diff $tdir/kernel.2.6.list $tdir/local.2.6.list | \
	grep '^< ' | \
	cut -d' ' -f2`
#
# Remove the temporary 2.6 list files.
rm -f $tdir/kernel.2.6.list $tdir/local.2.6.list
#
# Write out the current 2.6 situation.
echo "Versions of the 2.6 kernel missing from this directory:"
echo "	(Note: 2.6 support starts with 2.6.8)"
if ( "$list" == "" ) then
    echo none
else
    echo $list
endif
#
# Do the 3.x case.
#
# Build a list of the 3.x files in this directory.
set tdir = $cwd
\ls disable-init-param-3.*.diff | \
    cut -d- -f4 | \
    cut -dd -f1 | \
    sed -e 's|\.$||g' | \
    sort -t . -n -k 3 > $tdir/local.3.x.list
#
# Build a list of the 3.x files in the kernel directory.
cd /sft/kernel/v3.x/
\ls linux-3.*.tar.bz2 | \
    grep -v -- '[0-9]-rc[0-9]' | \
    cut -d- -f2 | \
    cut -dt -f1 | \
    sed -e 's|\.$||g' | \
    sort -t . -n -k 3 > $tdir/kernel.3.x.list
cd -
#
# Compare the two lists and build a list of the differences.
set list = \
    `diff $tdir/kernel.3.x.list $tdir/local.3.x.list | \
	grep '^< ' | \
	cut -d' ' -f2`
#
# Remove the temporary 3.x list files.
rm -f $tdir/kernel.3.x.list $tdir/local.3.x.list
#
# Write out the current 3.x situation.
echo "Versions of the 3.x kernel missing from this directory:"
echo "	(Note: 3.x support starts with 3.0)"
if ( "$list" == "" ) then
    echo none
else
    echo $list
endif
