fixes from frantisek to make the hostname and ca name hashing work also on sl5 and 6
authorJoni Hahkala <joni.hahkala@cern.ch>
Fri, 10 Feb 2012 13:42:31 +0000 (13:42 +0000)
committerJoni Hahkala <joni.hahkala@cern.ch>
Fri, 10 Feb 2012 13:42:31 +0000 (13:42 +0000)
bin/generate-test-certificates.sh

index 9f723cb..20a18f4 100755 (executable)
@@ -514,7 +514,11 @@ function add_ca_grid_sec {
     if [ ! -d 'grid-security/certificates-slashwithoutnamespaces' ]; then
         mkdir -p 'grid-security/certificates-slashwithoutnamespaces'
     fi
-    hash=$(openssl x509 -subject_hash_old -noout -in $1-ca/$1.cert)
+    if [ x"`openssl version`" \< x"OpenSSL 1.0.0" ]; then
+        hash=$(openssl x509 -hash -noout -in $1-ca/$1.cert)
+    else
+        hash=$(openssl x509 -subject_hash_old -noout -in $1-ca/$1.cert)
+    fi
     cp $1-ca/$1.cert grid-security/certificates/${hash}.0
     cp $1-ca/$1.crl grid-security/certificates/${hash}.r0
     # generating a signing_policy file
@@ -1219,7 +1223,7 @@ which openssl
 openssl version
 
 #get full hostname
-hostname_space=`hostname -A`
+hostname_space=`hostname -A 2>/dev/null || hostname -f`
 #remove trailing space
 hostname_full=`echo $hostname_space`
 echo host name is [$hostname_full]