diff options
Diffstat (limited to 'pki/base/scripts')
-rw-r--r-- | pki/base/scripts/base_svn_external_properties_db | 9 | ||||
-rwxr-xr-x | pki/base/scripts/enable_cvs_keywords_in_svn | 97 | ||||
-rwxr-xr-x | pki/base/scripts/pkicheck | 13 | ||||
-rwxr-xr-x | pki/base/scripts/pkimanifest | 100 | ||||
-rwxr-xr-x | pki/base/scripts/set_base_SVN_external_properties | 48 |
5 files changed, 267 insertions, 0 deletions
diff --git a/pki/base/scripts/base_svn_external_properties_db b/pki/base/scripts/base_svn_external_properties_db new file mode 100644 index 000000000..2e487c74d --- /dev/null +++ b/pki/base/scripts/base_svn_external_properties_db @@ -0,0 +1,9 @@ +############################################################################### +# Since the 'svn.fedorahosted.org' repository uses a different URL prefix to # +# distinguish between read-only (http) and read-write (svn+ssh) check-outs, # +# ALL external SVN properties that refer to this repository MUST now be # +# read-only, which means that ALL changes which refer to this repository # +# that need to be saved MUST be applied to the top-level directory referred # +# to by each external SVN property (i.e. - 'pki/base/config'). # +############################################################################### +config http://svn.fedorahosted.org/svn/pki/branches/IPA_v2_RHEL_6_ERRATA_BRANCH/pki/base/config diff --git a/pki/base/scripts/enable_cvs_keywords_in_svn b/pki/base/scripts/enable_cvs_keywords_in_svn new file mode 100755 index 000000000..fd14a885f --- /dev/null +++ b/pki/base/scripts/enable_cvs_keywords_in_svn @@ -0,0 +1,97 @@ +#!/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` + +# Retrieve the name of this base directory +PKI_PWD=`pwd` + +# Retrieve the base name of this script +PKI_SCRIPT=`basename $0` + +# Print pre-script instructions +printf "REMINDER: ALWAYS remember to execute 'svn update' on 'pki/base'\n" +printf " PRIOR to executing '${PKI_SCRIPT}'!\n\n" +while : +do + printf "Have you executed 'svn update' at the 'pki/base' level? [yn] " + read ANSWER + printf "\n" + if [ "${ANSWER}" = "N" ] || + [ "${ANSWER}" = "n" ] ; then + printf "\n" + printf "Please execute 'svn update'\n" + printf "PRIOR to executing '${PKI_SCRIPT}'!\n\n" + exit 255 + elif [ "${ANSWER}" = "Y" ] || + [ "${ANSWER}" = "y" ] ; then + printf "\n" + break + else + continue + fi +done + +# Set equivalent "SVN" keyword properties to enable +# legacy "CVS" keywords in pre-existing PKI files +SVN_KEYWORDS="Author Date Header Id Revision URL" + +# Generate timestamp +PKI_TIMESTAMP=`date +%Y%m%d%H%M%S` + +# Create the name of the list +PKI_LIST=list.${PKI_TIMESTAMP} + +# Switch into the 'pki/base' directory +cd ${PKI_PWD}/.. + +# Fill the list with the name of each ".c", ".cpp", and ".java" file +find . -type f | grep -v '/\.svn/' | egrep "\.(c|cpp|h|pm|java)$" > ${PKI_LIST} + +# Complete the list with miscellaneous files containing legacy "CVS" keywords +echo "./ca/shared/conf/catalina.policy" >> ${PKI_LIST} +echo "./ca/shared/conf/dtomcat5" >> ${PKI_LIST} +echo "./ocsp/shared/conf/catalina.policy" >> ${PKI_LIST} +echo "./ocsp/shared/conf/dtomcat5" >> ${PKI_LIST} +echo "./tks/shared/conf/catalina.policy" >> ${PKI_LIST} +echo "./tks/shared/conf/dtomcat5" >> ${PKI_LIST} +echo "./kra/shared/conf/catalina.policy" >> ${PKI_LIST} +echo "./kra/shared/conf/dtomcat5" >> ${PKI_LIST} +echo "./setup/pkicommon" >> ${PKI_LIST} +echo "./setup/pkicreate" >> ${PKI_LIST} +echo "./setup/pkihost" >> ${PKI_LIST} +echo "./setup/pkiremove" >> ${PKI_LIST} + +# Add 'svn:keywords' properties to ALL files in the list that +# do NOT already contain the SPECIFIED 'svn:keywords' properties +printf "BEGIN: Processing 'svn:keywords' to ALL files in list . . .\n" +for FILE in `cat ${PKI_LIST}` +do + # retrieve the current 'svn:keywords' properties set for this file + KEYWORDS=`svn propget svn:keywords ${FILE}` + if [ "${KEYWORDS}" = "" ] ; then + # set the SPECIFIED 'svn:keywords' properties on this file + svn propset svn:keywords "${SVN_KEYWORDS}" ${FILE} + elif [ "${KEYWORDS}" != "${SVN_KEYWORDS}" ] ; then + # Warn the script user if a file in the list contains + # 'svn:keywords' properties that are DIFFERENT than + # the SPECIFIED 'svn:keywords' properties + printf "WARNING: '${FILE}' ONLY contains the keywords '${KEYWORDS}'!\n" + fi +done +printf "END: Finished processing 'svn:keywords' to ALL files in list.\n\n" + +# Always remove this list +rm -rf ${PKI_LIST} + +# Print post-script instructions +printf "\n" +printf "REMINDER: ALWAYS remember to execute 'svn commit' on 'pki/base'\n" +printf " AFTER executing '${PKI_SCRIPT}'!\n\n" + diff --git a/pki/base/scripts/pkicheck b/pki/base/scripts/pkicheck new file mode 100755 index 000000000..6722e26bf --- /dev/null +++ b/pki/base/scripts/pkicheck @@ -0,0 +1,13 @@ +#!/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 + +# For now, check for symkey (legacy package) +rpm -qa | egrep -i pki-\|osutil\|symkey | sort | cat -n + diff --git a/pki/base/scripts/pkimanifest b/pki/base/scripts/pkimanifest new file mode 100755 index 000000000..31d443cfc --- /dev/null +++ b/pki/base/scripts/pkimanifest @@ -0,0 +1,100 @@ +#!/bin/bash +# BEGIN COPYRIGHT BLOCK +# (C) 2010 Red Hat, Inc. +# All rights reserved. +# END COPYRIGHT BLOCK + +# Define global constants +FOOTER="TIMING - ======== Finished Processing PKI Manifest ========" +HEADER="TIMING - ======== Started Processing PKI Manifest ========" +MANIFEST="manifest" +PKI="pki" +SCRIPTS="scripts" +SVN=".svn" + +# Define global variables +pki_date=`date +%Y%m%d%H%M%S` +pki_dir="" +pki_manifest="" + +# Define functions +Usage() +{ + printf "Usage 1: `basename ${0}`\n" + printf "Usage 2: `basename ${0}` source_path manifest_file\n\n" + printf " where 'Usage 1' must be explicitly executed\n" + printf " from one of the following subdirectories:\n\n" + printf " pki/base/scripts,\n" + printf " pki/dogtag/scripts, or\n" + printf " pki/redhat/scripts\n\n" +} + +# Check for valid number of arguments to shell script +if [ $# -eq 2 ] ; then + # Check that source path is a directory + if [ ! -d ${1} ] ; then + printf "The source path '${1}' does not exist!\n\n" + Usage + exit 255 + fi + + # Initialize variables + pki_dir=${1} + pki_manifest=${2}.${pki_date} +elif [ $# -eq 0 ] ; then + # Remember current location + pki_pwd=`pwd` + + # Check that this script is being run from an appropriate directory + if [ "`basename ${pki_pwd}`" != "${SCRIPTS}" ] ; then + printf "The '`basename ${0}`' script is NOT being executed " + printf "from a valid subdirectory!\n\n" + Usage + exit 255 + fi + + # Obtain the source directory related to this PKI manifest + pki_src_dir=`cd .. ; pwd | xargs basename ; cd ./${SCRIPTS}` + + # 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 ${pki_pwd}/../../.. + + # Initialize variables + pki_dir="${PKI}/${pki_src_dir}" + pki_manifest="`pwd`/${PKI}.${pki_src_dir}.${MANIFEST}.${pki_date}" +else + Usage + exit 255 +fi + +# Compose alphabetical list of specified source files +pki_now=`date` +echo "TIMING - ======== Started Generating Source File List ========" +echo "${pki_now}" +process_pki_tree=`find ${pki_dir} -name ${SVN} -prune -o -type f -print | sort` +echo "${pki_now}" +echo "TIMING - ======== Finished Generating Source File List ========" +echo + +# Generate PKI Manifest +pki_now=`date` +echo "${HEADER}" +echo "${pki_now}" + +printf "${HEADER}\n" > ${pki_manifest} +printf "${pki_now}\n\n" >> ${pki_manifest} +for f in "${process_pki_tree}" +do + echo "Processing ${f} . . ." + svn info ${f} >> ${pki_manifest} +done +pki_now=`date` +printf "${pki_now}\n" >> ${pki_manifest} +printf "${FOOTER}\n" >> ${pki_manifest} + +echo "${pki_now}" +echo "${FOOTER}" +echo + diff --git a/pki/base/scripts/set_base_SVN_external_properties b/pki/base/scripts/set_base_SVN_external_properties new file mode 100755 index 000000000..c08adf90a --- /dev/null +++ b/pki/base/scripts/set_base_SVN_external_properties @@ -0,0 +1,48 @@ +#!/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` + +# Retrieve the name of this base directory +PKI_PWD=`pwd` + +# Name and location of the SVN external properties DB. +SVN_EXTERNAL_PROPERTIES_DB_LOCATION="${PKI_PWD}" +SVN_EXTERNAL_PROPERTIES_DB_NAME="base_svn_external_properties_db" +SVN_EXTERNAL_PROPERTIES_DB="${SVN_EXTERNAL_PROPERTIES_DB_LOCATION}/${SVN_EXTERNAL_PROPERTIES_DB_NAME}" + +# Always make sure that the SVN external properties DB exists. +if [ ! -f ${SVN_EXTERNAL_PROPERTIES_DB} ]; then + printf "The SVN external properties DB called '${SVN_EXTERNAL_PROPERTIES_DB}' does NOT exist!\n" + exit 255; +fi + +# Specify the location and a list of the SVN components that +# require these SVN external properties to be updated. +SVN_COMPONENTS_LOCATION="${PKI_PWD}/.." +SVN_COMPONENTS="ca common console java-tools kra manage migrate native-tools ocsp osutil ra setup selinux silent symkey tks tps util" + +# Change directory to the location of all of these components, +# and execute the defined SVN external property changes. +cd ${SVN_COMPONENTS_LOCATION} +for SVN_COMPONENT in ${SVN_COMPONENTS} ; do + if [ -d "${SVN_COMPONENTS_LOCATION}/${SVN_COMPONENT}" ]; then + printf "Setting external SVN properties for the component called '${SVN_COMPONENT}' . . .\n" + cd "${SVN_COMPONENT}" + svn propset svn:externals -F "${SVN_EXTERNAL_PROPERTIES_DB}" . + svn propget svn:externals . + svn update + cd .. + else + printf "The component called '${SVN_COMPONENTS_LOCATION}/${SVN_COMPONENT}' does NOT exist!\n" + fi +done + +exit 0; + |