[Thunderbolt Android Development] trter10:
Well I have spent the better part of my day making this

#!/bin/sh

#Script made by Luke Frazier, aka trter10.
#This adds in the RIL to the framework.jar of a fresh mecha CM9 compile.

#Set our variables
day=$(date +%d)
month=$(date +%m)
year=$(date +%Y)

#Remove old clutter
echo Preparing workspace...
if [ -f ~/Desktop/cm-9-$year$month$day-UNOFFICIAL-mecha-RILADDED.zip ]
then
rm ~/Desktop/cm-9-$year$month$day-UNOFFICIAL-mecha-RILADDED.zip
fi
if [ -d ~/Desktop/apktool/framework ]
then
rm -rf ~/Desktop/apktool/framework.jar.out
fi
if [ -d ~/Desktop/apktool/cm-9-$year$month$day-UNOFFICIAL-mecha ]
then
rm -rf ~/Desktop/apktool/cm-9-$year$month$day-UNOFFICIAL-mecha
fi

#Copy the zip
echo Copying zip...
cp out/target/product/mecha/cm-9-*-UNOFFICIAL-mecha.zip ~/Desktop/apktool/cm-9-$year$month$day-UNOFFICIAL-mecha.zip

#Unzip the zip
echo Unzipping...
unzip ~/Desktop/apktool/cm-9-$year$month$day-UNOFFICIAL-mecha.zip -d ~/Desktop/apktool/cm-9-$year$month$day-UNOFFICIAL-mecha >/dev/null 2>&1

#Move the framework.jar
echo Moving unmodified framework...
mv ~/Desktop/apktool/cm-9-$year$month$day-UNOFFICIAL-mecha/system/framework/framework.jar ~/Desktop/apktool/framework.jar

#Decompile the framework.jar
echo Decompiling unmodified framework...
cd ~/Desktop/apktool/
java -jar apktool.jar d framework.jar >/dev/null 2>&1

#Copy the RIL
echo Copying RIL...
cp frameworkbase.jar.out/smali/com/android/internal/telephony/HTCMechaQualcommRIL.smali framework.jar.out/smali/com/android/internal/telephony/HTCMechaQualcommRIL.smali
cp frameworkbase.jar.out/smali/com/android/internal/telephony/HTCMechaQualcommRIL$1.smali framework.jar.out/smali/com/android/internal/telephony/HTCMechaQualcommRIL\$1.smali
cp frameworkbase.jar.out/smali/com/android/internal/telephony/HTCMechaQualcommRIL\$IccHandler.smali framework.jar.out/smali/com/android/internal/telephony/HTCMechaQualcommRIL\$IccHandler.smali

#Recompile the modified framework.jar
echo Compiling modified framework...
java -jar apktool.jar b framework.jar.out frameworkNEW.jar >/dev/null 2>&1

#Move the modified framework back into the ROM
echo Moving modified framework...
mv frameworkNEW.jar cm-9-$year$month$day-UNOFFICIAL-mecha/system/framework/framework.jar

#Remove the old signing
echo Removing old signing...
rm cm-9-$year$month$day-UNOFFICIAL-mecha/META-INF/CERT.RSA
rm cm-9-$year$month$day-UNOFFICIAL-mecha/META-INF/CERT.SF
rm cm-9-$year$month$day-UNOFFICIAL-mecha/META-INF/MANIFEST.MF
rm -rf cm-9-$year$month$day-UNOFFICIAL-mecha/META-INF/com/android

#Zip up the ROM
echo Zipping package...
cd cm-9-$year$month$day-UNOFFICIAL-mecha
zip -r cm-9-$year$month$day-UNOFFICIAL-mecha-RILADDED.zip * >/dev/null 2>&1

#Sign the ROM
echo Signing package...
java -jar /home/luke/android-new/out/host/linux-x86/framework/signapk.jar ../certificate.pem ../key.pk8 cm-9-$year$month$day-UNOFFICIAL-mecha-RILADDED.zip ../../cm-9-$year$month$day-UNOFFICIAL-mecha-RILADDED.zip
rm cm-9-$year$month$day-UNOFFICIAL-mecha-RILADDED.zip
cd ../..

#Done!
echo
echo "Finished package: $(realpath cm-9-$year$month$day-UNOFFICIAL-mecha-RILADDED.zip)" #The program realpath must be installed, sudo apt-get install realpath
echo " MD5: $(md5sum cm-9-$year$month$day-UNOFFICIAL-mecha-RILADDED.zip | awk {' print $1 '})"

#Change back to original directory
cd ~/android-new