[clue-tech] new thread -> RedHat RHEL kernel
mike havlicek
mhavlicek1 at yahoo.com
Fri Oct 28 18:26:12 MDT 2005
#!/bin/bash
##########################################################################
#
# Takes path to patches as argument
#
##########################################################################
#echo "$1"
#exit
SPECFILE=/usr/src/redhat/SPECS/kernel-2.6.spec
##########################################################################
moveon(){
export PS3='Continue: '
choices="Yes No"
select selection in $choices; do
if [ $selection ]; then
if [ $selection = Yes ]; then
echo "Moving on"
break
else
echo "Aborting patches"
exit
fi
else
echo "Invalid"
fi
done
}
##########################################################################
buildcommand() {
while read patchID switches; do
part[0]=$patchID
part[1]=$switches
################################
# Using () rather than backticks
# has caused problems here
################################
patchdef=`grep -i "${part[0]}:" $SPECFILE|cut -f 2
-d" "`
patchfile="$PATCHPATH$patchdef"
if [ $patchfile != ${patchfile%.bz2} ] ; then
#echo "$patchfile VS ${patchfile%.bz2}"
if [ -r $patchfile ] ; then
bzip2 -d $patchfile
fi
patchfile=${patchfile%.bz2}
fi
# Check if patch exists where we look and we have read
permission
if [ -r $patchfile ] ; then
##########################################################################
#
# Simply do the Unix patch without using $command here
#
##########################################################################
command="patch ${part[1]} < $patchfile"
echo $command
#patch ${part[1]} < $patchfile
else
echo "Error:"
echo "\"$patchdef\" unavailable."
sleep 1
#moveon
#exit
fi
# echo "${part[0]}"
# echo "${part[1]}"
done
} #< testdata
## Called as sed -nf <this file> $SPEC
## Extract order to apply patches from kernel spec
file and how to patch.
#/^#.*Alan/,/END.*APP/{
#/^%/s/%//p
#}
##########################################################################
# Called as sed -nf sedscr2 $SPEC
# Extract patch definitions
#210,/END.*DEF/{
#604d
#s/: */=/p
#}
#
#sed2=`sed -n '210,/END.*DEF/{604d}
##########################################################################
#moveon
if [ -z "$1" ] ; then
echo "Usage: ${0##*/} PATCHPATH"
else
sed1=`sed -n '/^#.*Alan/,/END.*APP/{/^%/s/%//p}'
$SPECFILE`
PATCHPATH="$1/"
# The following line works
echo "$sed1" | buildcommand
#read "$sed1" | buildcommand
fi
--- mike havlicek <mhavlicek1 at yahoo.com> wrote:
> I wrote a silly bash script that used Sed to strip
> the
> patch names from the spec file from the kernel srpm.
> And apply them in correct order.
>
> -Mike
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
> _______________________________________________
> CLUE-tech mailing list
> CLUE-tech at cluedenver.org
> http://cluedenver.org/mailman/listinfo/clue-tech
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech
More information about the clue-tech
mailing list