Update the "installAndRun.sh" script:
- Add the ability to build and run the app without re-installing the PublicationsRetriever library. This is useful when trying a non-published version of that library. - Fix a wrong variable-name.
This commit is contained in:
parent
bd0d9eb36f
commit
d6ff62d2ef
|
@ -10,12 +10,16 @@ handle_error () {
|
||||||
# Change the working directory to the script's directory, when running from another location.
|
# Change the working directory to the script's directory, when running from another location.
|
||||||
cd "${0%/*}" || handle_error "Could not change-dir to this script's dir!" 1
|
cd "${0%/*}" || handle_error "Could not change-dir to this script's dir!" 1
|
||||||
|
|
||||||
justInstall=0
|
justRun=0
|
||||||
|
avoidReInstallingPublicationsRetriever=0
|
||||||
|
|
||||||
if [[ $# -eq 1 ]]; then
|
if [[ $# -eq 1 ]]; then
|
||||||
justInstall=$1
|
justRun=$1
|
||||||
elif [[ $# -gt 1 ]]; then
|
elif [[ $# -eq 2 ]]; then
|
||||||
echo -e "Wrong number of arguments given: ${#}\nPlease execute it like: script.sh <justInstall: 0 | 1>"; exit 2
|
justRun=$1
|
||||||
|
avoidReInstallingPublicationsRetriever=$2
|
||||||
|
elif [[ $# -gt 2 ]]; then
|
||||||
|
echo -e "Wrong number of arguments given: ${#} (more than 2)\nPlease execute it like: script.sh <justRun: 0 | 1> <avoidReInstallingPublicationsRetriever: 0 | 1>"; exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check of the "inputData.txt" file exist, if not, ask to fill it.
|
# Check of the "inputData.txt" file exist, if not, ask to fill it.
|
||||||
|
@ -46,31 +50,39 @@ fi
|
||||||
|
|
||||||
gradleVersion="7.6"
|
gradleVersion="7.6"
|
||||||
|
|
||||||
if [[ justInstall -eq 0 ]]; then
|
if [[ justRun -eq 0 ]]; then
|
||||||
|
|
||||||
if [ ! -d libs ]; then
|
if [[ avoidReInstallingPublicationsRetriever -eq 1 ]]; then
|
||||||
mkdir libs || handle_error "The directory \"libs\" could not be created! Exiting.." 3
|
if [[ ! -f ./libs/publications_retriever-1.0-SNAPSHOT.jar ]]; then
|
||||||
|
avoidReInstallingPublicationsRetriever=0; # In case the jar-file does not exists, then make sure we follow the normal procedure, independently from what the user requested.
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd libs || exit 4
|
if [[ avoidReInstallingPublicationsRetriever -eq 0 ]]; then
|
||||||
git clone https://github.com/LSmyrnaios/PublicationsRetriever.git # We assume there is no previously source-code here, if so, it will be overwritten.
|
|
||||||
|
|
||||||
# Keep a backup of the previous JAR file, if it exists.
|
if [ ! -d libs ]; then
|
||||||
if [ -f ./publications_retriever-1.0-SNAPSHOT.jar ]; then
|
mkdir libs || handle_error "The directory \"libs\" could not be created! Exiting.." 3
|
||||||
mv ./publications_retriever-1.0-SNAPSHOT.jar ./publications_retriever-1.0-SNAPSHOT_BACKUP.jar
|
fi
|
||||||
|
cd libs || exit 4
|
||||||
|
git clone https://github.com/LSmyrnaios/PublicationsRetriever.git # We assume there is no previously source-code here, if so, it will be overwritten.
|
||||||
|
|
||||||
|
# Keep a backup of the previous JAR file, if it exists.
|
||||||
|
if [ -f ./publications_retriever-1.0-SNAPSHOT.jar ]; then
|
||||||
|
mv ./publications_retriever-1.0-SNAPSHOT.jar ./publications_retriever-1.0-SNAPSHOT_BACKUP.jar
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd PublicationsRetriever && sudo apt install -y maven && mvn clean install
|
||||||
|
|
||||||
|
# Copy the created JAR file to the top libs directory.
|
||||||
|
cp target/publications_retriever-1.0-SNAPSHOT.jar ../publications_retriever-1.0-SNAPSHOT.jar
|
||||||
|
|
||||||
|
# Delete the directory with the source-code.
|
||||||
|
cd ../ && rm -rf PublicationsRetriever
|
||||||
|
|
||||||
|
# Clean, (re)build and run the project.
|
||||||
|
cd ../
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd PublicationsRetriever && sudo apt install -y maven && mvn clean install
|
|
||||||
|
|
||||||
# Copy the created JAR file to the top libs directory.
|
|
||||||
cp target/publications_retriever-1.0-SNAPSHOT.jar ../publications_retriever-1.0-SNAPSHOT.jar
|
|
||||||
|
|
||||||
# Delete the directory with the source-code.
|
|
||||||
cd ../ && rm -rf PublicationsRetriever
|
|
||||||
|
|
||||||
# Clean, (re)build and run the project.
|
|
||||||
cd ../
|
|
||||||
|
|
||||||
if [[ ! -d /opt/gradle/gradle-${gradleVersion} ]]; then
|
if [[ ! -d /opt/gradle/gradle-${gradleVersion} ]]; then
|
||||||
wget https://services.gradle.org/distributions/gradle-${gradleVersion}-bin.zip
|
wget https://services.gradle.org/distributions/gradle-${gradleVersion}-bin.zip
|
||||||
echo -e "\nAsking for sudo, in order to install 'gradle'..\n"
|
echo -e "\nAsking for sudo, in order to install 'gradle'..\n"
|
||||||
|
|
Loading…
Reference in New Issue