@@ -1,11 +1,11 @@
3−BASE_DIR=$(dirname "`readlink -f "$0"`")
3+BASE_DIR="$(dirname -- "`readlink -f -- "$0"`")"
4−PYTHONPATH=$BASE_DIR
4+PYTHONPATH="$BASE_DIR"
5SEARX_DIR="$BASE_DIR/searx"
5SEARX_DIR="$BASE_DIR/searx"
8−cd "$BASE_DIR"
8+cd -- "$BASE_DIR"
10update_packages() {
10update_packages() {
11 pip install --upgrade pip
11 pip install --upgrade pip
@@ -24,12 +24,12 @@ install_geckodriver() {
25 geckodriver -V > /dev/null 2>&1 || NOTFOUND=1
25 geckodriver -V > /dev/null 2>&1 || NOTFOUND=1
27− if [ -z $NOTFOUND ]; then
27+ if [ -z "$NOTFOUND" ]; then
30 GECKODRIVER_VERSION="v0.18.0"
30 GECKODRIVER_VERSION="v0.18.0"
31− PLATFORM=`python -c "import six; import platform; six.print_(platform.system().lower(), platform.architecture()[0])"`
31+ PLATFORM="`python -c "import six; import platform; six.print_(platform.system().lower(), platform.architecture()[0])"`"
32− case $PLATFORM in
32+ case "$PLATFORM" in
33 "linux 32bit" | "linux2 32bit") ARCH="linux32";;
33 "linux 32bit" | "linux2 32bit") ARCH="linux32";;
34 "linux 64bit" | "linux2 64bit") ARCH="linux64";;
34 "linux 64bit" | "linux2 64bit") ARCH="linux64";;
35 "windows 32 bit") ARCH="win32";;
35 "windows 32 bit") ARCH="win32";;
@@ -47,15 +47,15 @@ install_geckodriver() {
49 GECKODRIVER_DIR="$1"
49 GECKODRIVER_DIR="$1"
50− mkdir -p "$GECKODRIVER_DIR"
50+ mkdir -p -- "$GECKODRIVER_DIR"
53 echo "Installing $GECKODRIVER_DIR/geckodriver from\n $GECKODRIVER_URL"
53 echo "Installing $GECKODRIVER_DIR/geckodriver from\n $GECKODRIVER_URL"
55− FILE=`mktemp`
55+ FILE="`mktemp`"
56− wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C "$GECKODRIVER_DIR" -f $FILE geckodriver
56+ wget -qO "$FILE" -- "$GECKODRIVER_URL" && tar xz -C "$GECKODRIVER_DIR" -f "$FILE" geckodriver
57− rm $FILE
57+ rm -- "$FILE"
58− chmod 777 "$GECKODRIVER_DIR/geckodriver"
58+ chmod 777 -- "$GECKODRIVER_DIR/geckodriver"
61pep8_check() {
61pep8_check() {
@@ -73,14 +73,14 @@ unit_tests() {
74py_test_coverage() {
74py_test_coverage() {
75 echo '[!] Running python test coverage'
75 echo '[!] Running python test coverage'
76− PYTHONPATH=`pwd` python -m nose2 -C --log-capture --with-coverage --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit" \
76+ PYTHONPATH="`pwd`" python -m nose2 -C --log-capture --with-coverage --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit" \
77 && coverage report \
77 && coverage report \
78 && coverage html
78 && coverage html
81robot_tests() {
81robot_tests() {
82 echo '[!] Running robot tests'
82 echo '[!] Running robot tests'
83− PYTHONPATH=`pwd` python "$SEARX_DIR/testing.py" robot
83+ PYTHONPATH="`pwd`" python "$SEARX_DIR/testing.py" robot
@@ -113,11 +113,11 @@ styles() {
114npm_packages() {
114npm_packages() {
115 echo '[!] install NPM packages for oscar theme'
115 echo '[!] install NPM packages for oscar theme'
116− cd $BASE_DIR/searx/static/themes/oscar
116+ cd -- "$BASE_DIR/searx/static/themes/oscar"
117 npm install
117 npm install
119 echo '[!] install NPM packages for simple theme'
119 echo '[!] install NPM packages for simple theme'
120− cd $BASE_DIR/searx/static/themes/simple
120+ cd -- "$BASE_DIR/searx/static/themes/simple"
121 npm install
121 npm install
@@ -133,7 +133,7 @@ locales() {
136− [ -z "$1" ] || printf "Error: $1\n"
136+ [ -z "$1" ] || printf 'Error: %s\n' "$1"
137 echo "Searx manage.sh help
137 echo "Searx manage.sh help
@@ -156,4 +156,4 @@ Commands
157[ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
157[ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
158 && help "action not found" \
158 && help "action not found" \
159− || $ACTION "$2"
159+ || "$ACTION" "$2"