rivviepop phantom :: knowledge in passing

knowledge in passing

getapp.sh: download OTA app to install from SD card

leave a comment »

You know you love it – Stupid Shell Tricks 101 time again ladies and gents. Here’s a utilitarian script to download a large OTA (”Over The Air”) app/theme/whatever and all it’s COD/JAR/JAD files – such as the Mobipocket Reader – to your workstation so you can install it on your mobile device using your SD card instead; handy if the app is really large, have problems with your device data connection, or pay a lot for the data usage on your device.

Usage is simple and easy like all my crazy little scripts, just wrap your brain around the bash-fu.

Download Usage
1) save the below code as ‘getapp.sh’
2) edit getapp.sh to put in the proper URL and JAD file (Mobipocket eReader used as an example)
3) comment/uncomment the use of wget or curl as needed (depends on what you have installed, I like curl)
4) make a new directory and run the script in that directory

Example:


cd ~ vi getapp.sh (edit/save/exit) mkdir mpocket cd mpocket sh ../getapp.sh

Install Usage
1) copy the folder “mpocket” to your SD card, it should contain all the random COD, JAD and JAR files
2) from your device launch the Media applet
3) Menu key -> Explore -> Media Card -> mpocket folder
4) click on the JAD file to start the install (i.e. mobireader.jad)

===

getapp.sh (here there be dragons)


#!/bin/sh
#
# retrieve an OTA app locally, copy to SD card and install
# from there instead (for large OTA apps)

URL=http://www.mobipocket.com/mobile/downloadsoft/download/mobile4.2.0/
JAD=mobireader.jad

# curl or wget may be used, comment/uncomment as needed
#CMD="wget --quiet"
CMD="curl -s -O"

echo "Retrieving: ${URL}${JAD}"
${CMD} "${URL}${JAD}"

echo "Converting ${JAD}"
dos2unix "${JAD}"

CODS=`cat ${JAD} | grep -i url | cut -f2 -d ' '`
for ii in ${CODS}; do
  echo "Retrieving: ${URL}${ii}"
  ${CMD} "${URL}${ii}"
done

exit 0

# rivviepop at blackberryforums.com
# licensed under the GPLv2

This can easily be expanded to take in parameters from the commandline, chop apart URLs as needed, or whatever works for your specific situation. In some cases you may need to use a “cookie jar”, a bit more of an advanced setup.

http://www.blackberryforums.com/linux-users-corner/125874-script-download-ota-app-install-sd-card.html

Written by rivviepop

2008-09-03 at 15:47

Leave a Reply

You must be logged in to post a comment.