From e082c0a124fa766e93a0001d7e0ff0caf8d8dfba Mon Sep 17 00:00:00 2001
From: Matthew Harmsen <mharmsen@redhat.com>
Date: Fri, 29 May 2015 12:17:31 -0600
Subject: [PATCH] Remove x86 architecture limitations

- PKI Trac Ticket #1392 - Remove i686/x86_64 architecture
---
 base/console/templates/pki_console_wrapper         | 14 ---------
 base/java-tools/bin/pki                            | 34 ++--------------------
 .../templates/pki_java_command_wrapper.in          | 19 ------------
 .../templates/pretty_print_cert_command_wrapper.in | 15 ----------
 .../templates/pretty_print_crl_command_wrapper.in  | 15 ----------
 .../tps-client/apache/pki_instance_command_wrapper | 21 -------------
 .../apache/pki_subsystem_command_wrapper           | 19 ------------
 base/tps-client/scripts/nss_pcache                 | 12 +-------
 scripts/compose_functions                          | 14 ++-------
 9 files changed, 5 insertions(+), 158 deletions(-)

diff --git a/base/console/templates/pki_console_wrapper b/base/console/templates/pki_console_wrapper
index 31c4ea4..2f110ed 100755
--- a/base/console/templates/pki_console_wrapper
+++ b/base/console/templates/pki_console_wrapper
@@ -84,20 +84,6 @@ if [ "${OS}" = "Linux" ] ; then
     ARCHITECTURE=`arch`
     JAVA="java"
     JAVA_OPTIONS=""
