Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

wpschecker
Monday, March 3rd, 2008 at 11:43:38pm UTC 

  1. #!/bin/bash
  2.  
  3. THEMEDIR="."
  4. TEMPDIR="/tmp/`basename $0`"
  5. TOOLSDIR="/home/rasher/apps/rockbox/build-env/src/rockbox/clean/tools/"
  6.  
  7. svn update "$TOOLSDIR/.."
  8.  
  9. REV=`$TOOLSDIR/svnversion.sh "$TOOLSDIR/.."`
  10. CHECKWPS="${TOOLSDIR}/checkwps"
  11. make -C "$TOOLSDIR" checkwps
  12.  
  13. if [ -n "$1" ]; then
  14.     THEMEDIR="$1"
  15. fi
  16. if [ ! -d "$THEMEDIR" ]; then
  17.     echo "Error: $THEMEDIR is not a directory"
  18.     exit 2
  19. fi
  20.  
  21. find "$THEMEDIR" -name "*zip" |(while read zipfile; do
  22.     mkdir -p "$TEMPDIR";
  23.     if [ ! -d "$TEMPDIR" ]; then
  24.         echo "Error: $TEMPDIR doesn't exist and couldn't be created"
  25.         exit 1
  26.     fi
  27.  
  28.     echo $zipfile
  29.     unzip -d "$TEMPDIR" "$zipfile" "*.wps" >/dev/null
  30.  
  31.     find "$TEMPDIR" -name "*.wps" |(PASS="false"; while read wps; do
  32.         result=`${CHECKWPS} "$wps"`
  33.         if [ "$result" = "WPS parsed OK" ]; then
  34.             # WPS is valid
  35.             echo "  PASS: $wps"
  36.             PASS="true"
  37.         else
  38.             # WPS is invalid
  39.             echo "  FAIL: $wps"
  40.         fi
  41.     done;
  42.     if [ "$PASS" = "true" ]; then
  43.         # Whole theme (at least one WPS) is valid
  44.         echo "  Theme pass"
  45.         # Delete .fail file if one exists
  46.         rm -f "$zipfile.fail"
  47.         # Always keep the latest passing REV
  48.         echo $REV > "$zipfile.pass"
  49.     else
  50.         # Whole theme (all WPS) is invalid
  51.         # Keep a .fail file with the first REV which failed
  52.         if [ ! -f "$zipfile.fail" ]; then
  53.             echo $REV > "$zipfile.fail"
  54.         fi
  55.         echo "  Theme fail"
  56.     fi
  57.     )
  58.     rm -rf "$TEMPDIR"
  59. done)

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right