Skip to content

Commit 30e05b5

Browse files
committed
Standardize downloads with a shared script
1 parent b84b83e commit 30e05b5

File tree

6 files changed

+130
-106
lines changed

6 files changed

+130
-106
lines changed

scripts/SCRIPTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Script | Directory | Description
88
| [analyze.sh](./analysis/analyze.sh) | analysis | Coordinates the end-to-end analysis process, encompassing tool installation, graph generation, and report generation. |
99
| [copyReportsIntoResults.sh](./copyReportsIntoResults.sh) | | Copies the results from the temp directory to the results directory grouped by the analysis name. |
1010
| [detectChangedArtifacts.sh](./detectChangedArtifacts.sh) | | Detect changed files in the artifacts directory with a text file containing the last hash code of the contents. |
11+
| [download.sh](./download.sh) | | Downloads a file into the directory of the environment variable SHARED_DOWNLOADS_DIRECTORY (or default "../downloads"). |
1112
| [downloadMavenArtifact.sh](./downloadMavenArtifact.sh) | | Downloads an artifact from Maven Central (https://mvnrepository.com/repos/central) |
1213
| [downloadAxonFramework.sh](./downloader/downloadAxonFramework.sh) | downloader | Downloads AxonFramework (https://developer.axoniq.io/axon-framework) artifacts from Maven Central. |
1314
| [analyzeAxonFramework.sh](./examples/analyzeAxonFramework.sh) | examples | This is an example for an analysis of AxonFramework |

scripts/download.sh

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/usr/bin/env bash
2+
3+
# Downloads a file into the directory of the environment variable SHARED_DOWNLOADS_DIRECTORY (or default "../downloads").
4+
# Does nothing if the file already exists.
5+
6+
# Command line options:
7+
# --url Download URL (required)
8+
# --filename Target file name with extension without path (optional, default = basename of download URL)
9+
10+
# Function to display script usage
11+
usage() {
12+
echo "Usage: $0 --url https://my.download.url [--filename download-file-name-without-path.ext> (default=url filename)]"
13+
exit 1
14+
}
15+
16+
# Default values
17+
downloadUrl=""
18+
filename=""
19+
20+
# Parse command line arguments
21+
while [[ $# -gt 0 ]]; do
22+
key="$1"
23+
case $key in
24+
--url)
25+
downloadUrl="$2"
26+
shift
27+
;;
28+
--filename)
29+
filename="$2"
30+
shift
31+
;;
32+
*)
33+
echo "download: Error: Unknown option: ${key}"
34+
usage
35+
;;
36+
esac
37+
shift
38+
done
39+
40+
if [[ -z ${downloadUrl} ]]; then
41+
echo "${USAGE}"
42+
exit 1
43+
fi
44+
45+
if ! curl --head --fail ${downloadUrl} >/dev/null 2>&1; then
46+
echo "download: Error: Invalid URL: ${downloadUrl}"
47+
exit 1
48+
fi
49+
50+
if [[ -z ${filename} ]]; then
51+
filename=$(basename -- "${downloadUrl}")
52+
fi
53+
54+
# Get shared download directory and create it if it doesn't exist
55+
SHARED_DOWNLOADS_DIRECTORY="${SHARED_DOWNLOADS_DIRECTORY:-$(dirname "$( pwd )")/downloads}"
56+
if [ ! -d "${SHARED_DOWNLOADS_DIRECTORY}" ] ; then
57+
echo "download: Creating shared downloads directory ${SHARED_DOWNLOADS_DIRECTORY}"
58+
mkdir -p ${SHARED_DOWNLOADS_DIRECTORY}
59+
fi
60+
61+
# Download the file if it doesn't exist in the shared downloads directory
62+
if [ ! -f "${SHARED_DOWNLOADS_DIRECTORY}/${filename}" ] ; then
63+
echo "download: Downloading ${filename} from ${downloadUrl} into ${SHARED_DOWNLOADS_DIRECTORY}"
64+
65+
# Download the file
66+
if ! curl -L --fail-with-body -o "${SHARED_DOWNLOADS_DIRECTORY}/${filename}" "${downloadUrl}"; then
67+
echo "download: Error: Failed to download ${filename}"
68+
rm -f "${SHARED_DOWNLOADS_DIRECTORY}/${filename}"
69+
exit 1
70+
fi
71+
else
72+
echo "download: ${filename} already downloaded"
73+
fi
74+
75+
# Check downloaded file size to be at least 600 bytes or otherwise delete the invalid file
76+
downloaded_file_size=$(wc -c "${SHARED_DOWNLOADS_DIRECTORY}/${filename}" | awk '{print $1}')
77+
if [[ "${downloaded_file_size}" -le 600 ]]; then
78+
echo "download: Error: Failed to download ${filename}: Filesize: ${downloaded_file_size} < 600 bytes"
79+
rm -f "${SHARED_DOWNLOADS_DIRECTORY}/${filename}"
80+
exit 1
81+
fi
82+
83+
# Fail if download failed
84+
if [ ! -f "${SHARED_DOWNLOADS_DIRECTORY}/${filename}" ] ; then
85+
echo "download: Error: Failed to download ${filename}"
86+
exit 1
87+
fi

scripts/downloadMavenArtifact.sh

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
# -t Maven Artifact Type (defaults to jar)
99
# -d Target directory for the downloaded file
1010

11+
# Requires download.sh
12+
1113
# Overrideable constants
1214
ARTIFACTS_DIRECTORY=${ARTIFACTS_DIRECTORY:-"artifacts"}
15+
SHARED_DOWNLOADS_DIRECTORY="${SHARED_DOWNLOADS_DIRECTORY:-$(dirname "$( pwd )")/downloads}"
1316

1417
# Default and initial values for command line options
1518
groupId=""
@@ -50,6 +53,12 @@ if [[ -z ${groupId} || -z ${artifactId} || -z ${version} || -z ${artifactType} |
5053
exit 1
5154
fi
5255

56+
## Get this "scripts" directory if not already set
57+
# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution.
58+
# CDPATH reduces the scope of the cd command to potentially prevent unintended directory changes.
59+
# This way non-standard tools like readlink aren't needed.
60+
SCRIPTS_DIR=${SCRIPTS_DIR:-$( CDPATH=. cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P )}
61+
5362
# Internal constants
5463
BASE_URL="https://repo1.maven.org/maven2"
5564
ARTIFACT_FILENAME="${artifactId}-${version}.${artifactType}"
@@ -58,31 +67,16 @@ DOWNLOAD_URL="${BASE_URL}/${GROUP_ID_FOR_API}/${artifactId}/${version}/${ARTIFAC
5867

5968
# Download Maven Artifact into the "targetDirectory"
6069
if [ ! -f "./${targetDirectory}/${ARTIFACT_FILENAME}" ] ; then
61-
echo "downloadMavenArtifact: Downloading ${DOWNLOAD_URL} into target directory ${targetDirectory}"
62-
63-
# Download Maven Artifact
64-
if ! curl -L --fail-with-body -O "${DOWNLOAD_URL}"; then
65-
echo "downloadMavenArtifact: Error: Failed to download ${ARTIFACT_FILENAME}"
66-
rm -f "${ARTIFACT_FILENAME}"
67-
exit 1
68-
fi
69-
70-
# Check downloaded file size to be at least 100 bytes
71-
downloaded_file_size=$(wc -c "${ARTIFACT_FILENAME}" | awk '{print $1}')
72-
if [[ "${downloaded_file_size}" -le 600 ]]; then
73-
echo "downloadMavenArtifact: Error: Failed to download ${ARTIFACT_FILENAME}: Invalid Filesize: ${downloaded_file_size} bytes"
74-
rm -f "${ARTIFACT_FILENAME}"
75-
exit 1
76-
fi
70+
source ${SCRIPTS_DIR}/download.sh --url "${DOWNLOAD_URL}" || exit 1
7771

7872
# Create artifacts targetDirectory if it doen't exist
7973
mkdir -p "./${targetDirectory}" || exit 1
8074

8175
# Delete already existing older versions of the artifact
8276
rm -f "./${targetDirectory}/${artifactId}"* || exit 1
8377

84-
# Move artifact to artifacts targetDirectory
85-
mv "${ARTIFACT_FILENAME}" "./${targetDirectory}" || exit 1
78+
# Copy artifact into artifacts targetDirectory
79+
cp -R "${SHARED_DOWNLOADS_DIRECTORY}/${ARTIFACT_FILENAME}" "./${targetDirectory}" || exit 1
8680
else
8781
echo "downloadMavenArtifact: ${ARTIFACT_FILENAME} already downloaded into target directory ${targetDirectory}"
8882
fi

scripts/downloader/downloadAxonFramework.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ echo "download${ANALYSIS_NAME}: ARTIFACTS_VERSION=${ARTIFACTS_VERSION}"
3030
# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution.
3131
# CDPATH reduces the scope of the cd command to potentially prevent unintended directory changes.
3232
# This way non-standard tools like readlink aren't needed.
33-
ANALYSIS_SCRIPT_DIR=${ANALYSIS_SCRIPT_DIR:-$( CDPATH=. cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P )}
34-
echo "download${ANALYSIS_NAME}: ANALYSIS_SCRIPT_DIR=${ANALYSIS_SCRIPT_DIR}"
33+
DOWNLOADER_SCRIPTS_DIR=${DOWNLOADER_SCRIPTS_DIR:-$( CDPATH=. cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P )}
34+
echo "download${ANALYSIS_NAME}: DOWNLOADER_SCRIPTS_DIR=${DOWNLOADER_SCRIPTS_DIR}"
3535

3636
# Get the "scripts" directory by taking the path of this script and going one directory up.
37-
SCRIPTS_DIR=${SCRIPTS_DIR:-$(dirname -- "${ANALYSIS_SCRIPT_DIR}")}
37+
SCRIPTS_DIR=${SCRIPTS_DIR:-$(dirname -- "${DOWNLOADER_SCRIPTS_DIR}")}
3838
echo "download${ANALYSIS_NAME}: SCRIPTS_DIR=${SCRIPTS_DIR}"
3939

4040
################################################################

scripts/setupJQAssistant.sh

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
# Installs (download and unzip) jQAssistant (https://jqassistant.org/get-started).
44

5-
# Be aware that this script runs in the current directory.
6-
# If you want JQassistant to be installed in the "tools" directory, then create and change it beforehand.
5+
# Requires download.sh
6+
7+
# Note: This script runs in the current directory. If you want JQassistant to be installed in e.a. the "tools" directory,
8+
# then create and change it beforehand.
79

810
JQASSISTANT_CLI_VERSION=${JQASSISTANT_CLI_VERSION:-"2.0.4"} # Neo4j v5: 2.0.3 (june 2023), Neo4j v4: 1.12.2 (april 2023)
911
JQASSISTANT_CLI_DOWNLOAD_URL=${JQASSISTANT_CLI_DOWNLOAD_URL:-"https://repo1.maven.org/maven2/com/buschmais/jqassistant/cli"}
@@ -12,14 +14,21 @@ JQASSISTANT_CLI_DISTRIBUTION=${JQASSISTANT_CLI_DISTRIBUTION:-"bin.zip"} # Neo4j
1214
TOOLS_DIRECTORY=${TOOLS_DIRECTORY:-"tools"} # Get the tools directory (defaults to "tools")
1315
SHARED_DOWNLOADS_DIRECTORY="${SHARED_DOWNLOADS_DIRECTORY:-$(dirname "$( pwd )")/downloads}"
1416

17+
## Get this "scripts" directory if not already set
18+
# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution.
19+
# CDPATH reduces the scope of the cd command to potentially prevent unintended directory changes.
20+
# This way non-standard tools like readlink aren't needed.
21+
SCRIPTS_DIR=${SCRIPTS_DIR:-$( CDPATH=. cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P )}
22+
echo "setupJQAssistant: SCRIPTS_DIR=$SCRIPTS_DIR"
23+
1524
# Check if TOOLS_DIRECTORY variable is set
1625
if [ -z "${TOOLS_DIRECTORY}" ]; then
1726
echo "setupJQAssistant: Error: Requires variable TOOLS_DIRECTORY to be set. If it is the current directory, then use a dot to reflect that."
1827
exit 1
1928
else
2029
# Create tools directory if it doesn't exists
2130
echo "setupJQAssistant: Creating tools directory <${TOOLS_DIRECTORY}> if neccessary"
22-
mkdir -p "${TOOLS_DIRECTORY}"
31+
mkdir -p "${TOOLS_DIRECTORY}" || exit 1
2332
fi
2433

2534
# Check if SHARED_DOWNLOADS_DIRECTORY variable is set
@@ -37,29 +46,13 @@ JQASSISTANT_INSTALLATION_NAME="${JQASSISTANT_CLI_ARTIFACT}-${JQASSISTANT_CLI_VER
3746
JQASSISTANT_INSTALLATION_DIRECTORY="${TOOLS_DIRECTORY}/${JQASSISTANT_INSTALLATION_NAME}"
3847

3948
# Download and unpack jQAssistant
40-
if [ ! -d "${JQASSISTANT_INSTALLATION_DIRECTORY}" ] ; then
41-
42-
# Download jQAssistant
43-
if [ ! -f "${SHARED_DOWNLOADS_DIRECTORY}/${JQASSISTANT_INSTALLATION_NAME}.zip" ] ; then
44-
jqassistant_cli_fulldownload_url=${JQASSISTANT_CLI_DOWNLOAD_URL}/${JQASSISTANT_CLI_ARTIFACT}/${JQASSISTANT_CLI_VERSION}/${JQASSISTANT_CLI_ARTIFACT}-${JQASSISTANT_CLI_VERSION}-${JQASSISTANT_CLI_DISTRIBUTION}
45-
echo "setupJQAssistant: Downloading ${JQASSISTANT_INSTALLATION_NAME}.zip from ${jqassistant_cli_fulldownload_url}"
46-
47-
# Download jQAssistant
48-
# With the option "-L" a redirection will be followed automatically
49-
curl -L --fail-with-body -o "${SHARED_DOWNLOADS_DIRECTORY}/${JQASSISTANT_INSTALLATION_NAME}.zip" "${jqassistant_cli_fulldownload_url}"
50-
else
51-
echo "setupJQAssistant: ${JQASSISTANT_INSTALLATION_NAME} already downloaded"
52-
fi
53-
54-
downloaded_file_size=$(wc -c "${SHARED_DOWNLOADS_DIRECTORY}/${JQASSISTANT_INSTALLATION_NAME}.zip" | awk '{print $1}')
55-
if [[ "${downloaded_file_size}" -le 1000 ]]; then
56-
echo "setupJQAssistant: Error: Failed to download ${JQASSISTANT_INSTALLATION_NAME}. Invalid Filesize"
57-
rm -f "${SHARED_DOWNLOADS_DIRECTORY}/${JQASSISTANT_INSTALLATION_NAME}.zip"
58-
exit 1
59-
fi
49+
if [ ! -d "${JQASSISTANT_INSTALLATION_DIRECTORY}" ] ; then
50+
jqassistant_cli_fulldownload_url=${JQASSISTANT_CLI_DOWNLOAD_URL}/${JQASSISTANT_CLI_ARTIFACT}/${JQASSISTANT_CLI_VERSION}/${JQASSISTANT_CLI_ARTIFACT}-${JQASSISTANT_CLI_VERSION}-${JQASSISTANT_CLI_DISTRIBUTION}
51+
jqassistant_cli_fulldownload_file="${JQASSISTANT_INSTALLATION_NAME}.zip"
52+
source ${SCRIPTS_DIR}/download.sh --url "${jqassistant_cli_fulldownload_url}" --filename "${jqassistant_cli_fulldownload_file}" || exit 2
6053

6154
# Unpack the ZIP file (-q option for less verbose output)
62-
unzip -q "${SHARED_DOWNLOADS_DIRECTORY}/${JQASSISTANT_INSTALLATION_NAME}.zip" -d "${TOOLS_DIRECTORY}"
55+
unzip -q "${SHARED_DOWNLOADS_DIRECTORY}/${jqassistant_cli_fulldownload_file}" -d "${TOOLS_DIRECTORY}" || exit 3
6356
else
64-
echo "setupJQAssistant: ${JQASSISTANT_INSTALLATION_NAME}.zip already installed"
57+
echo "setupJQAssistant: ${jqassistant_cli_fulldownload_file} already installed"
6558
fi

scripts/setupNeo4j.sh

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,11 @@ fi
6565
# Download and extract Neo4j
6666
if [ ! -d "${NEO4J_INSTALLATION_DIRECTORY}" ] ; then
6767

68-
# Download Neo4j
69-
if [ ! -f "${SHARED_DOWNLOADS_DIRECTORY}/${NEO4J_INSTALLATION_NAME}-unix.tar.gz" ] ; then
70-
echo "setupNeo4j: Downloading ${NEO4J_INSTALLATION_NAME}"
71-
72-
# Download Neo4j
73-
# With the option "-L" a redirection will be followed automatically
74-
curl -L --fail-with-body -o "${SHARED_DOWNLOADS_DIRECTORY}/${NEO4J_INSTALLATION_NAME}-unix.tar.gz" "https://dist.neo4j.org/${NEO4J_INSTALLATION_NAME}-unix.tar.gz" || exit 1
75-
else
76-
echo "setupNeo4j: ${NEO4J_INSTALLATION_NAME} already downloaded"
77-
fi
78-
79-
downloaded_neo4j_archive="${SHARED_DOWNLOADS_DIRECTORY}/${NEO4J_INSTALLATION_NAME}-unix.tar.gz"
80-
81-
# Check downloaded file size to be at least 100 bytes
82-
downloaded_file_size=$(wc -c "${downloaded_neo4j_archive}" | awk '{print $1}')
83-
if [[ "$downloaded_file_size" -le 100 ]]; then
84-
echo "setupNeo4j: Error: Failed to download ${NEO4J_INSTALLATION_NAME}: Invalid Filesize."
85-
rm -f "${downloaded_neo4j_archive}"
86-
exit 1
87-
fi
68+
neo4jDownloadArchiveFileName="${NEO4J_INSTALLATION_NAME}-unix.tar.gz"
69+
source ${SCRIPTS_DIR}/download.sh --url "https://dist.neo4j.org/${neo4jDownloadArchiveFileName}" || exit 1
8870

8971
# Extract the tar file
90-
tar -xf "${downloaded_neo4j_archive}" --directory "${TOOLS_DIRECTORY}"
72+
tar -xf "${SHARED_DOWNLOADS_DIRECTORY}/${neo4jDownloadArchiveFileName}" --directory "${TOOLS_DIRECTORY}" || exit 1
9173

9274
# Fail if Neo4j hadn't been downloaded successfully
9375
if [ ! -d "${NEO4J_INSTALLATION_DIRECTORY}" ] ; then
@@ -156,22 +138,7 @@ fi
156138
# Download and Install the Neo4j Plugin "Awesome Procedures for Neo4j" (APOC)
157139
if [ ! -f "${NEO4J_PLUGINS}/${NEO4J_APOC_PLUGIN_ARTIFACT}" ] ; then
158140

159-
# Download the Neo4j Plugin "Awesome Procedures for Neo4j"
160-
if [ ! -f "${SHARED_DOWNLOADS_DIRECTORY}/${NEO4J_APOC_PLUGIN_ARTIFACT}" ] ; then
161-
# Download the Neo4j Plugin "Awesome Procedures for Neo4j"
162-
echo "setupNeo4j: Downloading ${NEO4J_APOC_PLUGIN_ARTIFACT}"
163-
curl -L --fail-with-body -o "${SHARED_DOWNLOADS_DIRECTORY}/${NEO4J_APOC_PLUGIN_ARTIFACT}" https://github.com/${NEO4J_APOC_PLUGIN_GITHUB}/releases/download/${NEO4J_APOC_PLUGIN_VERSION}/apoc-${NEO4J_APOC_PLUGIN_VERSION}-${NEO4J_APOC_PLUGIN_EDITION}.jar || exit 1
164-
else
165-
echo "setupNeo4j: ${NEO4J_APOC_PLUGIN_ARTIFACT} already downloaded"
166-
fi
167-
168-
# Check downloaded file size to be at least 100 bytes
169-
downloaded_file_size=$(wc -c "${SHARED_DOWNLOADS_DIRECTORY}/${NEO4J_APOC_PLUGIN_ARTIFACT}" | awk '{print $1}')
170-
if [[ "$downloaded_file_size" -le 100 ]]; then
171-
echo "setupNeo4j: Error: Failed to download ${NEO4J_APOC_PLUGIN_ARTIFACT}: Invalid Filesize."
172-
rm -f "${SHARED_DOWNLOADS_DIRECTORY}/${NEO4J_APOC_PLUGIN_ARTIFACT}"
173-
exit 1
174-
fi
141+
source ${SCRIPTS_DIR}/download.sh --url "https://github.com/${NEO4J_APOC_PLUGIN_GITHUB}/releases/download/${NEO4J_APOC_PLUGIN_VERSION}/${NEO4J_APOC_PLUGIN_ARTIFACT}" || exit 1
175142

176143
# Uninstall previously installed Neo4j Plugin "Awesome Procedures for Neo4j" (APOC)
177144
rm -f "${NEO4J_PLUGINS}/apoc*.jar"
@@ -182,7 +149,7 @@ if [ ! -f "${NEO4J_PLUGINS}/${NEO4J_APOC_PLUGIN_ARTIFACT}" ] ; then
182149

183150
# Fail if Neo4j Plugin "Awesome Procedures for Neo4j" (APOC) hadn't been downloaded successfully
184151
if [ ! -f "${NEO4J_PLUGINS}/${NEO4J_APOC_PLUGIN_ARTIFACT}" ] ; then
185-
echo "setupNeo4j: Error: Failed to download and install ${NEO4J_APOC_PLUGIN_ARTIFACT}"
152+
echo "setupNeo4j: Error: Failed to install ${NEO4J_APOC_PLUGIN_ARTIFACT}"
186153
exit 1
187154
fi
188155

@@ -207,36 +174,18 @@ if [[ ${NEO4J_GDS_PLUGIN_EDITION} == "open" ]]; then
207174
else
208175
neo4jGraphDataScienceNeo4jVersion="4.4.23"
209176
fi
210-
neo4jGraphDataScienceReleaseArtifactPrefix="open-graph-data-science"
211-
neo4jGraphDataScienceReleaseArtifact="${neo4jGraphDataScienceReleaseArtifactPrefix}-${NEO4J_GDS_PLUGIN_VERSION}-for-neo4j-${neo4jGraphDataScienceNeo4jVersion}.jar"
177+
neo4jGraphDataScienceReleaseArtifact="open-graph-data-science-${NEO4J_GDS_PLUGIN_VERSION}-for-neo4j-${neo4jGraphDataScienceNeo4jVersion}.jar"
212178
else
213179
neo4jGraphDataScienceDownloadUrl="https://github.com/neo4j/graph-data-science/releases/download/${NEO4J_GDS_PLUGIN_VERSION}"
214-
neo4jGraphDataScienceReleaseArtifactPrefix="neo4j-graph-data-science"
215-
neo4jGraphDataScienceReleaseArtifact="${neo4jGraphDataScienceReleaseArtifactPrefix}-${NEO4J_GDS_PLUGIN_VERSION}-${NEO4J_GDS_PLUGIN_EDITION}.jar"
180+
neo4jGraphDataScienceReleaseArtifact="neo4j-graph-data-science-${NEO4J_GDS_PLUGIN_VERSION}-${NEO4J_GDS_PLUGIN_EDITION}.jar"
216181
fi
217182

218183
if [ ! -f "${NEO4J_PLUGINS}/${neo4jGraphDataScienceReleaseArtifact}" ] ; then
219184
# Download the Neo4j Plugin "Graph Data Science" (GDS)
220-
#source ${SCRIPTS_DIR}/download.sh --url "${neo4jGraphDataScienceDownloadUrl}/${neo4jGraphDataScienceReleaseArtifact}"
221-
222-
# Download the Neo4j Plugin "Graph Data Science" (GDS)
223-
if [ ! -f "${SHARED_DOWNLOADS_DIRECTORY}/${neo4jGraphDataScienceReleaseArtifact}" ] ; then
224-
echo "setupNeo4j: Downloading ${neo4jGraphDataScienceReleaseArtifact} from ${neo4jGraphDataScienceDownloadUrl}/${neo4jGraphDataScienceReleaseArtifact}"
225-
curl -L --fail-with-body -o "${SHARED_DOWNLOADS_DIRECTORY}/${neo4jGraphDataScienceReleaseArtifact}" ${neo4jGraphDataScienceDownloadUrl}/${neo4jGraphDataScienceReleaseArtifact} || exit 1
226-
else
227-
echo "setupNeo4j: ${neo4jGraphDataScienceReleaseArtifact} already downloaded"
228-
fi
229-
230-
# Check downloaded file size to be at least 100 bytes
231-
downloaded_file_size=$(wc -c "${SHARED_DOWNLOADS_DIRECTORY}/${neo4jGraphDataScienceReleaseArtifact}" | awk '{print $1}')
232-
if [[ "$downloaded_file_size" -le 100 ]]; then
233-
echo "setupNeo4j: Error: Failed to download ${neo4jGraphDataScienceReleaseArtifact}. Invalid Filesize."
234-
rm -f "${SHARED_DOWNLOADS_DIRECTORY}/${neo4jGraphDataScienceReleaseArtifact}"
235-
exit 1
236-
fi
185+
source ${SCRIPTS_DIR}/download.sh --url "${neo4jGraphDataScienceDownloadUrl}/${neo4jGraphDataScienceReleaseArtifact}" || exit 1
237186

238187
# Uninstall previously installed Neo4j Plugin "Graph Data Science" (GDS)
239-
rm -f "${NEO4J_PLUGINS}/${neo4jGraphDataScienceReleaseArtifactPrefix}*.jar"
188+
rm -f "${NEO4J_PLUGINS}/*graph-data-science*.jar"
240189

241190
# Install the Neo4j Plugin "Graph Data Science" (GDS)
242191
echo "setupNeo4j: Installing ${neo4jGraphDataScienceReleaseArtifact}"

0 commit comments

Comments
 (0)