#!/bin/bash # You'll need to change these to match your setup: STEM=BluetoothRemote CERTIFICATE=testCA.2007 KEYPASS=XYZ STOREPASS=XYZ BLUETOOTH_ADDRESS=00:17:4B:4E:86:85 KEYSTORE=~/code-certificate/example.sks JADTOOL=/home/mark/wtk2.2/WTK2.2/bin/JadTool.jar # ------------------------------------------------ set -e set -x if [ ! -e ${STEM}.jar ] then echo You should only run this in the directory with ${STEM}.jar exit -1 fi jarsigner -keystore ${KEYSTORE} -keypass ${KEYPASS} -storepass ${STOREPASS} ${STEM}.jar ${CERTIFICATE} JAR_SIZE=`ls -l ${STEM}.jar | awk '{ print $5; }'` sed "s/MIDlet-Jar-Size: .*/MIDlet-Jar-Size: ${JAR_SIZE}/g" < ${STEM}.jad > ${STEM}.jad.2 java -jar ${JADTOOL} -addcert -alias ${CERTIFICATE} -storepass ${STOREPASS} -keystore ${KEYSTORE} -inputjad ${STEM}.jad.2 -outputjad ${STEM}.jad.3 java -jar ${JADTOOL} -addjarsig -alias ${CERTIFICATE} -jarfile ${STEM}.jar -storepass ${STOREPASS} -keypass ${KEYPASS} -keystore ${KEYSTORE} -inputjad ${STEM}.jad.3 -outputjad ${STEM}.jad.4 mv ${STEM}.jad.4 ${STEM}.jad obexftp -b ${BLUETOOTH_ADDRESS} --put ${STEM}.jar obexftp -b ${BLUETOOTH_ADDRESS} --put ${STEM}.jad