diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-08-18 02:30:44 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-08-29 23:42:53 -0500 |
commit | 60835ed008586f85a22737d0161cb026f2dbffec (patch) | |
tree | 363e447f38aa7bfe9835955e7f1f7345228c14ff /base/java-tools/pki | |
parent | 88176c5c8caf146a1a408dc3a7f6b23e1a8e63b7 (diff) | |
download | pki-60835ed008586f85a22737d0161cb026f2dbffec.tar.gz pki-60835ed008586f85a22737d0161cb026f2dbffec.tar.xz pki-60835ed008586f85a22737d0161cb026f2dbffec.zip |
Moved REST CLI into pki-tools.
The pki-client.jar has been split and merged into pki-certsrv.jar
and pki-tools.jar. The REST client classes are now packaged in
com.netscape.certsrv.<component> packages. The REST CLI classes
are now packaged in com.netscape.cmstools.<component> packages.
The "pki" script has been moved into pki-tools RPM package.
Ticket #215
Diffstat (limited to 'base/java-tools/pki')
-rwxr-xr-x | base/java-tools/pki | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/base/java-tools/pki b/base/java-tools/pki new file mode 100755 index 000000000..e465fa926 --- /dev/null +++ b/base/java-tools/pki @@ -0,0 +1,111 @@ +#!/usr/bin/perl +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; 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 --- + +############################################################################### +## (1) Specify variables used by this script. ## +############################################################################### + +my $PRODUCT="pki"; +my $libpath=""; + + +############################################################################### +## (2) Define helper functions. ## +############################################################################### + +sub invalid_architecture() +{ + print "\n"; + print "ERROR: pki does not execute on this architecture\n"; + print "ERROR: check to make sure pki-tools package is installed!\n"; + print "\n"; +} + + +############################################################################### +## (3) Set the LD_LIBRARY_PATH environment variable ## +## (as well as the ${libpath} java property) to determine the ## +## search order this command uses to find shared libraries. ## +############################################################################### + +my $ARCHITECTURE=`uname -i`; +chop( $ARCHITECTURE ); + +if( $ARCHITECTURE eq "i386" ) { + $libpath="/usr/lib"; + + $ENV{LD_LIBRARY_PATH} = "/usr/lib/jss:" + . "/usr/lib:/lib"; +} elsif($ARCHITECTURE eq "x86_64") { + $libpath="/usr/lib64"; + + $ENV{LD_LIBRARY_PATH} = "/usr/lib64/jss:" + . "/usr/lib64:/lib64:" + . "/usr/lib/jss:" + . "/usr/lib:/lib"; +} else { + invalid_architecture(); + exit(255); +} + + +############################################################################### +## (4) Set the CP environment variable to determine the search ## +## order this command wrapper uses to find jar files. ## +############################################################################### + +$ENV{CLASSPATH} = "/usr/share/java/${PRODUCT}/pki-certsrv.jar:" + . "/usr/share/java/${PRODUCT}/pki-nsutil.jar:" + . "/usr/share/java/${PRODUCT}/pki-tools.jar:" + . "/usr/share/java/apache-commons-cli.jar:" + . "/usr/share/java/apache-commons-codec.jar:" + . "/usr/share/java/apache-commons-lang.jar:" + . "/usr/share/java/apache-commons-logging.jar:" + . "/usr/share/java/commons-httpclient.jar:" + . "/usr/share/java/httpcomponents/httpclient.jar:" + . "/usr/share/java/httpcomponents/httpcore.jar:" + . "/usr/share/java/jaxb-api.jar:" + . "/usr/share/java/resteasy/jaxrs-api.jar:" + . "/usr/share/java/resteasy/resteasy-atom-provider.jar:" + . "/usr/share/java/resteasy/resteasy-jaxb-provider.jar:" + . "/usr/share/java/resteasy/resteasy-jaxrs.jar:" + . "/usr/share/java/servlet.jar:"; + +if( $ARCHITECTURE eq "x86_64" ) { + $ENV{CLASSPATH} = $ENV{CLASSPATH} + . "/usr/lib64/java/jss4.jar:" + . "/usr/lib/java/jss4.jar:"; +} else { + $ENV{CLASSPATH} = $ENV{CLASSPATH} + . "/usr/lib/java/jss4.jar:"; +} + + +############################################################################### +## (5) Execute the java command specified by this java command wrapper ## +## based upon the preset LD_LIBRARY_PATH and CP environment variables. ## +############################################################################### + +my @args = (); +foreach (@ARGV) { + push(@args, quotemeta($_)); +} + +system("java -cp $ENV{CLASSPATH} com.netscape.cmstools.cli.MainCLI @args"); |