for i in $@
do


  echo "---"
  echo "unpacking $i .."
  TMP=tmp-$i
  mkdir $TMP
  cd $TMP
#  unzip -q ../$i
  jar xf ../$i
  ls
  chmod -R u+rwx *
  find . -type f | xargs chmod u-x
  echo "changing META-INF stuff .."
  cd META-INF
  rm -f *.SF
  rm -f *.DSA
  # this will determine the line number of the first blank line in MANIFEST.MF
  # (a blank line here is anything that has no letter/number)
  CUT=`egrep -nv '^.*[a-z|A-Z|0-9]+.*$' MANIFEST.MF|sed s/://|head -1|tr -d "\r\n"`
  if [ -z "$CUT" ]; 
  then 
    echo "no cut detected"; 
  else \
    echo "cutting MANIFEST.MF at line $CUT .." && 
    head -$CUT MANIFEST.MF >m.mf && 
    rm -f MANIFEST.MF && 
    mv m.mf MANIFEST.MF && 
    cat MANIFEST.MF;
  fi
  echo "repacking $i .."
  cd ..
  rm -f ../$i
  zip -q9r ../$i .
  cd ..
  rm -rf $TMP
  echo "signing $i .."


### sign again
#jarsigner -keystore /home/tbudev3/javaproj/endrov.git/ev/util/myKey -keypass cheeze -storepass cheeze $i mykey

#  $JDK/bin/jarsigner -keystore $KEYSTORE -storepass foopassword $i fookeyname
 # echo "verifying the signatures of $i .."
 # $JDK/bin/jarsigner -verify $i
#  echo indexing $i ..
 # $JDK/bin/jar -i $i


done
