All pastes #927021 Raw Edit

wpschecker

public shellscript v1 · immutable
#927021 ·published 2008-03-03 23:43 UTC
rendered paste body
#!/bin/bashTHEMEDIR="."TEMPDIR="/tmp/`basename $0`"TOOLSDIR="/home/rasher/apps/rockbox/build-env/src/rockbox/clean/tools/"svn update "$TOOLSDIR/.."REV=`$TOOLSDIR/svnversion.sh "$TOOLSDIR/.."`CHECKWPS="${TOOLSDIR}/checkwps"make -C "$TOOLSDIR" checkwpsif [ -n "$1" ]; then    THEMEDIR="$1"fiif [ ! -d "$THEMEDIR" ]; then    echo "Error: $THEMEDIR is not a directory"    exit 2fifind "$THEMEDIR" -name "*zip" |(while read zipfile; do    mkdir -p "$TEMPDIR";    if [ ! -d "$TEMPDIR" ]; then        echo "Error: $TEMPDIR doesn't exist and couldn't be created"        exit 1    fi    echo $zipfile    unzip -d "$TEMPDIR" "$zipfile" "*.wps" >/dev/null    find "$TEMPDIR" -name "*.wps" |(PASS="false"; while read wps; do        result=`${CHECKWPS} "$wps"`        if [ "$result" = "WPS parsed OK" ]; then            # WPS is valid            echo "  PASS: $wps"            PASS="true"        else            # WPS is invalid            echo "  FAIL: $wps"        fi    done;    if [ "$PASS" = "true" ]; then        # Whole theme (at least one WPS) is valid        echo "  Theme pass"        # Delete .fail file if one exists        rm -f "$zipfile.fail"        # Always keep the latest passing REV        echo $REV > "$zipfile.pass"    else        # Whole theme (all WPS) is invalid        # Keep a .fail file with the first REV which failed        if [ ! -f "$zipfile.fail" ]; then            echo $REV > "$zipfile.fail"        fi        echo "  Theme fail"    fi    )    rm -rf "$TEMPDIR"done)