From a97176845d25badb770223c149241f810a83288d Mon Sep 17 00:00:00 2001 From: hackademix Date: Thu, 2 Aug 2018 01:50:09 +0200 Subject: Consistent filesystem path quoting in shell scripts. --- TLD/generate.sh | 4 ++-- build.sh | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TLD/generate.sh b/TLD/generate.sh index ee5d327..0d3b1d8 100644 --- a/TLD/generate.sh +++ b/TLD/generate.sh @@ -3,13 +3,13 @@ BASE=$(dirname "$0") pushd "$BASE" fname=public_suffix_list.dat nflag="" -if [ -f $fname ]; then +if [ -f "$fname" ]; then nflag="-z $fname" fi URL=https://publicsuffix.org/list/$fname curl -O $nflag "$URL" -if ! grep 'com' $fname >/dev/null; then +if ! grep 'com' "$fname" >/dev/null; then echo >&2 "$fname empty or corrupt!" exit 1 fi diff --git a/build.sh b/build.sh index ec912fc..821857e 100644 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -BASE=$PWD +BASE="$PWD" SRC="$BASE/src" BUILD="$BASE/build" MANIFEST_IN="$SRC/manifest.json" @@ -24,7 +24,7 @@ LIB="$SRC/lib" TLD="$BASE/TLD" if ! [ $(date -r "$LIB/tld.js" +'%Y%m%d') -ge $(date +'%Y%m%d') ] && "$TLD/generate.sh"; then - cp -u "$TLD/tld.js" $LIB + cp -u "$TLD/tld.js" "$LIB" fi ./html5_events/html5_events.pl @@ -44,9 +44,9 @@ if ! grep '"id":' "$MANIFEST_OUT" >/dev/null; then exit 1 fi -for file in $SRC/content/*.js; do - if grep -P '\/\/\s(REL|DEV)_ONLY' $file >/dev/null; then - sed -re 's/\s*\/\/\s*(\S.*)\s*\/\/\s*REL_ONLY.*/\1/' -e 's/.*\/\/\s*DEV_ONLY.*//' $file > $BUILD/content/$(basename $file) +for file in "$SRC"/content/*.js; do + if grep -P '\/\/\s(REL|DEV)_ONLY' "$file" >/dev/null; then + sed -re 's/\s*\/\/\s*(\S.*)\s*\/\/\s*REL_ONLY.*/\1/' -e 's/.*\/\/\s*DEV_ONLY.*//' "$file" > "$BUILD"/content/$(basename "$file") fi done @@ -61,7 +61,7 @@ fi echo "Creating $XPI.xpi..." mkdir -p "$XPI_DIR" -"$BUILD_CMD" $BUILD_OPTS --source-dir=$(cygpath -w $BUILD) --artifacts-dir=$(cygpath -w $XPI_DIR) --ignore-files=test/XSS_test.js +"$BUILD_CMD" $BUILD_OPTS --source-dir=$(cygpath -w "$BUILD") --artifacts-dir=$(cygpath -w "$XPI_DIR") --ignore-files=test/XSS_test.js SIGNED="$XPI_DIR/noscript_security_suite-$VER-an+fx.xpi" if [ -f "$SIGNED" ]; then mv "$SIGNED" "$XPI.xpi" -- cgit v1.2.3