forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
content-runconversion.sh
executable file
·92 lines (84 loc) · 3.33 KB
/
content-runconversion.sh
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
#!/bin/bash
#
# Usage:
# content-runconversion.sh -j JDBC_DRIVER_JAR -k KERNEL_VERSION -s SAKAI_VERSION -m /path/to/m2/repository -p SAKAI_PROPERTIES_FILE UPGRADESCHEMA_CONFIG
#
# Example:
# content-runconversion.sh -j "$CATALINA_HOME/shared/lib/ojdbc14.jar" \
# -p "$CATALINA_HOME/sakai/sakai.properties" -k 1.0.3 \
# -s 2.6.0 -m /tmp/m2/repository upgradeschema-oracle.config
# The "runconversion.sh" script does not have to be run
# in place. It could be copied to the working directory.
# For Cygwin, ensure paths are in the proper format.
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
esac
if $cygwin; then
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
m2repository=`cygpath --path --unix "$HOMEDRIVE""$HOMEPATH"`/.m2/repository
else
m2repository="$HOME"/.m2/repository
fi
usage()
{
cat<<USAGE;
usage:
-h this message
-j extrajarfile
should include your JDBC JAR; may be specified multiple times (e.g., for MySQL)
-k kernelversion
version of kernel being used
-s sakaiversion
version of sakai being used (from master/pom.xml)
-m maven2repository
directory for maven2 repoository (DEFAULT: ~/.m2/repository)
-p sakaipropertiesfile
may be used to set up database connections
properties
the configuration file
eg
`basename $0` -j $CATALINA_HOME/shared/lib/ojdbc14.jar -k 1.0.3 -s 2.6.0 -m /tmp/m2/repository convertcontent.config
USAGE
}
while getopts 'hj:p:m:k:s:' OPTION
do
case $OPTION in
j) CLASSPATH="$CLASSPATH":"$OPTARG"
;;
p) JAVA_OPTS="$JAVA_OPTS -Dsakai.properties=$OPTARG"
;;
m) m2repository="$OPTARG"
;;
k) KERNELVERSION="$OPTARG"
;;
s) SAKAIVERSION="$OPTARG"
;;
h) usage
exit 0
;;
\?) usage
exit 2
;;
esac
done
shift $(($OPTIND - 1))
CLASSPATH="$CLASSPATH:"$m2repository"/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar"
CLASSPATH="$CLASSPATH:"$m2repository"/commons-collections/commons-collections/3.2/commons-collections-3.2.jar"
CLASSPATH="$CLASSPATH:"$m2repository"/commons-dbcp/commons-dbcp/1.2.2/commons-dbcp-1.2.2.jar"
CLASSPATH="$CLASSPATH:"$m2repository"/commons-pool/commons-pool/1.3/commons-pool-1.3.jar"
CLASSPATH="$CLASSPATH:"$m2repository"/org/sakaiproject/kernel/sakai-kernel-api/$KERNELVERSION/sakai-kernel-api-$KERNELVERSION.jar"
CLASSPATH="$CLASSPATH:"$m2repository"/org/sakaiproject/kernel/sakai-kernel-impl/$KERNELVERSION/sakai-kernel-impl-$KERNELVERSION.jar"
CLASSPATH="$CLASSPATH:"$m2repository"/org/sakaiproject/kernel/sakai-kernel-util/$KERNELVERSION/sakai-kernel-util-$KERNELVERSION.jar"
CLASSPATH="$CLASSPATH:"$m2repository"/org/sakaiproject/kernel/sakai-kernel-common/$KERNELVERSION/sakai-kernel-common-$KERNELVERSION.jar"
CLASSPATH="$CLASSPATH:"$m2repository"/org/sakaiproject/kernel/sakai-kernel-component/$KERNELVERSION/sakai-kernel-component-$KERNELVERSION.jar"
CLASSPATH="$CLASSPATH:"$m2repository"/org/sakaiproject/kernel/sakai-kernel-private/$KERNELVERSION/sakai-kernel-private-$KERNELVERSION.jar"
CLASSPATH="$CLASSPATH:"$m2repository"/log4j/log4j/1.2.9/log4j-1.2.9.jar"
# For Cygwin, ensure paths are in the proper format.
if $cygwin; then
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
fi
java $JAVA_OPTS \
-classpath "$CLASSPATH" \
org.sakaiproject.util.conversion.UpgradeSchema "$@"
exit 0