diff options
author | Aleksander Machniak <alec@alec.pl> | 2016-12-08 18:30:39 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2016-12-08 18:30:39 +0300 |
commit | 5bae3ca6f54cd9c12ed235cdf3e4e0e41eba1b80 (patch) | |
tree | 233758507531d0c03e217ed8b583d0bb0f1fa86c /bin | |
parent | 12a49437d2973df05e845c072c8d52972bdb1545 (diff) |
jsdeps.sh: Add 'cleanup' argument
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/jsdeps.sh | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/bin/jsdeps.sh b/bin/jsdeps.sh index af1e9c813..1917553eb 100755 --- a/bin/jsdeps.sh +++ b/bin/jsdeps.sh @@ -41,7 +41,7 @@ OPENPGP_PATH="$PWD/../plugins/enigma/openpgp.min.js" CM_VERSION="5.21.0" CM_URL="http://codemirror.net/codemirror-$CM_VERSION.zip" CM_SHA="3b767c2e3acd6796e54ed19ed2ac0755fcf87984" -CM_PATH="$PWD/../plugins/managesieve/codemirror.zip" +CM_PATH="$PWD/../plugins/managesieve/codemirror" ################################################################################ @@ -66,6 +66,17 @@ else exit 1 fi +if [ "$WHAT" = "cleanup" ]; then + set -x + rm -rf $JQUERY_PATH + rm -rf $JSTZ_PATH + rm -rf $PKEY_PATH + rm -rf $TINYMCE_PATH + rm -rf $OPENPGP_PATH + rm -rf $CM_PATH + exit +fi + if [ "$WHAT" = "jquery" ] || [ "$WHAT" = "" ]; then echo "Downloading jQuery..." @@ -196,15 +207,15 @@ fi if [ "$WHAT" = "codemirror" ] || [ "$WHAT" = "" ]; then echo "Downloading CodeMirror..." - $GET $CM_URL $OPT "$CM_PATH" - if [ ! -f "$CM_PATH" ]; then + $GET $CM_URL $OPT "$CM_PATH.zip" + if [ ! -f "$CM_PATH.zip" ]; then echo "ERROR: Failed to get $CM_URL" exit 1 fi - SUM=`$SHASUM "$CM_PATH" | cut -d " " -f 1` + SUM=`$SHASUM "$CM_PATH.zip" | cut -d " " -f 1` if [ "$SUM" != "$CM_SHA" ]; then - echo "ERROR: Incorrect SHA of $CM_PATH. Expected: $CM_SHA, got: $SUM" + echo "ERROR: Incorrect SHA of $CM_PATH.zip. Expected: $CM_SHA, got: $SUM" exit 1 fi @@ -218,13 +229,13 @@ if [ "$WHAT" = "codemirror" ] || [ "$WHAT" = "" ]; then $UNZIP -q "$CM_PATH" -d "$DIR" "codemirror-$CM_VERSION/addon/selection/active-line.js" $UNZIP -q "$CM_PATH" -d "$DIR" "codemirror-$CM_VERSION/mode/sieve/sieve.js" - if [ -d "$DIR/codemirror" ]; then - rm -drf "$DIR/codemirror" + if [ -d "$CM_PATH" ]; then + rm -drf "$CM_PATH" fi - mv -f "$DIR/codemirror-$CM_VERSION" "$DIR/codemirror" + mv -f "$DIR/codemirror-$CM_VERSION" "$CM_PATH" #cleanup - rm -f "$CM_PATH" + rm -f "$CM_PATH.zip" echo "Done" fi |