summaryrefslogtreecommitdiffstats
path: root/scripts/create_pki_yum_repos
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2012-03-24 02:27:47 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2012-03-26 11:43:54 -0500
commit621d9e5c413e561293d7484b93882d985b3fe15f (patch)
tree638f3d75761c121d9a8fb50b52a12a6686c5ac5c /scripts/create_pki_yum_repos
parent40d3643b8d91886bf210aa27f711731c81a11e49 (diff)
downloadpki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.gz
pki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.xz
pki-621d9e5c413e561293d7484b93882d985b3fe15f.zip
Removed unnecessary pki folder.
Previously the source code was located inside a pki folder. This folder was created during svn migration and is no longer needed. This folder has now been removed and the contents have been moved up one level. Ticket #131
Diffstat (limited to 'scripts/create_pki_yum_repos')
-rwxr-xr-xscripts/create_pki_yum_repos78
1 files changed, 78 insertions, 0 deletions
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"
+