-
-    if [ "${ARCHITECTURE}" = "i686" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    elif [ "${ARCHITECTURE}" = "x86_64" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib64:/lib64:${LD_LIBRARY_PATH}
-        LD_LIBRARY_PATH=/usr/lib64/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    else
-        invalid_architecture "${ARCHITECTURE}"
-        exit 255
-    fi
 elif [ "${OS}" = "SunOS" ] ; then
     ARCHITECTURE=`uname -p`
     if [ "${ARCHITECTURE}" = "sparc" ] &&
diff --git a/base/java-tools/bin/pki b/base/java-tools/bin/pki
index 0bba06e..152bf3f 100644
--- a/base/java-tools/bin/pki
+++ b/base/java-tools/bin/pki
@@ -25,30 +25,6 @@ import sys
 
 def run_java_cli(args):
 
-    # construct libpath based on the architecture
-    arch = subprocess.check_output('arch')
-    arch = arch.strip()
-
-    if arch == 'i686':
-        libpath = [
-            '/usr/lib/jss',
-            '/usr/lib',
-            '/lib'
-        ]
-
-    elif arch == 'x86_64':
-        libpath = [
-            '/usr/lib64/jss',
-            '/usr/lib64',
-            '/lib64',
-            '/usr/lib/jss',
-            '/usr/lib',
-            '/lib'
-        ]
-
-    else:
-        raise Exception('Unsupported architecture: ' + arch)
-
     # read RESTEasy library path
     value = subprocess.check_output(
         '. /etc/pki/pki.conf && echo $RESTEASY_LIB',
@@ -85,18 +61,12 @@ def run_java_cli(args):
         '/usr/share/java/pki/pki-cmsutil.jar',
         '/usr/share/java/pki/pki-certsrv.jar',
         '/usr/share/java/pki/pki-tools.jar',
+        '/usr/lib64/java/jss4.jar',
+        '/usr/lib/java/jss4.jar'
     ]
 
-    if arch == 'i686':
-        classpath.append('/usr/lib/java/jss4.jar')
-
-    elif arch == 'x86_64':
-        classpath.append('/usr/lib64/java/jss4.jar')
-        classpath.append('/usr/lib/java/jss4.jar')
-
     command = [
         'java',
-        '-Djava.library.path=' + (':'.join(libpath)),
         '-cp',
         ':'.join(classpath),
         'com.netscape.cmstools.cli.MainCLI'
diff --git a/base/java-tools/templates/pki_java_command_wrapper.in b/base/java-tools/templates/pki_java_command_wrapper.in
index 09e059e..404bcf0 100644
--- a/base/java-tools/templates/pki_java_command_wrapper.in
+++ b/base/java-tools/templates/pki_java_command_wrapper.in
@@ -70,25 +70,6 @@ if [ "${OS}" = "Linux" ] ; then
     ARCHITECTURE=`arch`
     JAVA="java"
     JAVA_OPTIONS=""
-
-    if [ "${ARCHITECTURE}" = "i686" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    elif [ "${ARCHITECTURE}" = "x86_64" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        LD_LIBRARY_PATH=/usr/lib64:/lib64:${LD_LIBRARY_PATH}
-        LD_LIBRARY_PATH=/usr/lib64/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    elif [ "${ARCHITECTURE}" = "armv7l" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    else
-        invalid_architecture "${ARCHITECTURE}"
-        exit 255
-    fi
 elif [ "${OS}" = "SunOS" ] ; then
     ARCHITECTURE=`uname -p`
     if [ "${ARCHITECTURE}" = "sparc" ] &&
diff --git a/base/java-tools/templates/pretty_print_cert_command_wrapper.in b/base/java-tools/templates/pretty_print_cert_command_wrapper.in
index 3a67e3a..6c1abc7 100644
--- a/base/java-tools/templates/pretty_print_cert_command_wrapper.in
+++ b/base/java-tools/templates/pretty_print_cert_command_wrapper.in
@@ -70,21 +70,6 @@ if [ "${OS}" = "Linux" ] ; then
     ARCHITECTURE=`arch`
     JAVA="java"
     JAVA_OPTIONS=""
-
-    if [ "${ARCHITECTURE}" = "i686" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    elif [ "${ARCHITECTURE}" = "x86_64" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        LD_LIBRARY_PATH=/usr/lib64:/lib64:${LD_LIBRARY_PATH}
-        LD_LIBRARY_PATH=/usr/lib64/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    else
-        invalid_architecture "${ARCHITECTURE}"
-        exit 255
-    fi
 elif [ "${OS}" = "SunOS" ] ; then
     ARCHITECTURE=`uname -p`
     if [ "${ARCHITECTURE}" = "sparc" ] &&
diff --git a/base/java-tools/templates/pretty_print_crl_command_wrapper.in b/base/java-tools/templates/pretty_print_crl_command_wrapper.in
index 900a887..19f8bd8 100644
--- a/base/java-tools/templates/pretty_print_crl_command_wrapper.in
+++ b/base/java-tools/templates/pretty_print_crl_command_wrapper.in
@@ -70,21 +70,6 @@ if [ "${OS}" = "Linux" ] ; then
     ARCHITECTURE=`arch`
     JAVA="java"
     JAVA_OPTIONS=""
-
-    if [ "${ARCHITECTURE}" = "i686" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    elif [ "${ARCHITECTURE}" = "x86_64" ] ; then
-        LD_LIBRARY_PATH=/usr/lib:/lib
-        LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
-        LD_LIBRARY_PATH=/usr/lib64:/lib64:${LD_LIBRARY_PATH}
-        LD_LIBRARY_PATH=/usr/lib64/jss:${LD_LIBRARY_PATH}
-        export LD_LIBRARY_PATH
-    else
-        invalid_architecture "${ARCHITECTURE}"
-        exit 255
-    fi
 elif [ "${OS}" = "SunOS" ] ; then
     ARCHITECTURE=`uname -p`
     if [ "${ARCHITECTURE}" = "sparc" ] &&
diff --git a/base/tps-client/apache/pki_instance_command_wrapper b/base/tps-client/apache/pki_instance_command_wrapper
index 8ecef80..45ce795 100644
--- a/base/tps-client/apache/pki_instance_command_wrapper
+++ b/base/tps-client/apache/pki_instance_command_wrapper
@@ -81,32 +81,11 @@ ARCHITECTURE=""
 if [ "${OS}" = "Linux" ] ; then
 	ARCHITECTURE=`arch`
 	if [ "${ARCHITECTURE}" = "i686" ] ; then
-		LD_LIBRARY_PATH=/usr/lib/java:/usr/lib:/lib
-		LD_LIBRARY_PATH=/usr/lib/${PRODUCT}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/var/lib/${INSTANCE}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/dirsec:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/java/dirsec:${LD_LIBRARY_PATH}
-		export LD_LIBRARY_PATH
-
 		PATH=/usr/lib/${PRODUCT}:/bin
 		PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${PATH}
 		PATH=/var/lib/${INSTANCE}:${PATH}
 		export PATH
 	elif [ "${ARCHITECTURE}" = "x86_64" ] ; then
-		LD_LIBRARY_PATH=/usr/lib/java:/usr/lib:/lib
-		LD_LIBRARY_PATH=/usr/lib/${PRODUCT}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/var/lib/${INSTANCE}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/dirsec:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/java/dirsec:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib64/java:/usr/lib64:/lib64:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib64/${PRODUCT}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib64/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib64/dirsec:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib64/java/dirsec:${LD_LIBRARY_PATH}
-		export LD_LIBRARY_PATH
-
 		PATH=/usr/lib/${PRODUCT}
 		PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${PATH}
 		PATH=/var/lib/${INSTANCE}:${PATH}
diff --git a/base/tps-client/apache/pki_subsystem_command_wrapper b/base/tps-client/apache/pki_subsystem_command_wrapper
index 4285b76..9a995c1 100644
--- a/base/tps-client/apache/pki_subsystem_command_wrapper
+++ b/base/tps-client/apache/pki_subsystem_command_wrapper
@@ -80,29 +80,10 @@ ARCHITECTURE=""
 if [ "${OS}" = "Linux" ] ; then
 	ARCHITECTURE=`arch`
 	if [ "${ARCHITECTURE}" = "i686" ] ; then
-		LD_LIBRARY_PATH=/usr/lib/java:/usr/lib:/lib
-		LD_LIBRARY_PATH=/usr/lib/${PRODUCT}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/dirsec:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/java/dirsec:${LD_LIBRARY_PATH}
-		export LD_LIBRARY_PATH
-
 		PATH=/usr/lib/${PRODUCT}:/bin
 		PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${PATH}
 		export PATH
 	elif [ "${ARCHITECTURE}" = "x86_64" ] ; then
-		LD_LIBRARY_PATH=/usr/lib/java:/usr/lib:/lib
-		LD_LIBRARY_PATH=/usr/lib/${PRODUCT}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/dirsec:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib/java/dirsec:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib64/java:/usr/lib64:/lib64:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib64/${PRODUCT}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib64/${PRODUCT}/${SUBSYSTEM}:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib64/dirsec:${LD_LIBRARY_PATH}
-		LD_LIBRARY_PATH=/usr/lib64/java/dirsec:${LD_LIBRARY_PATH}
-		export LD_LIBRARY_PATH
-
 		PATH=/usr/lib/${PRODUCT}
 		PATH=/usr/lib/${PRODUCT}/${SUBSYSTEM}:${PATH}
 		PATH=/usr/lib64/${PRODUCT}:/bin:${PATH}
diff --git a/base/tps-client/scripts/nss_pcache b/base/tps-client/scripts/nss_pcache
index 5295abb..6c4b21e 100755
--- a/base/tps-client/scripts/nss_pcache
+++ b/base/tps-client/scripts/nss_pcache
@@ -32,17 +32,7 @@ fi
 OS=`uname -s`
 PLATFORM=""
 
-if [ $OS = "Linux" ]; then
-	PLATFORM=`arch`
-	if [ $PLATFORM = "i686" ]; then
-		# 32-bit Linux
-		LD_LIBRARY_PATH=/usr/lib/dirsec:/usr/lib:$LD_LIBRARY_PATH
-	elif [ $PLATFORM = "x86_64" ]; then
-		# 64-bit Linux
-		LD_LIBRARY_PATH=/usr/lib64/dirsec:/usr/lib64:/usr/lib:$LD_LIBRARY_PATH
-	fi 
-	export LD_LIBRARY_PATH
-elif [ $OS = "SunOS" ]; then
+if [ $OS = "SunOS" ]; then
 	PLATFORM=`uname -p`
 	if	[ "${PLATFORM}" = "sparc" ] &&
 		[ -d "/usr/lib/sparcv9/" ] ; then
diff --git a/scripts/compose_functions b/scripts/compose_functions
index 75eee89..14dd965 100644
--- a/scripts/compose_functions
+++ b/scripts/compose_functions
@@ -8,23 +8,13 @@ if [ "${OS}" != "Linux" ] ; then
 	exit 255
 fi
 
-PLATFORM=`uname -p`
-if [ "${PLATFORM}" = "i686" ] ; then
-	ARCHITECTURE="32-bit"
-elif [ "${PLATFORM}" = "x86_64" ] ; then
-	ARCHITECTURE="64-bit"
-else
-	printf "'$0' is ONLY available on 'i686' or 'x86_64' platforms!\n"
-	exit 255
-fi
-
 if [ -f "/etc/redhat-release" ] ; then
 	DISTRIBUTION=`cat /etc/redhat-release | cut -c1-7`
 	DIST_VERSION=`cat /etc/redhat-release | tr -d [:alpha:][:blank:][\(\)]`
 	if [ "${DISTRIBUTION}" = "Fedora " ] ; then
-		MESSAGE="[built for ${ARCHITECTURE} Fedora ${DIST_VERSION}]"
+		MESSAGE="[built for Fedora ${DIST_VERSION}]"
 	elif [ "${DISTRIBUTION}" = "Red Hat" ] ; then
-		MESSAGE="[built for ${ARCHITECTURE} Red Hat ${DIST_VERSION}]"
+		MESSAGE="[built for Red Hat ${DIST_VERSION}]"
 	else
 		printf "'$0' is ONLY available on 'Fedora' or 'Red Hat' "
 		printf "distributions!\n"
-- 
1.8.3.1

