#!/bin/sh
echo $1;
X='<?xml version="1.0" encoding="UTF-8" ?>	 <bundleUpgradeRequest version="3.0"> <hwid>0x06001a06</hwid>  <pin>0x50101234</pin> <vendorid>0x1</vendorid> 	<billingID>a000001c587eca</billingID>	  <bundle scm-ver="%s"/>	 <parameters> 	 <flashsize value="0" unit="B"/>  </parameters>  <mode>upgrade</mode> 	<isolocale>en_US</isolocale>  </bundleUpgradeRequest>';
printf "$X" $1 > tmp-xml

curl -k -A'2.2.0.17/MacDesktop' --header "Content-Type: text/xml"  --data @tmp-xml https://cs.websl.blackberry.com/cs/cs/  | tidy -utf8 -xml - >pb-$1
URL=$(cat pb-$1| grep url| cut -f2 -d'"')
cat pb-$1| grep .bar| cut -f 2 -d'"' > barlist-$1
mkdir -p $1
for i in `cat barlist-$1`; do echo $URL$i; done > $1/barurl-$1

