From 2bf267cb81c1832cd88f940d375baa70662c8cf1 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 9 Jan 2017 21:34:18 +0800 Subject: [PATCH] Backup file `Release', and restore the saved copy after the packages building. --- buildcore.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/buildcore.sh b/buildcore.sh index ba6d5096a..9ea023521 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -190,6 +190,31 @@ function setversionvars { echo "$XCAT_RELEASE" >Release } +RELEASE_FILE="Release" +RELEASE_FILE_SAVE="${RELEASE_FILE}.save.998" + +function internal_backup() +{ + # Create a backup for file `Release' + if [ ! -f "${RELEASE_FILE_SAVE}" ] + then + mv "${RELEASE_FILE}" "${RELEASE_FILE_SAVE}" + cp "${RELEASE_FILE_SAVE}" "${RELEASE_FILE}" + fi +} + +function internal_cleanup() +{ + # Restore file `Release' + if [ -f "${RELEASE_FILE_SAVE}" ] + then + mv "${RELEASE_FILE_SAVE}" "${RELEASE_FILE}" + fi +} + +internal_backup +trap internal_cleanup 0 + if [ "$PROMOTE" != 1 ]; then # very long if statement to not do builds if we are promoting ### @LINE460 ### # we are doing a snap build CORE="core-snap"