Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions splunk/common-files/updateetc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2018 Splunk
# Copyright 2018-2020 Splunk

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,15 +15,17 @@
# limitations under the License.
#

if [[ -f "${SPLUNK_HOME}-etc/splunk.version" ]]; then
IMAGE_VERSION_SHA=`cat ${SPLUNK_HOME}-etc/splunk.version | sha512sum`
SPLUNK_ETC_BAK="${SPLUNK_ETC_BAK:-/opt/splunk-etc}"

if [[ -f "${SPLUNK_ETC_BAK}/splunk.version" ]]; then
IMAGE_VERSION_SHA=`cat ${SPLUNK_ETC_BAK}/splunk.version | sha512sum`

if [[ -f "${SPLUNK_HOME}/etc/splunk.version" ]]; then
ETC_VERSION_SHA=`cat ${SPLUNK_HOME}/etc/splunk.version | sha512sum`
fi

if [[ "x${IMAGE_VERSION_SHA}" != "x${ETC_VERSION_SHA}" ]]; then
echo Updating ${SPLUNK_HOME}/etc
(cd ${SPLUNK_HOME}-etc; tar cf - *) | (cd ${SPLUNK_HOME}/etc; tar xf -)
(cd ${SPLUNK_ETC_BAK}; tar cf - *) | (cd ${SPLUNK_HOME}/etc; tar xf -)
fi
fi