[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Whats wrong with this script ?



I am trying to get a module compiled against kernel 2.2.12-20, work on
2.2.19; I found this script on the net, when I run this as
 ./fixscript esscom.o esscom.fix.o I get the error -

./fixscript1: $MI: ambiguous redirect
./fixscript1: line 5: syntax error near unexpected token `do '
./fixscript1: line 5: ` do '

Here is the original script -

MI=/tmp/modinfo [ -z "$DEPMOD" ] && DEPMOD=depmod #new kernel version
modinfo section
echo -ne "kernel_version="`uname -r`"\0" > $MI #build the objcopy
command
CMD="objcopy"
for i in `$DEPMOD -e $1 2>&1 | sed 's/depmod://g' | grep -vE
"^$1:|Unresolved symbols|^#"` ; do
 echo -n doing $i
 i1=`echo $i | awk '{
  gsub(/_R[0-9a-fA-F]+/,"");
  printf("%s", $1);
 }'`
 echo -n " trunc=$i1"
 new=`awk '/ '$i1'_R/ {
  printf("%s", $2);
 }' < /proc/ksyms`
 echo " new=$new"
 CMD="$CMD --redefine-sym=$i=$new"
done #fix symbols which conflict with the serial driver
CMD="$CMD --redefine-sym=register_serial=register_lucent"
CMD="$CMD --redefine-sym=unregister_serial=unregister_lucent"
CMD="$CMD --redefine-sym=serial_console_init=ltmodem_console_init"
#replace the modinfo section with the new one
CMD="$CMD --remove-section=.modinfo --add-section=.modinfo=$MI"
CMD="$CMD $*" #run the command
$CMD #remove the section file
rm -f $MI

Can u tell whts wrong ?

Sachin









Reply to: