From 7994bb320f52ef9fb3643934bc94ab13356161d9 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 30 Apr 2021 17:52:32 -0400 Subject: [PATCH] Add more quotes --- tools/offline/init_caches.sh | 18 ++++++++-------- tools/offline/scripts/init_git_cache.sh | 12 +++++------ tools/offline/scripts/init_http_cache.sh | 26 ++++++++++++------------ tools/offline/scripts/init_pip_cache.sh | 6 +++--- tools/offline/scripts/use_git_cache.sh | 2 +- tools/offline/scripts/use_http_cache.sh | 6 +++--- tools/offline/scripts/use_pip_cache.sh | 2 +- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/tools/offline/init_caches.sh b/tools/offline/init_caches.sh index d856c48df0..7f14e9dcc7 100755 --- a/tools/offline/init_caches.sh +++ b/tools/offline/init_caches.sh @@ -5,7 +5,7 @@ echo "########################################################################## if [ -z "${LAMMPS_CACHING_DIR}" ] then - export LAMMPS_CACHING_DIR=$HOME/.cache/lammps + export LAMMPS_CACHING_DIR="$HOME/.cache/lammps" echo "environment variable LAMMPS_CACHING_DIR not set" echo "Using default $LAMMPS_CACHING_DIR as cache directory..." else @@ -17,7 +17,7 @@ CACHE_SCRIPTS_DIR="${SCRIPT_DIR}/scripts" if [ -z "${LAMMPS_DIR}" ] then - export LAMMPS_DIR=$(realpath $SCRIPT_DIR/../../) + export LAMMPS_DIR="$(realpath $SCRIPT_DIR/../../)" echo "environment variable LAMMPS_DIR not set" echo "Using default $LAMMPS_DIR as LAMMPS distribution base directory..." else @@ -29,14 +29,14 @@ export LOGGING_DIR="$LAMMPS_CACHING_DIR/logs" export PIP_CACHE_DIR="$LAMMPS_CACHING_DIR/pip" export HTTP_CACHE_DIR="$LAMMPS_CACHING_DIR/http" -mkdir -p $GITHUB_PROXY_DIR -mkdir -p $LOGGING_DIR -mkdir -p $PIP_CACHE_DIR -mkdir -p $HTTP_CACHE_DIR +mkdir -p "$GITHUB_PROXY_DIR" +mkdir -p "$LOGGING_DIR" +mkdir -p "$PIP_CACHE_DIR" +mkdir -p "$HTTP_CACHE_DIR" -${CACHE_SCRIPTS_DIR}/init_pip_cache.sh -${CACHE_SCRIPTS_DIR}/init_git_cache.sh -${CACHE_SCRIPTS_DIR}/init_http_cache.sh +"${CACHE_SCRIPTS_DIR}/init_pip_cache.sh" +"${CACHE_SCRIPTS_DIR}/init_git_cache.sh" +"${CACHE_SCRIPTS_DIR}/init_http_cache.sh" echo "##############################################################################" echo echo "To activate:" diff --git a/tools/offline/scripts/init_git_cache.sh b/tools/offline/scripts/init_git_cache.sh index d33c4276df..3b842fc5f5 100755 --- a/tools/offline/scripts/init_git_cache.sh +++ b/tools/offline/scripts/init_git_cache.sh @@ -6,8 +6,8 @@ then exit 1 fi -mkdir -p $GITHUB_PROXY_DIR -cd $GITHUB_PROXY_DIR +mkdir -p "$GITHUB_PROXY_DIR" +cd "$GITHUB_PROXY_DIR" PROJECTS=( akohlmey/sphinx-fortran @@ -16,8 +16,8 @@ PROJECTS=( for project in ${PROJECTS[@]} do - GH_NAMESPACE=$(dirname $project) - GH_PROJECT=$(basename $project) - mkdir -p $GH_NAMESPACE - git clone --bare https://github.com/$GH_NAMESPACE/$GH_PROJECT.git $GH_NAMESPACE/$GH_PROJECT.git + GH_NAMESPACE="$(dirname $project)" + GH_PROJECT="$(basename $project)" + mkdir -p "$GH_NAMESPACE" + git clone --bare "https://github.com/$GH_NAMESPACE/$GH_PROJECT.git" "$GH_NAMESPACE/$GH_PROJECT.git" done diff --git a/tools/offline/scripts/init_http_cache.sh b/tools/offline/scripts/init_http_cache.sh index 77f4bb184f..345ef87507 100755 --- a/tools/offline/scripts/init_http_cache.sh +++ b/tools/offline/scripts/init_http_cache.sh @@ -6,9 +6,9 @@ then exit 1 fi -mkdir -p $HTTP_CACHE_DIR -mkdir -p $HTTP_CACHE_DIR/potentials -mkdir -p $HTTP_CACHE_DIR/thirdparty +mkdir -p "$HTTP_CACHE_DIR" +mkdir -p "$HTTP_CACHE_DIR/potentials" +mkdir -p "$HTTP_CACHE_DIR/thirdparty" cd $HTTP_CACHE_DIR LAMMPS_DOWNLOADS_URL="https://download.lammps.org" @@ -27,9 +27,9 @@ POTENTIALS=( echo "Dowloading potentials..." for p in ${POTENTIALS[@]} do - if [ ! -f $HTTP_CACHE_DIR/potentials/$p ] + if [ ! -f "$HTTP_CACHE_DIR/potentials/$p" ] then - wget -O $HTTP_CACHE_DIR/potentials/$p $LAMMPS_POTENTIALS_URL/$p + wget -O "$HTTP_CACHE_DIR/potentials/$p" "$LAMMPS_POTENTIALS_URL/$p" fi done @@ -85,22 +85,22 @@ TARBALLS=( ############################################################################### # generate proxy cmake file to trick CMake to download from local HTTP server -echo "# auto-generated proxy preset file" > $HTTP_CACHE_DIR/proxy.cmake +echo "# auto-generated proxy preset file" > "$HTTP_CACHE_DIR/proxy.cmake" for t in ${TARBALLS[@]} do - FILENAME_VAR=${t/_URL/_FILENAME} - if [ -z ${!FILENAME_VAR} ] + FILENAME_VAR="${t/_URL/_FILENAME}" + if [ -z "${!FILENAME_VAR}" ] then - filename=$(basename ${!t}) + filename="$(basename ${!t})" else - filename=${!FILENAME_VAR} + filename="${!FILENAME_VAR}" fi - if [ ! -f $HTTP_CACHE_DIR/thirdparty/$filename ] + if [ ! -f "$HTTP_CACHE_DIR/thirdparty/$filename" ] then - wget -O $HTTP_CACHE_DIR/thirdparty/$filename ${!t} + wget -O "$HTTP_CACHE_DIR/thirdparty/$filename" "${!t}" fi - echo "set(${t} \"\${LAMMPS_DOWNLOADS_URL}/thirdparty/$filename\" CACHE STRING \"\" FORCE)" >> $HTTP_CACHE_DIR/proxy.cmake + echo "set(${t} \"\${LAMMPS_DOWNLOADS_URL}/thirdparty/$filename\" CACHE STRING \"\" FORCE)" >> "$HTTP_CACHE_DIR/proxy.cmake" done diff --git a/tools/offline/scripts/init_pip_cache.sh b/tools/offline/scripts/init_pip_cache.sh index 56160489cb..ca48ad63ee 100755 --- a/tools/offline/scripts/init_pip_cache.sh +++ b/tools/offline/scripts/init_pip_cache.sh @@ -14,9 +14,9 @@ fi set -x -mkdir -p $PIP_CACHE_DIR +mkdir -p "$PIP_CACHE_DIR" # download packages that might be needed -cd $PIP_CACHE_DIR +cd "$PIP_CACHE_DIR" pip3 download pip setuptools wheel -pip3 download -r $LAMMPS_DIR/doc/utils/requirements.txt +pip3 download -r "$LAMMPS_DIR/doc/utils/requirements.txt" diff --git a/tools/offline/scripts/use_git_cache.sh b/tools/offline/scripts/use_git_cache.sh index 049637725a..46e42ca7bd 100644 --- a/tools/offline/scripts/use_git_cache.sh +++ b/tools/offline/scripts/use_git_cache.sh @@ -7,7 +7,7 @@ then fi export GIT_CONFIG_COUNT=1 -export GIT_CONFIG_KEY_0=url.$GITHUB_PROXY_DIR/.insteadOf +export GIT_CONFIG_KEY_0="url.$GITHUB_PROXY_DIR/.insteadOf" export GIT_CONFIG_VALUE_0=git://github.com/ echo "Redirecting git://github.com urls to local cache..." diff --git a/tools/offline/scripts/use_http_cache.sh b/tools/offline/scripts/use_http_cache.sh index 717ab9f8b4..708e544b90 100644 --- a/tools/offline/scripts/use_http_cache.sh +++ b/tools/offline/scripts/use_http_cache.sh @@ -24,11 +24,11 @@ then exit 1 fi -python3 -m http.server $HTTP_CACHE_PORT --directory $HTTP_CACHE_DIR 2>&1 > ${LOGGING_DIR}/http.log & +python3 -m http.server $HTTP_CACHE_PORT --directory "$HTTP_CACHE_DIR" 2>&1 > "${LOGGING_DIR}/http.log" & export HTTP_CACHE_PID=$! -export HTTP_CACHE_URL=http://localhost:$HTTP_CACHE_PORT -export LAMMPS_HTTP_CACHE_CONFIG=$HTTP_CACHE_DIR/proxy.cmake +export HTTP_CACHE_URL="http://localhost:$HTTP_CACHE_PORT" +export LAMMPS_HTTP_CACHE_CONFIG="$HTTP_CACHE_DIR/proxy.cmake" echo "Running local HTTP cache server on $HTTP_CACHE_URL (pid: $HTTP_CACHE_PID)" function deactivate_http_cache { diff --git a/tools/offline/scripts/use_pip_cache.sh b/tools/offline/scripts/use_pip_cache.sh index f122aacd33..c3e3e2cb15 100644 --- a/tools/offline/scripts/use_pip_cache.sh +++ b/tools/offline/scripts/use_pip_cache.sh @@ -8,7 +8,7 @@ then fi export PIP_NO_INDEX=1 -export PIP_FIND_LINKS=$PIP_CACHE_DIR +export PIP_FIND_LINKS="$PIP_CACHE_DIR" echo "Disabling pip index and use local cache directory..."