tests: add armv7 debug test and a register dumper
[pandora-misc.git] / hotfix_updater / pnd_make.sh
1 #!/bin/bash
2  
3 ######adjust path of genpxml.sh if you want to use that "feture"#####
4  
5 TEMP=`getopt -o p:d:x:i:c -- "$@"`
6  
7 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
8  
9 eval set -- "$TEMP"
10 while true ; do
11         case "$1" in
12                 -p) echo "PNDNAME set to $2" ;PNDNAME=$2;shift 2;;
13                 -d) echo "FOLDER set to $2" ;FOLDER=$2;shift 2 ;;
14                 -x) echo "PXML set to $2" ;PXML=$2;shift 2 ;;
15                 -i) echo "ICON set to $2" ;ICON=$2;shift 2 ;;
16                 -c) echo "-c set, will create compressed squasfs image instead of iso $2" ;SQUASH=1;shift 1 ;;
17                 --) shift ; break ;;
18                 *) echo "Error while parsing arguments! $2" ; exit 1 ;;
19         esac
20 done
21  
22 rnd=$RANDOM; # random number for genpxml and index$rnd.xml
23  
24 #generate pxml if guess or empty
25 if [ ! $PXML ] || [ $PXML = "guess" ] && [  $PNDNAME ] && [ $FOLDER ];  then
26         PXMLtxt=$(/home/user/libpnd/pandora-libraries/testdata/scripts/genpxml.sh $FOLDER $ICON)
27         PXML=$FOLDER/PXML.xml
28         echo "$PXMLtxt" > $FOLDER/PXML.xml
29 fi
30  
31 #check arguments
32 if [ ! $PNDNAME ] || [ ! $FOLDER ] || [ ! $PXML ]; then
33         echo " Usage: pnd_make.sh -p your.pnd -d folder/containing/your/app/ -x 
34         your.pxml (or \"guess\" to try to generate it from the folder) -i icon.png"
35         exit 1
36 fi
37 if [ ! -d $FOLDER ]; then echo "$FOLDER doesnt exist"; exit 1; fi #check if folder actually exists
38 if [ ! -f $PXML ]; then echo "$PXML doesnt exist"; exit 1; fi #check if pxml actually exists
39  
40 #make iso from folder
41 if [ ! $SQUASH ]; then
42         mkisofs -o $PNDNAME.iso -R $FOLDER
43 else
44         mksquashfs $FOLDER $PNDNAME.iso 
45 fi
46 #append pxml to iso
47 cat $PNDNAME.iso $PXML >  $PNDNAME
48 rm $PNDNAME.iso #cleanup
49  
50 #append icon if specified
51 if [ $ICON ]; then # check if we want to add an icon
52         if [ ! -f $ICON ]; then #does the icon actually exist?
53                 echo "$ICON doesnt exist"
54         else # yes
55         mv $PNDNAME $PNDNAME.tmp
56         cat $PNDNAME.tmp $ICON > $PNDNAME # append icon
57         rm $PNDNAME.tmp #cleanup
58         fi
59 fi
60  
61 if [ $PXML = "guess" ];then rm $FOLDER/PXML.xml; fi #cleanup