Browse Source

[fix] manage.sh: add quotes arround parameters dealing with directories or files.

Alexandre Flament 7 years ago
parent
commit
1a814369fd
1 changed files with 10 additions and 9 deletions
  1. 10
    9
      manage.sh

+ 10
- 9
manage.sh View File

5
 SEARX_DIR="$BASE_DIR/searx"
5
 SEARX_DIR="$BASE_DIR/searx"
6
 ACTION=$1
6
 ACTION=$1
7
 
7
 
8
-cd $BASE_DIR
8
+cd "$BASE_DIR"
9
 
9
 
10
 update_packages() {
10
 update_packages() {
11
     pip install -r "$BASE_DIR/requirements.txt"
11
     pip install -r "$BASE_DIR/requirements.txt"
18
 
18
 
19
 install_geckodriver() {
19
 install_geckodriver() {
20
     echo '[!] Checking geckodriver'
20
     echo '[!] Checking geckodriver'
21
+    # TODO : check the current geckodriver version
21
     set -e
22
     set -e
22
     geckodriver -V 2>1 > /dev/null || NOTFOUND=1
23
     geckodriver -V 2>1 > /dev/null || NOTFOUND=1
23
     set +e
24
     set +e
35
     esac
36
     esac
36
     GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
37
     GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
37
 
38
 
38
-    if [ -z $1 ]; then
39
+    if [ -z "$1" ]; then
39
 	if [ -z "$VIRTUAL_ENV" ]; then
40
 	if [ -z "$VIRTUAL_ENV" ]; then
40
 	    echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n  $GECKODRIVER_URL"
41
 	    echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n  $GECKODRIVER_URL"
41
 	    exit    
42
 	    exit    
42
 	else
43
 	else
43
-	    GECKODRIVER_DIR=$VIRTUAL_ENV/bin
44
+	    GECKODRIVER_DIR="$VIRTUAL_ENV/bin"
44
 	fi
45
 	fi
45
     else
46
     else
46
-	GECKODRIVER_DIR=$1
47
-	mkdir -p $GECKODRIVER_DIR
47
+	GECKODRIVER_DIR="$1"
48
+	mkdir -p "$GECKODRIVER_DIR"
48
     fi
49
     fi
49
 
50
 
50
-    echo "Installing $GECKODRIVER_DIR from\n  $GECKODRIVER_URL"
51
+    echo "Installing $GECKODRIVER_DIR/geckodriver from\n  $GECKODRIVER_URL"
51
     
52
     
52
     FILE=`mktemp`
53
     FILE=`mktemp`
53
-    wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C $GECKODRIVER_DIR -f $FILE geckodriver
54
+    wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C "$GECKODRIVER_DIR" -f $FILE geckodriver
54
     rm $FILE
55
     rm $FILE
55
-    chmod 777 $GECKODRIVER_DIR/geckodriver
56
+    chmod 777 "$GECKODRIVER_DIR/geckodriver"
56
 }
57
 }
57
 
58
 
58
 pep8_check() {
59
 pep8_check() {
153
 
154
 
154
 [ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
155
 [ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
155
     && help "action not found" \
156
     && help "action not found" \
156
-    || $ACTION $2
157
+    || $ACTION "$2"