-
Notifications
You must be signed in to change notification settings - Fork 108
/
install-extensions.sh
54 lines (49 loc) · 2 KB
/
install-extensions.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
#!/bin/bash
# Inspired by https://github.com/kartoza/docker-geoserver
function download_extension() {
URL=$1
EXTENSION=$2
DOWNLOAD_FILE="${ADDITIONAL_LIBS_DIR}geoserver-${GEOSERVER_VERSION}-${EXTENSION}-plugin.zip"
if [ -e "$DOWNLOAD_FILE" ]; then
echo "$DOWNLOAD_FILE already exists. Skipping download."
else
if curl --output /dev/null --silent --head --fail "${URL}"; then
echo -e "\nDownloading ${EXTENSION} extension from ${URL} to ${DOWNLOAD_FILE}"
wget --progress=bar:force:noscroll -c --no-check-certificate "${URL}" -O ${DOWNLOAD_FILE}
else
echo "URL does not exist: ${URL}"
fi
fi
}
# Download stable plugins only if INSTALL_EXTENSIONS is true
if [ "$INSTALL_EXTENSIONS" = "true" ]; then
echo "Starting download of extensions"
if [ ! -d "$ADDITIONAL_LIBS_DIR" ]; then
mkdir -p $ADDITIONAL_LIBS_DIR
fi
for EXTENSION in $(echo "${STABLE_EXTENSIONS}" | tr ',' ' '); do
URL="${STABLE_PLUGIN_URL}/geoserver-${GEOSERVER_VERSION}-${EXTENSION}-plugin.zip"
download_extension ${URL} ${EXTENSION}
done
for EXTENSION in $(echo "${COMMUNITY_EXTENSIONS}" | tr ',' ' '); do
URL="${COMMUNITY_PLUGIN_URL}/geoserver-${GEOSERVER_VERSION}-${EXTENSION}-plugin.zip"
download_extension ${URL} ${EXTENSION}
done
echo "Finished download of extensions"
fi
# Install the extensions
echo "Starting installation of extensions"
for EXTENSION in $(echo "${STABLE_EXTENSIONS},${COMMUNITY_EXTENSIONS}" | tr ',' ' '); do
ADDITIONAL_LIB=${ADDITIONAL_LIBS_DIR}geoserver-${GEOSERVER_VERSION}-${EXTENSION}-plugin.zip
[ -e "$ADDITIONAL_LIB" ] || continue
if [[ $ADDITIONAL_LIB == *.zip ]]; then
unzip -q -o -d ${GEOSERVER_LIB_DIR} ${ADDITIONAL_LIB} "*.jar"
echo "Installed all jar files from ${ADDITIONAL_LIB}"
elif [[ $ADDITIONAL_LIB == *.jar ]]; then
cp ${ADDITIONAL_LIB} ${GEOSERVER_LIB_DIR}
echo "Installed ${ADDITIONAL_LIB}"
else
echo "Skipping ${ADDITIONAL_LIB}: unknown file extension."
fi
done
echo "Finished installation of extensions"