AMBARI-7637. Save overwritten custom stacks before upgrade. (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c2726070 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c2726070 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c2726070 Branch: refs/heads/branch-alerts-dev Commit: c2726070aaa3f0b9ad24001be91b6953f3fbc761 Parents: d0c85e5 Author: Andrew Onishuk <[email protected]> Authored: Fri Oct 3 22:13:33 2014 +0300 Committer: Andrew Onishuk <[email protected]> Committed: Fri Oct 3 22:13:33 2014 +0300 ---------------------------------------------------------------------- ambari-server/src/main/package/deb/control/preinst | 8 ++++++++ ambari-server/src/main/package/rpm/preinstall.sh | 8 ++++++++ 2 files changed, 16 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/c2726070/ambari-server/src/main/package/deb/control/preinst ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/package/deb/control/preinst b/ambari-server/src/main/package/deb/control/preinst index cf2041f..171e817 100644 --- a/ambari-server/src/main/package/deb/control/preinst +++ b/ambari-server/src/main/package/deb/control/preinst @@ -14,9 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License +STACKS_FOLDER="/var/lib/ambari-server/resources/stacks" +STACKS_FOLDER_OLD=/var/lib/ambari-server/resources/stacks_$(date '+%d_%m_%y_%H_%M').old + if [ -d "/etc/ambari-server/conf.save" ] then mv /etc/ambari-server/conf.save /etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save fi +if [ -d "$STACKS_FOLDER" ] +then + cp -r "$STACKS_FOLDER" "$STACKS_FOLDER_OLD" +fi + exit 0 http://git-wip-us.apache.org/repos/asf/ambari/blob/c2726070/ambari-server/src/main/package/rpm/preinstall.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/package/rpm/preinstall.sh b/ambari-server/src/main/package/rpm/preinstall.sh index c70a0cb..35090d7 100644 --- a/ambari-server/src/main/package/rpm/preinstall.sh +++ b/ambari-server/src/main/package/rpm/preinstall.sh @@ -13,9 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License +STACKS_FOLDER="/var/lib/ambari-server/resources/stacks" +STACKS_FOLDER_OLD=/var/lib/ambari-server/resources/stacks_$(date '+%d_%m_%y_%H_%M').old + if [ -d "/etc/ambari-server/conf.save" ] then mv /etc/ambari-server/conf.save /etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save fi +if [ -d "$STACKS_FOLDER" ] +then + cp -r "$STACKS_FOLDER" "$STACKS_FOLDER_OLD" +fi + exit 0 \ No newline at end of file
