-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdocksal-preinit
executable file
·33 lines (26 loc) · 1.17 KB
/
docksal-preinit
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
#!/usr/bin/env bash
# use user own configs if exists
if [[ -d /var/www/.docksal/etc/solr/conf ]]; then
SOLR_DEFAULT_CONFIG_SET="user-owned"
CONFIG_SET_PATH="/opt/docker-solr/configsets/${SOLR_DEFAULT_CONFIG_SET}"
mkdir -p "${CONFIG_SET_PATH}"
cp -R "/var/www/.docksal/etc/solr/conf" "${CONFIG_SET_PATH}"
else
if [[ ! -d "/opt/docker-solr/configsets/${SOLR_DEFAULT_CONFIG_SET}" ]]
then
echo "Config set ${SOLR_DEFAULT_CONFIG_SET} not supported by Solr ${VERSION}"
exit 1
else
CONFIG_SET_PATH="/opt/docker-solr/configsets/${SOLR_DEFAULT_CONFIG_SET}"
fi
fi
# Remove old symlinks
find ${SOLR_HOME}/configsets/ -type l -delete
# Symlinks config set to volume.
ln -sf "${CONFIG_SET_PATH}" "${SOLR_HOME}/configsets/${SOLR_DEFAULT_CONFIG_SET}";
# set default core
touch "${SOLR_HOME}/configsets/${SOLR_DEFAULT_CONFIG_SET}/core.properties"
# Comment out solr.install.dir param in solrcore.properties
sed -i 's/^solr.install.dir=/#solr.install.dir=/' ${SOLR_HOME}/configsets/${SOLR_DEFAULT_CONFIG_SET}/conf/solrcore.properties
[[ -n "$SOLR_INCLUDE" ]] || SOLR_INCLUDE="/opt/solr/bin/solr.in.sh"
sudo sed -i 's@^SOLR_HEAP=".*"@'"SOLR_HEAP=${SOLR_HEAP}"'@' $SOLR_INCLUDE