X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=testdata%2Fscripts%2Fpnd_make.sh;h=3a0ce2cd1468c0adbe17ff7e891cd45e0d3eaac2;hb=303fbe209ab8aa5f26224a18873d84e28fa8c305;hp=2586ac68ec30ac9b24c95752617d0f38e88bc993;hpb=50313b0bfd3002658e8fbb22112ad271b0131f94;p=pandora-libraries.git diff --git a/testdata/scripts/pnd_make.sh b/testdata/scripts/pnd_make.sh index 2586ac6..3a0ce2c 100755 --- a/testdata/scripts/pnd_make.sh +++ b/testdata/scripts/pnd_make.sh @@ -1,9 +1,8 @@ #!/bin/bash ######adjust path of genpxml.sh if you want to use that "feture"##### -# \!/ black magic ahead -TEMP=`getopt -o p:d:x:i: -- "$@"` +TEMP=`getopt -o p:d:x:i:c -- "$@"` if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi @@ -14,6 +13,7 @@ while true ; do -d) echo "FOLDER set to $2" ;FOLDER=$2;shift 2 ;; -x) echo "PXML set to $2" ;PXML=$2;shift 2 ;; -i) echo "ICON set to $2" ;ICON=$2;shift 2 ;; + -c) echo "-c set, will create compressed squasfs image instead of iso $2" ;SQUASH=1;shift 1 ;; --) shift ; break ;; *) echo "Error while parsing arguments! $2" ; exit 1 ;; esac @@ -21,38 +21,45 @@ done rnd=$RANDOM; # random number for genpxml and index$rnd.xml -if [ $PXML = "guess" ] && [ $PNDNAME ] && [ $FOLDER ]; then - PXMLtxt=$(~/pndtest/genxml.sh $FOLDER $ICON) - PXML=tmp$rnd.pxml - echo "$PXMLtxt" > tmp$rnd.pxml +#generate pxml if guess or empty +if [ ! $PXML ] || [ $PXML = "guess" ] && [ $PNDNAME ] && [ $FOLDER ]; then + PXMLtxt=$(/home/user/libpnd/pandora-libraries/testdata/scripts/genpxml.sh $FOLDER $ICON) + PXML=$FOLDER/PXML.xml + echo "$PXMLtxt" > $FOLDER/PXML.xml fi +#check arguments if [ ! $PNDNAME ] || [ ! $FOLDER ] || [ ! $PXML ]; then echo " Usage: pnd_make.sh -p your.pnd -d folder/containing/your/app/ -x your.pxml (or \"guess\" to try to generate it from the folder) -i icon.png" exit 1 fi +if [ ! -d $FOLDER ]; then echo "$FOLDER doesnt exist"; exit 1; fi #check if folder actually exists +if [ ! -f $PXML ]; then echo "$PXML doesnt exist"; exit 1; fi #check if pxml actually exists -if [ ! -d $FOLDER ]; then echo "$FOLDER doesnt exist"; exit 1; fi -if [ ! -f $PXML ]; then echo "$PXML doesnt exist"; exit 1; fi - - -mkisofs -o $PNDNAME.iso -R $FOLDER -#pxmlstart=$(stat -c%s "$PNDNAME.iso") - +#make iso from folder +if [ ! $SQUASH ]; then + mkisofs -o $PNDNAME.iso -R $FOLDER +else + if [ $(mksquashfs -version | awk '{if ($3 >= 4) print 1}') = 1 ]; then + echo "your squashfs version is older then version 4, pleas upgrade to 4.0 or later" + exit 1 + fi + mksquashfs -no-recovery -nopad $FOLDER $PNDNAME.iso +fi +#append pxml to iso cat $PNDNAME.iso $PXML > $PNDNAME -rm $PNDNAME.iso +rm $PNDNAME.iso #cleanup -if [ $ICON ]; then # is -i used? +#append icon if specified +if [ $ICON ]; then # check if we want to add an icon if [ ! -f $ICON ]; then #does the icon actually exist? echo "$ICON doesnt exist" else # yes mv $PNDNAME $PNDNAME.tmp - cat $PNDNAME.tmp $ICON > $PNDNAME + cat $PNDNAME.tmp $ICON > $PNDNAME # append icon + rm $PNDNAME.tmp #cleanup fi fi -if [ $PXML = "guess" ];then rm tmp$rnd.pxml; fi - -#printf %08d $pxmlstart >> $PNDNAME #append end of iso/start of pxml offset - +if [ $PXML = "guess" ];then rm $FOLDER/PXML.xml; fi #cleanup