awips2/rpms/delta/setup/updateSetup.sh
Bryan Kowal a89f0a64f0 Issue #202 - restoring rpm directory to ss_sync.
Former-commit-id: d537df4ab0 [formerly 4453ad2d10] [formerly 65e1e4ee0b] [formerly d537df4ab0 [formerly 4453ad2d10] [formerly 65e1e4ee0b] [formerly ea1c82452b [formerly 65e1e4ee0b [formerly 56068aa96fa6daf113861476bf4b7aebe2021ca4]]]]
Former-commit-id: ea1c82452b
Former-commit-id: 69f4822ad1 [formerly 9f6780c4dd] [formerly e63dac039e52161602915d3cf34685762acd5d9e [formerly 7f1b468010]]
Former-commit-id: ed7bf459df1503ce7bd9500dc984c56a535b768f [formerly dafb6b18d8]
Former-commit-id: bb662ca175
2012-01-20 13:38:00 -06:00

70 lines
1.9 KiB
Bash

#!/bin/bash
# This script will determine if any delta scripts need to be included in the
# rpm that is being built based on the build.
# This file contains the current build information.
CONST_VERSION_TXT="Installer.rpm/version.txt"
CONST_SETUP_CORE_DIR="Installer.rpm/delta/setup"
function copySetupCore()
{
# Arguments:
# ${1} == the current build root.
# ${2} == the default rpm prefix.
local BUILD_ROOT="${1}"
local RPM_DEFAULT_PREFIX="${2}"
updateScripts=( 'createUpdateRegistry.sh' 'updateManager.sh' )
if [ ! -d ${BUILD_ROOT}/${RPM_DEFAULT_PREFIX}/delta ]; then
mkdir -p ${BUILD_ROOT}/${RPM_DEFAULT_PREFIX}/delta
fi
# Copy the update scripts.
for script in ${updateScripts[*]};
do
cp ${WORKSPACE_DIR}/${CONST_SETUP_CORE_DIR}/${script} \
${BUILD_ROOT}/${RPM_DEFAULT_PREFIX}/delta
done
}
function copyApplicableDeltas()
{
# Arguments:
# ${1} == the current build root.
# ${2} == the component name.
# ${3} == the component project directory.
# ${4} == the default rpm prefix.
local BUILD_ROOT="${1}"
local COMPONENT_NAME="${2}"
local COMPONENT_PROJECT_DIR="${3}"
local RPM_DEFAULT_PREFIX="${4}"
local CURRENT_BUILD=`cat ${WORKSPACE_DIR}/${CONST_VERSION_TXT}`
# Determine if a delta directory exists for the component for the current build.
EXPECTED_DIR="${WORKSPACE_DIR}/Installer.rpm/${COMPONENT_PROJECT_DIR}"
EXPECTED_DIR="${EXPECTED_DIR}/delta/B${CURRENT_BUILD}"
# Create The Delta Script Directory.
if [ ! -d ${BUILD_ROOT}/${RPM_DEFAULT_PREFIX}/delta/${COMPONENT_NAME} ]; then
mkdir -p ${BUILD_ROOT}/${RPM_DEFAULT_PREFIX}/delta/${COMPONENT_NAME}
fi
if [ ! -d ${EXPECTED_DIR} ]; then
return
fi
# Determine How Many Delta Scripts There Are.
COUNT=`ls -1 ${EXPECTED_DIR} | wc -l`
if [ ${COUNT} -le 0 ]; then
return
fi
cp ${EXPECTED_DIR}/* \
${BUILD_ROOT}/${RPM_DEFAULT_PREFIX}/delta/${COMPONENT_NAME}
}