-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetToolVersion.sh
More file actions
executable file
·111 lines (99 loc) · 2.9 KB
/
setToolVersion.sh
File metadata and controls
executable file
·111 lines (99 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh
#
# Organization: MDIBL
# Author: Lucie Hutchins
# Date: March 2018
#
# A script that sets the tool's release version
# in the tool's current_release_number file to the value specified by the user
#
# What it does:
# 1) Create a directory for this tool if not exists under EXTERNAL_SOFTWARE_BASE
# 2) sets the current release number to the specified value
#
# Usage: ./setToolVersion.sh <tool_name> <version>
#
# This is run on demand
#
cd `dirname $0`
SCRIPT_NAME=`basename $0`
WORKING_DIR=`pwd`
GLOBAL_CONFIG=Configuration
function displayTools() {
echo ""
echo " List of available tools"
echo "---------------------------"
tools="`ls`"
for tool in ${tools}
do
[ -d ${tool} ] && echo " ${tool}"
done
echo ""
}
echo ""
date | tee -a ${LOG_FILE}
echo "
***************************************
BIOCORE PACKAGE INSTALL AUTOMATION
***************************************
"
## Validate usage
if [ $# -lt 2 ]
then
echo "Usage: ./${SCRIPT_NAME} tool_name tool_version"
echo "example: ./${SCRIPT_NAME} trimmomatic 0.36"
displayTools
exit 1
fi
TOOL_NAME=$1
RELEASE_NUMBER=$2
if [ ! -d ${TOOL_NAME} ]
then
echo "ERROR: No automation found for ${TOOL_NAME}"
echo "Check the spelling or the case sensitive"
displayTools
exit 1
fi
if [ ! -f ${GLOBAL_CONFIG} ]
then
echo "ERROR: ${GLOBAL_CONFIG} file missing under:${WORKING_DIR}"
echo "Make sure you run the ./setup.sh script first under:${WORKING_DIR}"
exit 1
fi
source ./${GLOBAL_CONFIG}
LOG_FILE="${DOWNLOADS_LOG_DIR}/${SCRIPT_NAME}.${TOOL_NAME}.log"
rm -rf ${LOG_FILE}
touch ${LOG_FILE}
## Path relative to this package install base
PACKAGE_DOWNLOADS_BASE=${EXTERNAL_SOFTWARE_BASE}/${TOOL_NAME}
[ ! -d ${PACKAGE_DOWNLOADS_BASE} ] && mkdir -p ${PACKAGE_DOWNLOADS_BASE}
RELEASE_FILE=${PACKAGE_DOWNLOADS_BASE}/${CURRENT_FLAG_FILE}
echo "Setting ${TOOL_NAME}'s Release version to ${RELEASE_NUMBER}"| tee -a ${LOG_FILE}
echo "The Release version info is stored in ${RELEASE_FILE}"| tee -a ${LOG_FILE}
echo ""| tee -a ${LOG_FILE}
RELEASE_NUMBER=`echo $RELEASE_NUMBER | sed -e 's/[[:space:]]*$//' | sed -e 's/^[[:space:]]*//'`
if [[ ${RELEASE_NUMBER} =~ ${REPOS_TAG_PATTERN} ]]
then
rm -f ${RELEASE_FILE}
touch ${RELEASE_FILE}
echo "${RELEASE_NUMBER}" > ${RELEASE_FILE}
fi
## Path relative to this script base
PACKAGE_CONFIG_FILE=${TOOL_NAME}/${TOOL_NAME}${PACKAGE_CONFIGFILE_SUFFIX}
if [ ! -f ${PACKAGE_CONFIG_FILE} ]
then
echo "ERROR: ${PACKAGE_CONFIG_FILE} missing under: ${WORKING_DIR}"
exit 1
fi
source ./${PACKAGE_CONFIG_FILE}
#
if [ -d ${PACKAGE_DOWNLOADS_BASE}/${RELEASE_DIR} ]
then
echo "WARNING:"
echo " ${TOOL_NAME} version $RELEASE_NUMBER is already installed."
echo " See: ${PACKAGE_DOWNLOADS_BASE}/${RELEASE_DIR} "
echo " Remove this directory first if you want to re-install this version"
fi
echo ""| tee -a ${LOG_FILE}
echo "Program complete"| tee -a ${LOG_FILE}
exit 0