Bläddra i källkod

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

Alexandre Flament 7 år sedan
förälder
incheckning
1a814369fd
1 ändrade filer med 10 tillägg och 9 borttagningar
  1. 10
    9
      manage.sh

+ 10
- 9
manage.sh Visa fil

@@ -5,7 +5,7 @@ PYTHONPATH=$BASE_DIR
5 5
 SEARX_DIR="$BASE_DIR/searx"
6 6
 ACTION=$1
7 7
 
8
-cd $BASE_DIR
8
+cd "$BASE_DIR"
9 9
 
10 10
 update_packages() {
11 11
     pip install -r "$BASE_DIR/requirements.txt"
@@ -18,6 +18,7 @@ update_dev_packages() {
18 18
 
19 19
 install_geckodriver() {
20 20
     echo '[!] Checking geckodriver'
21
+    # TODO : check the current geckodriver version
21 22
     set -e
22 23
     geckodriver -V 2>1 > /dev/null || NOTFOUND=1
23 24
     set +e
@@ -35,24 +36,24 @@ install_geckodriver() {
35 36
     esac
36 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 40
 	if [ -z "$VIRTUAL_ENV" ]; then
40 41
 	    echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n  $GECKODRIVER_URL"
41 42
 	    exit    
42 43
 	else
43
-	    GECKODRIVER_DIR=$VIRTUAL_ENV/bin
44
+	    GECKODRIVER_DIR="$VIRTUAL_ENV/bin"
44 45
 	fi
45 46
     else
46
-	GECKODRIVER_DIR=$1
47
-	mkdir -p $GECKODRIVER_DIR
47
+	GECKODRIVER_DIR="$1"
48
+	mkdir -p "$GECKODRIVER_DIR"
48 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 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 55
     rm $FILE
55
-    chmod 777 $GECKODRIVER_DIR/geckodriver
56
+    chmod 777 "$GECKODRIVER_DIR/geckodriver"
56 57
 }
57 58
 
58 59
 pep8_check() {
@@ -153,4 +154,4 @@ Commands
153 154
 
154 155
 [ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
155 156
     && help "action not found" \
156
-    || $ACTION $2
157
+    || $ACTION "$2"