Skip to content

Commit fed940f

Browse files
committed
Add the migration of Jackrabbit to Oak
1 parent 5ffa2fd commit fed940f

File tree

3 files changed

+47
-13
lines changed

3 files changed

+47
-13
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ RUN wget -nc https://www.silverpeas.org/files/silverpeas-${SILVERPEAS_VERSION}-w
9090
&& unzip wildfly-${WILDFLY_VERSION}.Final.zip -d /opt \
9191
&& mv /opt/silverpeas-${SILVERPEAS_VERSION}-wildfly${WILDFLY_VERSION%.?.?} /opt/silverpeas \
9292
&& mv /opt/wildfly-${WILDFLY_VERSION}.Final /opt/wildfly \
93+
&& wget -nc https://www.silverpeas.org/files/oak-migrate.zip \
94+
&& echo '02d21f69004f2d9e634e82ec062d94521bd6bc0385d7c0ddf9af261cb63afdbb oak-migrate.zip' | sha256sum -c --status - \
95+
&& mkdir -p /opt/oak-migration \
96+
&& unzip oak-migrate.zip -d /opt/oak-migration/ \
97+
&& chmod +x /opt/oak-migration/oak-migrate.sh \
9398
&& rm *.zip \
9499
&& mkdir -p /root/.m2
95100

src/bin/setup.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,37 @@
11
#!/usr/bin/env bash
22

3+
migrate_jcr() {
4+
# figure out the data home directory (by default it is into the Silverpeas home directory)
5+
data_home=`grep "SILVERPEAS_DATA_HOME[ ]*=" "${SILVERPEAS_HOME}/configuration/config.properties" | cut -d '=' -f 2 | xargs`
6+
if [ "Z${data_home}" = "Z" ]; then
7+
data_home="${SILVERPEAS_HOME}/data"
8+
else
9+
data_home=`sed -e "s/{env./{/g" <<< "${data_home}"`
10+
data_home=`eval echo -e "${data_home}"`
11+
fi
12+
13+
# figure out now the JCR home directory (by default it is located into the data home directory)
14+
jcr_home=`grep "JCR_HOME[ ]*=" "${SILVERPEAS_HOME}/configuration/config.properties" | cut -d '=' -f 2 | xargs`
15+
if [ "Z${jcr_home}" = "Z" ]; then
16+
jcr_home="${data_home}/jcr"
17+
else
18+
jcr_home=`sed -e "s/SILVERPEAS_DATA_HOME/data_home/g" <<< "${jcr_home}"`
19+
jcr_home=`eval echo -e "${jcr_home}"`
20+
fi
21+
22+
jcr_dir=`dirname ${jcr_home}`
23+
if [ -d "${jcr_dir}/jackrabbit" ] && [ ! -d "${jcr_dir}/jcr/segmentstore" ]; then
24+
echo "Migrate the JCR from Apache Jackrabbit 2 to Apache Jackrabbit Oak..."
25+
if ! /opt/oak-migration/oak-migrate.sh "$jcr_dir/jackrabbit" "$jcr_dir/jcr"; then
26+
exit 1
27+
fi
28+
fi
29+
}
30+
331
echo "Installation of Silverpeas $1"
432
./h2database start
533
./silverpeas clean install
34+
migrate_jcr
635
ret=$?
736
if [ $ret -eq 0 ]; then
837
rm ../log/build-*

