-
Notifications
You must be signed in to change notification settings - Fork 33
/
render-export-jetty-entrypoint.sh
executable file
·53 lines (39 loc) · 1.43 KB
/
render-export-jetty-entrypoint.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
#!/bin/sh
set -e
ABSOLUTE_SCRIPT=`readlink -m $0`
SCRIPTS_DIR=`dirname ${ABSOLUTE_SCRIPT}`
# configure this container using quote-stripped versions of current environment variables
. ${SCRIPTS_DIR}/render-env.sh
${SCRIPTS_DIR}/render-config.sh
ROOT_EXPORT_DIR="/render-export"
if [ ! -d ${ROOT_EXPORT_DIR} ]; then
echo """
ERROR: root export directory ${ROOT_EXPORT_DIR} not mounted
container should be run with mount option something like:
--mount source=host-export-dir,target=/render-export
"""
exit 1
fi
CONTAINER_RUN_TIME=$(date +"%Y%m%d_%H%M%S")
CONTAINER_EXPORT_DIR="${ROOT_EXPORT_DIR}/export_${CONTAINER_RUN_TIME}"
JETTY_BASE_EXPORT_DIR="${CONTAINER_EXPORT_DIR}/jetty_base"
JETTY_HOME_EXPORT_DIR="${CONTAINER_EXPORT_DIR}/jetty_home"
if [ -d ${JETTY_BASE_EXPORT_DIR} ]; then
echo """
ERROR: jetty base export directory ${JETTY_BASE_EXPORT_DIR} already exists
exiting so that existing files aren't overwritten
re-run to export to a directory with a new time stamp
"""
exit 1
fi
mkdir -p ${JETTY_BASE_EXPORT_DIR} ${JETTY_HOME_EXPORT_DIR}
echo """
exporting $(du -sh ${JETTY_BASE} | awk '{ print $1 " in " $2 }') to ${JETTY_BASE_EXPORT_DIR}
"""
# copy jetty base to export directory
cp -r ${JETTY_BASE}/* ${JETTY_BASE_EXPORT_DIR}
echo """
exporting $(du -sh ${JETTY_HOME} | awk '{ print $1 " in " $2 }') to ${JETTY_HOME_EXPORT_DIR}
"""
# copy jetty base to export directory
cp -r ${JETTY_HOME}/* ${JETTY_HOME_EXPORT_DIR}