diff options
Diffstat (limited to 'pki/base/manage')
-rw-r--r-- | pki/base/manage/LICENSE | 311 | ||||
-rw-r--r-- | pki/base/manage/build.xml | 277 | ||||
-rw-r--r-- | pki/base/manage/config/product.xml | 305 | ||||
-rw-r--r-- | pki/base/manage/config/release.xml | 86 | ||||
-rwxr-xr-x | pki/base/manage/pki-install | 1475 | ||||
-rwxr-xr-x | pki/base/manage/pki-uninstall | 1521 |
6 files changed, 3975 insertions, 0 deletions
diff --git a/pki/base/manage/LICENSE b/pki/base/manage/LICENSE new file mode 100644 index 000000000..e36f2269a --- /dev/null +++ b/pki/base/manage/LICENSE @@ -0,0 +1,311 @@ +This Program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This Program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this Program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +In addition, as a special exception, Red Hat, Inc. gives You the additional +right to link the code of this Program with code not covered under the GNU +General Public License ("Non-GPL Code") and to distribute linked combinations +including the two, subject to the limitations in this paragraph. Non-GPL +Code permitted under this exception must only link to the code of this +Program through those well defined interfaces identified in the file named +EXCEPTION found in the source code files (the "Approved Interfaces"). + +The files of Non-GPL Code may instantiate templates or use macros or inline +functions from the Approved Interfaces without causing the resulting work to +be covered by the GNU General Public License. Only Red Hat, Inc. may make +changes or additions to the list of Approved Interfaces. You must obey the +GNU General Public License in all respects for all of the Program code and +other code used in conjunction with the Program except the Non-GPL Code +covered by this exception. If you modify this file, you may extend this +exception to your version of the file, but you are not obligated to do so. +If you do not wish to provide this exception without modification, you must +delete this exception statement from your version and license this file +solely under the GPL without exception. + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. diff --git a/pki/base/manage/build.xml b/pki/base/manage/build.xml new file mode 100644 index 000000000..bca353f81 --- /dev/null +++ b/pki/base/manage/build.xml @@ -0,0 +1,277 @@ +<!-- ### BEGIN COPYRIGHT BLOCK ### + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + Copyright (C) 2007 Red Hat, Inc. + All rights reserved. + ### END COPYRIGHT BLOCK ### --> +<project name="manage" default="main" basedir="."> + + <import file="config/product.xml"/> + <import file="config/product-ext.xml" optional="true"/> + + + <target name="clean" + depends="" + description="--> remove component directories"> + <echo message="${begin.clean.log.message}"/> + <delete dir="${dist.base}"/> + <delete dir="${build.dir}"/> + <echo message="${end.clean.log.message}"/> + </target> + + + <target name="download" + depends="" + description="--> download dependent components"> + <echo message="${begin.download.log.message}"/> + <echo message="${empty.download.log.message}"/> + <echo message="${end.download.log.message}"/> + </target> + + + <target name="compile_java" + depends="" + description="--> compile java source code into classes"> + <echo message="${begin.compile.java.log.message}"/> + <echo message="${empty.compile.java.log.message}"/> + <echo message="${end.compile.java.log.message}"/> + </target> + + + <target name="build_jars" + depends="compile_java" + description="--> generate jar files"> + <echo message="${begin.build.jars.log.message}"/> + <echo message="${empty.build.jars.log.message}"/> + <echo message="${end.build.jars.log.message}"/> + </target> + + + <target name="build_jni_headers" + depends="compile_java" + description="--> generate jni header files"> + <echo message="${begin.build.jni.headers.log.message}"/> + <echo message="${empty.build.jni.headers.log.message}"/> + <echo message="${end.build.jni.headers.log.message}"/> + </target> + + + <target name="build" + depends="build_jars,build_jni_headers" + description="--> build classes, jars, and jni headers"> + <echo message="${notify.build.log.message}"/> + </target> + + + <target name="compile_junit_tests" + depends="build" + description="--> compile junit test source code"> + <echo message="${begin.compile.junit.tests.log.message}"/> + <echo message="${empty.compile.junit.tests.log.message}"/> + <echo message="${end.compile.junit.tests.log.message}"/> + </target> + + + <target name="run_junit_tests" + depends="compile_junit_tests" + description="--> execute junit tests"> + <echo message="${begin.run.junit.tests.log.message}"/> + <echo message="${empty.run.junit.tests.log.message}"/> + <echo message="${end.run.junit.tests.log.message}"/> + </target> + + + <target name="verify" + depends="run_junit_tests" + description="--> build and execute junit tests"> + <echo message="${notify.verify.log.message}"/> + </target> + + + <target name="clean_javadocs" + depends="" + description="--> remove javadocs directory"> + <echo message="${begin.clean.javadocs.log.message}"/> + <echo message="${empty.clean.javadocs.log.message}"/> + <echo message="${end.clean.javadocs.log.message}"/> + </target> + + + <target name="compose_javadocs" + depends="build" + description="--> generate javadocs"> + <echo message="${begin.compose.javadocs.log.message}"/> + <echo message="${empty.compose.javadocs.log.message}"/> + <echo message="${end.compose.javadocs.log.message}"/> + </target> + + + <target name="document" + depends="clean_javadocs,compose_javadocs" + description="--> remove old javadocs and compose new javadocs"> + <echo message="${notify.document.log.message}"/> + </target> + + + <target name="distribute_binaries" + depends="document" + description="--> create the zip and gzipped tar binary distributions"> + <echo message="${begin.distribute.binaries.log.message}"/> + <mkdir dir="${dist.base.binaries}"/> + + <echo message="${begin.binary.wrappers.log.message}"/> + <echo message="${empty.binary.wrappers.log.message}"/> + <echo message="${end.binary.wrappers.log.message}"/> + + <echo message="${begin.binary.zip.log.message}"/> + <zip destfile="${dist.base.binaries}/${dist.name}.zip"> + <zipfileset dir="." + filemode="755" + prefix="usr/bin"> + <include name="${product.prefix}-install"/> + <include name="${product.prefix}-uninstall"/> + </zipfileset> + <zipfileset dir="." + filemode="755" + prefix="usr/share/doc/${dist.name}"> + <include name="LICENSE"/> + </zipfileset> + </zip> + <echo message="${end.binary.zip.log.message}"/> + + <echo message="${begin.binary.tar.log.message}"/> + <tar longfile="gnu" + destfile="${dist.base.binaries}/${dist.name}.tar"> + <tarfileset dir="." + mode="755" + prefix="${dist.name}/usr/bin"> + <include name="${product.prefix}-install"/> + <include name="${product.prefix}-uninstall"/> + </tarfileset> + <tarfileset dir="." + mode="755" + prefix="${dist.name}/usr/share/doc/${dist.name}"> + <include name="LICENSE"/> + </tarfileset> + </tar> + <echo message="${end.binary.tar.log.message}"/> + + <echo message="${begin.binary.gtar.log.message}"/> + <gzip destfile="${dist.base.binaries}/${dist.name}.tar.gz" + src="${dist.base.binaries}/${dist.name}.tar"/> + <delete file="${dist.base.binaries}/${dist.name}.tar"/> + <delete dir="${dist.name}"/> + <checksum fileext=".md5"> + <fileset dir="${dist.base.binaries}/"> + <include name="**/*"/> + <exclude name="**/*.asc"/> + <exclude name="**/*.md5"/> + </fileset> + </checksum> + <checksum fileext=".sha1" + algorithm="SHA"> + <fileset dir="${dist.base.binaries}/"> + <include name="**/*"/> + <exclude name="**/*.asc"/> + <exclude name="**/*.md5"/> + </fileset> + </checksum> + <echo message="${end.binary.gtar.log.message}"/> + + <echo message="${end.distribute.binaries.log.message}"/> + </target> + + + <target name="distribute_source" + depends="" + description="--> create the zip and gzipped tar source distributions"> + <echo message="${begin.distribute.source.log.message}"/> + <mkdir dir="${dist.base.source}"/> + + <echo message="${begin.source.zip.log.message}"/> + <zip destfile="${dist.base.source}/${src.dist.name}.zip"> + <zipfileset dir="." + filemode="755" + prefix="${src.dist.name}"> + <include name="${specfile}"/> + <include name="LICENSE"/> + <include name="build.xml"/> + <include name="config/product*.xml"/> + <include name="config/release*.xml"/> + <include name="${product.prefix}-install"/> + <include name="${product.prefix}-uninstall"/> + <include name="release"/> + </zipfileset> + </zip> + <echo message="${end.source.zip.log.message}"/> + + <echo message="${begin.source.tar.log.message}"/> + <tar longfile="gnu" + destfile="${dist.base.source}/${src.dist.name}.tar"> + <tarfileset dir="." + mode="755" + prefix="${src.dist.name}"> + <include name="${specfile}"/> + <include name="LICENSE"/> + <include name="build.xml"/> + <include name="config/product*.xml"/> + <include name="config/release*.xml"/> + <include name="${product.prefix}-install"/> + <include name="${product.prefix}-uninstall"/> + <include name="release"/> + </tarfileset> + </tar> + <echo message="${end.source.tar.log.message}"/> + + <echo message="${begin.source.gtar.log.message}"/> + <gzip destfile="${dist.base.source}/${src.dist.name}.tar.gz" + src="${dist.base.source}/${src.dist.name}.tar"/> + <delete file="${dist.base.source}/${src.dist.name}.tar"/> + <delete dir="${dist.name}"/> + <checksum fileext=".md5"> + <fileset dir="${dist.base.source}/"> + <include name="**/*"/> + <exclude name="**/*.asc"/> + <exclude name="**/*.md5"/> + </fileset> + </checksum> + <checksum fileext=".sha1" + algorithm="SHA"> + <fileset dir="${dist.base.source}/"> + <include name="**/*"/> + <exclude name="**/*.asc"/> + <exclude name="**/*.md5"/> + </fileset> + </checksum> + <echo message="${end.source.gtar.log.message}"/> + + <echo message="${end.distribute.source.log.message}"/> + </target> + + + <target name="distribute" + depends="distribute_binaries,distribute_source" + description="--> create binary and source component distributions"> + <echo message="${notify.distribute.log.message}"/> + </target> + + + <target name="main" + depends="clean,distribute" + description="--> clean, build, verify, document, distribute [default]"> + <echo message="${notify.main.log.message}"/> + </target> + +</project> + diff --git a/pki/base/manage/config/product.xml b/pki/base/manage/config/product.xml new file mode 100644 index 000000000..33caf48ed --- /dev/null +++ b/pki/base/manage/config/product.xml @@ -0,0 +1,305 @@ +<!-- ### BEGIN COPYRIGHT BLOCK ### + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + Copyright (C) 2007 Red Hat, Inc. + All rights reserved. + ### END COPYRIGHT BLOCK ### --> +<project name="product.xml" default="main" basedir="."> + + <!-- Set up properties based upon the user's default Ant configuration --> + <property file=".ant.properties"/> + <property file="${user.home}/.ant.properties"/> + <property environment="env"/> + + + <!-- Check for required properties passed-in via the build scripts --> + <fail message="The '-Dspecfile=SPECFILE' property MUST always be specified!" + unless="specfile"/> + + + <!-- Set up optional properties passed-in via the build scripts --> + <property name="basedir" value=""/> + <property name="dirsec" value=""/> + <property name="target" value=""/> + + + <!-- Set up properties obtained from the spec file --> + <exec executable="perl" + failonerror="true" + outputproperty="Name"> + <arg value="-ne"/> + <arg value="print $1 if /%define base_product\s+(.*)/"/> + <arg value="${specfile}"/> + </exec> + + <exec executable="perl" + failonerror="true" + outputproperty="spec.product.ui.prefix"> + <arg value="-ne"/> + <arg value="print $1 if /%define base_ui_prefix\s+(\S+)/"/> + <arg value="${specfile}"/> + </exec> + + <exec executable="perl" + failonerror="true" + outputproperty="product.prefix"> + <arg value="-ne"/> + <arg value="print $1 if /%define base_prefix\s+(\S+)/"/> + <arg value="${specfile}"/> + </exec> + + <exec executable="perl" + failonerror="true" + outputproperty="product"> + <arg value="-ne"/> + <arg value="print $1 if /%define base_component\s+(\S+)/"/> + <arg value="${specfile}"/> + </exec> + + <!-- if "spec.product.ui.prefix" is "" or "linux", --> + <!-- set "product.ui.prefix" to ""; otherwise --> + <!-- set "product.ui.prefix" to "spec.product.ui.prefix" --> + <condition property="product.ui.prefix" + value="" + else="${spec.product.ui.prefix}"> + <or> + <equals arg1="${spec.product.ui.prefix}" + arg2=""/> + <equals arg1="${spec.product.ui.prefix}" + arg2="linux"/> + </or> + </condition> + + <!-- "product.name" is of the form "x-y-z" --> + <condition property="product.name" + value="${product.ui.prefix}-${product.prefix}-${product}"> + <not> + <equals arg1="${product.ui.prefix}" + arg2=""/> + </not> + </condition> + + <!-- "product.name" is of the form "x-y" --> + <condition property="product.name" + value="${product.prefix}-${product}"> + <and> + <equals arg1="${product.ui.prefix}" + arg2=""/> + <not> + <equals arg1="${product.prefix}" + arg2=""/> + </not> + </and> + </condition> + + <!-- "product.name" is of the form "x" --> + <condition property="product.name" + value="${product}"> + <and> + <equals arg1="${product.ui.prefix}" + arg2=""/> + <equals arg1="${product.prefix}" + arg2=""/> + </and> + </condition> + + <exec executable="perl" + failonerror="true" + outputproperty="version"> + <arg value="-ne"/> + <arg value="print $1 if /%define base_version\s+(\S+)/"/> + <arg value="${specfile}"/> + </exec> + + + <!-- Set up architecture-dependent properties --> + <exec executable="uname" + failonerror="true" + outputproperty="arch"> + <arg line="-i"/> + </exec> + + <!-- Set up architecture-independent properties --> + <property name="jar.home" value="/usr/share/java"/> + <property name="pki-jar.home" value="${jar.home}/${product.prefix}"/> + <property name="jni-jar.home" value="/usr/lib/java"/> + + <!-- Set up properties that control various build options --> + <property name="debug" value="true"/> + <property name="chmod.fail" value="true"/> + <property name="chmod.maxparallel" value="250"/> + <property name="deprecation" value="false"/> + <property name="optimize" value="true"/> + + + <!-- Set up properties related to the source tree --> + <property name="docs.dir" value="docs"/> + <property name="lib.dir" value="lib"/> + <property name="src.dir" value="src"/> + <property name="test.dir" value="test"/> + <property name="etc.dir" value="${src.dir}/etc"/> + <property name="script.dir" value="${src.dir}/script"/> + + + <!-- Set up properties for the release area --> + <property name="release.root" value="."/> + + + <!-- Set up properties for the build area --> + <property name="build.dir" value="build"/> + <property name="bootstrap.dir" value="bootstrap"/> + <property name="build.jars" value="${build.dir}/jars"/> + <property name="build.classes" value="${build.dir}/classes"/> + <property name="build.lib" value="${build.dir}/lib"/> + <property name="build.javadocs" value="${build.dir}/javadocs"/> + <property name="build.tests" value="${build.dir}/testcases"/> + <property name="build.tests.javadocs" value="${build.dir}/javadocs.test/"/> + <property name="manifest.tmp" value="${build.dir}/optional.manifest"/> + + + <!-- Set up properties for the distribution area --> + <property name="dist.name" value="${product.name}-${version}"/> + <property name="dist.base" value="dist"/> + <property name="dist.base.source" value="${dist.base}/source"/> + <property name="dist.base.binaries" value="${dist.base}/binary"/> + <property name="dist.dir" value="dist"/> + <property name="dist.bin" value="${dist.dir}/bin"/> + <property name="dist.lib" value="${dist.dir}/lib"/> + <property name="dist.docs" value="${dist.dir}/docs"/> + <property name="dist.etc" value="${dist.dir}/etc"/> + <property name="src.dist.name" value="${product.name}-${version}"/> + <property name="src.dist.dir" value="dist-src"/> + <property name="src.dist.src" value="${src.dist.dir}/src"/> + <property name="src.dist.docs" value="${src.dist.dir}/docs"/> + <property name="src.dist.lib" value="${src.dist.dir}/lib"/> + + + <!-- Set up properties for log messages --> + <property name="begin.clean.log.message" + value="Removing '${product.name}' component directories ..."/> + <property name="empty.clean.log.message" + value="Nothing to do!"/> + <property name="end.clean.log.message" + value="Completed removing '${product.name}' component directories."/> + <property name="begin.download.log.message" + value="Downloading '${product.name}' dependent components ..."/> + <property name="empty.download.log.message" + value="Nothing to do!"/> + <property name="end.download.log.message" + value="Completed downloading '${product.name}' dependent components."/> + <property name="begin.compile.java.log.message" + value="Compiling '${product.name}' java code from '${src.dir}' into '${build.classes}' ..."/> + <property name="empty.compile.java.log.message" + value="Nothing to do!"/> + <property name="end.compile.java.log.message" + value="Completed compiling '${product.name}' java code from '${src.dir}' into '${build.classes}'."/> + <property name="begin.build.jars.log.message" + value="Generating '${product.name}' jar files ..."/> + <property name="empty.build.jars.log.message" + value="Nothing to do!"/> + <property name="end.build.jars.log.message" + value="Completed generating '${product.name}' jar files."/> + <property name="begin.build.jni.headers.log.message" + value="Generating '${product.name}' java header files ..."/> + <property name="empty.build.jni.headers.log.message" + value="Nothing to do!"/> + <property name="end.build.jni.headers.log.message" + value="Completed generating '${product.name}' java header files."/> + <property name="notify.build.log.message" + value="Built classes, jars, and jni headers for the '${product.name}' component."/> + <property name="begin.compile.junit.tests.log.message" + value="Compiling '${product.name}' junit tests from '${test.dir}' into '${build.tests}' ..."/> + <property name="empty.compile.junit.tests.log.message" + value="Nothing to do!"/> + <property name="end.compile.junit.tests.log.message" + value="Completed compiling '${product.name}' junit tests from '${test.dir}' into '${build.tests}'."/> + <property name="begin.run.junit.tests.log.message" + value="Executing '${product.name}' tests ..."/> + <property name="empty.run.junit.tests.log.message" + value="Nothing to do!"/> + <property name="end.run.junit.tests.log.message" + value="Completed executing '${product.name}' tests."/> + <property name="notify.verify.log.message" + value="Verified the '${product.name}' component."/> + <property name="begin.clean.javadocs.log.message" + value="Removing '${product.name}' javadocs directory ..."/> + <property name="empty.clean.javadocs.log.message" + value="Nothing to do!"/> + <property name="end.clean.javadocs.log.message" + value="Completed removing '${product.name}' javadocs directory."/> + <property name="begin.compose.javadocs.log.message" + value="Composing '${product.name}' javadocs ..."/> + <property name="empty.compose.javadocs.log.message" + value="Nothing to do!"/> + <property name="end.compose.javadocs.log.message" + value="Completed composing '${product.name}' javadocs."/> + <property name="notify.document.log.message" + value="Documented '${product.name}' javadocs."/> + <property name="begin.distribute.binaries.log.message" + value="Creating '${product.name}' binary distributions ..."/> + <property name="begin.binary.wrappers.log.message" + value=" Creating '${product.name}' binary wrappers ..."/> + <property name="empty.binary.wrappers.log.message" + value=" Nothing to do!"/> + <property name="end.binary.wrappers.log.message" + value=" Completed creating '${product.name}' binary wrappers."/> + <property name="begin.binary.zip.log.message" + value=" Creating '${product.name}' binary zip files ..."/> + <property name="empty.binary.zip.log.message" + value=" Nothing to do!"/> + <property name="end.binary.zip.log.message" + value=" Completed creating '${product.name}' binary zip files."/> + <property name="begin.binary.tar.log.message" + value=" Creating '${product.name}' binary tar files ..."/> + <property name="empty.binary.tar.log.message" + value=" Nothing to do!"/> + <property name="end.binary.tar.log.message" + value=" Completed creating '${product.name}' binary tar files."/> + <property name="begin.binary.gtar.log.message" + value=" Creating '${product.name}' binary gzip files ..."/> + <property name="empty.binary.gtar.log.message" + value=" Nothing to do!"/> + <property name="end.binary.gtar.log.message" + value=" Completed creating '${product.name}' binary gzip files."/> + <property name="end.distribute.binaries.log.message" + value="Completed creating '${product.name}' binary distributions."/> + <property name="begin.distribute.source.log.message" + value="Creating '${product.name}' source distributions ..."/> + <property name="begin.source.zip.log.message" + value=" Creating '${product.name}' source zip files ..."/> + <property name="empty.source.zip.log.message" + value=" Nothing to do!"/> + <property name="end.source.zip.log.message" + value=" Completed creating '${product.name}' source zip files."/> + <property name="begin.source.tar.log.message" + value=" Creating '${product.name}' source tar files ..."/> + <property name="empty.source.tar.log.message" + value=" Nothing to do!"/> + <property name="end.source.tar.log.message" + value=" Completed creating '${product.name}' source tar files."/> + <property name="begin.source.gtar.log.message" + value=" Creating '${product.name}' source gzip files ..."/> + <property name="empty.source.gtar.log.message" + value=" Nothing to do!"/> + <property name="end.source.gtar.log.message" + value=" Completed creating '${product.name}' source gzip files."/> + <property name="end.distribute.source.log.message" + value="Completed creating '${product.name}' source distributions."/> + <property name="notify.distribute.log.message" + value="Distributed '${product.name}' distribution packages."/> + <property name="notify.main.log.message" + value="Built, verified, documented, and distributed a fresh '${product.name}' component."/> + +</project> + diff --git a/pki/base/manage/config/release.xml b/pki/base/manage/config/release.xml new file mode 100644 index 000000000..fc43aaeb7 --- /dev/null +++ b/pki/base/manage/config/release.xml @@ -0,0 +1,86 @@ +<!-- ### BEGIN COPYRIGHT BLOCK ### + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + Copyright (C) 2007 Red Hat, Inc. + All rights reserved. + ### END COPYRIGHT BLOCK ### --> +<project name="release.xml" default="main" basedir="${basedir}"> + + <echo message="Importing shared properties ..."/> + <import file="product.xml"/> + <import file="product-ext.xml" optional="true"/> + <import file="release-ext.xml" optional="true"/> + <echo message="Completed importing shared properties."/> + + + <target name="local" + depends="" + description="--> Generate this target locally"> + <echo message="Generating the '${product.name}' target locally ..."/> + <exec executable="ant" dir="${release.root}"> + <arg value="-Dspecfile=${product.name}.spec"/> + <arg value="-Ddirsec=${dirsec}"/> + <arg value="${target}"/> + </exec> + <echo message="Completed generating the '${product.name}' target locally."/> + </target> + + + <target name="main" + depends="" + description="--> Generate component RPMS and SRPMS"> + <echo message="Generating '${product.name}' RPMS and SRPMS ..."/> + + <exec executable="pwd" + failonerror="true" + outputproperty="top.dir"/> + <echo message="Established the '${top.dir}' top-level directory."/> + + <echo message="Creating the '${product.name}' source distribution ..."/> + <exec executable="ant" + dir="${release.root}"> + <arg value="-Dspecfile=${product.name}.spec"/> + <arg value="-Ddirsec=${dirsec}"/> + <arg value="distribute_source"/> + </exec> + <echo message="Completed creating the '${product.name}' source distribution."/> + + <echo message="Creating '${product.name}' RPM directories ..."/> + <mkdir dir="${release.root}/dist/rpmpkg"/> + <mkdir dir="${release.root}/dist/rpmpkg/SOURCES"/> + <mkdir dir="${release.root}/dist/rpmpkg/RPMS"/> + <mkdir dir="${release.root}/dist/rpmpkg/SRPMS"/> + <mkdir dir="${release.root}/dist/rpmpkg/SPECS"/> + <mkdir dir="${release.root}/dist/rpmpkg/BUILD"/> + <echo message="Completed creating '${product.name}' RPM directories."/> + + <echo message="Building '${product.name}' RPMS and SRPMS ..."/> + <exec executable="rpmbuild" + dir="${release.root}"> + <arg value="--define"/> + <arg value="_topdir ${top.dir}/${release.root}/dist/rpmpkg"/> + <arg value="-ta"/> + <arg value="${top.dir}/${release.root}/dist/source/${product.name}-${version}.tar.gz"/> + </exec> + <echo message="Completed building '${product.name}' RPMS and SRPMS."/> + + <echo message="Removing various '${product.name}' RPM directories and files ..."/> + <delete dir="${release.root}/dist/rpmpkg/BUILD"/> + <echo message="Completed removing various '${product.name}' RPM directories and files."/> + + <echo message="Completed generating '${product.name}' RPMS and SRPMS."/> + </target> + +</project> + diff --git a/pki/base/manage/pki-install b/pki/base/manage/pki-install new file mode 100755 index 000000000..25b28b9d4 --- /dev/null +++ b/pki/base/manage/pki-install @@ -0,0 +1,1475 @@ +#!/usr/bin/perl +# --- BEGIN COPYRIGHT BLOCK --- +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- + +############################################################## +# This script installs one or more PKI subsystem(s). +# +# To execute: +# +# pki-install -pki_subsystem=<pki_subsystem> # Where PKI subsystem +# # may be: +# # +# # 'all', 'ca', +# # 'drm', 'esc', +# # 'ocsp', 'ra', +# # 'tks', or 'tps' +# +# -pki_package_path=<package_path> # The fully specified +# # path to the PKI +# # package repository +# +# [-force] # Don't require +# # confirmation +# +# +# Installed Package Order: +# +# [1] PKI Dirsec Packages +# [2] PKI Mozldap Packages +# [3] PKI Apache Packages +# [4] PKI Fortitude Packages +# [5] PKI Perl Module Packages +# [6] PKI Tomcat Packages +# [7] PKI Migration Packages +# [8] PKI Subsystem Packages +# [9] Top-Level PKI Subsystem Package(s) +# +############################################################## + + +############################################################## +# Perl Version +############################################################## + +use strict; + +my $MINIMUM_PERL_VERSION = "5.006001"; + +my $perl_version_error_message = "\nERROR: Using Perl version $] ...\n" + . " Must use Perl version " + . "$MINIMUM_PERL_VERSION or later to " + . "run this script!\n\n"; + +die "$perl_version_error_message" if $] < $MINIMUM_PERL_VERSION; + + +############################################################## +# Execution Check +############################################################## + +# Check to insure that this script's original +# invocation directory has not been deleted! +my $cwd = `/bin/pwd`; +chomp $cwd; +if( "$cwd" eq "" ) { + print( STDERR "Cannot invoke '$0' from non-existent directory!\n" ); + print( STDOUT "\n" ); + exit 255; +} + + +############################################################## +# Environment Variables +############################################################## + +# untaint called subroutines +if( ( $^O ne 'Windows_NT' ) && ( $^O ne 'MSWin32' ) ) { + $> = $<; # set effective user ID to real UID + $) = $(; # set effective group ID to real GID + $ENV{ 'PATH' } = '/bin:/usr/bin'; + $ENV{ 'ENV' } = '' if $ENV{ 'ENV' } ne ''; +} + + +############################################################## +# Perl Modules +############################################################## + +# "Getopt/Long.pm" is a part of the standard Perl library and +# should therefore always be available +use Getopt::Long; + + +############################################################## +# Command-Line Variables +############################################################## + +my $ARGS = ( $#ARGV + 1 ); + +my $pki_subsystem = ""; +my $pki_package_path = ""; +my $force = 0; + + +############################################################## +# Local Constants +############################################################## + +my $ROOTUID = 0; + +my $MIN_ARGS = 2; +my $MAX_ARGS = 3; + + +############################################################## +# Local Data Structures +############################################################## + +# [1] PKI Dirsec Packages +my @pki_dirsec_packages = (); +my @ca_dirsec_packages = (); +my @kra_dirsec_packages = (); +my @ocsp_dirsec_packages = (); +my @ra_dirsec_packages = (); +my @tks_dirsec_packages = (); +my @tps_dirsec_packages = (); + +# [2] PKI Mozldap Packages +my @pki_mozldap6_packages = (); +my @ca_mozldap_packages = (); +my @kra_mozldap_packages = (); +my @ocsp_mozldap_packages = (); +my @ra_mozldap_packages = (); +my @tks_mozldap_packages = (); +my @tps_mozldap_packages = (); + +# [3] PKI Apache Packages +my @pki_apache_packages = (); +my @ca_apache_packages = (); +my @kra_apache_packages = (); +my @ocsp_apache_packages = (); +my @ra_apache_packages = (); +my @tks_apache_packages = (); +my @tps_apache_packages = (); + +# [4] PKI Fortitude Packages +my @pki_fortitude_mozldap_packages = (); +my @pki_fortitude_packages = (); +my @ca_fortitude_packages = (); +my @kra_fortitude_packages = (); +my @ocsp_fortitude_packages = (); +my @ra_fortitude_packages = (); +my @tks_fortitude_packages = (); +my @tps_fortitude_packages = (); + +# [5] PKI Perl Module Packages +my @pki_perl_module_packages = (); +my @ca_perl_module_packages = (); +my @kra_perl_module_packages = (); +my @ocsp_perl_module_packages = (); +my @ra_perl_module_packages = (); +my @tks_perl_module_packages = (); +my @tps_perl_module_packages = (); + +# [6] PKI Tomcat Packages +my @pki_tomcat_packages = (); +my @ca_tomcat_packages = (); +my @kra_tomcat_packages = (); +my @ocsp_tomcat_packages = (); +my @ra_tomcat_packages = (); +my @tks_tomcat_packages = (); +my @tps_tomcat_packages = (); + +# [7] PKI Migration Packages +my @pki_migration_packages = (); +my @ca_migration_packages = (); +my @kra_migration_packages = (); +my @ocsp_migration_packages = (); +my @ra_migration_packages = (); +my @tks_migration_packages = (); +my @tps_migration_packages = (); + +# [8] PKI Subsystem Packages +my @pki_packages = (); +my @ca_packages = (); +my @esc_packages = (); +my @kra_packages = (); +my @ocsp_packages = (); +my @ra_packages = (); +my @tks_packages = (); +my @tps_packages = (); + +# [9] Top-Level PKI Subsystem Package(s) +my %pki_subsystems = (); + + +############################################################## +# Local Variables +############################################################## + +my $pki_architecture = ""; +my $pki_flavor = ""; +my $pki_package_type = ""; +my $pki_containers = ""; +my $presence_command = ""; +my $presence_message = ""; +my $install_command = ""; +my $pki_prefix = ""; +my $pki_suffix = ""; + +my @pki_package_installation_list = (); + +my $command = ""; + + +############################################################## +# Platform-Dependent Data Initialization +############################################################## + +if( $^O eq "linux" ) { + $pki_architecture = `uname -i`; + $pki_flavor = "pki"; + $pki_package_type = "rpm"; + $pki_containers = "RPMs"; + $presence_command = "rpm -q "; + $install_command = "rpm -Uvh "; + + chomp( $pki_architecture ); + + if( $pki_architecture eq "i386" ) { + $pki_prefix = ""; + $pki_suffix = ""; + } elsif( $pki_architecture eq "x86_64" ) { + $pki_prefix = ""; + $pki_suffix = ""; + } else { + print( STDERR + "\nERROR: Unsupported architecture '$pki_architecture'!\n\n" ); + exit 255; + } + + + # [1] PKI Dirsec Packages + @pki_dirsec_packages = ( + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools", + "$pki_prefix" . "dirsec-jss" . "$pki_suffix" + ); + @ca_dirsec_packages = ( @pki_dirsec_packages ); + @kra_dirsec_packages = ( @pki_dirsec_packages ); + @ocsp_dirsec_packages = ( @pki_dirsec_packages ); + @ra_dirsec_packages = ( + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools" + ); + @tks_dirsec_packages = ( @pki_dirsec_packages ); + @tps_dirsec_packages = ( + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools" + ); + + + # [2] PKI Mozldap Packages + @pki_mozldap6_packages = ( + "$pki_prefix" . "svrcore" . "$pki_suffix", + "$pki_prefix" . "mozldap6" . "$pki_suffix", + "$pki_prefix" . "mozldap6" . "$pki_suffix" . "-tools" + ); + @ca_mozldap_packages = ( + @pki_mozldap6_packages + ); + @kra_mozldap_packages = ( + @pki_mozldap6_packages + ); + @ocsp_mozldap_packages = ( + @pki_mozldap6_packages + ); + @ra_mozldap_packages = ( + @pki_mozldap6_packages + ); + @tks_mozldap_packages = ( + @pki_mozldap6_packages + ); + @tps_mozldap_packages = ( + @pki_mozldap6_packages + ); + + + # [3] PKI Apache Packages + @pki_apache_packages = (); + @ca_apache_packages = (); + @kra_apache_packages = (); + @ocsp_apache_packages = (); + @ra_apache_packages = (); + @tks_apache_packages = (); + @tps_apache_packages = (); + + + # [4] PKI Fortitude Packages + @pki_fortitude_mozldap_packages = ( + "$pki_prefix" . "mozldap" . "$pki_suffix", + "$pki_prefix" . "mozldap" . "$pki_suffix" . "-tools", + ); + @pki_fortitude_packages = ( + "$pki_prefix" . "fortitude-mod_nss" . "$pki_suffix", + "$pki_prefix" . "fortitude-mod_revocator" . "$pki_suffix", + "$pki_prefix" . "fortitude-web" . "$pki_suffix" + ); + @ca_fortitude_packages = (); + @kra_fortitude_packages = (); + @ocsp_fortitude_packages = (); + @ra_fortitude_packages = ( + @pki_fortitude_mozldap_packages, + @pki_fortitude_packages + ); + @tks_fortitude_packages = (); + @tps_fortitude_packages = ( + @pki_fortitude_mozldap_packages, + @pki_fortitude_packages + ); + + + # [5] PKI Perl Module Packages + @pki_perl_module_packages = ( + "$pki_prefix" . "perl-Parse-RecDescent" . "$pki_suffix", + "$pki_prefix" . "perl-HTML-Tagset" . "$pki_suffix", + "$pki_prefix" . "perl-HTML-Parser" . "$pki_suffix", + "$pki_prefix" . "perl-URI" . "$pki_suffix", + "$pki_prefix" . "perl-libwww-perl" . "$pki_suffix", + "$pki_prefix" . "perl-XML-Parser" . "$pki_suffix", + "$pki_prefix" . "perl-XML-Simple" . "$pki_suffix", + "$pki_prefix" . "perl-XML-NamespaceSupport" . "$pki_suffix", + "$pki_prefix" . "perl-XML-SAX" . "$pki_suffix" + ); + @ca_perl_module_packages = (); + @kra_perl_module_packages = (); + @ocsp_perl_module_packages = (); + @ra_perl_module_packages = ( @pki_perl_module_packages ); + @tks_perl_module_packages = (); + @tps_perl_module_packages = ( @pki_perl_module_packages ); + + + # [6] PKI Tomcat Packages + @pki_tomcat_packages = ( + "$pki_prefix" . "eclipse-ecj" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-logging" . "$pki_suffix", + "$pki_prefix" . "tomcat5-servlet-2.4-api" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-collections" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-beanutils" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-digester" . "$pki_suffix", + "$pki_prefix" . "oro" . "$pki_suffix", + "$pki_prefix" . "classpathx-jaf" . "$pki_suffix", + "$pki_prefix" . "ldapjdk" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-pool" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-fileupload" . "$pki_suffix", + "$pki_prefix" . "xmlbeans" . "$pki_suffix", + "$pki_prefix" . "xml-commons" . "$pki_suffix", + "$pki_prefix" . "xml-commons-apis" . "$pki_suffix", + "$pki_prefix" . "regexp" . "$pki_suffix", + "$pki_prefix" . "bcel" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-dbcp" . "$pki_suffix", + "$pki_prefix" . "tomcat5-jasper" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-discovery" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-httpclient3" . "$pki_suffix", + "$pki_prefix" . "jms" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-launcher" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-el" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-daemon" . "$pki_suffix", + "$pki_prefix" . "gnu-crypto-sasl-jdk1.4" . "$pki_suffix", + "$pki_prefix" . "classpathx-mail" . "$pki_suffix", + "$pki_prefix" . "xerces-j2" . "$pki_suffix", + "$pki_prefix" . "xalan-j2" . "$pki_suffix", + "$pki_prefix" . "log4j" . "$pki_suffix", + "$pki_prefix" . "xml-commons-resolver" . "$pki_suffix", + "$pki_prefix" . "avalon-logkit" . "$pki_suffix", + "$pki_prefix" . "avalon-framework" . "$pki_suffix", + "$pki_prefix" . "jdom" . "$pki_suffix", + "$pki_prefix" . "oldjdom" . "$pki_suffix", + "$pki_prefix" . "werken.xpath" . "$pki_suffix", + "$pki_prefix" . "velocity" . "$pki_suffix", + "$pki_prefix" . "ant" . "$pki_suffix", + "$pki_prefix" . "wsdl4j" . "$pki_suffix", + "$pki_prefix" . "axis" . "$pki_suffix", + "$pki_prefix" . "mx4j" . "$pki_suffix", + "$pki_prefix" . "geronimo-specs" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-modeler" . "$pki_suffix", + "$pki_prefix" . "idm-console-framework" . "$pki_suffix", + "$pki_prefix" . "fedora-idm-console" . "$pki_suffix", + "$pki_prefix" . "tomcat5" . "$pki_suffix" + ); + @ca_tomcat_packages = ( @pki_tomcat_packages ); + @kra_tomcat_packages = ( @pki_tomcat_packages ); + @ocsp_tomcat_packages = ( @pki_tomcat_packages ); + @ra_tomcat_packages = (); + @tks_tomcat_packages = ( @pki_tomcat_packages ); + @tps_tomcat_packages = (); + + + # [7] PKI Migration Packages + @pki_migration_packages = ( + "$pki_prefix" . "$pki_flavor-migrate" . "$pki_suffix" + ); + @ca_migration_packages = ( @pki_migration_packages ); + @kra_migration_packages = ( @pki_migration_packages ); + @ocsp_migration_packages = ( @pki_migration_packages ); + @ra_migration_packages = ( @pki_migration_packages ); + @tks_migration_packages = ( @pki_migration_packages ); + @tps_migration_packages = ( @pki_migration_packages ); + + + # [8] PKI Subsystem Packages + @pki_packages = ( + "$pki_prefix" . "$pki_flavor-manage" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "sqlite" . "$pki_suffix", + "$pki_prefix" . "perl-DBD-SQLite" . "$pki_suffix", + "pcsc-lite", + "pcsc-lite-libs", + "pcsc-lite-doc", + "ifd-egate", + "ccid", + "coolkey" + ); + @ca_packages = ( + "$pki_prefix" . "$pki_flavor-manage" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "*-" . "$pki_flavor-ca-ui" . "$pki_suffix" + ); + @esc_packages = ( + "pcsc-lite", + "pcsc-lite-libs", + "pcsc-lite-doc", + "ifd-egate", + "ccid", + "coolkey" + ); + @kra_packages = ( + "$pki_prefix" . "$pki_flavor-manage" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "*-" . "$pki_flavor-kra-ui" . "$pki_suffix" + ); + @ocsp_packages = ( + "$pki_prefix" . "$pki_flavor-manage" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "*-" . "$pki_flavor-ocsp-ui" . "$pki_suffix" + ); + @ra_packages = ( + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "sqlite" . "$pki_suffix", + "$pki_prefix" . "perl-DBD-SQLite" . "$pki_suffix", + "*-" . "$pki_flavor-ra-ui" . "$pki_suffix" + ); + @tks_packages = ( + "$pki_prefix" . "$pki_flavor-manage" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "*-" . "$pki_flavor-tks-ui" . "$pki_suffix" + ); + @tps_packages = ( + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "*-" . "$pki_flavor-tps-ui" . "$pki_suffix" + ); + + + # [9] Top-Level PKI Subsystem Package(s) + %pki_subsystems = ( + "ca" => "$pki_prefix" . "$pki_flavor-ca" . "$pki_suffix", + "drm" => "$pki_prefix" . "$pki_flavor-kra" . "$pki_suffix", + "esc" => "esc", + "ocsp" => "$pki_prefix" . "$pki_flavor-ocsp" . "$pki_suffix", + "ra" => "$pki_prefix" . "$pki_flavor-ra" . "$pki_suffix", + "tks" => "$pki_prefix" . "$pki_flavor-tks" . "$pki_suffix", + "tps" => "$pki_prefix" . "$pki_flavor-tps" . "$pki_suffix" + ); +} elsif( $^O eq "solaris" ) { + $pki_architecture = "sparcv9"; + $pki_flavor = "pki"; + $pki_package_type = "pkg"; + $pki_containers = "PKGs"; + $presence_command = "pkginfo | grep -c "; + $install_command = "( echo \"all\"; yes ) | /usr/sbin/pkgadd -d ./"; + + if( $pki_architecture eq "sparc" ) { + $pki_prefix = "RHAT"; + $pki_suffix = ""; + } elsif( $pki_architecture eq "sparcv9" ) { + $pki_prefix = "RHAT"; + $pki_suffix = "x"; + } else { + print( STDERR + "\nERROR: Unsupported architecture '$pki_architecture'!\n\n" ); + exit 255; + } + + + # [1] PKI Dirsec Packages + @pki_dirsec_packages = ( + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools", + "$pki_prefix" . "dirsec-jss" . "$pki_suffix" + ); + @ca_dirsec_packages = ( @pki_dirsec_packages ); + @kra_dirsec_packages = ( @pki_dirsec_packages ); + @ocsp_dirsec_packages = ( @pki_dirsec_packages ); + @ra_dirsec_packages = ( + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools" + ); + @tks_dirsec_packages = ( @pki_dirsec_packages ); + @tps_dirsec_packages = ( + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools" + ); + + + # [2] PKI Mozldap Packages + @pki_mozldap6_packages = ( + "$pki_prefix" . "svrcore" . "$pki_suffix", + "$pki_prefix" . "sasl" . "$pki_suffix" . "-lib", + "$pki_prefix" . "mozldap6" . "$pki_suffix", + "$pki_prefix" . "mozldap6" . "$pki_suffix" . "-tools" + ); + @ca_mozldap_packages = ( + @pki_mozldap6_packages + ); + @kra_mozldap_packages = ( + @pki_mozldap6_packages + ); + @ocsp_mozldap_packages = ( + @pki_mozldap6_packages + ); + @ra_mozldap_packages = ( + @pki_mozldap6_packages + ); + @tks_mozldap_packages = ( + @pki_mozldap6_packages + ); + @tps_mozldap_packages = ( + @pki_mozldap6_packages + ); + + + # [3] PKI Apache Packages + @pki_apache_packages = ( + "$pki_prefix" . "perl" . "$pki_suffix", + "$pki_prefix" . "apr" . "$pki_suffix", + "$pki_prefix" . "pcre" . "$pki_suffix", + "$pki_prefix" . "db4fortitude" . "$pki_suffix", + "$pki_prefix" . "db4fortitude" . "$pki_suffix" . "-utils", + "$pki_prefix" . "expat" . "$pki_suffix", + "$pki_prefix" . "apr-util" . "$pki_suffix", + "$pki_prefix" . "httpd" . "$pki_suffix", + "$pki_prefix" . "mod-perl" . "$pki_suffix" + ); + @ca_apache_packages = (); + @kra_apache_packages = (); + @ocsp_apache_packages = (); + @ra_apache_packages = ( @pki_apache_packages ); + @tks_apache_packages = (); + @tps_apache_packages = ( @pki_apache_packages ); + + + # [4] PKI Fortitude Packages + @pki_fortitude_mozldap_packages = ( + "$pki_prefix" . "mozldap" . "$pki_suffix", + "$pki_prefix" . "mozldap" . "$pki_suffix" . "-tools" + ); + @pki_fortitude_packages = ( + "$pki_prefix" . "fortitude-mod-nss" . "$pki_suffix", + "$pki_prefix" . "fortitude-mod-revocator" . "$pki_suffix", + "$pki_prefix" . "fortitude-web" . "$pki_suffix" + ); + @ca_fortitude_packages = (); + @kra_fortitude_packages = (); + @ocsp_fortitude_packages = (); + @ra_fortitude_packages = ( + @pki_fortitude_mozldap_packages, + @pki_fortitude_packages + ); + @tks_fortitude_packages = (); + @tps_fortitude_packages = ( + @pki_fortitude_mozldap_packages, + @pki_fortitude_packages + ); + + + # [5] PKI Perl Module Packages + @pki_perl_module_packages = ( + "$pki_prefix" . "perl-Parse-RecDescent" . "$pki_suffix", + "$pki_prefix" . "perl-HTML-Tagset" . "$pki_suffix", + "$pki_prefix" . "perl-HTML-Parser" . "$pki_suffix", + "$pki_prefix" . "perl-URI" . "$pki_suffix", + "$pki_prefix" . "perl-libwww-perl" . "$pki_suffix", + "$pki_prefix" . "perl-XML-Parser" . "$pki_suffix", + "$pki_prefix" . "perl-XML-Simple" . "$pki_suffix", + "$pki_prefix" . "perl-XML-NamespaceSupport" . "$pki_suffix", + "$pki_prefix" . "perl-XML-SAX" . "$pki_suffix" + ); + @ca_perl_module_packages = (); + @kra_perl_module_packages = (); + @ocsp_perl_module_packages = (); + @ra_perl_module_packages = ( @pki_perl_module_packages ); + @tks_perl_module_packages = (); + @tps_perl_module_packages = ( @pki_perl_module_packages ); + + + # [6] PKI Tomcat Packages + @pki_tomcat_packages = ( + "$pki_prefix" . "jpackage-utils" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-logging" . "$pki_suffix", + "$pki_prefix" . "tomcat5-servlet-2-4-api" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-collections" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-beanutils" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-digester" . "$pki_suffix", + "$pki_prefix" . "oro" . "$pki_suffix", + "$pki_prefix" . "classpathx-jaf" . "$pki_suffix", + "$pki_prefix" . "ldapjdk" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-pool" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-fileupload" . "$pki_suffix", + "$pki_prefix" . "xmlbeans" . "$pki_suffix", + "$pki_prefix" . "xml-commons" . "$pki_suffix", + "$pki_prefix" . "xml-commons-apis" . "$pki_suffix", + "$pki_prefix" . "regexp" . "$pki_suffix", + "$pki_prefix" . "bcel" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-dbcp" . "$pki_suffix", + "$pki_prefix" . "tomcat5-jasper" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-discovery" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-httpclient3" . "$pki_suffix", + "$pki_prefix" . "jms" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-launcher" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-el" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-daemon" . "$pki_suffix", + "$pki_prefix" . "gnu-crypto-sasl-jdk1-4" . "$pki_suffix", + "$pki_prefix" . "classpathx-mail" . "$pki_suffix", + "$pki_prefix" . "xerces-j2" . "$pki_suffix", + "$pki_prefix" . "xalan-j2" . "$pki_suffix", + "$pki_prefix" . "log4j" . "$pki_suffix", + "$pki_prefix" . "xml-commons-resolver" . "$pki_suffix", + "$pki_prefix" . "avalon-logkit" . "$pki_suffix", + "$pki_prefix" . "avalon-framework" . "$pki_suffix", + "$pki_prefix" . "jdom" . "$pki_suffix", + "$pki_prefix" . "oldjdom" . "$pki_suffix", + "$pki_prefix" . "werken-xpath" . "$pki_suffix", + "$pki_prefix" . "velocity" . "$pki_suffix", + "$pki_prefix" . "ant" . "$pki_suffix", + "$pki_prefix" . "wsdl4j" . "$pki_suffix", + "$pki_prefix" . "axis" . "$pki_suffix", + "$pki_prefix" . "mx4j" . "$pki_suffix", + "$pki_prefix" . "geronimo-specs" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-modeler" . "$pki_suffix", + "$pki_prefix" . "idm-console-framework" . "$pki_suffix", + "$pki_prefix" . "fedora-idm-console" . "$pki_suffix", + "$pki_prefix" . "tomcat5" . "$pki_suffix" + ); + @ca_tomcat_packages = ( @pki_tomcat_packages ); + @kra_tomcat_packages = ( @pki_tomcat_packages ); + @ocsp_tomcat_packages = ( @pki_tomcat_packages ); + @ra_tomcat_packages = (); + @tks_tomcat_packages = ( @pki_tomcat_packages ); + @tps_tomcat_packages = (); + + + # [7] PKI Migration Packages + @pki_migration_packages = ( + "$pki_prefix" . "$pki_flavor-migrate" . "$pki_suffix" + ); + @ca_migration_packages = ( @pki_migration_packages ); + @kra_migration_packages = ( @pki_migration_packages ); + @ocsp_migration_packages = ( @pki_migration_packages ); + @ra_migration_packages = ( @pki_migration_packages ); + @tks_migration_packages = ( @pki_migration_packages ); + @tps_migration_packages = ( @pki_migration_packages ); + + + # [8] PKI Subsystem Packages + @pki_packages = ( + "$pki_prefix" . "$pki_flavor-manage" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "readline" . "$pki_suffix", + "$pki_prefix" . "ncurses" . "$pki_suffix", + "$pki_prefix" . "sqlite" . "$pki_suffix", + "$pki_prefix" . "perl-DBI" . "$pki_suffix", + "$pki_prefix" . "perl-DBD-SQLite" . "$pki_suffix" + ); + @ca_packages = ( + "$pki_prefix" . "$pki_flavor-manage" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "*-" . "$pki_flavor-ca-ui" . "$pki_suffix" + ); + @esc_packages = (); + @kra_packages = ( + "$pki_prefix" . "$pki_flavor-manage" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "*-" . "$pki_flavor-kra-ui" . "$pki_suffix" + ); + @ocsp_packages = ( + "$pki_prefix" . "$pki_flavor-manage" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "*-" . "$pki_flavor-ocsp-ui" . "$pki_suffix" + ); + @ra_packages = ( + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "readline" . "$pki_suffix", + "$pki_prefix" . "ncurses" . "$pki_suffix", + "$pki_prefix" . "sqlite" . "$pki_suffix", + "$pki_prefix" . "perl-DBI" . "$pki_suffix", + "$pki_prefix" . "perl-DBD-SQLite" . "$pki_suffix", + "*-" . "$pki_flavor-ra-ui" . "$pki_suffix" + ); + @tks_packages = ( + "$pki_prefix" . "$pki_flavor-manage" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "*-" . "$pki_flavor-tks-ui" . "$pki_suffix" + ); + @tps_packages = ( + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "*-" . "$pki_flavor-tps-ui" . "$pki_suffix" + ); + + + # [9] Top-Level PKI Subsystem Package(s) + %pki_subsystems = ( + "ca" => "$pki_prefix" . "$pki_flavor-ca" . "$pki_suffix", + "drm" => "$pki_prefix" . "$pki_flavor-kra" . "$pki_suffix", + "ocsp" => "$pki_prefix" . "$pki_flavor-ocsp" . "$pki_suffix", + "ra" => "$pki_prefix" . "$pki_flavor-ra" . "$pki_suffix", + "tks" => "$pki_prefix" . "$pki_flavor-tks" . "$pki_suffix", + "tps" => "$pki_prefix" . "$pki_flavor-tps" . "$pki_suffix" + ); +} else { + print( STDERR + "\nERROR: Unsupported platform '$^O'!\n\n" ); + exit 255; +} + + +############################################################## +# Local Data Initialization +############################################################## + + + +############################################################## +# PKI Subsystem Installation Subroutines +############################################################## + +# no args +# return 1 - true, or +# return 0 - false +sub is_Windows() +{ + if( ( $^O eq "Windows_NT" ) || ( $^O eq "MSWin32" ) ) { + return 1; + } + + return 0; +} + + +# no args +# return 1 - success, or +# return 0 - failure +sub check_for_root_UID() +{ + my $result = 0; + + # On Linux/UNIX, insure that this script is being run as "root"; + # First check the "Real" UID, and then check the "Effective" UID. + if( !is_Windows() ) { + if( ( $< != $ROOTUID ) && + ( $> != $ROOTUID ) ) { + print( STDERR + "\nERROR: The '$0' script must be run as root!\n\n" ); + $result = 0; + } else { + # Success -- running script as root + $result = 1; + } + } else { + print( STDERR + "\nERROR: Root UID makes no sense on Windows machines!\n\n" ); + $result = 0; + } + + return $result; +} + + +# no args +# no return value +sub usage() +{ + print( STDOUT + "USAGE: pki-install -pki_subsystem=<pki_subsystem> " + . "# Where PKI subsystem\n" + . " " + . "# may be:\n" + . " " + . "#\n" + . " " + . "# 'all', 'ca',\n" + . " " + . "# 'drm', 'esc',\n" + . " " + . "# 'ocsp', 'ra',\n" + . " " + . "# 'tks', or 'tps\n\n" + . " -pki_package_path=<package_path> " + . "# The fully specified\n" + . " " + . "# path to the PKI\n" + . " " + . "# package repository\n\n" + . " [-force] " + . "# Don't require\n" + . " " + . "# confirmation\n\n\n" ); + + print( STDOUT + " NOTE: The keyword 'all' adds every PKI " + . "subsystem to\n" + . " this host (including 'esc' on Linux).\n\n" ); + + print( STDOUT + " EXAMPLE: pki-install -pki_subsystem=all\n" + . " -pki_package_path=/media/cdrom/Fedora/RPMS\n" + . " -force\n\n" ); + + return; +} + + +# no args +# return 1 - success, or +# return 0 - failure +sub check_for_valid_number_of_arguments() +{ + my $result = 1; + + if( $ARGS < $MIN_ARGS || + $ARGS > $MAX_ARGS ) { + print( STDERR + "\nERROR: Specified " + . $ARGS + . " command-line arguments!\n\n" ); + $result = 0; + } + + return $result; +} + + +# no args +# return 1 - success, or +# return 0 - failure +sub check_for_valid_path() +{ + my $result = 1; + my $total_pki_packages = 0; + + # make sure that the path provided is a valid directory + if( ! -d $pki_package_path ) { + print( STDERR + "\nERROR: The specified path '" + . $pki_package_path + . "' is an invalid directory!\n\n" ); + $result = 0; + } else { + # check this directory for the presence of any packages + while( <$pki_package_path/*.$pki_package_type> ) { + $total_pki_packages++; + } + + if( !$total_pki_packages ) { + print( STDERR + "\nERROR: The specified path '" + . $pki_package_path + . "' contains no $pki_containers!\n\n" ); + $result = 0; + } + } + + return $result; +} + + +# arg0 list to be processed +# no return value +sub build_pki_package_installation_list +{ + while( @_ ) { + my $package .= shift( @_ ); + + my $package_name = ""; + + # express complete package name using wildcards + my $wildcard_package = $package . "-[0123456789]*"; + + # expand this complete package name to display it without wildcards + my $complete_package = `cd $pki_package_path; ls $wildcard_package`; + chomp( $complete_package ); + + # remove extension from package name + my $package_sans_extension = substr( $complete_package, + 0, + rindex( $complete_package, + "." + . $pki_package_type ) ); + + # remove architecture from remaining package name + my $package_sans_architecture = substr( $package_sans_extension, + 0, + rindex( $package_sans_extension, + "." ) ); + + # assign platform-dependent values + if( $^O eq "linux" ) { + $package_name = $package_sans_architecture; + $presence_message = "package $package_name is not installed\n"; + } elsif( $^O eq "solaris" ) { + $package_name = $package; + $presence_message = "0\n"; + } + + # process this package + my $rv = `$presence_command $package_name`; + if( "$rv" eq "$presence_message" ) { + push( @pki_package_installation_list, $complete_package ); + } + } + + return; +} + + +# no args +# no return value +sub print_pki_package_installation_list() +{ + print( STDOUT "PKI Package Installation List: " ); + while( @pki_package_installation_list ) { + my $package .= shift( @pki_package_installation_list ); + print( STDOUT " $package" ); + } + print( STDOUT "\n\n" ); + + return; +} + + +# no args +# return 1 - success, or +# return 0 - failure +sub determine_installed_pki_subsystems() +{ + my @installed_pki_subsystems = (); + + my $install_ca_subsystem = 0; + my $install_esc_subsystem = 0; + my $install_kra_subsystem = 0; + my $install_ocsp_subsystem = 0; + my $install_ra_subsystem = 0; + my $install_tks_subsystem = 0; + my $install_tps_subsystem = 0; + my $total_pki_subsystems = 0; + + my $specified_pki_subsystem = 0; + + # mark specified PKI subsystems + if( $pki_subsystem eq 'all' ) { + $specified_pki_subsystem = 1; + } + + # always process all PKI subsystems + while( my ( $key, $value ) = each( %pki_subsystems ) ) { + # mark specified PKI subsystem + if( $pki_subsystem eq $key ) { + $specified_pki_subsystem = 1; + } + + my $package_name = ""; + + # express complete package name using wildcards + my $wildcard_package = $value . "-[0123456789]*"; + + # expand this complete package name to display it without wildcards + my $complete_package = `cd $pki_package_path; ls $wildcard_package`; + chomp( $complete_package ); + + # remove extension from package name + my $package_sans_extension = substr( $complete_package, + 0, + rindex( $complete_package, + "." + . $pki_package_type ) ); + + # remove architecture from remaining package name + my $package_sans_architecture = substr( $package_sans_extension, + 0, + rindex( $package_sans_extension, + "." ) ); + + # assign platform-dependent values + if( $^O eq "linux" ) { + $package_name = $package_sans_architecture; + $presence_message = "package $package_name is not installed\n"; + } elsif( $^O eq "solaris" ) { + $package_name = $value; + $presence_message = "0\n"; + } + + my $rv = `$presence_command $package_name`; + if( $rv eq $presence_message ) { + # mark PKI subsystem for installation + if( $pki_subsystem eq $key ) { + if( $pki_subsystem eq 'ca' ) { + $install_ca_subsystem = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'drm' ) { + $install_kra_subsystem = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'esc' ) { + $install_esc_subsystem = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'ocsp' ) { + $install_ocsp_subsystem = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'ra' ) { + $install_ra_subsystem = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'tks' ) { + $install_tks_subsystem = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'tps' ) { + $install_tps_subsystem = 1; + $total_pki_subsystems++; + } + + print( STDOUT + "\nNOTIFICATION: Attempting to add '" + . $key + . "' subsystem ...\n\n" ); + } + + # mark this PKI subsystem to be installed + push( @installed_pki_subsystems, $value ); + } + } + + # check to be sure that a valid PKI subsystem was specified + if( !$specified_pki_subsystem ) { + print( STDERR + "\nERROR: The specified PKI subsystem '" + . $pki_subsystem + . "' is an invalid PKI subsystem!\n\n" ); + return 0; + } + + # mark each PKI subsystem package to be added + if( $pki_subsystem eq 'all' ) { + # mark all CA, ESC, KRA, OCSP, RA, TKS, and/or TPS + # packages for installation + build_pki_package_installation_list( @pki_dirsec_packages ); + build_pki_package_installation_list( @pki_mozldap6_packages ); + build_pki_package_installation_list( @pki_apache_packages ); + build_pki_package_installation_list( @pki_fortitude_mozldap_packages ); + build_pki_package_installation_list( @pki_fortitude_packages ); + build_pki_package_installation_list( @pki_perl_module_packages ); + build_pki_package_installation_list( @pki_tomcat_packages ); + build_pki_package_installation_list( @pki_migration_packages ); + build_pki_package_installation_list( @pki_packages ); + build_pki_package_installation_list( @installed_pki_subsystems ); + } elsif( $pki_subsystem eq 'ca' ) { + # mark all CA packages for installation + build_pki_package_installation_list( @ca_dirsec_packages ); + build_pki_package_installation_list( @ca_mozldap_packages ); + build_pki_package_installation_list( @ca_apache_packages ); + build_pki_package_installation_list( @ca_fortitude_packages ); + build_pki_package_installation_list( @ca_perl_module_packages ); + build_pki_package_installation_list( @ca_tomcat_packages ); + build_pki_package_installation_list( @ca_migration_packages ); + build_pki_package_installation_list( @ca_packages ); + if( $install_ca_subsystem ) { + # express complete package name using wildcards + my $wildcard_package = $pki_subsystems{$pki_subsystem} + . "-[01234567890]*"; + + # expand this complete package name to display it without wildcards + my $complete_package = `cd $pki_package_path; ls $wildcard_package`; + chomp( $complete_package ); + + push( @pki_package_installation_list, $complete_package ); + } + } elsif( $pki_subsystem eq 'drm' ) { + # mark all KRA packages for installation + build_pki_package_installation_list( @kra_dirsec_packages ); + build_pki_package_installation_list( @kra_mozldap_packages ); + build_pki_package_installation_list( @kra_apache_packages ); + build_pki_package_installation_list( @kra_fortitude_packages ); + build_pki_package_installation_list( @kra_perl_module_packages ); + build_pki_package_installation_list( @kra_tomcat_packages ); + build_pki_package_installation_list( @kra_migration_packages ); + build_pki_package_installation_list( @kra_packages ); + if( $install_kra_subsystem ) { + # express complete package name using wildcards + my $wildcard_package = $pki_subsystems{$pki_subsystem} + . "-[01234567890]*"; + + # expand this complete package name to display it without wildcards + my $complete_package = `cd $pki_package_path; ls $wildcard_package`; + chomp( $complete_package ); + + push( @pki_package_installation_list, $complete_package ); + } + } elsif( $pki_subsystem eq 'esc' ) { + # mark all ESC packages for installation + build_pki_package_installation_list( @esc_packages ); + if( $install_esc_subsystem ) { + # express complete package name using wildcards + my $wildcard_package = $pki_subsystems{$pki_subsystem} + . "-[01234567890]*"; + + # expand this complete package name to display it without wildcards + my $complete_package = `cd $pki_package_path; ls $wildcard_package`; + chomp( $complete_package ); + + push( @pki_package_installation_list, $complete_package ); + } + } elsif( $pki_subsystem eq 'ocsp' ) { + # mark all OCSP packages for installation + build_pki_package_installation_list( @ocsp_dirsec_packages ); + build_pki_package_installation_list( @ocsp_mozldap_packages ); + build_pki_package_installation_list( @ocsp_apache_packages ); + build_pki_package_installation_list( @ocsp_fortitude_packages ); + build_pki_package_installation_list( @ocsp_perl_module_packages ); + build_pki_package_installation_list( @ocsp_tomcat_packages ); + build_pki_package_installation_list( @ocsp_migration_packages ); + build_pki_package_installation_list( @ocsp_packages ); + if( $install_ocsp_subsystem ) { + # express complete package name using wildcards + my $wildcard_package = $pki_subsystems{$pki_subsystem} + . "-[01234567890]*"; + + # expand this complete package name to display it without wildcards + my $complete_package = `cd $pki_package_path; ls $wildcard_package`; + chomp( $complete_package ); + + push( @pki_package_installation_list, $complete_package ); + } + } elsif( $pki_subsystem eq 'ra' ) { + # mark all RA packages for installation + build_pki_package_installation_list( @ra_dirsec_packages ); + build_pki_package_installation_list( @ra_mozldap_packages ); + build_pki_package_installation_list( @ra_apache_packages ); + build_pki_package_installation_list( @ra_fortitude_packages ); + build_pki_package_installation_list( @ra_perl_module_packages ); + build_pki_package_installation_list( @ra_tomcat_packages ); + build_pki_package_installation_list( @ra_migration_packages ); + build_pki_package_installation_list( @ra_packages ); + if( $install_ra_subsystem ) { + # express complete package name using wildcards + my $wildcard_package = $pki_subsystems{$pki_subsystem} + . "-[01234567890]*"; + + # expand this complete package name to display it without wildcards + my $complete_package = `cd $pki_package_path; ls $wildcard_package`; + chomp( $complete_package ); + + push( @pki_package_installation_list, $complete_package ); + } + } elsif( $pki_subsystem eq 'tks' ) { + # mark all TKS packages for installation + build_pki_package_installation_list( @tks_dirsec_packages ); + build_pki_package_installation_list( @tks_mozldap_packages ); + build_pki_package_installation_list( @tks_apache_packages ); + build_pki_package_installation_list( @tks_fortitude_packages ); + build_pki_package_installation_list( @tks_perl_module_packages ); + build_pki_package_installation_list( @tks_tomcat_packages ); + build_pki_package_installation_list( @tks_migration_packages ); + build_pki_package_installation_list( @tks_packages ); + if( $install_tks_subsystem ) { + # express complete package name using wildcards + my $wildcard_package = $pki_subsystems{$pki_subsystem} + . "-[01234567890]*"; + + # expand this complete package name to display it without wildcards + my $complete_package = `cd $pki_package_path; ls $wildcard_package`; + chomp( $complete_package ); + + push( @pki_package_installation_list, $complete_package ); + } + } elsif( $pki_subsystem eq 'tps' ) { + # mark all TPS packages for installation + build_pki_package_installation_list( @tps_dirsec_packages ); + build_pki_package_installation_list( @tps_mozldap_packages ); + build_pki_package_installation_list( @tps_apache_packages ); + build_pki_package_installation_list( @tps_fortitude_packages ); + build_pki_package_installation_list( @tps_perl_module_packages ); + build_pki_package_installation_list( @tps_tomcat_packages ); + build_pki_package_installation_list( @tps_migration_packages ); + build_pki_package_installation_list( @tps_packages ); + if( $install_tps_subsystem ) { + # express complete package name using wildcards + my $wildcard_package = $pki_subsystems{$pki_subsystem} + . "-[01234567890]*"; + + # expand this complete package name to display it without wildcards + my $complete_package = `cd $pki_package_path; ls $wildcard_package`; + chomp( $complete_package ); + + push( @pki_package_installation_list, $complete_package ); + } + } + + return 1; +} + + +# arg0 question +# return answer +sub prompt +{ + my $promptStr = $_[0]; + + my $answer = ""; + + print( STDOUT "$promptStr " ); + + $| = 1; + $answer = <STDIN>; + + chomp $answer; + + print( STDOUT "\n" ); + + return $answer; +} + + +# no args +# no return values +sub install_specified_pki_subsystems() +{ + my $confirm = ""; + + if( scalar( @pki_package_installation_list ) ) { + if( $^O eq "linux" ) { + $command = "cd $pki_package_path;\n" . $install_command; + + while( @pki_package_installation_list ) { + $command .= shift( @pki_package_installation_list ); + $command .= " "; + } + + # remove any trailing spaces + chop( $command ); + } elsif( $^O eq "solaris" ) { + $command = "cd $pki_package_path;\n"; + + while( @pki_package_installation_list ) { + $command .= $install_command; + $command .= shift( @pki_package_installation_list ); + $command .= ";\n"; + } + } + } else { + print( STDERR + "\nNOTIFICATION: No packages for the specified PKI " + . "subsystem(s)\n" + . " could be added to this host!\n\n" ); + return; + } + +ASK_AGAIN: + if( !$force ) { + $confirm = prompt( "\nCONFIRMATION: You are about to execute " + . "the following commands:\n\n" + . "$command\n\n" + . "Are you sure (Y/N)? " ); + + if( $confirm eq "N" || $confirm eq "n" ) { + return; + } elsif( $confirm ne "Y" && $confirm ne "y" ) { + goto ASK_AGAIN; + } + } + + system( "$command" ); + + return; +} + + +############################################################## +# Main Program +############################################################## + +# no args +# return 1 - success, or +# return 0 - failure +sub main() +{ + my $result = 0; + + # On Linux/UNIX, insure that this script is being run as "root". + $result = check_for_root_UID(); + if( !$result ) { + usage(); + exit 255; + } + + # Parse command-line arguments. + GetOptions( "pki_subsystem=s" => \$pki_subsystem, + "pki_package_path=s" => \$pki_package_path, + "force" => \$force ); + + # Check for valid number of command-line arguments. + $result = check_for_valid_number_of_arguments(); + if( !$result ) { + usage(); + exit 255; + } + + # Check for a valid path. + $result = check_for_valid_path(); + if( !$result ) { + usage(); + exit 255; + } + + # Determine which subsystem(s) are installed on this system + $result = determine_installed_pki_subsystems(); + if( !$result ) { + usage(); + exit 255; + } + + # Install specified subsystem(s) + install_specified_pki_subsystems(); + + return 1; +} + + +############################################################## +# PKI Subsystem Installation +############################################################## + +main(); + +exit 0; + diff --git a/pki/base/manage/pki-uninstall b/pki/base/manage/pki-uninstall new file mode 100755 index 000000000..1d27cfd2b --- /dev/null +++ b/pki/base/manage/pki-uninstall @@ -0,0 +1,1521 @@ +#!/usr/bin/perl +# --- BEGIN COPYRIGHT BLOCK --- +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- + + +############################################################## +# This script uninstalls one or more existing PKI subsystem(s). +# +# To execute: +# +# pki-uninstall -pki_subsystem=<pki_subsystem> # Where PKI subsystem +# # may be: +# # +# # 'all', 'ca', +# # 'drm', 'esc', +# # 'ocsp', 'ra', +# # 'tks', or 'tps' +# +# [-force] # Don't require +# # confirmation +# +# +# Uninstalled Package Order: +# +# [1] Top-Level PKI Subsystem Package(s) +# [2] PKI Subsystem Packages +# [3] PKI Migration Packages +# [4] PKI Tomcat Packages +# [5] PKI Perl Module Packages +# [6] PKI Fortitude Packages +# [7] PKI Apache Packages +# [8] PKI Mozldap Packages +# [9] PKI Dirsec Packages +# +############################################################## + + +############################################################## +# Perl Version +############################################################## + +use strict; + +my $MINIMUM_PERL_VERSION = "5.006001"; + +my $perl_version_error_message = "\nERROR: Using Perl version $] ...\n" + . " Must use Perl version " + . "$MINIMUM_PERL_VERSION or later to " + . "run this script!\n\n"; + +die "$perl_version_error_message" if $] < $MINIMUM_PERL_VERSION; + + +############################################################## +# Execution Check +############################################################## + +# Check to insure that this script's original +# invocation directory has not been deleted! +my $cwd = `/bin/pwd`; +chomp $cwd; +if( "$cwd" eq "" ) { + print( STDERR "Cannot invoke '$0' from non-existent directory!\n" ); + print( STDOUT "\n" ); + exit 255; +} + + +############################################################## +# Environment Variables +############################################################## + +# untaint called subroutines +if( ( $^O ne 'Windows_NT' ) && ( $^O ne 'MSWin32' ) ) { + $> = $<; # set effective user ID to real UID + $) = $(; # set effective group ID to real GID + $ENV{ 'PATH' } = '/bin:/usr/bin'; + $ENV{ 'ENV' } = '' if $ENV{ 'ENV' } ne ''; +} + + +############################################################## +# Perl Modules +############################################################## + +# "Getopt/Long.pm" is a part of the standard Perl library and +# should therefore always be available +use Getopt::Long; + + +############################################################## +# Command-Line Variables +############################################################## + +my $ARGS = ( $#ARGV + 1 ); + +my $pki_subsystem = ""; +my $force = 0; + + +############################################################## +# Local Constants +############################################################## + +my $ROOTUID = 0; + +my $MIN_ARGS = 1; +my $MAX_ARGS = 2; + + +############################################################## +# Local Data Structures +############################################################## + +# [1] Top-Level PKI Subsystem Package(s) +my %pki_subsystems = (); + +# [2] PKI Subsystem Packages +my @pki_packages = (); +my @ca_packages = (); +my @esc_packages = (); +my @kra_packages = (); +my @ocsp_packages = (); +my @ra_packages = (); +my @tks_packages = (); +my @tps_packages = (); + +# [3] PKI Migration Packages +my @pki_migration_packages = (); +my @ca_migration_packages = (); +my @kra_migration_packages = (); +my @ocsp_migration_packages = (); +my @ra_migration_packages = (); +my @tks_migration_packages = (); +my @tps_migration_packages = (); + +# [4] PKI Tomcat Packages +my @pki_tomcat_packages = (); +my @ca_tomcat_packages = (); +my @kra_tomcat_packages = (); +my @ocsp_tomcat_packages = (); +my @ra_tomcat_packages = (); +my @tks_tomcat_packages = (); +my @tps_tomcat_packages = (); + +# [5] PKI Perl Module Packages +my @pki_perl_module_packages = (); +my @ca_perl_module_packages = (); +my @kra_perl_module_packages = (); +my @ocsp_perl_module_packages = (); +my @ra_perl_module_packages = (); +my @tks_perl_module_packages = (); +my @tps_perl_module_packages = (); + +# [6] PKI Fortitude Packages +my @pki_fortitude_packages = (); +my @pki_fortitude_mozldap_packages = (); +my @ca_fortitude_packages = (); +my @kra_fortitude_packages = (); +my @ocsp_fortitude_packages = (); +my @ra_fortitude_packages = (); +my @tks_fortitude_packages = (); +my @tps_fortitude_packages = (); + +# [7] PKI Apache Packages +my @pki_apache_packages = (); +my @ca_apache_packages = (); +my @kra_apache_packages = (); +my @ocsp_apache_packages = (); +my @ra_apache_packages = (); +my @tks_apache_packages = (); +my @tps_apache_packages = (); + +# [8] PKI Mozldap Packages +my @pki_mozldap6_packages = (); +my @ca_mozldap_packages = (); +my @kra_mozldap_packages = (); +my @ocsp_mozldap_packages = (); +my @ra_mozldap_packages = (); +my @tks_mozldap_packages = (); +my @tps_mozldap_packages = (); + +# [9] PKI Dirsec Packages +my @pki_dirsec_packages = (); +my @ca_dirsec_packages = (); +my @kra_dirsec_packages = (); +my @ocsp_dirsec_packages = (); +my @ra_dirsec_packages = (); +my @tks_dirsec_packages = (); +my @tps_dirsec_packages = (); + + +############################################################## +# Local Variables +############################################################## + +my $pki_architecture = ""; +my $pki_flavor = ""; +my $presence_command = ""; +my $presence_message = ""; +my $uninstall_command = ""; +my $pki_prefix = ""; +my $pki_suffix = ""; + +my @pki_package_removal_list = (); + +my $command = ""; + + +############################################################## +# Platform-Dependent Data Initialization +############################################################## + +if( $^O eq "linux" ) { + $pki_architecture = `uname -i`; + $pki_flavor = "pki"; + $presence_command = "rpm -q "; + $uninstall_command = "rpm -ev "; + + chomp( $pki_architecture ); + + if( $pki_architecture eq "i386" ) { + $pki_prefix = ""; + $pki_suffix = ""; + } elsif( $pki_architecture eq "x86_64" ) { + $pki_prefix = ""; + $pki_suffix = ""; + } else { + print( STDERR + "\nERROR: Unsupported architecture '$pki_architecture'!\n\n" ); + exit 255; + } + + + # [1] Top-Level PKI Subsystem Package(s) + %pki_subsystems = ( + "ca" => "$pki_prefix" . "$pki_flavor-ca" . "$pki_suffix", + "drm" => "$pki_prefix" . "$pki_flavor-kra" . "$pki_suffix", + "esc" => "esc", + "ocsp" => "$pki_prefix" . "$pki_flavor-ocsp" . "$pki_suffix", + "ra" => "$pki_prefix" . "$pki_flavor-ra" . "$pki_suffix", + "tks" => "$pki_prefix" . "$pki_flavor-tks" . "$pki_suffix", + "tps" => "$pki_prefix" . "$pki_flavor-tps" . "$pki_suffix" + ); + + + # [2] PKI Subsystem Packages + @pki_packages = ( + "coolkey", + "ccid", + "ifd-egate", + "pcsc-lite-doc", + "pcsc-lite-libs", + "pcsc-lite", + "$pki_prefix" . "perl-DBD-SQLite" . "$pki_suffix", + "$pki_prefix" . "sqlite" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix" + ); + @ca_packages = ( + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix" + ); + @esc_packages = ( + "coolkey", + "ccid", + "ifd-egate", + "pcsc-lite-doc", + "pcsc-lite-libs", + "pcsc-lite" + ); + @kra_packages = ( + "*-" . "$pki_flavor-kra-ui" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix" + ); + @ocsp_packages = ( + "*-" . "$pki_flavor-ocsp-ui" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix" + ); + @ra_packages = ( + "*-" . "$pki_flavor-ra-ui" . "$pki_suffix", + "$pki_prefix" . "perl-DBD-SQLite" . "$pki_suffix", + "$pki_prefix" . "sqlite" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix" + ); + @tks_packages = ( + "*-" . "$pki_flavor-tks-ui" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix" + ); + @tps_packages = ( + "*-" . "$pki_flavor-tps-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix" + ); + + + # [3] PKI Migration Packages + @pki_migration_packages = ( + "$pki_prefix" . "$pki_flavor-migrate" . "$pki_suffix", + ); + @ca_migration_packages = ( @pki_migration_packages ); + @kra_migration_packages = ( @pki_migration_packages ); + @ocsp_migration_packages = ( @pki_migration_packages ); + @ra_migration_packages = ( @pki_migration_packages ); + @tks_migration_packages = ( @pki_migration_packages ); + @tps_migration_packages = ( @pki_migration_packages ); + + + # [4] PKI Tomcat Packages + @pki_tomcat_packages = ( + "$pki_prefix" . "tomcat5" . "$pki_suffix", + "$pki_prefix" . "idm-console-framework" . "$pki_suffix", + "$pki_prefix" . "fedora-idm-console" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-modeler" . "$pki_suffix", + "$pki_prefix" . "geronimo-specs" . "$pki_suffix", + "$pki_prefix" . "mx4j" . "$pki_suffix", + "$pki_prefix" . "axis" . "$pki_suffix", + "$pki_prefix" . "wsdl4j" . "$pki_suffix", + "$pki_prefix" . "ant" . "$pki_suffix", + "$pki_prefix" . "velocity" . "$pki_suffix", + "$pki_prefix" . "werken.xpath" . "$pki_suffix", + "$pki_prefix" . "oldjdom" . "$pki_suffix", + "$pki_prefix" . "jdom" . "$pki_suffix", + "$pki_prefix" . "avalon-framework" . "$pki_suffix", + "$pki_prefix" . "avalon-logkit" . "$pki_suffix", + "$pki_prefix" . "xml-commons-resolver" . "$pki_suffix", + "$pki_prefix" . "log4j" . "$pki_suffix", + "$pki_prefix" . "xalan-j2" . "$pki_suffix", + "$pki_prefix" . "xerces-j2" . "$pki_suffix", + "$pki_prefix" . "classpathx-mail" . "$pki_suffix", + "$pki_prefix" . "gnu-crypto-sasl-jdk1.4" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-daemon" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-el" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-launcher" . "$pki_suffix", + "$pki_prefix" . "jms" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-httpclient3" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-discovery" . "$pki_suffix", + "$pki_prefix" . "tomcat5-jasper" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-dbcp" . "$pki_suffix", + "$pki_prefix" . "bcel" . "$pki_suffix", + "$pki_prefix" . "regexp" . "$pki_suffix", + "$pki_prefix" . "xml-commons-apis" . "$pki_suffix", + "$pki_prefix" . "xml-commons" . "$pki_suffix", + "$pki_prefix" . "xmlbeans" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-fileupload" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-pool" . "$pki_suffix", + "$pki_prefix" . "ldapjdk" . "$pki_suffix", + "$pki_prefix" . "classpathx-jaf" . "$pki_suffix", + "$pki_prefix" . "oro" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-digester" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-beanutils" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-collections" . "$pki_suffix", + "$pki_prefix" . "tomcat5-servlet-2.4-api" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-logging" . "$pki_suffix", + ); + @ca_tomcat_packages = ( @pki_tomcat_packages ); + @kra_tomcat_packages = ( @pki_tomcat_packages ); + @ocsp_tomcat_packages = ( @pki_tomcat_packages ); + @ra_tomcat_packages = (); + @tks_tomcat_packages = ( @pki_tomcat_packages ); + @tps_tomcat_packages = (); + + + # [5] PKI Perl Module Packages + @pki_perl_module_packages = ( + "$pki_prefix" . "perl-XML-Simple" . "$pki_suffix", + "$pki_prefix" . "perl-Parse-RecDescent" . "$pki_suffix" + ); + @ca_perl_module_packages = (); + @kra_perl_module_packages = (); + @ocsp_perl_module_packages = (); + @ra_perl_module_packages = ( @pki_perl_module_packages ); + @tks_perl_module_packages = (); + @tps_perl_module_packages = ( @pki_perl_module_packages ); + + + # [6] PKI Fortitude Packages + @pki_fortitude_packages = ( + "$pki_prefix" . "fortitude-web" . "$pki_suffix", + "$pki_prefix" . "fortitude-mod_revocator" . "$pki_suffix", + "$pki_prefix" . "fortitude-mod_nss" . "$pki_suffix" + ); + @pki_fortitude_mozldap_packages = ( + "$pki_prefix" . "mozldap" . "$pki_suffix" . "-tools", + "$pki_prefix" . "mozldap" . "$pki_suffix" + ); + @ca_fortitude_packages = (); + @kra_fortitude_packages = (); + @ocsp_fortitude_packages = (); + @ra_fortitude_packages = ( + @pki_fortitude_packages, + @pki_fortitude_mozldap_packages + ); + @tks_fortitude_packages = (); + @tps_fortitude_packages = ( + @pki_fortitude_packages, + @pki_fortitude_mozldap_packages + ); + + + # [7] PKI Apache Packages + @pki_apache_packages = (); + @ca_apache_packages = (); + @kra_apache_packages = (); + @ocsp_apache_packages = (); + @ra_apache_packages = (); + @tks_apache_packages = (); + @tps_apache_packages = (); + + + # [8] PKI Mozldap Packages + @pki_mozldap6_packages = ( + "$pki_prefix" . "mozldap6" . "$pki_suffix" . "-tools", + "$pki_prefix" . "mozldap6" . "$pki_suffix", + "$pki_prefix" . "svrcore" . "$pki_suffix" + ); + @ca_mozldap_packages = ( + @pki_mozldap6_packages + ); + @kra_mozldap_packages = ( + @pki_mozldap6_packages + ); + @ocsp_mozldap_packages = ( + @pki_mozldap6_packages + ); + @ra_mozldap_packages = ( + @pki_mozldap6_packages + ); + @tks_mozldap_packages = ( + @pki_mozldap6_packages + ); + @tps_mozldap_packages = ( + @pki_mozldap6_packages + ); + + + # [9] PKI Dirsec Packages + @pki_dirsec_packages = ( + "$pki_prefix" . "dirsec-jss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix" + ); + @ca_dirsec_packages = ( @pki_dirsec_packages ); + @kra_dirsec_packages = ( @pki_dirsec_packages ); + @ocsp_dirsec_packages = ( @pki_dirsec_packages ); + @ra_dirsec_packages = ( + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix" + ); + @tks_dirsec_packages = ( @pki_dirsec_packages ); + @tps_dirsec_packages = ( + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix" + ); +} elsif( $^O eq "solaris" ) { + $pki_architecture = "sparcv9"; + $pki_flavor = "pki"; + $presence_command = "pkginfo | grep -c "; + $uninstall_command = "yes | /usr/sbin/pkgrm "; + + if( $pki_architecture eq "sparc" ) { + $pki_prefix = "RHAT"; + $pki_suffix = ""; + } elsif( $pki_architecture eq "sparcv9" ) { + $pki_prefix = "RHAT"; + $pki_suffix = "x"; + } else { + print( STDERR + "\nERROR: Unsupported architecture '$pki_architecture'!\n\n" ); + exit 255; + } + + + # [1] Top-Level PKI Subsystem Package(s) + %pki_subsystems = ( + "ca" => "$pki_prefix" . "$pki_flavor-ca" . "$pki_suffix", + "drm" => "$pki_prefix" . "$pki_flavor-kra" . "$pki_suffix", + "ocsp" => "$pki_prefix" . "$pki_flavor-ocsp" . "$pki_suffix", + "ra" => "$pki_prefix" . "$pki_flavor-ra" . "$pki_suffix", + "tks" => "$pki_prefix" . "$pki_flavor-tks" . "$pki_suffix", + "tps" => "$pki_prefix" . "$pki_flavor-tps" . "$pki_suffix" + ); + + + # [2] PKI Subsystem Packages + @pki_packages = ( + "$pki_prefix" . "perl-DBD-SQLite" . "$pki_suffix", + "$pki_prefix" . "perl-DBI" . "$pki_suffix", + "$pki_prefix" . "sqlite" . "$pki_suffix", + "$pki_prefix" . "readline" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix" + ); + @ca_packages = ( + "*-" . "$pki_flavor-ca-ui" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix" + ); + @esc_packages = (); + @kra_packages = ( + "*-" . "$pki_flavor-kra-ui" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix" + ); + @ocsp_packages = ( + "*-" . "$pki_flavor-ocsp-ui" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix" + ); + @ra_packages = ( + "*-" . "$pki_flavor-ra-ui" . "$pki_suffix", + "$pki_prefix" . "perl-DBD-SQLite" . "$pki_suffix", + "$pki_prefix" . "perl-DBI" . "$pki_suffix", + "$pki_prefix" . "sqlite" . "$pki_suffix", + "$pki_prefix" . "readline" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix" + ); + @tks_packages = ( + "*-" . "$pki_flavor-tks-ui" . "$pki_suffix", + "*-" . "$pki_flavor-common-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-common" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-java-tools" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-console" . "$pki_suffix", + "*-" . "$pki_flavor-console-ui" . "$pki_suffix", + "$pki_prefix" . "tomcatjss" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-util" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix", + "$pki_prefix" . "symkey" . "$pki_suffix", + "$pki_prefix" . "osutil" . "$pki_suffix" + ); + @tps_packages = ( + "*-" . "$pki_flavor-tps-ui" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-setup" . "$pki_suffix", + "$pki_prefix" . "$pki_flavor-native-tools" . "$pki_suffix" + ); + + + # [3] PKI Migration Packages + @pki_migration_packages = ( + "$pki_prefix" . "$pki_flavor-migrate" . "$pki_suffix", + ); + @ca_migration_packages = ( @pki_migration_packages ); + @kra_migration_packages = ( @pki_migration_packages ); + @ocsp_migration_packages = ( @pki_migration_packages ); + @ra_migration_packages = ( @pki_migration_packages ); + @tks_migration_packages = ( @pki_migration_packages ); + @tps_migration_packages = ( @pki_migration_packages ); + + + # [4] PKI Tomcat Packages + @pki_tomcat_packages = ( + "$pki_prefix" . "tomcat5" . "$pki_suffix", + "$pki_prefix" . "idm-console-framework" . "$pki_suffix", + "$pki_prefix" . "fedora-idm-console" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-modeler" . "$pki_suffix", + "$pki_prefix" . "geronimo-specs" . "$pki_suffix", + "$pki_prefix" . "mx4j" . "$pki_suffix", + "$pki_prefix" . "axis" . "$pki_suffix", + "$pki_prefix" . "wsdl4j" . "$pki_suffix", + "$pki_prefix" . "ant" . "$pki_suffix", + "$pki_prefix" . "velocity" . "$pki_suffix", + "$pki_prefix" . "werken-xpath" . "$pki_suffix", + "$pki_prefix" . "oldjdom" . "$pki_suffix", + "$pki_prefix" . "jdom" . "$pki_suffix", + "$pki_prefix" . "avalon-framework" . "$pki_suffix", + "$pki_prefix" . "avalon-logkit" . "$pki_suffix", + "$pki_prefix" . "xml-commons-resolver" . "$pki_suffix", + "$pki_prefix" . "log4j" . "$pki_suffix", + "$pki_prefix" . "xalan-j2" . "$pki_suffix", + "$pki_prefix" . "xerces-j2" . "$pki_suffix", + "$pki_prefix" . "classpathx-mail" . "$pki_suffix", + "$pki_prefix" . "gnu-crypto-sasl-jdk1-4" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-daemon" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-el" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-launcher" . "$pki_suffix", + "$pki_prefix" . "jms" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-httpclient3" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-discovery" . "$pki_suffix", + "$pki_prefix" . "tomcat5-jasper" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-dbcp" . "$pki_suffix", + "$pki_prefix" . "bcel" . "$pki_suffix", + "$pki_prefix" . "regexp" . "$pki_suffix", + "$pki_prefix" . "xml-commons-apis" . "$pki_suffix", + "$pki_prefix" . "xml-commons" . "$pki_suffix", + "$pki_prefix" . "xmlbeans" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-fileupload" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-pool" . "$pki_suffix", + "$pki_prefix" . "ldapjdk" . "$pki_suffix", + "$pki_prefix" . "classpathx-jaf" . "$pki_suffix", + "$pki_prefix" . "oro" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-digester" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-beanutils" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-collections" . "$pki_suffix", + "$pki_prefix" . "tomcat5-servlet-2-4-api" . "$pki_suffix", + "$pki_prefix" . "jakarta-commons-logging" . "$pki_suffix", + "$pki_prefix" . "jpackage-utils" . "$pki_suffix" + ); + @ca_tomcat_packages = ( @pki_tomcat_packages ); + @kra_tomcat_packages = ( @pki_tomcat_packages ); + @ocsp_tomcat_packages = ( @pki_tomcat_packages ); + @ra_tomcat_packages = (); + @tks_tomcat_packages = ( @pki_tomcat_packages ); + @tps_tomcat_packages = (); + + + # [5] PKI Perl Module Packages + @pki_perl_module_packages = ( + "$pki_prefix" . "perl-XML-SAX" . "$pki_suffix", + "$pki_prefix" . "perl-XML-NamespaceSupport" . "$pki_suffix", + "$pki_prefix" . "perl-XML-Simple" . "$pki_suffix", + "$pki_prefix" . "perl-XML-Parser" . "$pki_suffix", + "$pki_prefix" . "perl-libwww-perl" . "$pki_suffix", + "$pki_prefix" . "perl-URI" . "$pki_suffix", + "$pki_prefix" . "perl-HTML-Parser" . "$pki_suffix", + "$pki_prefix" . "perl-HTML-Tagset" . "$pki_suffix", + "$pki_prefix" . "perl-Parse-RecDescent" . "$pki_suffix" + ); + @ca_perl_module_packages = (); + @kra_perl_module_packages = (); + @ocsp_perl_module_packages = (); + @ra_perl_module_packages = ( @pki_perl_module_packages ); + @tks_perl_module_packages = (); + @tps_perl_module_packages = ( @pki_perl_module_packages ); + + + # [6] PKI Fortitude Packages + @pki_fortitude_packages = ( + "$pki_prefix" . "fortitude-web" . "$pki_suffix", + "$pki_prefix" . "fortitude-mod-revocator" . "$pki_suffix", + "$pki_prefix" . "fortitude-mod-nss" . "$pki_suffix" + ); + @pki_fortitude_mozldap_packages = ( + "$pki_prefix" . "mozldap" . "$pki_suffix" . "-tools", + "$pki_prefix" . "mozldap" . "$pki_suffix" + ); + @ca_fortitude_packages = (); + @kra_fortitude_packages = (); + @ocsp_fortitude_packages = (); + @ra_fortitude_packages = ( + @pki_fortitude_packages, + @pki_fortitude_mozldap_packages + ); + @tks_fortitude_packages = (); + @tps_fortitude_packages = ( + @pki_fortitude_packages, + @pki_fortitude_mozldap_packages + ); + + + # [7] PKI Apache Packages + @pki_apache_packages = ( + "$pki_prefix" . "mod-perl" . "$pki_suffix", + "$pki_prefix" . "httpd" . "$pki_suffix", + "$pki_prefix" . "apr-util" . "$pki_suffix", + "$pki_prefix" . "expat" . "$pki_suffix", + "$pki_prefix" . "db4fortitude" . "$pki_suffix" . "-utils", + "$pki_prefix" . "db4fortitude" . "$pki_suffix", + "$pki_prefix" . "pcre" . "$pki_suffix", + "$pki_prefix" . "apr" . "$pki_suffix" + ); + @ca_apache_packages = (); + @kra_apache_packages = (); + @ocsp_apache_packages = (); + @ra_apache_packages = ( @pki_apache_packages ); + @tks_apache_packages = (); + @tps_apache_packages = ( @pki_apache_packages ); + + + # [8] PKI Mozldap Packages + @pki_mozldap6_packages = ( + "$pki_prefix" . "mozldap6" . "$pki_suffix" . "-tools", + "$pki_prefix" . "mozldap6" . "$pki_suffix", + "$pki_prefix" . "sasl" . "$pki_suffix" . "-lib", + "$pki_prefix" . "svrcore" . "$pki_suffix" + ); + @ca_mozldap_packages = ( + @pki_mozldap6_packages + ); + @kra_mozldap_packages = ( + @pki_mozldap6_packages + ); + @ocsp_mozldap_packages = ( + @pki_mozldap6_packages + ); + @ra_mozldap_packages = ( + @pki_mozldap6_packages + ); + @tks_mozldap_packages = ( + @pki_mozldap6_packages + ); + @tps_mozldap_packages = ( + @pki_mozldap6_packages + ); + + + # [9] PKI Dirsec Packages + @pki_dirsec_packages = ( + "$pki_prefix" . "dirsec-jss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix" + ); + @ca_dirsec_packages = ( @pki_dirsec_packages ); + @kra_dirsec_packages = ( @pki_dirsec_packages ); + @ocsp_dirsec_packages = ( @pki_dirsec_packages ); + @ra_dirsec_packages = ( + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix" + ); + @tks_dirsec_packages = ( @pki_dirsec_packages ); + @tps_dirsec_packages = ( + "$pki_prefix" . "dirsec-nss" . "$pki_suffix" . "-tools", + "$pki_prefix" . "dirsec-nss" . "$pki_suffix", + "$pki_prefix" . "dirsec-nspr" . "$pki_suffix" + ); +} else { + print( STDERR + "\nERROR: Unsupported platform '$^O'!\n\n" ); + exit 255; +} + + +############################################################## +# Local Data Initialization +############################################################## + + + +############################################################## +# PKI Subsystem Removal Subroutines +############################################################## + +# no args +# return 1 - true, or +# return 0 - false +sub is_Windows() +{ + if( ( $^O eq "Windows_NT" ) || ( $^O eq "MSWin32" ) ) { + return 1; + } + + return 0; +} + + +# no args +# return 1 - success, or +# return 0 - failure +sub check_for_root_UID() +{ + my $result = 0; + + # On Linux/UNIX, insure that this script is being run as "root"; + # First check the "Real" UID, and then check the "Effective" UID. + if( !is_Windows() ) { + if( ( $< != $ROOTUID ) && + ( $> != $ROOTUID ) ) { + print( STDERR + "\nERROR: The '$0' script must be run as root!\n\n" ); + $result = 0; + } else { + # Success -- running script as root + $result = 1; + } + } else { + print( STDERR + "\nERROR: Root UID makes no sense on Windows machines!\n\n" ); + $result = 0; + } + + return $result; +} + + +# no args +# no return value +sub usage() +{ + print( STDOUT + "USAGE: pki-uninstall -pki_subsystem=<pki_subsystem> " + . "# Where PKI subsystem\n" + . " " + . "# may be:\n" + . " " + . "#\n" + . " " + . "# 'all', 'ca',\n" + . " " + . "# 'drm', 'esc',\n" + . " " + . "# 'ocsp', 'ra',\n" + . " " + . "# 'tks', or 'tps\n\n" + . " [-force] " + . "# Don't require\n" + . " " + . "# confirmation\n\n\n" ); + + print( STDOUT + " NOTE: The keyword 'all' removes every PKI " + . "subsystem installed on\n" + . " this host (including 'esc' if present), " + . "but removes no PKI\n" + . " instances installed on this host.\n\n" ); + + print( STDOUT + " EXAMPLE: pki-uninstall -pki_subsystem=all -force\n\n" ); + + return; +} + + +# no args +# return 1 - success, or +# return 0 - failure +sub check_for_valid_number_of_arguments() +{ + my $result = 1; + + if( $ARGS < $MIN_ARGS || + $ARGS > $MAX_ARGS ) { + print( STDERR + "\nERROR: Specified " + . $ARGS + . " command-line arguments!\n\n" ); + $result = 0; + } + + return $result; +} + + +# arg0 list to be processed +# no return value +sub build_pki_package_removal_list +{ + while( @_ ) { + my $package .= shift( @_ ); + + if( $^O eq "linux" ) { + $presence_message = "package $package is not installed\n"; + } elsif( $^O eq "solaris" ) { + $presence_message = "0\n"; + } + + my $rv = `$presence_command $package`; + if( "$rv" ne "$presence_message" ) { + push( @pki_package_removal_list, $package ); + } + } + + return; +} + + +# no args +# no return value +sub print_pki_package_removal_list() +{ + print( STDOUT "PKI Package Removal List: " ); + while( @pki_package_removal_list ) { + my $package .= shift( @pki_package_removal_list ); + print( STDOUT " $package" ); + } + print( STDOUT "\n\n" ); + + return; +} + + +# no args +# return 1 - success, or +# return 0 - failure +sub determine_installed_pki_subsystems() +{ + my @installed_pki_subsystems = (); + + my $ca_subsystem_presence = 0; + my $esc_subsystem_presence = 0; + my $kra_subsystem_presence = 0; + my $ocsp_subsystem_presence = 0; + my $ra_subsystem_presence = 0; + my $tks_subsystem_presence = 0; + my $total_pki_subsystems = 0; + my $tps_subsystem_presence = 0; + + my $specified_pki_subsystem = 0; + + # mark specified PKI subsystems + if( $pki_subsystem eq 'all' ) { + $specified_pki_subsystem = 1; + } + + # always process all PKI subsystems + while( my ( $key, $value ) = each( %pki_subsystems ) ) { + # mark specified PKI subsystem + if( $pki_subsystem eq $key ) { + $specified_pki_subsystem = 1; + } + + if( $^O eq "linux" ) { + $presence_message = "package $value is not installed\n"; + } elsif( $^O eq "solaris" ) { + $presence_message = "0\n"; + } + + my $rv = `$presence_command $value`; + if( $rv ne $presence_message ) { + # mark PKI subsystem presence + if( $pki_subsystem eq $key ) { + if( $pki_subsystem eq 'ca' ) { + $ca_subsystem_presence = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'drm' ) { + $kra_subsystem_presence = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'esc' ) { + $esc_subsystem_presence = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'ocsp' ) { + $ocsp_subsystem_presence = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'ra' ) { + $ra_subsystem_presence = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'tks' ) { + $tks_subsystem_presence = 1; + $total_pki_subsystems++; + } elsif( $pki_subsystem eq 'tps' ) { + $tps_subsystem_presence = 1; + $total_pki_subsystems++; + } + + print( STDOUT + "\nNOTIFICATION: Attempting to remove '" + . $key + . "' subsystem ...\n\n" ); + } + + # mark this PKI subsystem as installed + push( @installed_pki_subsystems, $value ); + } + } + + # check to be sure that a valid PKI subsystem was specified + if( !$specified_pki_subsystem ) { + print( STDERR + "\nERROR: The specified PKI subsystem '" + . $pki_subsystem + . "' is an invalid PKI subsystem!\n\n" ); + return 0; + } + + # check to be sure that at least one PKI subsystem + # is installed on this host + if( !scalar( @installed_pki_subsystems ) ) { + print( STDERR + "\nWARNING: No top-level PKI subsystems are installed " + . "on this host!\n\n" ); + } + + # mark each PKI subsystem package to be removed + if( $pki_subsystem eq 'all' ) { + # mark all remaining CA, ESC, KRA, OCSP, RA, TKS, and/or TPS packages + # for removal, even if no top-level subsystem package exists + build_pki_package_removal_list( @installed_pki_subsystems ); + build_pki_package_removal_list( @pki_packages ); + build_pki_package_removal_list( @pki_migration_packages ); + build_pki_package_removal_list( @pki_tomcat_packages ); + build_pki_package_removal_list( @pki_perl_module_packages ); + build_pki_package_removal_list( @pki_fortitude_packages ); + build_pki_package_removal_list( @pki_fortitude_mozldap_packages ); + build_pki_package_removal_list( @pki_apache_packages ); + build_pki_package_removal_list( @pki_mozldap6_packages ); + build_pki_package_removal_list( @pki_dirsec_packages ); + } elsif( $pki_subsystem eq 'ca' ) { + if( !$ca_subsystem_presence ) { + if( $total_pki_subsystems >= 1 ) { + # the user specified this subsystem, and although it + # DOES NOT exist on this machine, a different + # PKI subsystem DOES exist on this machine + print( STDERR + "\nERROR: Although at least one valid PKI subsystem " + . "does exist on this machine,\n" + . " the specified PKI subsystem '" + . $pki_subsystem + . "' does NOT exist on this machine!\n\n" ); + return 0; + } else { + # check to be sure that the specified PKI subsystem + # is installed on this host + print( STDERR + "\nWARNING: The specified PKI subsystem '" + . $pki_subsystem + . "' is NOT installed on this host!\n\n" ); + } + } else { + # a top-level CA package exists + if( $total_pki_subsystems > 1 ) { + # although a top-level CA package exists, it cannot be + # removed due to shared package conflicts with one or + # more different installed PKI subsystems + print( STDOUT + "\nERROR: Unable to delete entire '" + . $pki_subsystem + . "' subsystem due to shared packages!\n\n" ); + return 0; + } else { + # mark the top-level CA package for removal + push( @pki_package_removal_list, + $pki_subsystems{$pki_subsystem} ); + } + } + + # mark all remaining CA packages for removal, + # even if no top-level CA package is installed + build_pki_package_removal_list( @ca_packages ); + build_pki_package_removal_list( @ca_migration_packages ); + build_pki_package_removal_list( @ca_tomcat_packages ); + build_pki_package_removal_list( @ca_perl_module_packages ); + build_pki_package_removal_list( @ca_fortitude_packages ); + build_pki_package_removal_list( @ca_apache_packages ); + build_pki_package_removal_list( @ca_mozldap_packages ); + build_pki_package_removal_list( @ca_dirsec_packages ); + } elsif( $pki_subsystem eq 'drm' ) { + if( !$kra_subsystem_presence ) { + if( $total_pki_subsystems >= 1 ) { + # the user specified this subsystem, and although it + # DOES NOT exist on this machine, a different + # PKI subsystem DOES exist on this machine + print( STDERR + "\nERROR: Although at least one valid PKI subsystem " + . "does exist on this machine,\n" + . " the specified PKI subsystem '" + . $pki_subsystem + . "' does NOT exist on this machine!\n\n" ); + return 0; + } else { + # check to be sure that the specified PKI subsystem + # is installed on this host + print( STDERR + "\nWARNING: The specified PKI subsystem '" + . $pki_subsystem + . "' is NOT installed on this host!\n\n" ); + } + } else { + # a top-level KRA package exists + if( $total_pki_subsystems > 1 ) { + # although a top-level KRA package exists, it cannot be + # removed due to shared package conflicts with one or + # more different installed PKI subsystems + print( STDOUT + "\nERROR: Unable to delete entire '" + . $pki_subsystem + . "' subsystem due to shared packages!\n\n" ); + return 0; + } else { + # mark the top-level KRA package for removal + push( @pki_package_removal_list, + $pki_subsystems{$pki_subsystem} ); + } + } + + # mark all remaining KRA packages for removal, + # even if no top-level KRA package is installed + build_pki_package_removal_list( @kra_packages ); + build_pki_package_removal_list( @kra_migration_packages ); + build_pki_package_removal_list( @kra_tomcat_packages ); + build_pki_package_removal_list( @kra_perl_module_packages ); + build_pki_package_removal_list( @kra_fortitude_packages ); + build_pki_package_removal_list( @kra_apache_packages ); + build_pki_package_removal_list( @kra_mozldap_packages ); + build_pki_package_removal_list( @kra_dirsec_packages ); + } elsif( $pki_subsystem eq 'esc' ) { + # mark the top-level ESC package for removal + push( @pki_package_removal_list, + $pki_subsystems{$pki_subsystem} ); + + # mark all remaining ESC packages for removal, + # even if no top-level ESC package is installed + build_pki_package_removal_list( @esc_packages ); + } elsif( $pki_subsystem eq 'ocsp' ) { + if( !$ocsp_subsystem_presence ) { + if( $total_pki_subsystems >= 1 ) { + # the user specified this subsystem, and although it + # DOES NOT exist on this machine, a different + # PKI subsystem DOES exist on this machine + print( STDERR + "\nERROR: Although at least one valid PKI subsystem " + . "does exist on this machine,\n" + . " the specified PKI subsystem '" + . $pki_subsystem + . "' does NOT exist on this machine!\n\n" ); + return 0; + } else { + # check to be sure that the specified PKI subsystem + # is installed on this host + print( STDERR + "\nWARNING: The specified PKI subsystem '" + . $pki_subsystem + . "' is NOT installed on this host!\n\n" ); + } + } else { + # a top-level OCSP package exists + if( $total_pki_subsystems > 1 ) { + # although a top-level OCSP package exists, it cannot be + # removed due to shared package conflicts with one or + # more different installed PKI subsystems + print( STDOUT + "\nERROR: Unable to delete entire '" + . $pki_subsystem + . "' subsystem due to shared packages!\n\n" ); + return 0; + } else { + # mark the top-level OCSP package for removal + push( @pki_package_removal_list, + $pki_subsystems{$pki_subsystem} ); + } + } + + # mark all remaining OCSP packages for removal, + # even if no top-level OCSP package is installed + build_pki_package_removal_list( @ocsp_packages ); + build_pki_package_removal_list( @ocsp_migration_packages ); + build_pki_package_removal_list( @ocsp_tomcat_packages ); + build_pki_package_removal_list( @ocsp_perl_module_packages ); + build_pki_package_removal_list( @ocsp_fortitude_packages ); + build_pki_package_removal_list( @ocsp_apache_packages ); + build_pki_package_removal_list( @ocsp_mozldap_packages ); + build_pki_package_removal_list( @ocsp_dirsec_packages ); + } elsif( $pki_subsystem eq 'ra' ) { + if( !$ra_subsystem_presence ) { + if( $total_pki_subsystems >= 1 ) { + # the user specified this subsystem, and although it + # DOES NOT exist on this machine, a different + # PKI subsystem DOES exist on this machine + print( STDERR + "\nERROR: Although at least one valid PKI subsystem " + . "does exist on this machine,\n" + . " the specified PKI subsystem '" + . $pki_subsystem + . "' does NOT exist on this machine!\n\n" ); + return 0; + } else { + # check to be sure that the specified PKI subsystem + # is installed on this host + print( STDERR + "\nWARNING: The specified PKI subsystem '" + . $pki_subsystem + . "' is NOT installed on this host!\n\n" ); + } + } else { + # a top-level RA package exists + if( $total_pki_subsystems > 1 ) { + # although a top-level RA package exists, it cannot be + # removed due to shared package conflicts with one or + # more different installed PKI subsystems + print( STDOUT + "\nERROR: Unable to delete entire '" + . $pki_subsystem + . "' subsystem due to shared packages!\n\n" ); + return 0; + } else { + # mark the top-level RA package for removal + push( @pki_package_removal_list, + $pki_subsystems{$pki_subsystem} ); + } + } + + # mark all remaining RA packages for removal, + # even if no top-level RA package is installed + build_pki_package_removal_list( @ra_packages ); + build_pki_package_removal_list( @ra_migration_packages ); + build_pki_package_removal_list( @ra_tomcat_packages ); + build_pki_package_removal_list( @ra_perl_module_packages ); + build_pki_package_removal_list( @ra_fortitude_packages ); + build_pki_package_removal_list( @ra_apache_packages ); + build_pki_package_removal_list( @ra_mozldap_packages ); + } elsif( $pki_subsystem eq 'tks' ) { + if( !$tks_subsystem_presence ) { + if( $total_pki_subsystems >= 1 ) { + # the user specified this subsystem, and although it + # DOES NOT exist on this machine, a different + # PKI subsystem DOES exist on this machine + print( STDERR + "\nERROR: Although at least one valid PKI subsystem " + . "does exist on this machine,\n" + . " the specified PKI subsystem '" + . $pki_subsystem + . "' does NOT exist on this machine!\n\n" ); + return 0; + } else { + # check to be sure that the specified PKI subsystem + # is installed on this host + print( STDERR + "\nWARNING: The specified PKI subsystem '" + . $pki_subsystem + . "' is NOT installed on this host!\n\n" ); + } + } else { + # a top-level TKS package exists + if( $total_pki_subsystems > 1 ) { + # although a top-level TKS package exists, it cannot be + # removed due to shared package conflicts with one or + # more different installed PKI subsystems + print( STDOUT + "\nERROR: Unable to delete entire '" + . $pki_subsystem + . "' subsystem due to shared packages!\n\n" ); + return 0; + } else { + # mark the top-level TKS package for removal + push( @pki_package_removal_list, + $pki_subsystems{$pki_subsystem} ); + } + } + + # mark all remaining TKS packages for removal, + # even if no top-level TKS package is installed + build_pki_package_removal_list( @tks_packages ); + build_pki_package_removal_list( @tks_migration_packages ); + build_pki_package_removal_list( @tks_tomcat_packages ); + build_pki_package_removal_list( @tks_perl_module_packages ); + build_pki_package_removal_list( @tks_fortitude_packages ); + build_pki_package_removal_list( @tks_apache_packages ); + build_pki_package_removal_list( @tks_mozldap_packages ); + build_pki_package_removal_list( @tks_dirsec_packages ); + } elsif( $pki_subsystem eq 'tps' ) { + if( !$tps_subsystem_presence ) { + if( $total_pki_subsystems >= 1 ) { + # the user specified this subsystem, and although it + # DOES NOT exist on this machine, a different + # PKI subsystem DOES exist on this machine + print( STDERR + "\nERROR: Although at least one valid PKI subsystem " + . "does exist on this machine,\n" + . " the specified PKI subsystem '" + . $pki_subsystem + . "' does NOT exist on this machine!\n\n" ); + return 0; + } else { + # check to be sure that the specified PKI subsystem + # is installed on this host + print( STDERR + "\nWARNING: The specified PKI subsystem '" + . $pki_subsystem + . "' is NOT installed on this host!\n\n" ); + } + } else { + # a top-level TPS package exists + if( $total_pki_subsystems > 1 ) { + # although a top-level TPS package exists, it cannot be + # removed due to shared package conflicts with one or + # more different installed PKI subsystems + print( STDOUT + "\nERROR: Unable to delete entire '" + . $pki_subsystem + . "' subsystem due to shared packages!\n\n" ); + return 0; + } else { + # mark the top-level TPS package for removal + push( @pki_package_removal_list, + $pki_subsystems{$pki_subsystem} ); + } + } + + # mark all remaining TPS packages for removal, + # even if no top-level TPS package is installed + build_pki_package_removal_list( @tps_packages ); + build_pki_package_removal_list( @tps_migration_packages ); + build_pki_package_removal_list( @tps_tomcat_packages ); + build_pki_package_removal_list( @tps_perl_module_packages ); + build_pki_package_removal_list( @tps_fortitude_packages ); + build_pki_package_removal_list( @tps_apache_packages ); + build_pki_package_removal_list( @tps_mozldap_packages ); + build_pki_package_removal_list( @tps_dirsec_packages ); + } + + return 1; +} + + +# arg0 question +# return answer +sub prompt +{ + my $promptStr = $_[0]; + + my $answer = ""; + + print( STDOUT "$promptStr " ); + + $| = 1; + $answer = <STDIN>; + + chomp $answer; + + print( STDOUT "\n" ); + + return $answer; +} + + +# no args +# no return values +sub remove_specified_pki_subsystems() +{ + my $confirm = ""; + + if( scalar( @pki_package_removal_list ) ) { + # The uninstalled package order is "stored" in the array + # starting with the top-most package (e. g. - "pki-ca") + # down to the bottom-most package (e. g. - "dirsec-nspr"). + if( $^O eq "linux" ) { + $command = $uninstall_command; + + # Since the RPM command removes packages from right-to-left, + # this command needs to order the packages from the bottom-most + # package up to the top-most package. + for( my $i = $#pki_package_removal_list ; $i >= 0 ; $i-- ) { + $command .= $pki_package_removal_list[$i]; + $command .= " "; + } + + # remove any trailing spaces + chop( $command ); + } elsif( $^O eq "solaris" ) { + # Since the PKG command removes packages from left-to-right, + # this command needs to order the packages from the top-most + # package down to the bottom-most package. + while( @pki_package_removal_list ) { + $command .= $uninstall_command; + $command .= shift( @pki_package_removal_list ); + $command .= ";\n"; + } + } + } else { + print( STDERR + "\nNOTIFICATION: No packages for the specified PKI " + . "subsystem(s)\n" + . " could be removed from this host!\n\n" ); + return; + } + +ASK_AGAIN: + if( !$force ) { + $confirm = prompt( "\nCONFIRMATION: You are about to execute " + . "the following command:\n\n" + . "$command\n\n" + . "Are you sure (Y/N)? " ); + + if( $confirm eq "N" || $confirm eq "n" ) { + return; + } elsif( $confirm ne "Y" && $confirm ne "y" ) { + goto ASK_AGAIN; + } + } + + system( "$command" ); + + return; +} + + +############################################################## +# Main Program +############################################################## + +# no args +# return 1 - success, or +# return 0 - failure +sub main() +{ + my $result = 0; + + # On Linux/UNIX, insure that this script is being run as "root". + $result = check_for_root_UID(); + if( !$result ) { + usage(); + exit 255; + } + + # Parse command-line arguments. + GetOptions( "pki_subsystem=s" => \$pki_subsystem, + "force" => \$force ); + + # Check for valid number of command-line arguments. + $result = check_for_valid_number_of_arguments(); + if( !$result ) { + usage(); + exit 255; + } + + # Determine which subsystem(s) are installed on this system + $result = determine_installed_pki_subsystems(); + if( !$result ) { + usage(); + exit 255; + } + + # Remove specified subsystem(s) + remove_specified_pki_subsystems(); + + return 1; +} + + +############################################################## +# PKI Subsystem Removal +############################################################## + +main(); + +exit 0; + |