jimmydot | 3982f4f | 2017-05-07 14:58:24 -0400 | [diff] [blame^] | 1 | #!/bin/bash
|
| 2 |
|
| 3 | FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache.ccf
|
| 4 | TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache_template.ccf
|
| 5 | BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache.ccf.bk.1
|
| 6 | BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache.ccf.bk.2
|
| 7 |
|
| 8 | echo "Localizing the VID cache configuration"
|
| 9 |
|
| 10 | if [ -z "${CACHE_DIRECTORY}" ]; then
|
| 11 | CACHE_DIRECTORY=${ROOT_DIR}/cache
|
| 12 | fi
|
| 13 |
|
| 14 | mkdir -p "${CACHE_DIRECTORY}"
|
| 15 |
|
| 16 | #------------------------------------------------------------------------
|
| 17 | #- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS
|
| 18 | #------------------------------------------------------------------------
|
| 19 | if [ -f ${BACKUP1_CONFIG_FILE} ]; then
|
| 20 | cp -f ${BACKUP1_CONFIG_FILE} ${BACKUP2_CONFIG_FILE} || {
|
| 21 | echo "ERROR: Could not copy ${BACKUP1_CONFIG_FILE} to ${BACKUP2_CONFIG_FILE}"
|
| 22 | exit 1
|
| 23 | }
|
| 24 | fi
|
| 25 |
|
| 26 | #------------------------------------------------------------------------
|
| 27 | #- MAKE A BACKUP OF CURRENT FILE, IF EXISTS
|
| 28 | #------------------------------------------------------------------------
|
| 29 | if [ -f ${FINAL_CONFIG_FILE} ]; then
|
| 30 | cp -f ${FINAL_CONFIG_FILE} ${BACKUP1_CONFIG_FILE} || {
|
| 31 | echo "ERROR: Could not copy ${FINAL_CONFIG_FILE} to ${BACKUP1_CONFIG_FILE}"
|
| 32 | exit 2
|
| 33 | }
|
| 34 | fi
|
| 35 |
|
| 36 | sed -e 's,${CACHE_DIRECTORY},'${CACHE_DIRECTORY}',g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || {
|
| 37 | echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}"
|
| 38 | exit 3
|
| 39 | }
|
| 40 |
|
| 41 | echo "Localized ${FINAL_CONFIG_FILE} successfully."
|