diff options
-rwxr-xr-x | manage.sh | 70 | ||||
-rw-r--r-- | searx/settings.yml | 1 | ||||
-rwxr-xr-x | utils/update-translations.sh | 6 |
3 files changed, 39 insertions, 38 deletions
@@ -1,11 +1,11 @@ #!/bin/sh -BASE_DIR=$(dirname "`readlink -f "$0"`") -PYTHONPATH=$BASE_DIR +BASE_DIR="$(dirname -- "`readlink -f -- "$0"`")" +PYTHONPATH="$BASE_DIR" SEARX_DIR="$BASE_DIR/searx" -ACTION=$1 +ACTION="$1" -cd "$BASE_DIR" +cd -- "$BASE_DIR" update_packages() { pip install --upgrade pip @@ -22,40 +22,40 @@ install_geckodriver() { echo '[!] Checking geckodriver' # TODO : check the current geckodriver version set -e - geckodriver -V 2>1 > /dev/null || NOTFOUND=1 + geckodriver -V > /dev/null 2>&1 || NOTFOUND=1 set +e - if [ -z $NOTFOUND ]; then - return + if [ -z "$NOTFOUND" ]; then + return fi GECKODRIVER_VERSION="v0.18.0" - PLATFORM=`python -c "import six; import platform; six.print_(platform.system().lower(), platform.architecture()[0])"` - case $PLATFORM in - "linux 32bit" | "linux2 32bit") ARCH="linux32";; - "linux 64bit" | "linux2 64bit") ARCH="linux64";; - "windows 32 bit") ARCH="win32";; - "windows 64 bit") ARCH="win64";; - "mac 64bit") ARCH="macos";; + PLATFORM="`python -c "import six; import platform; six.print_(platform.system().lower(), platform.architecture()[0])"`" + case "$PLATFORM" in + "linux 32bit" | "linux2 32bit") ARCH="linux32";; + "linux 64bit" | "linux2 64bit") ARCH="linux64";; + "windows 32 bit") ARCH="win32";; + "windows 64 bit") ARCH="win64";; + "mac 64bit") ARCH="macos";; esac GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz"; if [ -z "$1" ]; then - if [ -z "$VIRTUAL_ENV" ]; then - echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n $GECKODRIVER_URL" - exit - else - GECKODRIVER_DIR="$VIRTUAL_ENV/bin" - fi + if [ -z "$VIRTUAL_ENV" ]; then + echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n $GECKODRIVER_URL" + exit + else + GECKODRIVER_DIR="$VIRTUAL_ENV/bin" + fi else - GECKODRIVER_DIR="$1" - mkdir -p "$GECKODRIVER_DIR" + GECKODRIVER_DIR="$1" + mkdir -p -- "$GECKODRIVER_DIR" fi echo "Installing $GECKODRIVER_DIR/geckodriver from\n $GECKODRIVER_URL" - - FILE=`mktemp` - wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C "$GECKODRIVER_DIR" -f $FILE geckodriver - rm $FILE - chmod 777 "$GECKODRIVER_DIR/geckodriver" + + FILE="`mktemp`" + wget -qO "$FILE" -- "$GECKODRIVER_URL" && tar xz -C "$GECKODRIVER_DIR" -f "$FILE" geckodriver + rm -- "$FILE" + chmod 777 -- "$GECKODRIVER_DIR/geckodriver" } pep8_check() { @@ -73,14 +73,14 @@ unit_tests() { py_test_coverage() { echo '[!] Running python test coverage' - PYTHONPATH=`pwd` python -m nose2 -C --log-capture --with-coverage --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit" \ + PYTHONPATH="`pwd`" python -m nose2 -C --log-capture --with-coverage --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit" \ && coverage report \ && coverage html } robot_tests() { echo '[!] Running robot tests' - PYTHONPATH=`pwd` python "$SEARX_DIR/testing.py" robot + PYTHONPATH="`pwd`" python "$SEARX_DIR/testing.py" robot } tests() { @@ -113,18 +113,18 @@ styles() { npm_packages() { echo '[!] install NPM packages for oscar theme' - cd $BASE_DIR/searx/static/themes/oscar + cd -- "$BASE_DIR/searx/static/themes/oscar" npm install - echo '[!] install NPM packages for simple theme' - cd $BASE_DIR/searx/static/themes/simple + echo '[!] install NPM packages for simple theme' + cd -- "$BASE_DIR/searx/static/themes/simple" npm install } grunt_build() { echo '[!] Grunt build : oscar theme' grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js" - echo '[!] Grunt build : simple theme' + echo '[!] Grunt build : simple theme' grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js" } @@ -133,7 +133,7 @@ locales() { } help() { - [ -z "$1" ] || printf "Error: $1\n" + [ -z "$1" ] || printf 'Error: %s\n' "$1" echo "Searx manage.sh help Commands @@ -156,4 +156,4 @@ Commands [ "$(command -V "$ACTION" | grep ' function$')" = "" ] \ && help "action not found" \ - || $ACTION "$2" + || "$ACTION" "$2" diff --git a/searx/settings.yml b/searx/settings.yml index 818a32c1f..185efc30d 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -581,6 +581,7 @@ engines: - name : yahoo engine : yahoo shortcut : yh + disabled : True - name : yandex engine : yandex diff --git a/utils/update-translations.sh b/utils/update-translations.sh index 00e7fb1e0..240387ae7 100755 --- a/utils/update-translations.sh +++ b/utils/update-translations.sh @@ -7,9 +7,9 @@ SEARX_DIR='searx' -pybabel extract -F babel.cfg -o messages.pot $SEARX_DIR -for f in `ls $SEARX_DIR'/translations/'`; do - pybabel update -N -i messages.pot -d $SEARX_DIR'/translations/' -l $f +pybabel extract -F babel.cfg -o messages.pot "$SEARX_DIR" +for f in `ls "$SEARX_DIR"'/translations/'`; do + pybabel update -N -i messages.pot -d "$SEARX_DIR"'/translations/' -l "$f" done echo '[!] update done, edit .po files if required and run pybabel compile -d searx/translations/' |