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

This commit is contained in:
Alexandre Flament 2017-08-16 18:14:07 +02:00
parent d87eb4da61
commit 1a814369fd

View file

@ -5,7 +5,7 @@ PYTHONPATH=$BASE_DIR
SEARX_DIR="$BASE_DIR/searx" SEARX_DIR="$BASE_DIR/searx"
ACTION=$1 ACTION=$1
cd $BASE_DIR cd "$BASE_DIR"
update_packages() { update_packages() {
pip install -r "$BASE_DIR/requirements.txt" pip install -r "$BASE_DIR/requirements.txt"
@ -18,6 +18,7 @@ update_dev_packages() {
install_geckodriver() { install_geckodriver() {
echo '[!] Checking geckodriver' echo '[!] Checking geckodriver'
# TODO : check the current geckodriver version
set -e set -e
geckodriver -V 2>1 > /dev/null || NOTFOUND=1 geckodriver -V 2>1 > /dev/null || NOTFOUND=1
set +e set +e
@ -35,24 +36,24 @@ install_geckodriver() {
esac esac
GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz"; GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
if [ -z $1 ]; then if [ -z "$1" ]; then
if [ -z "$VIRTUAL_ENV" ]; 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" echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n $GECKODRIVER_URL"
exit exit
else else
GECKODRIVER_DIR=$VIRTUAL_ENV/bin GECKODRIVER_DIR="$VIRTUAL_ENV/bin"
fi fi
else else
GECKODRIVER_DIR=$1 GECKODRIVER_DIR="$1"
mkdir -p $GECKODRIVER_DIR mkdir -p "$GECKODRIVER_DIR"
fi fi
echo "Installing $GECKODRIVER_DIR from\n $GECKODRIVER_URL" echo "Installing $GECKODRIVER_DIR/geckodriver from\n $GECKODRIVER_URL"
FILE=`mktemp` FILE=`mktemp`
wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C $GECKODRIVER_DIR -f $FILE geckodriver wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C "$GECKODRIVER_DIR" -f $FILE geckodriver
rm $FILE rm $FILE
chmod 777 $GECKODRIVER_DIR/geckodriver chmod 777 "$GECKODRIVER_DIR/geckodriver"
} }
pep8_check() { pep8_check() {
@ -153,4 +154,4 @@ Commands
[ "$(command -V "$ACTION" | grep ' function$')" = "" ] \ [ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
&& help "action not found" \ && help "action not found" \
|| $ACTION $2 || $ACTION "$2"