>From a6786b63dc92c50a548cdcc0080a6b9ee14afb09 Mon Sep 17 00:00:00 2001
From: Ade Lee <alee@redhat.com>
Date: Fri, 3 Jan 2014 11:41:02 -0500
Subject: [PATCH 178/179] Debian - replace arch specification

uname -i returns "unknown" on a debian system. "arch" on the other
hand works for fedora, rhel and debian.  Replacing these for all
packages except for the migration ones which will not be built on debian
in any case.
---
 base/console/templates/pki_console_wrapper                     | 4 ++--
 base/java-tools/pki                                            | 4 ++--
 base/java-tools/templates/pki_java_command_wrapper.in          | 4 ++--
 base/java-tools/templates/pretty_print_cert_command_wrapper.in | 4 ++--
 base/java-tools/templates/pretty_print_crl_command_wrapper.in  | 4 ++--
 base/ra/scripts/nss_pcache                                     | 4 ++--
 base/server/scripts/operations                                 | 2 +-
 base/setup/pkicommon.pm                                        | 4 ++--
 base/setup/pkicreate                                           | 2 +-
 base/setup/scripts/functions                                   | 2 +-
 base/setup/scripts/pki_apache_initscript                       | 2 +-
 base/silent/scripts/pkisilent                                  | 4 ++--
 base/tps/apache/pki_instance_command_wrapper                   | 4 ++--
 base/tps/apache/pki_subsystem_command_wrapper                  | 4 ++--
 base/tps/scripts/nss_pcache                                    | 4 ++--
 15 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/base/console/templates/pki_console_wrapper b/base/console/templates/pki_console_wrapper
index cc9590697a936ef840b0a3bde277644920b47a9e..31c4ea48197affc697b83cd507abed332deb644a 100755
--- a/base/console/templates/pki_console_wrapper
+++ b/base/console/templates/pki_console_wrapper
@@ -81,11 +81,11 @@ OS=`uname -s`
 ARCHITECTURE=""
 
 if [ "${OS}" = "Linux" ] ; then
-    ARCHITECTURE=`uname -i`
+    ARCHITECTURE=`arch`
     JAVA="java"
     JAVA_OPTIONS=""
 
-    if [ "${ARCHITECTURE}" = "i386" ] ; then
+    if [ "${ARCHITECTURE}" = "i686" ] ; then
         LD_LIBRARY_PATH=/usr/lib:/lib
         LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
         export LD_LIBRARY_PATH
diff --git a/base/java-tools/pki b/base/java-tools/pki
index 582162010932abed82fe6c929b235f3603b3cddd..27802410f142824e2c251bbbc77ef6b477587703 100755
--- a/base/java-tools/pki
+++ b/base/java-tools/pki
@@ -45,10 +45,10 @@ sub invalid_architecture()
 ##      search order this command uses to find shared libraries.             ##
 ###############################################################################
 
-my $ARCHITECTURE=`uname -i`;
+my $ARCHITECTURE=`arch`;
 chop( $ARCHITECTURE );
 