src/run.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ configure_silverpeas() {
1111
local configure=0
1212
if [ "Z${locale}" != "Z" ]; then
1313
echo " -> set locale to ${locale}"
14-
echo "SILVERPEAS_USER_LANGUAGE=${locale}" >> ${SILVERPEAS_HOME}/configuration/config.properties
15-
echo "SILVERPEAS_CONTENT_LANGUAGES=${locale}" >> ${SILVERPEAS_HOME}/configuration/config.properties
14+
echo "SILVERPEAS_USER_LANGUAGE=${locale}" >> "${SILVERPEAS_HOME}"/configuration/config.properties
15+
echo "SILVERPEAS_CONTENT_LANGUAGES=${locale}" >> "${SILVERPEAS_HOME}"/configuration/config.properties
1616
configure=1
1717
fi
18-
if [ -f ${SILVERPEAS_HOME}/configuration/custom_config.properties ]; then
18+
if [ -f "${SILVERPEAS_HOME}/configuration/custom_config.properties" ]; then
1919
echo " -> set custom configuration from custom_config.properties"
20-
sed -e "s/DB_.*$//g" ${SILVERPEAS_HOME}/configuration/custom_config.properties > ${SILVERPEAS_HOME}/configuration/custom_config.fixed.properties
21-
cat ${SILVERPEAS_HOME}/configuration/custom_config.fixed.properties >> ${SILVERPEAS_HOME}/configuration/config.properties
22-
rm ${SILVERPEAS_HOME}/configuration/custom_config.fixed.properties
20+
sed -e "s/DB_.*$//g" "${SILVERPEAS_HOME}"/configuration/custom_config.properties > "${SILVERPEAS_HOME}"/configuration/custom_config.fixed.properties
21+
cat "${SILVERPEAS_HOME}"/configuration/custom_config.fixed.properties >> "${SILVERPEAS_HOME}"/configuration/config.properties
22+
rm "${SILVERPEAS_HOME}"/configuration/custom_config.fixed.properties
2323
configure=1
2424
fi
25-
if [ -f ${SILVERPEAS_HOME}/configuration/silverpeas/CustomerSettings.xml ] || [ -f ${SILVERPEAS_HOME}/configuration/silverpeas/CustomSettings.xml ]; then
25+
if [ -f "${SILVERPEAS_HOME}/configuration/silverpeas/CustomerSettings.xml" ] || [ -f "${SILVERPEAS_HOME}/configuration/silverpeas/CustomSettings.xml" ]; then
2626
echo " -> custom settings detected in CustomerSettings.xml or CustomSettings.xml"
2727
configure=1
2828
fi
@@ -32,10 +32,10 @@ configure_silverpeas() {
3232
}
3333

3434
start_silverpeas() {
35-
${SILVERPEAS_HOME}/bin/h2database start
35+
"${SILVERPEAS_HOME}"/bin/h2database start
3636

3737
echo "Start Silverpeas..."
38-
${JBOSS_HOME}/bin/standalone.sh -b 0.0.0.0 -c standalone-full.xml &
38+
"${JBOSS_HOME}"/bin/standalone.sh -b 0.0.0.0 -c standalone-full.xml &
3939
local pids=`jobs -p`
4040
wait $pids
4141
}
@@ -48,17 +48,17 @@ stop_silverpeas() {
4848
kill $pids &> /dev/null
4949
fi
5050

51-
${SILVERPEAS_HOME}/bin/h2database stop
51+
"${SILVERPEAS_HOME}"/bin/h2database stop
5252
}
5353

5454
trap 'stop_silverpeas' SIGTERM
5555

56-
if [ -f ${SILVERPEAS_HOME}/bin/.install ]; then
56+
if [ -f "${SILVERPEAS_HOME}/bin/.install" ]; then
5757
configure_silverpeas
58-
rm ${SILVERPEAS_HOME}/bin/.install
58+
rm "${SILVERPEAS_HOME}"/bin/.install
5959
fi
6060

61-
if [ -f ${SILVERPEAS_HOME}/configuration/config.properties ] && [ ! -e ${SILVERPEAS_HOME}/bin/.install ]; then
61+
if [ -f "${SILVERPEAS_HOME}/configuration/config.properties" ] && [ ! -e "${SILVERPEAS_HOME}/bin/.install" ]; then
6262
start_silverpeas
6363
else
6464
echo "No ${SILVERPEAS_HOME}/configuration/config.properties found! No start!"

0 commit comments

Comments
 (0)