diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build_dogtag_pki | 200 | ||||
-rwxr-xr-x | scripts/compose_dogtag_pki_meta_packages | 78 | ||||
-rwxr-xr-x | scripts/compose_dogtag_pki_theme_packages | 196 | ||||
-rw-r--r-- | scripts/compose_functions | 275 | ||||
-rwxr-xr-x | scripts/compose_ipa_pki_theme_packages | 217 | ||||
-rwxr-xr-x | scripts/compose_pki_console_packages | 194 | ||||
-rwxr-xr-x | scripts/compose_pki_core_packages | 194 | ||||
-rwxr-xr-x | scripts/compose_pki_migrate_packages | 194 | ||||
-rwxr-xr-x | scripts/compose_pki_ra_packages | 194 | ||||
-rwxr-xr-x | scripts/compose_pki_tps_packages | 194 | ||||
-rwxr-xr-x | scripts/create_pki_yum_repos | 78 | ||||
-rwxr-xr-x | scripts/install_default_ca_instance | 56 | ||||
-rwxr-xr-x | scripts/install_default_pki_instances | 122 | ||||
-rwxr-xr-x | scripts/pki_patch_maker | 113 | ||||
-rwxr-xr-x | scripts/prepare_dogtag_pki | 323 | ||||
-rwxr-xr-x | scripts/remove_default_pki_instances | 115 | ||||
-rwxr-xr-x | scripts/remove_pki_components | 150 |
17 files changed, 2893 insertions, 0 deletions
diff --git a/scripts/build_dogtag_pki b/scripts/build_dogtag_pki new file mode 100755 index 000000000..f2c171fbb --- /dev/null +++ b/scripts/build_dogtag_pki @@ -0,0 +1,200 @@ +#!/bin/bash +# BEGIN COPYRIGHT BLOCK +# (C) 2011 Red Hat, Inc. +# All rights reserved. +# END COPYRIGHT BLOCK + +# 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 name of the machine +PKI_HOSTNAME=`hostname` + +# Set pre-defined variables +PKI_DIR="pki" +PKI_FLAVOR="dogtag" +PKI_SCRIPTS_DIR="scripts" +ROOT_UID=0 + +# This script may ONLY be run on Linux! +PKI_OS=`uname` +if [ "${PKI_OS}" != "Linux" ]; then + printf "The '$0' script is ONLY executable\n" + printf "on a 'Linux' machine!\n" + exit 255 +fi +PKI_ARCH=`uname -p` +NOARCH="noarch" + +# Set packaging variables +RPM_EXE="/bin/rpm" +YUM_EXE="/usr/bin/yum" +YUM_EXE_OPTIONS="-y --nogpgcheck install" +RPM_DIR="RPMS" +RPM_EXT="-[0-9]*.rpm" +COMBINED="combined" + +# Set sudo variables +PKI_SUDO="/usr/bin/sudo" +PKI_SUDOERS="/etc/sudoers" + +# Set user identity variables +PKI_EUID=`/usr/bin/id -u` +PKI_UID=`/usr/bin/id -ur` +PKI_USERNAME=`/usr/bin/id -un` + +# Make sure that this script is NOT being run as root! +if [ ${PKI_UID} -eq ${ROOT_UID} ] || + [ ${PKI_EUID} -eq ${ROOT_UID} ]; then + printf "The '$0' script may NOT be run as root!\n" + exit 255 +fi + +# Check for the presence of the 'sudo' executable +if [ ! -x "${PKI_SUDO}" ]; then + printf "The '$0' script requires the '${PKI_SUDO}' executable\n" + printf "to be available on '${PKI_HOSTNAME}'!\n" + exit 255 +fi + +# Check for the presence of the 'sudoers' file +if [ ! -e "${PKI_SUDOERS}" ]; then + printf "The '$0' script requires the '${PKI_SUDOERS}' file\n" + printf "to be available on '${PKI_HOSTNAME}'!\n" + exit 255 +fi + +# Check for the presence of the required sudoers command(s) +PKI_SUDOERS_COMMAND="(root) NOPASSWD: ALL" +PKI_SUDOERS_LINE="${PKI_USERNAME} NOPASSWD: ALL" +PKI_SUDOERS_RPM_COMMAND="(root) NOPASSWD: ${RPM_EXE}" +PKI_SUDOERS_RPM_LINE="${PKI_USERNAME} ALL = NOPASSWD: ${RPM_EXE}" +PKI_SUDOERS_YUM_COMMAND="(root) NOPASSWD: ${YUM_EXE}" +PKI_SUDOERS_YUM_LINE="${PKI_USERNAME} ALL = NOPASSWD: ${YUM_EXE}" +printf "Checking if '${PKI_USERNAME}' has the appropriate '${PKI_SUDO}' permissions . . .\n" +printf "[NOTE: A password prompt may appear requiring ${PKI_USERNAME}'s password.]\n" +# NOTE: If 'ALL' commands are NOT sudo enabled, then at least BOTH +# of the 'RPM' and 'YUM' commands MUST be sudo enabled! +`${PKI_SUDO} -l | grep "${PKI_SUDOERS_COMMAND}" > /dev/null 2>&1` +if [ $? -ne 0 ]; then + sudo_commands=2 + `${PKI_SUDO} -l | grep "${PKI_SUDOERS_RPM_COMMAND}" > /dev/null 2>&1` + if [ $? -ne 0 ]; then + sudo_commands=`expr ${sudo_commands} - 1` + fi + `${PKI_SUDO} -l | grep "${PKI_SUDOERS_YUM_COMMAND}" > /dev/null 2>&1` + if [ $? -ne 0 ]; then + sudo_commands=`expr ${sudo_commands} - 1` + fi + if [ ${sudo_commands} -ne 2 ]; then + printf "The '$0' script requires that the\n" + printf "'${PKI_SUDOERS}' file MUST contain BOTH of these lines:\n\n" + printf " '${PKI_SUDOERS_RPM_LINE}'\n" + printf " '${PKI_SUDOERS_YUM_LINE}'\n\n" + exit 255 + fi +fi + +# Set 'composition scripts' variables +PKI_COMPOSE_SCRIPTS_DIR="${PKI_PWD}/${PKI_DIR}/${PKI_SCRIPTS_DIR}" +COMPOSE_DOGTAG_PKI_THEME_PACKAGES="compose_dogtag_pki_theme_packages" +COMPOSE_PKI_CORE_PACKAGES="compose_pki_core_packages" +COMPOSE_PKI_RA_PACKAGES="compose_pki_ra_packages" +COMPOSE_PKI_TPS_PACKAGES="compose_pki_tps_packages" +COMPOSE_PKI_CONSOLE_PACKAGES="compose_pki_console_packages" + +# Establish 'packages' directories variables +PKI_PACKAGES_DIR="${PKI_PWD}/packages" +PKI_DOGTAG_THEME_PACKAGES_DIR="${PKI_PWD}/packages.dogtag_theme" +PKI_CORE_PACKAGES_DIR="${PKI_PWD}/packages.core" +PKI_RA_PACKAGES_DIR="${PKI_PWD}/packages.ra" +PKI_TPS_PACKAGES_DIR="${PKI_PWD}/packages.tps" +PKI_CONSOLE_PACKAGES_DIR="${PKI_PWD}/packages.console" + +# Establish PKI theme package names +PKI_COMMON_THEME=${PKI_FLAVOR}-pki-common-theme${RPM_EXT} +PKI_CA_THEME=${PKI_FLAVOR}-pki-ca-theme${RPM_EXT} +PKI_KRA_THEME=${PKI_FLAVOR}-pki-kra-theme${RPM_EXT} +PKI_OCSP_THEME=${PKI_FLAVOR}-pki-ocsp-theme${RPM_EXT} +PKI_RA_THEME=${PKI_FLAVOR}-pki-ra-theme${RPM_EXT} +PKI_TKS_THEME=${PKI_FLAVOR}-pki-tks-theme${RPM_EXT} +PKI_TPS_THEME=${PKI_FLAVOR}-pki-tps-theme${RPM_EXT} +PKI_CONSOLE_THEME=${PKI_FLAVOR}-pki-console-theme${RPM_EXT} + +# Establish PKI core package names +PKI_SETUP=pki-setup${RPM_EXT} +PKI_SYMKEY=pki-symkey${RPM_EXT} +PKI_NATIVE_TOOLS=pki-native-tools${RPM_EXT} +PKI_UTIL=pki-util${RPM_EXT} +PKI_UTIL_JAVADOC=pki-util-javadoc${RPM_EXT} +PKI_JAVA_TOOLS=pki-java-tools${RPM_EXT} +PKI_JAVA_TOOLS_JAVADOC=pki-java-tools-javadoc${RPM_EXT} +PKI_COMMON=pki-common${RPM_EXT} +PKI_COMMON_JAVADOC=pki-common-javadoc${RPM_EXT} +PKI_SELINUX=pki-selinux${RPM_EXT} +PKI_CA=pki-ca${RPM_EXT} +PKI_KRA=pki-kra${RPM_EXT} +PKI_OCSP=pki-ocsp${RPM_EXT} +PKI_TKS=pki-tks${RPM_EXT} +PKI_SILENT=pki-silent${RPM_EXT} + +# Establish PKI ra package names +PKI_RA=pki-ra${RPM_EXT} + +# Establish PKI tps package names +PKI_TPS=pki-tps${RPM_EXT} + +# Establish PKI console package names +PKI_CONSOLE=pki-console${RPM_EXT} + +# Always start with new package directories +rm -rf ${PKI_PACKAGES_DIR} +rm -rf ${PKI_DOGTAG_THEME_PACKAGES_DIR} +rm -rf ${PKI_CORE_PACKAGES_DIR} +rm -rf ${PKI_RA_PACKAGES_DIR} +rm -rf ${PKI_TPS_PACKAGES_DIR} +rm -rf ${PKI_CONSOLE_PACKAGES_DIR} + +# Compose and install 'dogtag-pki-theme' packages +cd ${PKI_PWD} +${PKI_COMPOSE_SCRIPTS_DIR}/${COMPOSE_DOGTAG_PKI_THEME_PACKAGES} rpms +mv ${PKI_PACKAGES_DIR} ${PKI_DOGTAG_THEME_PACKAGES_DIR} +cd ${PKI_DOGTAG_THEME_PACKAGES_DIR}/${RPM_DIR}/${NOARCH} +${PKI_SUDO} ${YUM_EXE} ${YUM_EXE_OPTIONS} ${PKI_COMMON_THEME} ${PKI_CA_THEME} ${PKI_KRA_THEME} ${PKI_OCSP_THEME} ${PKI_RA_THEME} ${PKI_TKS_THEME} ${PKI_TPS_THEME} ${PKI_CONSOLE_THEME} + +# Compose and install 'pki-core' packages +cd ${PKI_PWD} +${PKI_COMPOSE_SCRIPTS_DIR}/${COMPOSE_PKI_CORE_PACKAGES} hybrid_rpms +mv ${PKI_PACKAGES_DIR} ${PKI_CORE_PACKAGES_DIR} +cd ${PKI_CORE_PACKAGES_DIR}/${RPM_DIR} +mkdir -p ${PKI_CORE_PACKAGES_DIR}/${RPM_DIR}/${COMBINED} +cp -p ${NOARCH}/*.rpm ${PKI_ARCH}/*.rpm ${PKI_CORE_PACKAGES_DIR}/${RPM_DIR}/${COMBINED} +cd ${PKI_CORE_PACKAGES_DIR}/${RPM_DIR}/${COMBINED} +${PKI_SUDO} ${YUM_EXE} ${YUM_EXE_OPTIONS} ${PKI_SETUP} ${PKI_SYMKEY} ${PKI_NATIVE_TOOLS} ${PKI_UTIL} ${PKI_UTIL_JAVADOC} ${PKI_JAVA_TOOLS} ${PKI_JAVA_TOOLS_JAVADOC} ${PKI_COMMON} ${PKI_COMMON_JAVADOC} ${PKI_SELINUX} ${PKI_CA} ${PKI_SILENT} + +# Compose and install 'pki-ra' packages +cd ${PKI_PWD} +${PKI_COMPOSE_SCRIPTS_DIR}/${COMPOSE_PKI_RA_PACKAGES} rpms +mv ${PKI_PACKAGES_DIR} ${PKI_RA_PACKAGES_DIR} +cd ${PKI_RA_PACKAGES_DIR}/${RPM_DIR}/${NOARCH} +${PKI_SUDO} ${YUM_EXE} ${YUM_EXE_OPTIONS} ${PKI_RA} + +# Compose and install 'pki-tps' packages +cd ${PKI_PWD} +${PKI_COMPOSE_SCRIPTS_DIR}/${COMPOSE_PKI_TPS_PACKAGES} rpms +mv ${PKI_PACKAGES_DIR} ${PKI_TPS_PACKAGES_DIR} +cd ${PKI_TPS_PACKAGES_DIR}/${RPM_DIR}/${PKI_ARCH} +${PKI_SUDO} ${YUM_EXE} ${YUM_EXE_OPTIONS} ${PKI_TPS} + +# Compose and install 'pki-console' packages +cd ${PKI_PWD} +${PKI_COMPOSE_SCRIPTS_DIR}/${COMPOSE_PKI_CONSOLE_PACKAGES} rpms +mv ${PKI_PACKAGES_DIR} ${PKI_CONSOLE_PACKAGES_DIR} +cd ${PKI_CONSOLE_PACKAGES_DIR}/${RPM_DIR}/${NOARCH} +${PKI_SUDO} ${YUM_EXE} ${YUM_EXE_OPTIONS} ${PKI_CONSOLE} + diff --git a/scripts/compose_dogtag_pki_meta_packages b/scripts/compose_dogtag_pki_meta_packages new file mode 100755 index 000000000..a31532192 --- /dev/null +++ b/scripts/compose_dogtag_pki_meta_packages @@ -0,0 +1,78 @@ +#!/bin/bash +# BEGIN COPYRIGHT BLOCK +# (C) 2010 Red Hat, Inc. +# All rights reserved. +# END COPYRIGHT BLOCK + +## +## Include common 'compose' functions +## + +COMPOSE_PWD=`dirname $0` + + +## 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 packages directory for 'dogtag-pki' META packages +## + +PKI_PACKAGES="${PKI_PWD}/packages" + + +## +## Specify 'dogtag-pki' META functions +## + +create_packages_directory() +{ + printf "Creating top-level 'packages' directory . . . " + mkdir -p ${PKI_PACKAGES} + printf "done.\n" +} + +create_META_package_directories() +{ + printf "Creating 'dogtag-pki' META package directories . . . " + mkdir -p ${PKI_PACKAGES} + mkdir -p ${PKI_PACKAGES}/BUILD + mkdir -p ${PKI_PACKAGES}/BUILDROOT + mkdir -p ${PKI_PACKAGES}/RPMS + mkdir -p ${PKI_PACKAGES}/SOURCES + mkdir -p ${PKI_PACKAGES}/SPECS + mkdir -p ${PKI_PACKAGES}/SRPMS + printf "done.\n" +} + +build_specified_META_package() +{ + package=$1 + spec_file_path="${PKI_PWD}/pki/specs" + spec_file="${package}.spec" + + printf "BEGIN: Building '${package}' META package . . .\n" + cp ${spec_file_path}/${spec_file} ${PKI_PACKAGES}/SPECS + rpmbuild --define "_topdir ${PKI_PACKAGES}" -ba --clean ${PKI_PACKAGES}/SPECS/${spec_file} > /dev/null 2>&1 + printf "END: Building '${package}' META package.\n" +} + + +## +## Build the 'dogtag-pki' META package +## + +create_packages_directory +create_META_package_directories +build_specified_META_package dogtag-pki + diff --git a/scripts/compose_dogtag_pki_theme_packages b/scripts/compose_dogtag_pki_theme_packages new file mode 100755 index 000000000..4eefe240d --- /dev/null +++ b/scripts/compose_dogtag_pki_theme_packages @@ -0,0 +1,196 @@ +#!/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 'dogtag-pki' name and version information +## + +DOGTAG_PKI_THEME="dogtag-pki-theme" +DOGTAG_PKI_THEME_VERSION="10.0.0.a1" + + +## +## Establish the SOURCE files/directories of the 'dogtag-pki' source directory +## + +PKI_SPECS_FILE="${PKI_DIR}/specs/${DOGTAG_PKI_THEME}.spec" +PKI_COMPONENT_LIST="test common-ui ca-ui kra-ui ocsp-ui tks-ui ra-ui tps-ui console-ui" + + +## +## Establish the TARGET files/directories of the 'dogtag-pki' source/spec files +## + +PKI_PACKAGES="${PKI_PWD}/packages" +DOGTAG_PKI_THEME_BUILD_DIR="${PKI_PACKAGES}/BUILD" +DOGTAG_PKI_THEME_RPMS_DIR="${PKI_PACKAGES}/RPMS" +DOGTAG_PKI_THEME_SOURCES_DIR="${PKI_PACKAGES}/SOURCES" +DOGTAG_PKI_THEME_SPECS_DIR="${PKI_PACKAGES}/SPECS" +DOGTAG_PKI_THEME_SRPMS_DIR="${PKI_PACKAGES}/SRPMS" + +DOGTAG_PKI_THEME_TARBALL="${DOGTAG_PKI_THEME}-${DOGTAG_PKI_THEME_VERSION}.tar.gz" +DOGTAG_PKI_THEME_SPEC_FILE="${DOGTAG_PKI_THEME_SPECS_DIR}/${DOGTAG_PKI_THEME}.spec" +DOGTAG_PKI_THEME_PACKAGE_SCRIPT="${PKI_PACKAGES}/package_${DOGTAG_PKI_THEME}" +DOGTAG_PKI_THEME_PACKAGE_COMMAND="${RPMBUILD_CMD} SPECS/${DOGTAG_PKI_THEME}.spec" + +DOGTAG_PKI_THEME_STAGING_DIR="${PKI_PACKAGES}/staging" +DOGTAG_PKI_THEME_DIR="${DOGTAG_PKI_THEME_STAGING_DIR}/${DOGTAG_PKI_THEME}-${DOGTAG_PKI_THEME_VERSION}" +DOGTAG_PKI_THEME_DOGTAG_DIR="${DOGTAG_PKI_THEME_DIR}/dogtag" + + +## +## Always create a top-level 'packages' directory +## + +mkdir -p ${PKI_PACKAGES} + + + +## +## Always create 'dogtag-pki' package directories +## + +mkdir -p ${DOGTAG_PKI_THEME_BUILD_DIR} +mkdir -p ${DOGTAG_PKI_THEME_RPMS_DIR} +mkdir -p ${DOGTAG_PKI_THEME_SOURCES_DIR} +mkdir -p ${DOGTAG_PKI_THEME_SPECS_DIR} +mkdir -p ${DOGTAG_PKI_THEME_SRPMS_DIR} + + +## +## Always start with new 'dogtag-pki' package files +## + +rm -rf ${DOGTAG_PKI_THEME_BUILD_DIR}/${DOGTAG_PKI_THEME}-${DOGTAG_PKI_THEME_VERSION} +rm -f ${DOGTAG_PKI_THEME_RPMS_DIR}/${DOGTAG_PKI_THEME}-${DOGTAG_PKI_THEME_VERSION}*.rpm +rm -f ${DOGTAG_PKI_THEME_SOURCES_DIR}/${DOGTAG_PKI_THEME_TARBALL} +rm -f ${DOGTAG_PKI_THEME_SPEC_FILE} +rm -f ${DOGTAG_PKI_THEME_SRPMS_DIR}/${DOGTAG_PKI_THEME}-${DOGTAG_PKI_THEME_VERSION}*.rpm + + +## +## Copy a new 'dogtag-pki' spec file from the +## current contents of the PKI working repository +## + +cp -p ${PKI_SPECS_FILE} ${DOGTAG_PKI_THEME_SPECS_DIR} + + +## +## If specified, copy all Patches from the spec file URL to SOURCES +## + +if [ ${FETCH_PATCH_FILES} -eq 1 ] ; then + Fetch_Patch_Files ${PKI_SPECS_FILE} ${DOGTAG_PKI_THEME_SOURCES_DIR} +fi + + +## +## Copy the specified Source Tarball from the spec file URL to SOURCES, or +## Generate a fresh Source Tarball from the local source +## + +if [ ${FETCH_SOURCE_TARBALL} -eq 1 ] ; then + Fetch_Source_Tarball ${PKI_SPECS_FILE} ${DOGTAG_PKI_THEME_SOURCES_DIR} +else + ## + ## Always start with a new 'dogtag-pki' staging directory + ## + + rm -rf ${DOGTAG_PKI_THEME_STAGING_DIR} + + + ## + ## To generate the 'dogtag-pki' tarball, construct a staging area + ## consisting of the 'dogtag-pki' source components from the + ## current contents of the PKI working repository + ## + + mkdir -p ${DOGTAG_PKI_THEME_DIR} + cd ${PKI_DIR} + for file in "${PKI_FILE_LIST}" ; + do + cp -p ${file} ${DOGTAG_PKI_THEME_DIR} + done + find ${PKI_CMAKE_DIR} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${DOGTAG_PKI_THEME_DIR} > /dev/null 2>&1 + cd - > /dev/null 2>&1 + + mkdir -p ${DOGTAG_PKI_THEME_DOGTAG_DIR} + cd ${PKI_DOGTAG_DIR} + cp -p ${PKI_DOGTAG_MANIFEST} ${DOGTAG_PKI_THEME_DOGTAG_DIR} + for component in "${PKI_COMPONENT_LIST}" ; + do + find ${component} \ + -name .svn -prune -o \ + -name *.spec -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${DOGTAG_PKI_THEME_DOGTAG_DIR} > /dev/null 2>&1 + done + cd - > /dev/null 2>&1 + + + ## + ## Create the 'dogtag-pki' tarball + ## + + mkdir -p ${DOGTAG_PKI_THEME_SOURCES_DIR} + cd ${DOGTAG_PKI_THEME_STAGING_DIR} + gtar -zcvf ${DOGTAG_PKI_THEME_TARBALL} \ + "${DOGTAG_PKI_THEME}-${DOGTAG_PKI_THEME_VERSION}" > /dev/null 2>&1 + mv ${DOGTAG_PKI_THEME_TARBALL} ${DOGTAG_PKI_THEME_SOURCES_DIR} + cd - > /dev/null 2>&1 + + + ## + ## Always remove the PKI staging area + ## + + rm -rf ${DOGTAG_PKI_THEME_STAGING_DIR} +fi + + +## +## Always generate a fresh 'dogtag-pki' package script +## + +rm -rf ${DOGTAG_PKI_THEME_PACKAGE_SCRIPT} +printf "#!/bin/bash\n\n" > ${DOGTAG_PKI_THEME_PACKAGE_SCRIPT} +printf "${DOGTAG_PKI_THEME_PACKAGE_COMMAND}\n\n" >> ${DOGTAG_PKI_THEME_PACKAGE_SCRIPT} +chmod 775 ${DOGTAG_PKI_THEME_PACKAGE_SCRIPT} + + +## +## Automatically invoke RPM/SRPM creation +## + +cd ${PKI_PACKAGES} ; +bash ./package_${DOGTAG_PKI_THEME} | tee package_${DOGTAG_PKI_THEME}.log 2>&1 + diff --git a/scripts/compose_functions b/scripts/compose_functions new file mode 100644 index 000000000..22c128df1 --- /dev/null +++ b/scripts/compose_functions @@ -0,0 +1,275 @@ +## +## Obtain various platform information +## + +OS=`uname` +if [ "${OS}" != "Linux" ] ; then + printf "'$0' is ONLY available on '${OS}'!\n" + exit 255 +fi + +PLATFORM=`uname -p` +if [ "${PLATFORM}" = "i686" ] ; then + ARCHITECTURE="32-bit" +elif [ "${PLATFORM}" = "x86_64" ] ; then + ARCHITECTURE="64-bit" +else + printf "'$0' is ONLY available on 'i686' or 'x86_64' platforms!\n" + exit 255 +fi + +if [ -f "/etc/redhat-release" ] ; then + DISTRIBUTION=`cat /etc/redhat-release | cut -c1-7` + DIST_VERSION=`cat /etc/redhat-release | tr -d [:alpha:][:blank:][\(\)]` + if [ "${DISTRIBUTION}" = "Fedora " ] ; then + MESSAGE="[built for ${ARCHITECTURE} Fedora ${DIST_VERSION}]" + elif [ "${DISTRIBUTION}" = "Red Hat" ] ; then + MESSAGE="[built for ${ARCHITECTURE} Red Hat ${DIST_VERSION}]" + else + printf "'$0' is ONLY available on 'Fedora' or 'Red Hat' " + printf "distributions!\n" + exit 255 + fi +else + printf "'$0' is ONLY available on 'Fedora' or 'Red Hat' distributions!\n" + exit 255 +fi + + +## +## Establish various shared variables +## + +PKI_DIR="pki" +export PKI_DIR + +PKI_BASE_DIR="${PKI_DIR}/base" +export PKI_BASE_DIR + +PKI_DOGTAG_DIR="${PKI_DIR}/dogtag" +export PKI_DOGTAG_DIR + +PKI_FILE_LIST="CMakeLists.txt COPYING CPackConfig.cmake ConfigureChecks.cmake DefineOptions.cmake README cmake_uninstall.cmake.in config.h.cmake" +export PKI_FILE_LIST + +PKI_CMAKE_DIR="cmake" +export PKI_CMAKE_DIR + +PKI_BASE_MANIFEST="CMakeLists.txt" +export PKI_BASE_MANIFEST + +PKI_DOGTAG_MANIFEST="CMakeLists.txt" +export PKI_DOGTAG_MANIFEST + + +## +## Usage statement +## + +Usage() +{ + printf "\n" + printf "Usage: $0 <target>\n\n" + printf " where <target> is one of the following:\n\n" + printf " srpm - copies a spec file from local source,\n" + printf " generates a tarball from local source, " + printf "and\n" + printf " produces an SRPM\n" + printf " [suitable for use by 'mock']\n\n" + printf " rpms - copies a spec file from local source,\n" + printf " generates a tarball from local source, " + printf "and\n" + printf " produces an SRPM and one or more RPMS\n" + printf " ${MESSAGE}\n\n" + printf " hybrid_srpm - copies a spec file from local source,\n" + printf " generates a tarball from local source,\n" + printf " fetches patches from the spec's URL, " + printf "and\n" + printf " produces an SRPM\n" + printf " [suitable for use by 'mock']\n\n" + printf " hybrid_rpms - copies a spec file from local source,\n" + printf " generates a tarball from local source,\n" + printf " fetches all patches from the spec's URL," + printf " and\n" + printf " produces an SRPM and one or more RPMS\n" + printf " ${MESSAGE}\n\n" + printf " patched_srpm - copies a spec file from local source,\n" + printf " fetches a tarball from the spec's URL,\n" + printf " fetches all patches from the spec's URL," + printf " and\n" + printf " produces an SRPM\n" + printf " [suitable for use by 'mock']\n\n" + printf " patched_rpms - copies a spec file from local source,\n" + printf " fetches a tarball from the spec's URL,\n" + printf " fetches all patches from the spec's URL," + printf " and\n" + printf " produces an SRPM and one or more RPMS\n" + printf " ${MESSAGE}\n\n" +} + + +## +## Copy Specified Patches to SOURCES +## +Fetch_Patch_Files() +{ + if [ $# -ne 2 ] ; then + Usage + exit 255 + fi + + SPECFILE=$1 + TARGET_DIR=$2 + + if [ ! -f ${SPECFILE} ] ; then + printf "ERROR: '${SPECFILE}' is missing!\n\n" + Usage + exit 255 + elif [ ! -d ${TARGET_DIR} ] ; then + printf "ERROR: '${TARGET_DIR}' does NOT exist!\n\n" + Usage + exit 255 + fi + + component_name_marker="Name" + component_version_marker="Version" + component_source_marker="Source" + component_patch_marker="Patch" + + component_name="" + component_version="" + component_source="" + component_url="" + component_patch="" + + exec < ${SPECFILE} + while read line; do + entry=`echo $line | cut -d: -f 1` + if [ "${entry:0:4}" = "${component_name_marker}" ] ; then + component_name=`echo $line | cut -d' ' -f 2` + elif [ "${entry:0:7}" = "${component_version_marker}" ] ; then + component_version=`echo $line | cut -d' ' -f 2` + elif [ "${entry:0:6}" = "${component_source_marker}" ] ; then + value=`echo $line | cut -d' ' -f 2` + component_source=`echo $value | sed -e "s/\%{name}/${component_name}/g" -e "s/\%{version}/${component_version}/g"` + component_url=`dirname ${component_source}` + elif [ "${entry:0:5}" = "${component_patch_marker}" ] ; then + if [ ${component_url} != "" ] ; then + value=`echo $line | cut -d' ' -f 2` + component_patch=${component_url}"/"`echo $value | sed -e "s/\%{name}/${component_name}/g" -e "s/\%{version}/${component_version}/g"` + wget -q -O ${TARGET_DIR}/`basename ${component_patch}` ${component_patch} + if [ $? -ne 0 ] ; then + printf "ERROR: Failed to download '${component_patch}'!\n\n" + Usage + exit 255 + elif [ ! -f ${TARGET_DIR}/`basename ${component_patch}` ] ; then + printf "ERROR: Failed to save '${TARGET_DIR}/`basename ${component_patch}`'!\n\n" + Usage + exit 255 + fi + else + printf "ERROR: '${component_source_marker}' MUST be specified PRIOR to '${component_patch_marker}'!\n\n" + Usage + exit 255 + fi + fi + done +} + + +## +## Copy Specified Source Tarball to SOURCES +## +Fetch_Source_Tarball() +{ + if [ $# -ne 2 ] ; then + Usage + exit 255 + fi + + SPECFILE=$1 + TARGET_DIR=$2 + + if [ ! -f ${SPECFILE} ] ; then + printf "ERROR: '${SPECFILE}' is missing!\n\n" + Usage + exit 255 + elif [ ! -d ${TARGET_DIR} ] ; then + printf "ERROR: '${TARGET_DIR}' does NOT exist!\n\n" + Usage + exit 255 + fi + + component_name_marker="Name" + component_version_marker="Version" + component_tarball_marker="Source" + + component_name="" + component_version="" + component_tarball="" + + exec < ${SPECFILE} + while read line; do + entry=`echo $line | cut -d: -f 1` + if [ "${entry:0:4}" = "${component_name_marker}" ] ; then + component_name=`echo $line | cut -d' ' -f 2` + elif [ "${entry:0:7}" = "${component_version_marker}" ] ; then + component_version=`echo $line | cut -d' ' -f 2` + elif [ "${entry:0:6}" = "${component_tarball_marker}" ] ; then + value=`echo $line | cut -d' ' -f 2` + component_tarball=`echo $value | sed -e "s/\%{name}/${component_name}/g" -e "s/\%{version}/${component_version}/g"` + wget -q -O ${TARGET_DIR}/`basename ${component_tarball}` ${component_tarball} + if [ $? -ne 0 ] ; then + printf "ERROR: Failed to download '${component_tarball}'!\n\n" + Usage + exit 255 + elif [ ! -f ${TARGET_DIR}/`basename ${component_tarball}` ] ; then + printf "ERROR: Failed to save '${TARGET_DIR}/`basename ${component_tarball}`'!\n\n" + Usage + exit 255 + fi + fi + done +} + + +## +## Check for command line argument validity +## + +if [ $# -ne 1 ] ; then + Usage + exit 255 +fi + +if [ $1 = "srpm" ] ; then + RPMBUILD_CMD="rpmbuild --define \"_topdir \`pwd\`\" -bs" + FETCH_SOURCE_TARBALL=0 + FETCH_PATCH_FILES=0 +elif [ $1 = "hybrid_srpm" ] ; then + RPMBUILD_CMD="rpmbuild --define \"_topdir \`pwd\`\" -bs" + FETCH_SOURCE_TARBALL=0 + FETCH_PATCH_FILES=1 +elif [ $1 = "patched_srpm" ] ; then + RPMBUILD_CMD="rpmbuild --define \"_topdir \`pwd\`\" -bs" + FETCH_SOURCE_TARBALL=1 + FETCH_PATCH_FILES=1 +elif [ $1 = "rpms" ] ; then + RPMBUILD_CMD="rpmbuild --define \"_topdir \`pwd\`\" -ba" + FETCH_SOURCE_TARBALL=0 + FETCH_PATCH_FILES=0 +elif [ $1 = "hybrid_rpms" ] ; then + RPMBUILD_CMD="rpmbuild --define \"_topdir \`pwd\`\" -ba" + FETCH_SOURCE_TARBALL=0 + FETCH_PATCH_FILES=1 +elif [ $1 = "patched_rpms" ] ; then + RPMBUILD_CMD="rpmbuild --define \"_topdir \`pwd\`\" -ba" + FETCH_SOURCE_TARBALL=1 + FETCH_PATCH_FILES=1 +else + Usage + exit 255 +fi +export RPMBUILD_CMD + + diff --git a/scripts/compose_ipa_pki_theme_packages b/scripts/compose_ipa_pki_theme_packages new file mode 100755 index 000000000..f2ef9042b --- /dev/null +++ b/scripts/compose_ipa_pki_theme_packages @@ -0,0 +1,217 @@ +#!/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 'ipa-pki' name and version information +## + +IPA_PKI_THEME="ipa-pki-theme" +IPA_PKI_THEME_VERSION="10.0.0.a1" + + +## +## Establish the SOURCE files/directories of the 'ipa-pki' source directory +## + +PKI_SPECS_FILE="${PKI_DIR}/specs/${IPA_PKI_THEME}.spec" +PKI_COMPONENT_LIST="common-ui ca-ui" + + +## +## Establish the TARGET files/directories of the 'ipa-pki' source/spec files +## + +PKI_PACKAGES="${PKI_PWD}/packages" +IPA_PKI_THEME_BUILD_DIR="${PKI_PACKAGES}/BUILD" +IPA_PKI_THEME_RPMS_DIR="${PKI_PACKAGES}/RPMS" +IPA_PKI_THEME_SOURCES_DIR="${PKI_PACKAGES}/SOURCES" +IPA_PKI_THEME_SPECS_DIR="${PKI_PACKAGES}/SPECS" +IPA_PKI_THEME_SRPMS_DIR="${PKI_PACKAGES}/SRPMS" + +IPA_PKI_THEME_TARBALL="${IPA_PKI_THEME}-${IPA_PKI_THEME_VERSION}.tar.gz" +IPA_PKI_THEME_SPEC_FILE="${IPA_PKI_THEME_SPECS_DIR}/${IPA_PKI_THEME}.spec" +IPA_PKI_THEME_PACKAGE_SCRIPT="${PKI_PACKAGES}/package_${IPA_PKI_THEME}" +IPA_PKI_THEME_PACKAGE_COMMAND="${RPMBUILD_CMD} SPECS/${IPA_PKI_THEME}.spec" + +IPA_PKI_THEME_STAGING_DIR="${PKI_PACKAGES}/staging" +IPA_PKI_THEME_DIR="${IPA_PKI_THEME_STAGING_DIR}/${IPA_PKI_THEME}-${IPA_PKI_THEME_VERSION}" +IPA_PKI_THEME_DOGTAG_DIR="${IPA_PKI_THEME_DIR}/dogtag" +IPA_PKI_THEME_DOGTAG_SUBDIR="${IPA_PKI_THEME}-${IPA_PKI_THEME_VERSION}/dogtag" + + +## +## Always create a top-level 'packages' directory +## + +mkdir -p ${PKI_PACKAGES} + + +## +## Always create 'ipa-pki' package directories +## + +mkdir -p ${IPA_PKI_THEME_BUILD_DIR} +mkdir -p ${IPA_PKI_THEME_RPMS_DIR} +mkdir -p ${IPA_PKI_THEME_SOURCES_DIR} +mkdir -p ${IPA_PKI_THEME_SPECS_DIR} +mkdir -p ${IPA_PKI_THEME_SRPMS_DIR} + + +## +## Always start with new 'ipa-pki' package files +## + +rm -rf ${IPA_PKI_THEME_BUILD_DIR}/${IPA_PKI_THEME}-${IPA_PKI_THEME_VERSION} +rm -f ${IPA_PKI_THEME_RPMS_DIR}/${IPA_PKI_THEME}-${IPA_PKI_THEME_VERSION}*.rpm +rm -f ${IPA_PKI_THEME_SOURCES_DIR}/${IPA_PKI_THEME_TARBALL} +rm -f ${IPA_PKI_THEME_SPEC_FILE} +rm -f ${IPA_PKI_THEME_SRPMS_DIR}/${IPA_PKI_THEME}-${IPA_PKI_THEME_VERSION}*.rpm + + +## +## Copy a new 'ipa-pki' spec file from the +## current contents of the PKI working repository +## + +cp -p ${PKI_SPECS_FILE} ${IPA_PKI_THEME_SPECS_DIR} + + +## +## If specified, copy all Patches from the spec file URL to SOURCES +## + +if [ ${FETCH_PATCH_FILES} -eq 1 ] ; then + Fetch_Patch_Files ${PKI_SPECS_FILE} ${IPA_PKI_THEME_SOURCES_DIR} +fi + + +## +## Copy the specified Source Tarball from the spec file URL to SOURCES, or +## Generate a fresh Source Tarball from the local source +## + +if [ ${FETCH_SOURCE_TARBALL} -eq 1 ] ; then + Fetch_Source_Tarball ${PKI_SPECS_FILE} ${IPA_PKI_THEME_SOURCES_DIR} +else + ## + ## Always start with a new 'ipa-pki' staging directory + ## + + rm -rf ${IPA_PKI_THEME_STAGING_DIR} + + + ## + ## To generate the 'ipa-pki' tarball, construct a staging area + ## consisting of the 'ipa-pki' source components from the + ## current contents of the PKI working repository + ## + + mkdir -p ${IPA_PKI_THEME_DIR} + cd ${PKI_DIR} + for file in "${PKI_FILE_LIST}" ; + do + cp -p ${file} ${IPA_PKI_THEME_DIR} + done + find ${PKI_CMAKE_DIR} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${IPA_PKI_THEME_DIR} > /dev/null 2>&1 + cd - > /dev/null 2>&1 + + mkdir -p ${IPA_PKI_THEME_DOGTAG_DIR} + cd ${PKI_DOGTAG_DIR} + cp -p ${PKI_DOGTAG_MANIFEST} ${IPA_PKI_THEME_DOGTAG_DIR} + for component in "${PKI_COMPONENT_LIST}" ; + do + find ${component} \ + -name .svn -prune -o \ + -name *.spec -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${IPA_PKI_THEME_DOGTAG_DIR} > /dev/null 2>&1 + done + cd - > /dev/null 2>&1 + + + ## + ## Create the 'ipa-pki' tarball + ## + + mkdir -p ${IPA_PKI_THEME_SOURCES_DIR} + cd ${IPA_PKI_THEME_STAGING_DIR} + # Remove all '*.htm*' web pages and 'Dogtag-specific' graphics + # Map 'Dogtag' color '#225580' to black + # Map 'Dogtag' color '#4f52b5' to black + # Map 'DCS' text to 'XXX' + # Map 'dogtag' text to 'XXXXXX' + # Map 'Dogtag' text to 'XXXXXX' + # Map 'DOGTAG' text to 'XXXXXX' + # Map 'Fedora' text to 'XXXXXX' + # Map 'FEDORA' text to 'XXXXXX' + find ${IPA_PKI_THEME_DOGTAG_SUBDIR} -name "favicon.ico" -print -or \ + -name "*.htm" -print -or \ + -name "*.html" -print -or \ + -name "logo_header.gif" -print | xargs rm ; + find ${IPA_PKI_THEME_DOGTAG_SUBDIR} -type f -exec sed -i 's/#225580/#000000/g' {} \; ; + find ${IPA_PKI_THEME_DOGTAG_SUBDIR} -type f -exec sed -i 's/#4f52b5/#000000/g' {} \; ; + find ${IPA_PKI_THEME_DOGTAG_SUBDIR} -type f -exec sed -i 's/DCS/XXX/g' {} \; ; + find ${IPA_PKI_THEME_DOGTAG_SUBDIR} -type f -exec sed -i 's/dogtag/XXXXXX/g' {} \; ; + find ${IPA_PKI_THEME_DOGTAG_SUBDIR} -type f -exec sed -i 's/Dogtag/XXXXXX/g' {} \; ; + find ${IPA_PKI_THEME_DOGTAG_SUBDIR} -type f -exec sed -i 's/DOGTAG/XXXXXX/g' {} \; ; + find ${IPA_PKI_THEME_DOGTAG_SUBDIR} -type f -exec sed -i 's/Fedora/XXXXXX/g' {} \; ; + find ${IPA_PKI_THEME_DOGTAG_SUBDIR} -type f -exec sed -i 's/FEDORA/XXXXXX/g' {} \; + gtar -zcvf ${IPA_PKI_THEME_TARBALL} \ + "${IPA_PKI_THEME}-${IPA_PKI_THEME_VERSION}" > /dev/null 2>&1 + mv ${IPA_PKI_THEME_TARBALL} ${IPA_PKI_THEME_SOURCES_DIR} + cd - > /dev/null 2>&1 + + + ## + ## Always remove the PKI staging area + ## + + rm -rf ${IPA_PKI_THEME_STAGING_DIR} +fi + + +## +## Always generate a fresh 'ipa-pki' package script +## + +rm -rf ${IPA_PKI_THEME_PACKAGE_SCRIPT} +printf "#!/bin/bash\n\n" > ${IPA_PKI_THEME_PACKAGE_SCRIPT} +printf "${IPA_PKI_THEME_PACKAGE_COMMAND}\n\n" >> ${IPA_PKI_THEME_PACKAGE_SCRIPT} +chmod 775 ${IPA_PKI_THEME_PACKAGE_SCRIPT} + + +## +## Automatically invoke RPM/SRPM creation +## + +cd ${PKI_PACKAGES} ; +bash ./package_${IPA_PKI_THEME} | tee package_${IPA_PKI_THEME}.log 2>&1 + diff --git a/scripts/compose_pki_console_packages b/scripts/compose_pki_console_packages new file mode 100755 index 000000000..a163525c3 --- /dev/null +++ b/scripts/compose_pki_console_packages @@ -0,0 +1,194 @@ +#!/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-console' name and version information +## + +PKI_CONSOLE="pki-console" +PKI_CONSOLE_VERSION="10.0.0.a1" + + +## +## Establish the SOURCE files/directories of the 'pki-console' source directory +## + +PKI_SPECS_FILE="${PKI_DIR}/specs/${PKI_CONSOLE}.spec" +PKI_COMPONENT_LIST="test console" + + +## +## Establish the TARGET files/directories of the 'pki-console' source/spec files +## + +PKI_PACKAGES="${PKI_PWD}/packages" +PKI_CONSOLE_BUILD_DIR="${PKI_PACKAGES}/BUILD" +PKI_CONSOLE_RPMS_DIR="${PKI_PACKAGES}/RPMS" +PKI_CONSOLE_SOURCES_DIR="${PKI_PACKAGES}/SOURCES" +PKI_CONSOLE_SPECS_DIR="${PKI_PACKAGES}/SPECS" +PKI_CONSOLE_SRPMS_DIR="${PKI_PACKAGES}/SRPMS" + +PKI_CONSOLE_TARBALL="${PKI_CONSOLE}-${PKI_CONSOLE_VERSION}.tar.gz" +PKI_CONSOLE_SPEC_FILE="${PKI_CONSOLE_SPECS_DIR}/${PKI_CONSOLE}.spec" +PKI_CONSOLE_PACKAGE_SCRIPT="${PKI_PACKAGES}/package_${PKI_CONSOLE}" +PKI_CONSOLE_PACKAGE_COMMAND="${RPMBUILD_CMD} SPECS/${PKI_CONSOLE}.spec" + +PKI_CONSOLE_STAGING_DIR="${PKI_PACKAGES}/staging" +PKI_CONSOLE_DIR="${PKI_CONSOLE_STAGING_DIR}/${PKI_CONSOLE}-${PKI_CONSOLE_VERSION}" +PKI_CONSOLE_BASE_DIR="${PKI_CONSOLE_DIR}/base" + + +## +## Always create a top-level 'packages' directory +## + +mkdir -p ${PKI_PACKAGES} + + +## +## Always create 'pki-console' package directories +## + +mkdir -p ${PKI_CONSOLE_BUILD_DIR} +mkdir -p ${PKI_CONSOLE_RPMS_DIR} +mkdir -p ${PKI_CONSOLE_SOURCES_DIR} +mkdir -p ${PKI_CONSOLE_SPECS_DIR} +mkdir -p ${PKI_CONSOLE_SRPMS_DIR} + + +## +## Always start with new 'pki-console' package files +## + +rm -rf ${PKI_CONSOLE_BUILD_DIR}/${PKI_CONSOLE}-${PKI_CONSOLE_VERSION} +rm -f ${PKI_CONSOLE_RPMS_DIR}/${PKI_CONSOLE}-${PKI_CONSOLE_VERSION}*.rpm +rm -f ${PKI_CONSOLE_SOURCES_DIR}/${PKI_CONSOLE_TARBALL} +rm -f ${PKI_CONSOLE_SPEC_FILE} +rm -f ${PKI_CONSOLE_SRPMS_DIR}/${PKI_CONSOLE}-${PKI_CONSOLE_VERSION}*.rpm + + +## +## Copy a new 'pki-console' spec file from the +## current contents of the PKI working repository +## + +cp -p ${PKI_SPECS_FILE} ${PKI_CONSOLE_SPECS_DIR} + + +## +## If specified, copy all Patches from the spec file URL to SOURCES +## + +if [ ${FETCH_PATCH_FILES} -eq 1 ] ; then + Fetch_Patch_Files ${PKI_SPECS_FILE} ${PKI_CONSOLE_SOURCES_DIR} +fi + + +## +## Copy the specified Source Tarball from the spec file URL to SOURCES, or +## Generate a fresh Source Tarball from the local source +## + +if [ ${FETCH_SOURCE_TARBALL} -eq 1 ] ; then + Fetch_Source_Tarball ${PKI_SPECS_FILE} ${PKI_CONSOLE_SOURCES_DIR} +else + ## + ## Always start with a new 'pki-console' staging directory + ## + + rm -rf ${PKI_CONSOLE_STAGING_DIR} + + + ## + ## To generate the 'pki-console' tarball, construct a staging area + ## consisting of the 'pki-console' source components from the + ## current contents of the PKI working repository + ## + + mkdir -p ${PKI_CONSOLE_DIR} + cd ${PKI_DIR} + for file in "${PKI_FILE_LIST}" ; + do + cp -p ${file} ${PKI_CONSOLE_DIR} + done + find ${PKI_CMAKE_DIR} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${PKI_CONSOLE_DIR} > /dev/null 2>&1 + cd - > /dev/null 2>&1 + + mkdir -p ${PKI_CONSOLE_BASE_DIR} + cd ${PKI_BASE_DIR} + cp -p ${PKI_BASE_MANIFEST} ${PKI_CONSOLE_BASE_DIR} + for component in "${PKI_COMPONENT_LIST}" ; + do + find ${component} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${PKI_CONSOLE_BASE_DIR} > /dev/null 2>&1 + done + cd - > /dev/null 2>&1 + + + ## + ## Create the 'pki-console' tarball + ## + + mkdir -p ${PKI_CONSOLE_SOURCES_DIR} + cd ${PKI_CONSOLE_STAGING_DIR} + gtar -zcvf ${PKI_CONSOLE_TARBALL} \ + "${PKI_CONSOLE}-${PKI_CONSOLE_VERSION}" > /dev/null 2>&1 + mv ${PKI_CONSOLE_TARBALL} ${PKI_CONSOLE_SOURCES_DIR} + cd - > /dev/null 2>&1 + + + ## + ## Always remove the PKI staging area + ## + + rm -rf ${PKI_CONSOLE_STAGING_DIR} +fi + + +## +## Always generate a fresh 'pki-console' package script +## + +rm -rf ${PKI_CONSOLE_PACKAGE_SCRIPT} +printf "#!/bin/bash\n\n" > ${PKI_CONSOLE_PACKAGE_SCRIPT} +printf "${PKI_CONSOLE_PACKAGE_COMMAND}\n\n" >> ${PKI_CONSOLE_PACKAGE_SCRIPT} +chmod 775 ${PKI_CONSOLE_PACKAGE_SCRIPT} + + +## +## Automatically invoke RPM/SRPM creation +## + +cd ${PKI_PACKAGES} ; +bash ./package_${PKI_CONSOLE} | tee package_${PKI_CONSOLE}.log 2>&1 + diff --git a/scripts/compose_pki_core_packages b/scripts/compose_pki_core_packages new file mode 100755 index 000000000..8e8395180 --- /dev/null +++ b/scripts/compose_pki_core_packages @@ -0,0 +1,194 @@ +#!/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-core' name and version information +## + +PKI_CORE="pki-core" +PKI_CORE_VERSION="10.0.0.a1" + + +## +## Establish the SOURCE files/directories of the 'pki-core' source directory +## + +PKI_SPECS_FILE="${PKI_DIR}/specs/${PKI_CORE}.spec" +PKI_COMPONENT_LIST="test deploy setup symkey native-tools util java-tools common selinux ca kra ocsp tks silent" + + +## +## Establish the TARGET files/directories of the 'pki-core' source/spec files +## + +PKI_PACKAGES="${PKI_PWD}/packages" +PKI_CORE_BUILD_DIR="${PKI_PACKAGES}/BUILD" +PKI_CORE_RPMS_DIR="${PKI_PACKAGES}/RPMS" +PKI_CORE_SOURCES_DIR="${PKI_PACKAGES}/SOURCES" +PKI_CORE_SPECS_DIR="${PKI_PACKAGES}/SPECS" +PKI_CORE_SRPMS_DIR="${PKI_PACKAGES}/SRPMS" + +PKI_CORE_TARBALL="${PKI_CORE}-${PKI_CORE_VERSION}.tar.gz" +PKI_CORE_SPEC_FILE="${PKI_CORE_SPECS_DIR}/${PKI_CORE}.spec" +PKI_CORE_PACKAGE_SCRIPT="${PKI_PACKAGES}/package_${PKI_CORE}" +PKI_CORE_PACKAGE_COMMAND="${RPMBUILD_CMD} SPECS/${PKI_CORE}.spec" + +PKI_CORE_STAGING_DIR="${PKI_PACKAGES}/staging" +PKI_CORE_DIR="${PKI_CORE_STAGING_DIR}/${PKI_CORE}-${PKI_CORE_VERSION}" +PKI_CORE_BASE_DIR="${PKI_CORE_DIR}/base" + + +## +## Always create a top-level 'packages' directory +## + +mkdir -p ${PKI_PACKAGES} + + +## +## Always create 'pki-core' package directories +## + +mkdir -p ${PKI_CORE_BUILD_DIR} +mkdir -p ${PKI_CORE_RPMS_DIR} +mkdir -p ${PKI_CORE_SOURCES_DIR} +mkdir -p ${PKI_CORE_SPECS_DIR} +mkdir -p ${PKI_CORE_SRPMS_DIR} + + +## +## Always start with new 'pki-core' package files +## + +rm -rf ${PKI_CORE_BUILD_DIR}/${PKI_CORE}-${PKI_CORE_VERSION} +rm -f ${PKI_CORE_RPMS_DIR}/${PKI_CORE}-${PKI_CORE_VERSION}*.rpm +rm -f ${PKI_CORE_SOURCES_DIR}/${PKI_CORE_TARBALL} +rm -f ${PKI_CORE_SPEC_FILE} +rm -f ${PKI_CORE_SRPMS_DIR}/${PKI_CORE}-${PKI_CORE_VERSION}*.rpm + + +## +## Copy a new 'pki-core' spec file from the +## current contents of the PKI working repository +## + +cp -p ${PKI_SPECS_FILE} ${PKI_CORE_SPECS_DIR} + + +## +## If specified, copy all Patches from the spec file URL to SOURCES +## + +if [ ${FETCH_PATCH_FILES} -eq 1 ] ; then + Fetch_Patch_Files ${PKI_SPECS_FILE} ${PKI_CORE_SOURCES_DIR} +fi + + +## +## Copy the specified Source Tarball from the spec file URL to SOURCES, or +## Generate a fresh Source Tarball from the local source +## + +if [ ${FETCH_SOURCE_TARBALL} -eq 1 ] ; then + Fetch_Source_Tarball ${PKI_SPECS_FILE} ${PKI_CORE_SOURCES_DIR} +else + ## + ## Always start with a new 'pki-core' staging directory + ## + + rm -rf ${PKI_CORE_STAGING_DIR} + + + ## + ## To generate the 'pki-core' tarball, construct a staging area + ## consisting of the 'pki-core' source components from the + ## current contents of the PKI working repository + ## + + mkdir -p ${PKI_CORE_DIR} + cd ${PKI_DIR} + for file in "${PKI_FILE_LIST}" ; + do + cp -p ${file} ${PKI_CORE_DIR} + done + find ${PKI_CMAKE_DIR} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${PKI_CORE_DIR} > /dev/null 2>&1 + cd - > /dev/null 2>&1 + + mkdir -p ${PKI_CORE_BASE_DIR} + cd ${PKI_BASE_DIR} + cp -p ${PKI_BASE_MANIFEST} ${PKI_CORE_BASE_DIR} + for component in "${PKI_COMPONENT_LIST}" ; + do + find ${component} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${PKI_CORE_BASE_DIR} > /dev/null 2>&1 + done + cd - > /dev/null 2>&1 + + + ## + ## Create the 'pki-core' tarball + ## + + mkdir -p ${PKI_CORE_SOURCES_DIR} + cd ${PKI_CORE_STAGING_DIR} + gtar -zcvf ${PKI_CORE_TARBALL} \ + "${PKI_CORE}-${PKI_CORE_VERSION}" > /dev/null 2>&1 + mv ${PKI_CORE_TARBALL} ${PKI_CORE_SOURCES_DIR} + cd - > /dev/null 2>&1 + + + ## + ## Always remove the PKI staging area + ## + + rm -rf ${PKI_CORE_STAGING_DIR} +fi + + +## +## Always generate a fresh 'pki-core' package script +## + +rm -rf ${PKI_CORE_PACKAGE_SCRIPT} +printf "#!/bin/bash\n\n" > ${PKI_CORE_PACKAGE_SCRIPT} +printf "${PKI_CORE_PACKAGE_COMMAND}\n\n" >> ${PKI_CORE_PACKAGE_SCRIPT} +chmod 775 ${PKI_CORE_PACKAGE_SCRIPT} + + +## +## Automatically invoke RPM/SRPM creation +## + +cd ${PKI_PACKAGES} ; +bash ./package_${PKI_CORE} | tee package_${PKI_CORE}.log 2>&1 + diff --git a/scripts/compose_pki_migrate_packages b/scripts/compose_pki_migrate_packages new file mode 100755 index 000000000..39789f897 --- /dev/null +++ b/scripts/compose_pki_migrate_packages @@ -0,0 +1,194 @@ +#!/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-migrate' name and version information +## + +PKI_MIGRATE="pki-migrate" +PKI_MIGRATE_VERSION="10.0.0.a1" + + +## +## Establish the SOURCE files/directories of the 'pki-migrate' source directory +## + +PKI_SPECS_FILE="${PKI_DIR}/specs/${PKI_MIGRATE}.spec" +PKI_COMPONENT_LIST="test migrate" + + +## +## Establish the TARGET files/directories of the 'pki-migrate' source/spec files +## + +PKI_PACKAGES="${PKI_PWD}/packages" +PKI_MIGRATE_BUILD_DIR="${PKI_PACKAGES}/BUILD" +PKI_MIGRATE_RPMS_DIR="${PKI_PACKAGES}/RPMS" +PKI_MIGRATE_SOURCES_DIR="${PKI_PACKAGES}/SOURCES" +PKI_MIGRATE_SPECS_DIR="${PKI_PACKAGES}/SPECS" +PKI_MIGRATE_SRPMS_DIR="${PKI_PACKAGES}/SRPMS" + +PKI_MIGRATE_TARBALL="${PKI_MIGRATE}-${PKI_MIGRATE_VERSION}.tar.gz" +PKI_MIGRATE_SPEC_FILE="${PKI_MIGRATE_SPECS_DIR}/${PKI_MIGRATE}.spec" +PKI_MIGRATE_PACKAGE_SCRIPT="${PKI_PACKAGES}/package_${PKI_MIGRATE}" +PKI_MIGRATE_PACKAGE_COMMAND="${RPMBUILD_CMD} SPECS/${PKI_MIGRATE}.spec" + +PKI_MIGRATE_STAGING_DIR="${PKI_PACKAGES}/staging" +PKI_MIGRATE_DIR="${PKI_MIGRATE_STAGING_DIR}/${PKI_MIGRATE}-${PKI_MIGRATE_VERSION}" +PKI_MIGRATE_BASE_DIR="${PKI_MIGRATE_DIR}/base" + + +## +## Always create a top-level 'packages' directory +## + +mkdir -p ${PKI_PACKAGES} + + +## +## Always create 'pki-migrate' package directories +## + +mkdir -p ${PKI_MIGRATE_BUILD_DIR} +mkdir -p ${PKI_MIGRATE_RPMS_DIR} +mkdir -p ${PKI_MIGRATE_SOURCES_DIR} +mkdir -p ${PKI_MIGRATE_SPECS_DIR} +mkdir -p ${PKI_MIGRATE_SRPMS_DIR} + + +## +## Always start with new 'pki-migrate' package files +## + +rm -rf ${PKI_MIGRATE_BUILD_DIR}/${PKI_MIGRATE}-${PKI_MIGRATE_VERSION} +rm -f ${PKI_MIGRATE_RPMS_DIR}/${PKI_MIGRATE}-${PKI_MIGRATE_VERSION}*.rpm +rm -f ${PKI_MIGRATE_SOURCES_DIR}/${PKI_MIGRATE_TARBALL} +rm -f ${PKI_MIGRATE_SPEC_FILE} +rm -f ${PKI_MIGRATE_SRPMS_DIR}/${PKI_MIGRATE}-${PKI_MIGRATE_VERSION}*.rpm + + +## +## Copy a new 'pki-migrate' spec file from the +## current contents of the PKI working repository +## + +cp -p ${PKI_SPECS_FILE} ${PKI_MIGRATE_SPECS_DIR} + + +## +## If specified, copy all Patches from the spec file URL to SOURCES +## + +if [ ${FETCH_PATCH_FILES} -eq 1 ] ; then + Fetch_Patch_Files ${PKI_SPECS_FILE} ${PKI_MIGRATE_SOURCES_DIR} +fi + + +## +## Copy the specified Source Tarball from the spec file URL to SOURCES, or +## Generate a fresh Source Tarball from the local source +## + +if [ ${FETCH_SOURCE_TARBALL} -eq 1 ] ; then + Fetch_Source_Tarball ${PKI_SPECS_FILE} ${PKI_MIGRATE_SOURCES_DIR} +else + ## + ## Always start with a new 'pki-migrate' staging directory + ## + + rm -rf ${PKI_MIGRATE_STAGING_DIR} + + + ## + ## To generate the 'pki-migrate' tarball, construct a staging area + ## consisting of the 'pki-migrate' source components from the + ## current contents of the PKI working repository + ## + + mkdir -p ${PKI_MIGRATE_DIR} + cd ${PKI_DIR} + for file in "${PKI_FILE_LIST}" ; + do + cp -p ${file} ${PKI_MIGRATE_DIR} + done + find ${PKI_CMAKE_DIR} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${PKI_MIGRATE_DIR} > /dev/null 2>&1 + cd - > /dev/null 2>&1 + + mkdir -p ${PKI_MIGRATE_BASE_DIR} + cd ${PKI_BASE_DIR} + cp -p ${PKI_BASE_MANIFEST} ${PKI_MIGRATE_BASE_DIR} + for component in "${PKI_COMPONENT_LIST}" ; + do + find ${component} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${PKI_MIGRATE_BASE_DIR} > /dev/null 2>&1 + done + cd - > /dev/null 2>&1 + + + ## + ## Create the 'pki-migrate' tarball + ## + + mkdir -p ${PKI_MIGRATE_SOURCES_DIR} + cd ${PKI_MIGRATE_STAGING_DIR} + gtar -zcvf ${PKI_MIGRATE_TARBALL} \ + "${PKI_MIGRATE}-${PKI_MIGRATE_VERSION}" > /dev/null 2>&1 + mv ${PKI_MIGRATE_TARBALL} ${PKI_MIGRATE_SOURCES_DIR} + cd - > /dev/null 2>&1 + + + ## + ## Always remove the PKI staging area + ## + + rm -rf ${PKI_MIGRATE_STAGING_DIR} +fi + + +## +## Always generate a fresh 'pki-migrate' package script +## + +rm -rf ${PKI_MIGRATE_PACKAGE_SCRIPT} +printf "#!/bin/bash\n\n" > ${PKI_MIGRATE_PACKAGE_SCRIPT} +printf "${PKI_MIGRATE_PACKAGE_COMMAND}\n\n" >> ${PKI_MIGRATE_PACKAGE_SCRIPT} +chmod 775 ${PKI_MIGRATE_PACKAGE_SCRIPT} + + +## +## Automatically invoke RPM/SRPM creation +## + +cd ${PKI_PACKAGES} ; +bash ./package_${PKI_MIGRATE} | tee package_${PKI_MIGRATE}.log 2>&1 + diff --git a/scripts/compose_pki_ra_packages b/scripts/compose_pki_ra_packages new file mode 100755 index 000000000..b5ff90f03 --- /dev/null +++ b/scripts/compose_pki_ra_packages @@ -0,0 +1,194 @@ +#!/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-ra' name and version information +## + +PKI_RA="pki-ra" +PKI_RA_VERSION="10.0.0.a1" + + +## +## Establish the SOURCE files/directories of the 'pki-ra' source directory +## + +PKI_SPECS_FILE="${PKI_DIR}/specs/${PKI_RA}.spec" +PKI_COMPONENT_LIST="ra" + + +## +## Establish the TARGET files/directories of the 'pki-ra' source/spec files +## + +PKI_PACKAGES="${PKI_PWD}/packages" +PKI_RA_BUILD_DIR="${PKI_PACKAGES}/BUILD" +PKI_RA_RPMS_DIR="${PKI_PACKAGES}/RPMS" +PKI_RA_SOURCES_DIR="${PKI_PACKAGES}/SOURCES" +PKI_RA_SPECS_DIR="${PKI_PACKAGES}/SPECS" +PKI_RA_SRPMS_DIR="${PKI_PACKAGES}/SRPMS" + +PKI_RA_TARBALL="${PKI_RA}-${PKI_RA_VERSION}.tar.gz" +PKI_RA_SPEC_FILE="${PKI_RA_SPECS_DIR}/${PKI_RA}.spec" +PKI_RA_PACKAGE_SCRIPT="${PKI_PACKAGES}/package_${PKI_RA}" +PKI_RA_PACKAGE_COMMAND="${RPMBUILD_CMD} SPECS/${PKI_RA}.spec" + +PKI_RA_STAGING_DIR="${PKI_PACKAGES}/staging" +PKI_RA_DIR="${PKI_RA_STAGING_DIR}/${PKI_RA}-${PKI_RA_VERSION}" +PKI_RA_BASE_DIR="${PKI_RA_DIR}/base" + + +## +## Always create a top-level 'packages' directory +## + +mkdir -p ${PKI_PACKAGES} + + +## +## Always create 'pki-ra' package directories +## + +mkdir -p ${PKI_RA_BUILD_DIR} +mkdir -p ${PKI_RA_RPMS_DIR} +mkdir -p ${PKI_RA_SOURCES_DIR} +mkdir -p ${PKI_RA_SPECS_DIR} +mkdir -p ${PKI_RA_SRPMS_DIR} + + +## +## Always start with new 'pki-ra' package files +## + +rm -rf ${PKI_RA_BUILD_DIR}/${PKI_RA}-${PKI_RA_VERSION} +rm -f ${PKI_RA_RPMS_DIR}/${PKI_RA}-${PKI_RA_VERSION}*.rpm +rm -f ${PKI_RA_SOURCES_DIR}/${PKI_RA_TARBALL} +rm -f ${PKI_RA_SPEC_FILE} +rm -f ${PKI_RA_SRPMS_DIR}/${PKI_RA}-${PKI_RA_VERSION}*.rpm + + +## +## Copy a new 'pki-ra' spec file from the +## current contents of the PKI working repository +## + +cp -p ${PKI_SPECS_FILE} ${PKI_RA_SPECS_DIR} + + +## +## If specified, copy all Patches from the spec file URL to SOURCES +## + +if [ ${FETCH_PATCH_FILES} -eq 1 ] ; then + Fetch_Patch_Files ${PKI_SPECS_FILE} ${PKI_RA_SOURCES_DIR} +fi + + +## +## Copy the specified Source Tarball from the spec file URL to SOURCES, or +## Generate a fresh Source Tarball from the local source +## + +if [ ${FETCH_SOURCE_TARBALL} -eq 1 ] ; then + Fetch_Source_Tarball ${PKI_SPECS_FILE} ${PKI_RA_SOURCES_DIR} +else + ## + ## Always start with a new 'pki-ra' staging directory + ## + + rm -rf ${PKI_RA_STAGING_DIR} + + + ## + ## To generate the 'pki-ra' tarball, construct a staging area + ## consisting of the 'pki-ra' source components from the + ## current contents of the PKI working repository + ## + + mkdir -p ${PKI_RA_DIR} + cd ${PKI_DIR} + for file in "${PKI_FILE_LIST}" ; + do + cp -p ${file} ${PKI_RA_DIR} + done + find ${PKI_CMAKE_DIR} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${PKI_RA_DIR} > /dev/null 2>&1 + cd - > /dev/null 2>&1 + + mkdir -p ${PKI_RA_BASE_DIR} + cd ${PKI_BASE_DIR} + cp -p ${PKI_BASE_MANIFEST} ${PKI_RA_BASE_DIR} + for component in "${PKI_COMPONENT_LIST}" ; + do + find ${component} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${PKI_RA_BASE_DIR} > /dev/null 2>&1 + done + cd - > /dev/null 2>&1 + + + ## + ## Create the 'pki-ra' tarball + ## + + mkdir -p ${PKI_RA_SOURCES_DIR} + cd ${PKI_RA_STAGING_DIR} + gtar -zcvf ${PKI_RA_TARBALL} \ + "${PKI_RA}-${PKI_RA_VERSION}" > /dev/null 2>&1 + mv ${PKI_RA_TARBALL} ${PKI_RA_SOURCES_DIR} + cd - > /dev/null 2>&1 + + + ## + ## Always remove the PKI staging area + ## + + rm -rf ${PKI_RA_STAGING_DIR} +fi + + +## +## Always generate a fresh 'pki-ra' package script +## + +rm -rf ${PKI_RA_PACKAGE_SCRIPT} +printf "#!/bin/bash\n\n" > ${PKI_RA_PACKAGE_SCRIPT} +printf "${PKI_RA_PACKAGE_COMMAND}\n\n" >> ${PKI_RA_PACKAGE_SCRIPT} +chmod 775 ${PKI_RA_PACKAGE_SCRIPT} + + +## +## Automatically invoke RPM/SRPM creation +## + +cd ${PKI_PACKAGES} ; +bash ./package_${PKI_RA} | tee package_${PKI_RA}.log 2>&1 + diff --git a/scripts/compose_pki_tps_packages b/scripts/compose_pki_tps_packages new file mode 100755 index 000000000..eb7738641 --- /dev/null +++ b/scripts/compose_pki_tps_packages @@ -0,0 +1,194 @@ +#!/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-tps' name and version information +## + +PKI_TPS="pki-tps" +PKI_TPS_VERSION="10.0.0.a1" + + +## +## Establish the SOURCE files/directories of the 'pki-tps' source directory +## + +PKI_SPECS_FILE="${PKI_DIR}/specs/${PKI_TPS}.spec" +PKI_COMPONENT_LIST="tps" + + +## +## Establish the TARGET files/directories of the 'pki-tps' source/spec files +## + +PKI_PACKAGES="${PKI_PWD}/packages" +PKI_TPS_BUILD_DIR="${PKI_PACKAGES}/BUILD" +PKI_TPS_RPMS_DIR="${PKI_PACKAGES}/RPMS" +PKI_TPS_SOURCES_DIR="${PKI_PACKAGES}/SOURCES" +PKI_TPS_SPECS_DIR="${PKI_PACKAGES}/SPECS" +PKI_TPS_SRPMS_DIR="${PKI_PACKAGES}/SRPMS" + +PKI_TPS_TARBALL="${PKI_TPS}-${PKI_TPS_VERSION}.tar.gz" +PKI_TPS_SPEC_FILE="${PKI_TPS_SPECS_DIR}/${PKI_TPS}.spec" +PKI_TPS_PACKAGE_SCRIPT="${PKI_PACKAGES}/package_${PKI_TPS}" +PKI_TPS_PACKAGE_COMMAND="${RPMBUILD_CMD} SPECS/${PKI_TPS}.spec" + +PKI_TPS_STAGING_DIR="${PKI_PACKAGES}/staging" +PKI_TPS_DIR="${PKI_TPS_STAGING_DIR}/${PKI_TPS}-${PKI_TPS_VERSION}" +PKI_TPS_BASE_DIR="${PKI_TPS_DIR}/base" + + +## +## Always create a top-level 'packages' directory +## + +mkdir -p ${PKI_PACKAGES} + + +## +## Always create 'pki-tps' package directories +## + +mkdir -p ${PKI_TPS_BUILD_DIR} +mkdir -p ${PKI_TPS_RPMS_DIR} +mkdir -p ${PKI_TPS_SOURCES_DIR} +mkdir -p ${PKI_TPS_SPECS_DIR} +mkdir -p ${PKI_TPS_SRPMS_DIR} + + +## +## Always start with new 'pki-tps' package files +## + +rm -rf ${PKI_TPS_BUILD_DIR}/${PKI_TPS}-${PKI_TPS_VERSION} +rm -f ${PKI_TPS_RPMS_DIR}/${PKI_TPS}-${PKI_TPS_VERSION}*.rpm +rm -f ${PKI_TPS_SOURCES_DIR}/${PKI_TPS_TARBALL} +rm -f ${PKI_TPS_SPEC_FILE} +rm -f ${PKI_TPS_SRPMS_DIR}/${PKI_TPS}-${PKI_TPS_VERSION}*.rpm + + +## +## Copy a new 'pki-tps' spec file from the +## current contents of the PKI working repository +## + +cp -p ${PKI_SPECS_FILE} ${PKI_TPS_SPECS_DIR} + + +## +## If specified, copy all Patches from the spec file URL to SOURCES +## + +if [ ${FETCH_PATCH_FILES} -eq 1 ] ; then + Fetch_Patch_Files ${PKI_SPECS_FILE} ${PKI_TPS_SOURCES_DIR} +fi + + +## +## Copy the specified Source Tarball from the spec file URL to SOURCES, or +## Generate a fresh Source Tarball from the local source +## + +if [ ${FETCH_SOURCE_TARBALL} -eq 1 ] ; then + Fetch_Source_Tarball ${PKI_SPECS_FILE} ${PKI_TPS_SOURCES_DIR} +else + ## + ## Always start with a new 'pki-tps' staging directory + ## + + rm -rf ${PKI_TPS_STAGING_DIR} + + + ## + ## To generate the 'pki-tps' tarball, construct a staging area + ## consisting of the 'pki-tps' source components from the + ## current contents of the PKI working repository + ## + + mkdir -p ${PKI_TPS_DIR} + cd ${PKI_DIR} + for file in "${PKI_FILE_LIST}" ; + do + cp -p ${file} ${PKI_TPS_DIR} + done + find ${PKI_CMAKE_DIR} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${PKI_TPS_DIR} > /dev/null 2>&1 + cd - > /dev/null 2>&1 + + mkdir -p ${PKI_TPS_BASE_DIR} + cd ${PKI_BASE_DIR} + cp -p ${PKI_BASE_MANIFEST} ${PKI_TPS_BASE_DIR} + for component in "${PKI_COMPONENT_LIST}" ; + do + find ${component} \ + -name .svn -prune -o \ + -name *.swp -prune -o \ + -print | cpio -pdum ${PKI_TPS_BASE_DIR} > /dev/null 2>&1 + done + cd - > /dev/null 2>&1 + + + ## + ## Create the 'pki-tps' tarball + ## + + mkdir -p ${PKI_TPS_SOURCES_DIR} + cd ${PKI_TPS_STAGING_DIR} + gtar -zcvf ${PKI_TPS_TARBALL} \ + "${PKI_TPS}-${PKI_TPS_VERSION}" > /dev/null 2>&1 + mv ${PKI_TPS_TARBALL} ${PKI_TPS_SOURCES_DIR} + cd - > /dev/null 2>&1 + + + ## + ## Always remove the PKI staging area + ## + + rm -rf ${PKI_TPS_STAGING_DIR} +fi + + +## +## Always generate a fresh 'pki-tps' package script +## + +rm -rf ${PKI_TPS_PACKAGE_SCRIPT} +printf "#!/bin/bash\n\n" > ${PKI_TPS_PACKAGE_SCRIPT} +printf "${PKI_TPS_PACKAGE_COMMAND}\n\n" >> ${PKI_TPS_PACKAGE_SCRIPT} +chmod 775 ${PKI_TPS_PACKAGE_SCRIPT} + + +## +## Automatically invoke RPM/SRPM creation +## + +cd ${PKI_PACKAGES} ; +bash ./package_${PKI_TPS} | tee package_${PKI_TPS}.log 2>&1 + diff --git a/scripts/create_pki_yum_repos b/scripts/create_pki_yum_repos new file mode 100755 index 000000000..b900e180f --- /dev/null +++ b/scripts/create_pki_yum_repos @@ -0,0 +1,78 @@ +#!/bin/bash + +# This script may ONLY be run on Linux! +PKI_OS=`uname` +if [ "${PKI_OS}" != "Linux" ]; then + printf "The '$0' script is ONLY executable\n" + printf "on a 'Linux' machine!\n" + exit 255 +fi + +# 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 a list of 'packages' directories +PKI_PACKAGE_DIRS_LIST="packages packages.dogtag_theme packages.ipa_theme packages.core packages.kra packages.ocsp packages.ra packages.tks packages.tps packages.console" + +# This script is only executable from the directory +# containing at the "./pki" directory! +if [ ! -d ./pki ]; then + printf "The '$0' script is ONLY executable\n" + printf "from the directory containing './pki'!\n" + exit 255 +fi + +printf "Removing any 'RPMS/' and 'SRPMS/' directories . . . " +if [ -d RPMS ]; then + rm -rf RPMS +fi +if [ -d SRPMS ]; then + rm -rf SRPMS +fi +printf "done.\n\n" + +printf "Creating new 'RPMS/' and 'SRPMS/' directories . . . " +mkdir RPMS SRPMS +printf "done.\n\n" + +printf "Copying all 'RPMS' and 'SRPMS' into the 'RPMS/' directory . . . " +for package_dir in ${PKI_PACKAGE_DIRS_LIST} ; +do + if [ -d ${package_dir} ] ; then + cd ${package_dir} + find . -name "*.rpm" | xargs -n1 -I{} cp -p {} ../RPMS + cd .. + fi +done +printf "done.\n\n" + +printf "Moving all 'SRPMS' into the 'SRPMS/' directory . . . " +mv ./RPMS/*.src.rpm ./SRPMS +printf "done.\n\n" + +if [ -x /usr/bin/createrepo ]; then + printf "Attempting to create a yum repo in the 'RPMS/' directory . . .\n" + /usr/bin/createrepo ./RPMS + printf "done.\n\n" + + printf "Attempting to create a yum repo in the 'SRPMS/' directory . . .\n" + /usr/bin/createrepo ./SRPMS + printf "done.\n\n" +fi + +printf "Counting all 'RPMS' . . . " +RPM_COUNT=`ls -1 ./RPMS/*.rpm | wc -l` +printf "done.\n\n" + +printf "Counting all 'SRPMS' . . . " +SRPM_COUNT=`ls -1 ./SRPMS/*.rpm | wc -l` +printf "done.\n\n" + +printf "TOTAL: RPMS = ${RPM_COUNT}\n" +printf " SRPMS = ${SRPM_COUNT}\n\n" + diff --git a/scripts/install_default_ca_instance b/scripts/install_default_ca_instance new file mode 100755 index 000000000..7de098018 --- /dev/null +++ b/scripts/install_default_ca_instance @@ -0,0 +1,56 @@ +#!/bin/bash +# BEGIN COPYRIGHT BLOCK +# (C) 2010 Red Hat, Inc. +# All rights reserved. +# END COPYRIGHT BLOCK + +## Always switch into this base directory +## prior to script execution so that all +## of its output is written to this directory + +cd `dirname $0` + + +## +## This script MUST be run as root! +## + +ROOTUID=0 + +OS=`uname` +if [ "${OS}" = "Linux" ] ; then + MY_EUID=`/usr/bin/id -u` + MY_UID=`/usr/bin/id -ur` + USERNAME=`/usr/bin/id -un` +else + printf "ERROR: Unsupported operating system '${OS}'!\n" + exit 255 +fi + +if [ "${MY_UID}" != "${ROOTUID}" ] && + [ "${MY_EUID}" != "${ROOTUID}" ] ; then + printf "ERROR: The '$0' script must be run as root!\n" + exit 255 +fi + + + +## +## Define DEFAULT CA Instance +## + +pkicreate -pki_instance_root=/var/lib \ + -pki_instance_name=pki-ca \ + -subsystem_type=ca \ + -agent_secure_port=9443 \ + -ee_secure_port=9444 \ + -ee_secure_client_auth_port=9446 \ + -admin_secure_port=9445 \ + -unsecure_port=9180 \ + -tomcat_server_port=9701 \ + -user=pkiuser \ + -group=pkiuser \ + -redirect conf=/etc/pki-ca \ + -redirect logs=/var/log/pki-ca \ + -verbose + diff --git a/scripts/install_default_pki_instances b/scripts/install_default_pki_instances new file mode 100755 index 000000000..7c1bc9db3 --- /dev/null +++ b/scripts/install_default_pki_instances @@ -0,0 +1,122 @@ +#!/bin/bash +# BEGIN COPYRIGHT BLOCK +# (C) 2010 Red Hat, Inc. +# All rights reserved. +# END COPYRIGHT BLOCK + +## Always switch into this base directory +## prior to script execution so that all +## of its output is written to this directory + +cd `dirname $0` + + +## +## This script MUST be run as root! +## + +ROOTUID=0 + +OS=`uname` +if [ "${OS}" = "Linux" ] ; then + MY_EUID=`/usr/bin/id -u` + MY_UID=`/usr/bin/id -ur` + USERNAME=`/usr/bin/id -un` +else + printf "ERROR: Unsupported operating system '${OS}'!\n" + exit 255 +fi + +if [ "${MY_UID}" != "${ROOTUID}" ] && + [ "${MY_EUID}" != "${ROOTUID}" ] ; then + printf "ERROR: The '$0' script must be run as root!\n" + exit 255 +fi + + + +## +## Define DEFAULT PKI Instances +## + +pkicreate -pki_instance_root=/var/lib \ + -pki_instance_name=pki-ca \ + -subsystem_type=ca \ + -agent_secure_port=9443 \ + -ee_secure_port=9444 \ + -ee_secure_client_auth_port=9446 \ + -admin_secure_port=9445 \ + -unsecure_port=9180 \ + -tomcat_server_port=9701 \ + -user=pkiuser \ + -group=pkiuser \ + -redirect conf=/etc/pki-ca \ + -redirect logs=/var/log/pki-ca \ + -verbose + +pkicreate -pki_instance_root=/var/lib \ + -pki_instance_name=pki-kra \ + -subsystem_type=kra \ + -agent_secure_port=10443 \ + -ee_secure_port=10444 \ + -admin_secure_port=10445 \ + -unsecure_port=10180 \ + -tomcat_server_port=10701 \ + -user=pkiuser \ + -group=pkiuser \ + -redirect conf=/etc/pki-kra \ + -redirect logs=/var/log/pki-kra \ + -verbose + +pkicreate -pki_instance_root=/var/lib \ + -pki_instance_name=pki-ocsp \ + -subsystem_type=ocsp \ + -agent_secure_port=11443 \ + -ee_secure_port=11444 \ + -admin_secure_port=11445 \ + -unsecure_port=11180 \ + -tomcat_server_port=11701 \ + -user=pkiuser \ + -group=pkiuser \ + -redirect conf=/etc/pki-ocsp \ + -redirect logs=/var/log/pki-ocsp \ + -verbose + +pkicreate -pki_instance_root=/var/lib \ + -pki_instance_name=pki-tks \ + -subsystem_type=tks \ + -agent_secure_port=13443 \ + -ee_secure_port=13444 \ + -admin_secure_port=13445 \ + -unsecure_port=13180 \ + -tomcat_server_port=13701 \ + -user=pkiuser \ + -group=pkiuser \ + -redirect conf=/etc/pki-tks \ + -redirect logs=/var/log/pki-tks \ + -verbose + +pkicreate -pki_instance_root=/var/lib \ + -pki_instance_name=pki-ra \ + -subsystem_type=ra \ + -secure_port=12889 \ + -non_clientauth_secure_port=12890 \ + -unsecure_port=12888 \ + -user=pkiuser \ + -group=pkiuser \ + -redirect conf=/etc/pki-ra \ + -redirect logs=/var/log/pki-ra \ + -verbose + +pkicreate -pki_instance_root=/var/lib \ + -pki_instance_name=pki-tps \ + -subsystem_type=tps \ + -secure_port=7889 \ + -non_clientauth_secure_port=7890 \ + -unsecure_port=7888 \ + -user=pkiuser \ + -group=pkiuser \ + -redirect conf=/etc/pki-tps \ + -redirect logs=/var/log/pki-tps \ + -verbose + diff --git a/scripts/pki_patch_maker b/scripts/pki_patch_maker new file mode 100755 index 000000000..08e8aacd8 --- /dev/null +++ b/scripts/pki_patch_maker @@ -0,0 +1,113 @@ +#!/bin/bash +## BEGIN COPYRIGHT BLOCK +## (C) 2011 Red Hat, Inc. +## All rights reserved. +## END COPYRIGHT BLOCK + +## This shell script must always be executed in the base +## directory located one level above this shell script +cd `dirname $0`/.. + + +## +## Usage statement +## + +Usage() +{ + printf "\n" + printf "Usage: $0 <startrev> <endrev> <srpm> <basever>\n\n" + printf " where:\n\n" + printf " <startrev> is the starting SVN revision\n\n" + printf " <endrev> is the ending SVN revision\n\n" + printf " <srpm> is one of the following:\n\n" + printf " ipa-pki-theme\n" + printf " pki-core\n\n" + printf " <basever> is the version of the specified <srpm>\n" + printf "\n" + printf "IMPORTANT: Successful use of this script relies upon separation\n" + printf " of 'pki-core' and 'ipa-pki-theme' check-ins. All\n" + printf " patch files automatically produced by this script\n" + printf " should be applied and tested thoroughly before\n" + printf " being accepted as proper patches.\n\n" +} + + +## +## Identify source associated with srpm +## +IPA_PKI_THEME="dogtag/ca-ui dogtag/common-ui" +PKI_CORE="base/ca base/common base/java-tools base/native-tools base/selinux base/setup base/silent base/symkey base/util" + + +## +## Check for command line argument validity +## + +if [ $# -ne 4 ] ; then + printf "ERROR: Insufficent parameters!\n" + Usage + exit 255 +fi + +startrev=$1 +endrev=$2 +srpm=$3 +basever=$4 + +if [ ${srpm} == "pki-core" ]; then + source=${PKI_CORE} +elif [ ${srpm} == "ipa-pki-theme" ]; then + source=${IPA_PKI_THEME} +else + printf "ERROR: Invalid <srpm> specified!\n" + Usage + exit 255 +fi + +if [ ${startrev} -ge ${endrev} ]; then + printf "ERROR: <startrev> must be less than <endrev>!\n" + Usage + exit 255 +fi + + +## +## Always establish a new working directory +## +workingdir=/tmp/pki_patch_maker +if [ ! -e ${workingdir} ]; then + mkdir ${workingdir} +fi +rm -rf ${workingdir}/${srpm} +mkdir ${workingdir}/${srpm} + + +## +## Process specified SVN revision numbers +## +for i in ${source} +do + svn log -q -r${startrev}:${endrev} $i |grep "^r"|awk '{print $1}'|sed 's/r//' >> ${workingdir}/${srpm}/revnos +done + +cat ${workingdir}/${srpm}/revnos |sort |uniq > ${workingdir}/${srpm}/revnos2 + + +## +## Generate patches for the specified SRPM based upon SVN revision numbers +## +while read rev0 +do + svn diff -c $rev0 --diff-cmd /usr/bin/diff -x "-Nurb" > ${workingdir}/${srpm}/${srpm}-${basever}-r${rev0}.patch +done < ${workingdir}/${srpm}/revnos2 + + +## +## Generate sample changelog messages associated with these patches +## +while read rev0 +do + echo `svn log -r $rev0 |grep -i "Resolves"`, $rev0 >> ${workingdir}/${srpm}/changelog +done < ${workingdir}/${srpm}/revnos2 + diff --git a/scripts/prepare_dogtag_pki b/scripts/prepare_dogtag_pki new file mode 100755 index 000000000..0b0f8148e --- /dev/null +++ b/scripts/prepare_dogtag_pki @@ -0,0 +1,323 @@ +#!/bin/bash +# BEGIN COPYRIGHT BLOCK +# (C) 2011 Red Hat, Inc. +# All rights reserved. +# END COPYRIGHT BLOCK + +# Always switch into the base directory of this +# shell script prior to executing it so that all +# of its output is written to this directory +cd `dirname $0` + +# +# Usage statement +# + +Usage() +{ + printf "\n" + printf "Usage: $0 [-skip_directory_server_installation]\n\n" +} + +# +# Check for command line argument validity +# +skip_directory_server_installation=0 +if [ $# -gt 1 ] ; then + printf "ERROR: Incorrect number of parameters!\n" + Usage + exit 255 +elif [ $# -eq 1 ] ; then + if [ $1 != "-skip_directory_server_installation" ] ; then + printf "ERROR: Incorrect parameters usage!\n" + Usage + exit 255 + else + skip_directory_server_installation=1 + fi +fi + +# Retrieve the name of this base directory +PKI_PWD=`pwd` + +# Establish the name of the machine +PKI_HOSTNAME=`hostname` + +# Set pre-defined variables +ROOT_UID=0 + +# This script may ONLY be run on Linux! +PKI_OS=`uname` +if [ "${PKI_OS}" != "Linux" ]; then + printf "The '$0' script is ONLY executable\n" + printf "on a 'Linux' machine!\n" + exit 255 +fi + +# For Fedora machines, compute the FEDORA_VERSION +if [ -e /etc/fedora-release ]; then + FEDORA_VERSION=`rpm -qf --qf='%{VERSION}' /etc/fedora-release | tr -d [A-Z] | tr -d [a-z]` +else + # For now, just give FEDORA_VERSION a bogus value if not using Fedora. + FEDORA_VERSION=9999 +fi + +# Set Linux variables +PKI_PLATFORM="LINUX" +RPM_EXE="/bin/rpm" +YUM_EXE="/usr/bin/yum" +YUM_EXE_OPTIONS="-y install" + +# Set sudo variables +PKI_SUDO="/usr/bin/sudo" +PKI_SUDOERS="/etc/sudoers" + +# Set user identity variables +PKI_EUID=`/usr/bin/id -u` +PKI_UID=`/usr/bin/id -ur` +PKI_USERNAME=`/usr/bin/id -un` + +# Make sure that this script is NOT being run as root! +if [ ${PKI_UID} -eq ${ROOT_UID} ] || + [ ${PKI_EUID} -eq ${ROOT_UID} ]; then + printf "The '$0' script may NOT be run as root!\n" + exit 255 +fi + +# Check for the presence of the 'sudo' executable +if [ ! -x "${PKI_SUDO}" ]; then + printf "The '$0' script requires the '${PKI_SUDO}' executable\n" + printf "to be available on '${PKI_HOSTNAME}'!\n" + exit 255 +fi + +# Check for the presence of the 'sudoers' file +if [ ! -e "${PKI_SUDOERS}" ]; then + printf "The '$0' script requires the '${PKI_SUDOERS}' file\n" + printf "to be available on '${PKI_HOSTNAME}'!\n" + exit 255 +fi + +# Check for the presence of the required sudoers command(s) +PKI_SUDOERS_COMMAND="(root) NOPASSWD: ALL" +PKI_SUDOERS_LINE="${PKI_USERNAME} NOPASSWD: ALL" +PKI_SUDOERS_RPM_COMMAND="(root) NOPASSWD: ${RPM_EXE}" +PKI_SUDOERS_RPM_LINE="${PKI_USERNAME} ALL = NOPASSWD: ${RPM_EXE}" +PKI_SUDOERS_YUM_COMMAND="(root) NOPASSWD: ${YUM_EXE}" +PKI_SUDOERS_YUM_LINE="${PKI_USERNAME} ALL = NOPASSWD: ${YUM_EXE}" +printf "Checking if '${PKI_USERNAME}' has the appropriate '${PKI_SUDO}' permissions . . .\n" +printf "[NOTE: A password prompt may appear requiring ${PKI_USERNAME}'s password.]\n" +# NOTE: If 'ALL' commands are NOT sudo enabled, then at least BOTH +# of the 'RPM' and 'YUM' commands MUST be sudo enabled! +`${PKI_SUDO} -l | grep "${PKI_SUDOERS_COMMAND}" > /dev/null 2>&1` +if [ $? -ne 0 ]; then + sudo_commands=2 + `${PKI_SUDO} -l | grep "${PKI_SUDOERS_RPM_COMMAND}" > /dev/null 2>&1` + if [ $? -ne 0 ]; then + sudo_commands=`expr ${sudo_commands} - 1` + fi + `${PKI_SUDO} -l | grep "${PKI_SUDOERS_YUM_COMMAND}" > /dev/null 2>&1` + if [ $? -ne 0 ]; then + sudo_commands=`expr ${sudo_commands} - 1` + fi + if [ ${sudo_commands} -ne 2 ]; then + printf "The '$0' script requires that the\n" + printf "'${PKI_SUDOERS}' file MUST contain BOTH of these lines:\n\n" + printf " '${PKI_SUDOERS_RPM_LINE}'\n" + printf " '${PKI_SUDOERS_YUM_LINE}'\n\n" + exit 255 + fi +fi + +###################################### +# Establish PKI Development Packages # +###################################### + +# Language Development +GCC="gcc" +GPLUSPLUS="gcc-c++" +JAVA="java-1.6.0-openjdk" +JAVAC="java-1.6.0-openjdk-devel" +PERL="perl" + +# Language Development Support Utilities +JPACKAGE_UTILS="jpackage-utils" +PKGCONFIG="pkgconfig" + +# Build Utilities +ANT="ant" +CMAKE="cmake" +MAKE="make" +M4="m4" + +# Packaging Utilities +RPM="rpm" +RPM_BUILD="rpm-build" +YUM="yum" +YUM_UTILS="yum-utils" + +# Compression Utilities +GZIP="gzip" +TAR="tar" +ZIP="zip" +ZLIB="zlib" +ZLIB="zlib-devel" + +# Fetching Utilities +CURL="curl" +WGET="wget" + +# Revision Control Utilities +CVS="cvs" +GIT="git" +SVN="subversion" + +# Miscellaneous Utilities +CHKCONFIG="chkconfig" +INITSCRIPTS="initscripts" +OPENSSH_CLIENTS="openssh-clients" +#SENDMAIL="sendmail" + +# Create a catch-all variable for PKI Development Packages +PKI_DEVELOPMENT_PACKAGES="${GCC} ${GPLUSPLUS} ${JAVA} ${JAVAC} ${PERL} ${JPACKAGE_UTILS} ${PKGCONFIG} ${ANT} ${CMAKE} ${MAKE} ${M4} ${RPM} ${RPM_BUILD} ${YUM} ${YUM_UTILS} ${GZIP} ${TAR} ${ZIP} ${ZLIB} ${CURL} ${WGET} ${CVS} ${GIT} ${SVN} ${CHKCONFIG} ${INITSCRIPTS} ${OPENSSH_CLIENTS} ${SENDMAIL}" + + +################################## +# Establish PKI Support Packages # +################################## + +# Apache Packages +APR="apr" +APR_DEVEL="apr-devel" +APR_UTIL="apr-util" +APR_UTIL_DEVEL="apr-util-devel" +EXPAT="expat" +EXPAT_DEVEL="expat-devel" +HTTPD="httpd" +HTTPD_DEVEL="httpd-devel" +HTTPD_TOOLS="httpd-tools" +PCRE="pcre" +PCRE_DEVEL="pcre-devel" + +# Tomcat Packages +TOMCAT6="tomcat6" +TOMCAT6_LIB="tomcat6-lib" +if [ ${FEDORA_VERSION} -ge 14 ]; then + APACHE_COMMONS_LANG="apache-commons-daemon" + APACHE_COMMONS_LANG="apache-commons-lang" + APACHE_COMMONS_LOGGING="apache-commons-logging" +else + APACHE_COMMONS_LANG="jakarta-commons-daemon" + APACHE_COMMONS_LANG="jakarta-commons-lang" + APACHE_COMMONS_LOGGING="jakarta-commons-logging" +fi +APACHE_COMMONS_CODEC="apache-commons-codec" +JAKARTA_COMMONS_COLLECTIONS="jakarta-commons-collections" +JAKARTA_COMMONS_DBCP="jakarta-commons-dbcp" +JAKARTA_COMMONS_POOL="jakarta-commons-pool" + +# Cross-Platform Packages +NSPR="nspr" +NSPR_DEVEL="nspr-devel" + +# Cryptographic Packages +NSS="nss" +NSS_DEVEL="nss-devel" +NSS_TOOLS="nss-tools" + +# Tomcat Cryptographic Bridge Packages +JSS="jss" +JSS_JAVADOC="jss-javadoc" +TOMCATJSS="tomcatjss" + +# Apache Cryptographic Bridge Packages +MOD_NSS="mod_nss" +MOD_PERL="mod_perl" +MOD_REVOCATOR="mod_revocator" + +# Console Packages +IDM_CONSOLE_FRAMEWORK="idm-console-framework" + +# LDAP Support Packages +CYRUS_SASL="cyrus-sasl" +CYRUS_SASL_DEVEL="cyrus-sasl-devel" +LDAPJDK="ldapjdk" +OPENLDAP="openldap" +OPENLDAP_CLIENTS="openldap-clients" +OPENLDAP_DEVEL="openldap-devel" + +# Perl Modules +PERL_CRYPT_SSLEAY="perl-Crypt-SSLeay" +PERL_DBD_SQLITE="perl-DBD-SQLite" +PERL_DBI="perl-DBI" +PERL_HTML_PARSER="perl-HTML-Parser" +PERL_HTML_TAGSET="perl-HTML-Tagset" +PERL_LIBWWW_PERL="perl-libwww-perl" +PERL_MOZILLA_LDAP="perl-Mozilla-LDAP" +PERL_PARSE_RECDESCENT="perl-Parse-RecDescent" +PERL_URI="perl-URI" +PERL_XML_NAMESPACESUPPORT="perl-XML-NamespaceSupport" +PERL_XML_PARSER="perl-XML-Parser" +PERL_XML_SAX="perl-XML-SAX" +PERL_XML_SIMPLE="perl-XML-Simple" + +# PKI Clients +ESC="esc" + +# Security Packages +SVRCORE="svrcore" +SVRCORE_DEVEL="svrcore-devel" + +# SELinux Packages +POLICYCOREUTILS="policycoreutils" +SELINUX_POLICY_DEVEL="selinux-policy-devel" +SELINUX_POLICY_TARGETED="selinux-policy-targeted" + +# SQLite Packages +SQLITE="sqlite" +SQLITE_DEVEL="sqlite-devel" + +# Velocity Packages +VELOCITY="velocity" +BCEL="bcel" +JAKARTA_ORO="jakarta-oro" +JDOM="jdom" +LOG4J="log4j" +REGEXP="regexp" +WERKEN_XPATH="werken-xpath" +XALAN_J2="xalan-j2" +XERCES_J2="xerces-j2" +XML_COMMONS_APIS="xml-commons-apis" +XML_COMMONS_RESOLVER="xml-commons-resolver" + +# Create a catch-all variable for PKI Support Packages +PKI_SUPPORT_PACKAGES="${APR} ${APR_DEVEL} ${APR_UTIL} ${APR_UTIL_DEVEL} ${EXPAT} ${EXPAT_DEVEL} ${HTTPD} ${HTTPD_DEVEL} ${HTTPD_TOOLS} ${PCRE} ${PCRE_DEVEL} ${TOMCAT6} ${TOMCAT6_LIB} ${APACHE_COMMONS_LANG} ${APACHE_COMMONS_LANG} ${APACHE_COMMONS_LOGGING} ${APACHE_COMMONS_CODEC} ${JAKARTA_COMMONS_COLLECTIONS} ${JAKARTA_COMMONS_DBCP} ${JAKARTA_COMMONS_POOL} ${NSPR} ${NSPR_DEVEL} ${NSS} ${NSS_DEVEL} ${NSS_TOOLS} ${JSS} ${JSS_JAVADOC} ${TOMCATJSS} ${MOD_NSS} ${MOD_PERL} ${MOD_REVOCATOR} ${IDM_CONSOLE_FRAMEWORK} ${CYRUS_SASL} ${CYRUS_SASL_DEVEL} ${LDAPJDK} ${OPENLDAP} ${OPENLDAP_CLIENTS} ${OPENLDAP_DEVEL} ${PERL_CRYPT_SSLEAY} ${PERL_DBD_SQLITE} ${PERL_DBI} ${PERL_HTML_PARSER} ${PERL_HTML_TAGSET} ${PERL_LIBWWW_PERL} ${PERL_MOZILLA_LDAP} ${PERL_PARSE_RECDESCENT} ${PERL_URI} ${PERL_XML_NAMESPACESUPPORT} ${PERL_XML_PARSER} ${PERL_XML_SAX} ${PERL_XML_SIMPLE} ${ESC} ${SVRCORE} ${SVRCORE_DEVEL} ${POLICYCOREUTILS} ${SELINUX_POLICY_DEVEL} ${SELINUX_POLICY_TARGETED} ${SQLITE} ${SQLITE_DEVEL} ${VELOCITY} ${BCEL} ${JAKARTA_ORO} ${JDOM} ${LOG4J} ${REGEXP} ${WERKEN_XPATH} ${XALAN_J2} ${XERCES_J2} ${XML_COMMONS_APIS} ${XML_COMMONS_RESOLVER}" + +########################################### +# Establish PKI Installation Dependencies # +########################################### + +# LDAP Packages (for non-remote use) +LDAP="389-ds" +LDAP_ADMIN="389-admin" +LDAP_ADMIN_CONSOLE="389-admin-console" +LDAP_ADMIN_CONSOLE_DOC="389-admin-console-doc" +LDAP_ADMINUTIL="389-adminutil" +LDAP_BASE="389-ds-base" +LDAP_CONSOLE="389-console" +LDAP_DS_CONSOLE="389-ds-console" +LDAP_DS_CONSOLE_DOC="389-ds-console-doc" +LDAP_DSGW="389-dsgw" + +# Create a catch-all variable for LDAP Packages +if [ ${skip_directory_server_installation} -eq 1 ]; then + LDAP_PACKAGES="" +else + LDAP_PACKAGES="${LDAP} ${LDAP_ADMIN} ${LDAP_ADMIN_CONSOLE} ${LDAP_ADMIN_CONSOLE_DOC} ${LDAP_ADMINUTIL} ${LDAP_BASE} ${LDAP_CONSOLE} ${LDAP_DS_CONSOLE} ${LDAP_DS_CONSOLE_DOC} ${LDAP_DSGW}" +fi + + +# Build and install PKI Development Packages, PKI Support Packages, and +# optionally, LDAP Packages +${PKI_SUDO} ${YUM_EXE} ${YUM_EXE_OPTIONS} ${PKI_DEVELOPMENT_PACKAGES} ${PKI_SUPPORT_PACKAGES} ${LDAP_PACKAGES} + diff --git a/scripts/remove_default_pki_instances b/scripts/remove_default_pki_instances new file mode 100755 index 000000000..3ec355f1f --- /dev/null +++ b/scripts/remove_default_pki_instances @@ -0,0 +1,115 @@ +#!/bin/bash +## BEGIN COPYRIGHT BLOCK +## (C) 2008 Red Hat, Inc. +## All rights reserved. +## END COPYRIGHT BLOCK + +## Always switch into this base directory +## prior to script execution so that all +## of its output is written to this directory + +cd `dirname $0` + + +## +## This script MUST be run as root! +## + +ROOTUID=0 + +OS=`uname` +if [ "${OS}" = "Linux" ] ; then + MY_EUID=`/usr/bin/id -u` + MY_UID=`/usr/bin/id -ur` + USERNAME=`/usr/bin/id -un` +else + printf "ERROR: Unsupported operating system '${OS}'!\n" + exit 255 +fi + +if [ "${MY_UID}" != "${ROOTUID}" ] && + [ "${MY_EUID}" != "${ROOTUID}" ] ; then + printf "ERROR: The '$0' script must be run as root!\n" + exit 255 +fi + + + +## +## Define DEFAULT PKI Instances +## + +PKI_DIR="/var/lib" + +PKI_CA="pki-ca" +PKI_DRM="pki-kra" +PKI_OCSP="pki-ocsp" +PKI_TKS="pki-tks" +PKI_RA="pki-ra" +PKI_TPS="pki-tps" + +## +## NOTE: Always remove "${PKI_CA}" last, as it will most +## likely host the default Security Domain! +## +PKI_INSTANCES="${PKI_TPS} ${PKI_RA} ${PKI_TKS} ${PKI_OCSP} ${PKI_DRM} ${PKI_CA}" + + + +## +## Ask user if is is okay to remove ALL DEFAULT PKI instances +## + +printf "REMINDER: PKI instances contain user's PKI data, and consist of\n" +printf " DEFAULT PKI instances and CUSTOMIZED PKI instances.\n\n" +printf " DEFAULT PKI instances are automatically created whenever\n" +printf " one of the PKI subsystems are installed UNLESS that\n" +printf " particular PKI subsystem's DEFAULT PKI instance\n" +printf " already exists.\n\n" +printf " DEFAULT PKI instances consist of the following:\n\n" +printf " CA - ${PKI_DIR}/${PKI_CA}\n" +printf " DRM - ${PKI_DIR}/${PKI_DRM}\n" +printf " OCSP - ${PKI_DIR}/${PKI_OCSP}\n" +printf " RA - ${PKI_DIR}/${PKI_RA}\n" +printf " TKS - ${PKI_DIR}/${PKI_TKS}\n" +printf " TPS - ${PKI_DIR}/${PKI_TPS}\n\n" +while : +do + printf "This script REMOVES ALL DEFAULT PKI instances! " + printf "Is this okay? [yn] " + read ANSWER + printf "\n" + if [ "${ANSWER}" = "Y" ] || + [ "${ANSWER}" = "y" ] ; then + printf "\n" + break + elif [ "${ANSWER}" = "N" ] || + [ "${ANSWER}" = "n" ] ; then + printf "\n" + printf "No DEFAULT PKI instances will be removed.\n\n" + exit 255 + else + continue + fi +done + + + +## +## Remove ALL DEFAULT PKI Instances present . . . +## + +INSTANCES=0 +for INSTANCE in ${PKI_INSTANCES} ; do + if [ -d "${PKI_DIR}/${INSTANCE}" ] ; then + INSTANCES=`expr $INSTANCES + 1` + pkiremove -pki_instance_root=${PKI_DIR} -pki_instance_name=${INSTANCE} -force + fi +done + +if [ ${INSTANCES} -eq 0 ] ; then + printf "No DEFAULT PKI instances need to be removed.\n\n" +fi + +exit 0 + diff --git a/scripts/remove_pki_components b/scripts/remove_pki_components new file mode 100755 index 000000000..63dab7c00 --- /dev/null +++ b/scripts/remove_pki_components @@ -0,0 +1,150 @@ +#!/bin/bash +## BEGIN COPYRIGHT BLOCK +## (C) 2008 Red Hat, Inc. +## All rights reserved. +## END COPYRIGHT BLOCK + +## Always switch into this base directory +## prior to script execution so that all +## of its output is written to this directory + +cd `dirname $0` + + +## +## This script MUST be run as root! +## + +ROOTUID=0 + +OS=`uname` +if [ "${OS}" = "Linux" ] ; then + MY_EUID=`/usr/bin/id -u` + MY_UID=`/usr/bin/id -ur` + USERNAME=`/usr/bin/id -un` +else + printf "ERROR: Unsupported operating system '${OS}'!\n" + exit 255 +fi + +if [ "${MY_UID}" != "${ROOTUID}" ] && + [ "${MY_EUID}" != "${ROOTUID}" ] ; then + printf "ERROR: The '$0' script must be run as root!\n" + exit 255 +fi + + + +## +## Define DEFAULT PKI Instances +## + +PKI_DIR="/var/lib" + +PKI_CA="pki-ca" +PKI_DRM="pki-kra" +PKI_OCSP="pki-ocsp" +PKI_TKS="pki-tks" +PKI_RA="pki-ra" +PKI_TPS="pki-tps" + + + +## +## Ask user if any PKI instances need to be removed +## + +printf "REMINDER: PKI instances contain user's PKI data, and consist of\n" +printf " DEFAULT PKI instances and CUSTOMIZED PKI instances.\n\n" +printf " DEFAULT PKI instances are automatically created whenever\n" +printf " one of the PKI subsystems are installed UNLESS that\n" +printf " particular PKI subsystem's DEFAULT PKI instance\n" +printf " already exists.\n\n" +printf " DEFAULT PKI instances consist of the following:\n\n" +printf " CA - ${PKI_DIR}/${PKI_CA}\n" +printf " DRM - ${PKI_DIR}/${PKI_DRM}\n" +printf " OCSP - ${PKI_DIR}/${PKI_OCSP}\n" +printf " RA - ${PKI_DIR}/${PKI_RA}\n" +printf " TKS - ${PKI_DIR}/${PKI_TKS}\n" +printf " TPS - ${PKI_DIR}/${PKI_TPS}\n\n" +printf " Please use the 'remove_default_pki_instances' script\n" +printf " to remove ALL of these DEFAULT PKI instances, OR\n" +printf " use the 'pkiremove' utility to remove INDIVIDUAL\n" +printf " DEFAULT PKI instances.\n\n" +printf " CUSTOMIZED PKI instances may be named anything and\n" +printf " may be located anywhere. Please use the 'pkiremove'\n" +printf " utility to remove any CUSTOMIZED PKI instances.\n\n" +printf " IMPORTANT: NEITHER CUSTOMIZED PKI instances,\n" +printf " NOR DEFAULT PKI instances will be\n" +printf " REMOVED by this script!\n\n" +while : +do + printf "Do any DEFAULT or CUSTOMIZED PKI instances need to be removed\n" + printf "PRIOR to uninstalling ALL of the PKI components? [yn] " + read ANSWER + printf "\n" + if [ "${ANSWER}" = "Y" ] || + [ "${ANSWER}" = "y" ] ; then + printf "\n" + printf "Please REMOVE the desired CUSTOMIZED and/or DEFAULT\n" + printf "PKI instances PRIOR to re-running this script.\n\n" + exit 255 + elif [ "${ANSWER}" = "N" ] || + [ "${ANSWER}" = "n" ] ; then + printf "\n" + break + else + continue + fi +done + + + +## +## Check for PKI components present on this operating system +## + +printf "Processing PKI components present on system . . . " + # (1) grab all PKI components + PKI_COMPONENTS=`rpm -qa --queryformat '%{NAME}\n' | grep pki` + + # (2) check for symkey (legacy package) + `rpm -q --quiet symkey` + SYMKEY_PRESENCE=$? + if [ "${SYMKEY_PRESENCE}" = "0" ] ; then + PKI_COMPONENTS="${PKI_COMPONENTS} symkey" + fi +printf "done.\n\n" + + + +## +## Place the PKI components into a list +## + +PKI_COMPONENT_LIST="" +for COMPONENT in ${PKI_COMPONENTS} ; do + if [ "${PKI_COMPONENT_LIST}" = "" ] ; then + PKI_COMPONENT_LIST="${COMPONENT}" + else + PKI_COMPONENT_LIST="${PKI_COMPONENT_LIST} ${COMPONENT}" + fi +done + + + +## +## Remove ALL PKI components in the list +## + +if [ "${PKI_COMPONENT_LIST}" != "" ] ; then + printf "Removing the following PKI packages:\n" + printf " ${PKI_COMPONENT_LIST}\n\n" + rpm -ev ${PKI_COMPONENT_LIST} + printf "\n" +else + printf "No PKI packages need to be removed.\n\n" +fi + +exit 0 + |