-if( $ARCHITECTURE eq "i386" ) {
+if( $ARCHITECTURE eq "i686" ) {
     $libpath="/usr/lib";
 
     $ENV{LD_LIBRARY_PATH} = "/usr/lib/jss:"
diff --git a/base/java-tools/templates/pki_java_command_wrapper.in b/base/java-tools/templates/pki_java_command_wrapper.in
index e9ff0055347a0304027b421d5313ac1ad9ffade7..267b9df2cdddf7950528d4832c23cd58747d4229 100644
--- a/base/java-tools/templates/pki_java_command_wrapper.in
+++ b/base/java-tools/templates/pki_java_command_wrapper.in
@@ -67,11 +67,11 @@ invalid_architecture() {
 OS=`uname -s`
 
 if [ "${OS}" = "Linux" ] ; then
-    ARCHITECTURE=`uname -i`
+    ARCHITECTURE=`arch`
     JAVA="java"
     JAVA_OPTIONS=""
 
-    if [ "${ARCHITECTURE}" = "i386" ] ; then
+    if [ "${ARCHITECTURE}" = "i686" ] ; then
         LD_LIBRARY_PATH=/usr/lib:/lib
         LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
         export LD_LIBRARY_PATH
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 811935ef46160c1a7993d24fe982d6289bd8a819..06fac424d4123f439c2ad228fa6a069e5faa779e 100644
--- a/base/java-tools/templates/pretty_print_cert_command_wrapper.in
+++ b/base/java-tools/templates/pretty_print_cert_command_wrapper.in
@@ -67,11 +67,11 @@ invalid_architecture() {
 OS=`uname -s`
 
 if [ "${OS}" = "Linux" ] ; then
-    ARCHITECTURE=`uname -i`
+    ARCHITECTURE=`arch`
     JAVA="java"
     JAVA_OPTIONS=""
 
-    if [ "${ARCHITECTURE}" = "i386" ] ; then
+    if [ "${ARCHITECTURE}" = "i686" ] ; then
         LD_LIBRARY_PATH=/usr/lib:/lib
         LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
         export LD_LIBRARY_PATH
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 e70b9ab347db33f1ed6078f968e5a39218b67918..8aeec252c42351740e17fa01d5df1dfe152eb95b 100644
--- a/base/java-tools/templates/pretty_print_crl_command_wrapper.in
+++ b/base/java-tools/templates/pretty_print_crl_command_wrapper.in
@@ -67,11 +67,11 @@ invalid_architecture() {
 OS=`uname -s`
 
 if [ "${OS}" = "Linux" ] ; then
-    ARCHITECTURE=`uname -i`
+    ARCHITECTURE=`arch`
     JAVA="java"
     JAVA_OPTIONS=""
 
-    if [ "${ARCHITECTURE}" = "i386" ] ; then
+    if [ "${ARCHITECTURE}" = "i686" ] ; then
         LD_LIBRARY_PATH=/usr/lib:/lib
         LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
         export LD_LIBRARY_PATH
diff --git a/base/ra/scripts/nss_pcache b/base/ra/scripts/nss_pcache
index bf978b48b1622b668200195a478fa15bf32aeb98..c1f6b6c3167ae1d61e128d7fd89babb24f5667f5 100755
--- a/base/ra/scripts/nss_pcache
+++ b/base/ra/scripts/nss_pcache
@@ -33,8 +33,8 @@ fi
 OS=`uname -s`
 
 if [ $OS = "Linux" ]; then
-	PLATFORM=`uname -i`
-	if [ $PLATFORM = "i386" ]; 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
diff --git a/base/server/scripts/operations b/base/server/scripts/operations
index 7d026fe31f35f9c5bd10f8acdf2e2cef80b399c3..ebbe5d084c49ed89ec7a7b3fa065af4b05ac6570 100644
--- a/base/server/scripts/operations
+++ b/base/server/scripts/operations
@@ -56,7 +56,7 @@ esac
 shopt -s nullglob
 
 OS=`uname -s`
-ARCHITECTURE=`uname -i`
+ARCHITECTURE=`arch`
 
 # Check to insure that this script's original invocation directory
 # has not been deleted!
diff --git a/base/setup/pkicommon.pm b/base/setup/pkicommon.pm
index 16f553e00fdc17e879ec34ab9e79d6c08e5a1ce0..b5bb8110e9832b68a68b6a44e9f3dc78a893c3fa 100755
--- a/base/setup/pkicommon.pm
+++ b/base/setup/pkicommon.pm
@@ -207,10 +207,10 @@ if ($^O eq "linux") {
     $pki_registry_path = "$default_registry_path/pki";
     $default_initscripts_path = "/etc/rc.d/init.d";
     $default_lockdir = "/var/lock/pki";
-    $default_hardware_platform = `uname -i`;
+    $default_hardware_platform = `arch`;
     $default_hardware_platform =~ s/\s+$//g;
     chomp($default_hardware_platform);
-    if ($default_hardware_platform eq "i386") {
+    if ($default_hardware_platform eq "i686") {
         # 32-bit Linux
         $default_system_binaries       = "/bin";
         $default_system_libraries      = "/lib";
diff --git a/base/setup/pkicreate b/base/setup/pkicreate
index a63d6b32c3380c474fc3bbdbca00e6bf0f84ce80..097b881a632c0fb822b735f0ca4ba04dc0d8e923 100755
--- a/base/setup/pkicreate
+++ b/base/setup/pkicreate
@@ -629,7 +629,7 @@ if ($^O eq "linux") {
 
 # Initialize Java-specific variables
 if ($^O eq "linux") {
-    if ($default_hardware_platform eq "i386") {
+    if ($default_hardware_platform eq "i686") {
         # 32-bit Linux
 
         # Supported hardware token PKCS #11 modules
diff --git a/base/setup/scripts/functions b/base/setup/scripts/functions
index 45e6dee1281715cce4d3909d852b84bf0b171d52..96722a1ee567862efc20ef33230926fc2cde603e 100644
--- a/base/setup/scripts/functions
+++ b/base/setup/scripts/functions
@@ -62,7 +62,7 @@ esac
 shopt -s nullglob
 
 OS=`uname -s`
-ARCHITECTURE=`uname -i`
+ARCHITECTURE=`arch`
 
 # Check to insure that this script's original invocation directory
 # has not been deleted!
diff --git a/base/setup/scripts/pki_apache_initscript b/base/setup/scripts/pki_apache_initscript
index 247acad064972a6ac22b3e109ce220480a116b27..9fde99567047aed815ac5156ef68adbef8fbf7c8 100755
--- a/base/setup/scripts/pki_apache_initscript
+++ b/base/setup/scripts/pki_apache_initscript
@@ -12,7 +12,7 @@ PKI_REGISTRY_FILE=[PKI_REGISTRY_FILE]
 shopt -s nullglob
 
 OS=`uname -s`
-ARCHITECTURE=`uname -i`
+ARCHITECTURE=`arch`
 
 # Source values associated with this particular PKI instance
 if [ -f $PKI_REGISTRY_FILE ]; then
diff --git a/base/silent/scripts/pkisilent b/base/silent/scripts/pkisilent
index e9b154437a2de6cec54f1ea97cf99f80522645aa..d0189031a70413af0a55222ea45531737f7d0469 100755
--- a/base/silent/scripts/pkisilent
+++ b/base/silent/scripts/pkisilent
@@ -45,10 +45,10 @@ sub invalid_architecture()
 ##      search order this command uses to find shared libraries.             ##
 ###############################################################################
 
-my $ARCHITECTURE=`uname -i`;
+my $ARCHITECTURE=`arch`;
 chop( $ARCHITECTURE );
 
-if( $ARCHITECTURE eq "i386" ) {
+if( $ARCHITECTURE eq "i686" ) {
     $libpath="/usr/lib";
 
     $ENV{LD_LIBRARY_PATH} = "/usr/lib/jss:"
diff --git a/base/tps/apache/pki_instance_command_wrapper b/base/tps/apache/pki_instance_command_wrapper
index 913b37e4a0d5397eb894b52977e020dcd062aded..8ecef807538d9b4e2aa5d45dd40028ffe246e9e3 100644
--- a/base/tps/apache/pki_instance_command_wrapper
+++ b/base/tps/apache/pki_instance_command_wrapper
@@ -79,8 +79,8 @@ OS=`uname -s`
 ARCHITECTURE=""
 
 if [ "${OS}" = "Linux" ] ; then
-	ARCHITECTURE=`uname -i`
-	if [ "${ARCHITECTURE}" = "i386" ] ; 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}
diff --git a/base/tps/apache/pki_subsystem_command_wrapper b/base/tps/apache/pki_subsystem_command_wrapper
index 19cbf9dd9f635a2c82fd9cdc402ea3046707db5b..4285b767a7a85693263f49649529a57fa1390ab7 100644
--- a/base/tps/apache/pki_subsystem_command_wrapper
+++ b/base/tps/apache/pki_subsystem_command_wrapper
@@ -78,8 +78,8 @@ OS=`uname -s`
 ARCHITECTURE=""
 
 if [ "${OS}" = "Linux" ] ; then
-	ARCHITECTURE=`uname -i`
-	if [ "${ARCHITECTURE}" = "i386" ] ; 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}
diff --git a/base/tps/scripts/nss_pcache b/base/tps/scripts/nss_pcache
index f87d7bbf68bed98d22a0801f65c3aefb38b844ce..5295abb846805c760f7f99d27269ff968bbe9e73 100755
--- a/base/tps/scripts/nss_pcache
+++ b/base/tps/scripts/nss_pcache
@@ -33,8 +33,8 @@ OS=`uname -s`
 PLATFORM=""
 
 if [ $OS = "Linux" ]; then
-	PLATFORM=`uname -i`
-	if [ $PLATFORM = "i386" ]; 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
-- 
1.8.3.1

