#!/bin/bash # BEGIN COPYRIGHT BLOCK # (C) 2010 Red Hat, Inc. # All rights reserved. # END COPYRIGHT BLOCK ## ## Include common 'compose' functions ## COMPOSE_PWD=`dirname $0` source ${COMPOSE_PWD}/compose_functions ## Always switch into the base directory three levels ## above this shell script prior to executing it so ## that all of its output is written to this directory cd `dirname $0`/../.. ## ## Retrieve the name of this base directory ## PKI_PWD=`pwd` ## ## Establish the 'pki-ocsp' name and version information ## PKI_OCSP="pki-ocsp" PKI_OCSP_VERSION="9.0.0" ## ## Establish the SOURCE files/directories of the 'pki-ocsp' source directory ## PKI_SPECS_FILE="${PKI_DIR}/specs/${PKI_OCSP}.spec" PKI_COMPONENT_LIST="ocsp" ## ## Establish the TARGET files/directories of the 'pki-ocsp' source/spec files ## PKI_PACKAGES="${PKI_PWD}/packages" PKI_OCSP_BUILD_DIR="${PKI_PACKAGES}/BUILD" PKI_OCSP_RPMS_DIR="${PKI_PACKAGES}/RPMS" PKI_OCSP_SOURCES_DIR="${PKI_PACKAGES}/SOURCES" PKI_OCSP_SPECS_DIR="${PKI_PACKAGES}/SPECS" PKI_OCSP_SRPMS_DIR="${PKI_PACKAGES}/SRPMS" PKI_OCSP_TARBALL="${PKI_OCSP}-${PKI_OCSP_VERSION}.tar.gz" PKI_OCSP_SPEC_FILE="${PKI_OCSP_SPECS_DIR}/${PKI_OCSP}.spec" PKI_OCSP_PACKAGE_SCRIPT="${PKI_PACKAGES}/package_${PKI_OCSP}" PKI_OCSP_PACKAGE_COMMAND="${RPMBUILD_CMD} SPECS/${PKI_OCSP}.spec" PKI_OCSP_STAGING_DIR="${PKI_PACKAGES}/staging" PKI_OCSP_DIR="${PKI_OCSP_STAGING_DIR}/${PKI_OCSP}-${PKI_OCSP_VERSION}" PKI_OCSP_BASE_DIR="${PKI_OCSP_DIR}/base" ## ## Always create a top-level 'packages' directory ## mkdir -p ${PKI_PACKAGES} ## ## Always create 'pki-ocsp' package directories ## mkdir -p ${PKI_OCSP_BUILD_DIR} mkdir -p ${PKI_OCSP_RPMS_DIR} mkdir -p ${PKI_OCSP_SOURCES_DIR} mkdir -p ${PKI_OCSP_SPECS_DIR} mkdir -p ${PKI_OCSP_SRPMS_DIR} ## ## Always start with new 'pki-ocsp' package files ## rm -rf ${PKI_OCSP_BUILD_DIR}/${PKI_OCSP}-${PKI_OCSP_VERSION} rm -f ${PKI_OCSP_RPMS_DIR}/${PKI_OCSP}-${PKI_OCSP_VERSION}*.rpm rm -f ${PKI_OCSP_SOURCES_DIR}/${PKI_OCSP_TARBALL} rm -f ${PKI_OCSP_SPEC_FILE} rm -f ${PKI_OCSP_SRPMS_DIR}/${PKI_OCSP}-${PKI_OCSP_VERSION}*.rpm ## ## Copy a new 'pki-ocsp' spec file from the ## current contents of the PKI working repository ## cp -p ${PKI_SPECS_FILE} ${PKI_OCSP_SPECS_DIR} if [ ${USE_PATCH_FILES} -eq 1 ] ; then Retrieve_Source_Tarball_and_Patches ${PKI_SPECS_FILE} ${PKI_PATCHES_DIR} ${PKI_OCSP_SOURCES_DIR} else ## ## Always start with a new 'pki-ocsp' staging directory ## rm -rf ${PKI_OCSP_STAGING_DIR} ## ## To generate the 'pki-ocsp' tarball, construct a staging area ## consisting of the 'pki-ocsp' source components from the ## current contents of the PKI working repository ## mkdir -p ${PKI_OCSP_DIR} cd ${PKI_DIR} for file in "${PKI_FILE_LIST}" ; do cp -p ${file} ${PKI_OCSP_DIR} done find ${PKI_CMAKE_DIR} \ -name .svn -prune -o \ -name *.swp -prune -o \ -print | cpio -pdum ${PKI_OCSP_DIR} > /dev/null 2>&1 cd - > /dev/null 2>&1 mkdir -p ${PKI_OCSP_BASE_DIR} cd ${PKI_BASE_DIR} cp -p ${PKI_BASE_MANIFEST} ${PKI_OCSP_BASE_DIR} for component in "${PKI_COMPONENT_LIST}" ; do find ${component} \ -name .svn -prune -o \ -name *.swp -prune -o \ -name Makefile.am -prune -o \ -name Makefile.in -prune -o \ -name aclocal.m4 -prune -o \ -name autogen.sh -prune -o \ -name build.xml -prune -o \ -name compile -prune -o \ -name config.guess -prune -o \ -name config.h.in -prune -o \ -name config.sub -prune -o \ -name configure -prune -o \ -name configure.ac -prune -o \ -name depcomp -prune -o \ -name install-sh -prune -o \ -name ltmain.sh -prune -o \ -name m4 -prune -o \ -name missing -prune -o \ -name setup_package -prune -o \ -print | cpio -pdum ${PKI_OCSP_BASE_DIR} > /dev/null 2>&1 done cd - > /dev/null 2>&1 ## ## Due to the following lower-level 'config' subdirectories, ## INDEPENDENTLY remove ALL top-level 'config' directories: ## ## * ./console/src/com/netscape/admin/certsrv/config (N/A 'pki-ocsp') ## * ./tps/forms/tps/admin/console/config (N/A 'pki-ocsp') ## rm -rf ${PKI_OCSP_BASE_DIR}/*/config ## ## Create the 'pki-ocsp' tarball ## mkdir -p ${PKI_OCSP_SOURCES_DIR} cd ${PKI_OCSP_STAGING_DIR} gtar -zcvf ${PKI_OCSP_TARBALL} \ "${PKI_OCSP}-${PKI_OCSP_VERSION}" > /dev/null 2>&1 mv ${PKI_OCSP_TARBALL} ${PKI_OCSP_SOURCES_DIR} cd - > /dev/null 2>&1 ## ## Always remove the PKI staging area ## rm -rf ${PKI_OCSP_STAGING_DIR} fi ## ## Always generate a fresh 'pki-ocsp' package script ## rm -rf ${PKI_OCSP_PACKAGE_SCRIPT} printf "#!/bin/bash\n\n" > ${PKI_OCSP_PACKAGE_SCRIPT} printf "${PKI_OCSP_PACKAGE_COMMAND}\n\n" >> ${PKI_OCSP_PACKAGE_SCRIPT} chmod 775 ${PKI_OCSP_PACKAGE_SCRIPT} ## ## Automatically invoke RPM/SRPM creation ## cd ${PKI_PACKAGES} ; bash ./package_${PKI_OCSP} | tee package_${PKI_OCSP}.log 2>&1