Whitespace changes and variable name rationalization.
authorAkos Frohner <akos.frohner@cern.ch>
Mon, 22 May 2006 09:23:03 +0000 (09:23 +0000)
committerAkos Frohner <akos.frohner@cern.ch>
Mon, 22 May 2006 09:23:03 +0000 (09:23 +0000)
bin/generate-test-certificates.sh

index a038c8b..c80ed7f 100755 (executable)
@@ -40,7 +40,7 @@ function create_cert {
     fi
 
     if [ $flags == "bigclient" ]; then
-       flags="client"
+        flags="client"
     fi
 
     # if we are in a state where we are generating proxies (${CA_DIR}/serial_proxy.txt exists)
@@ -641,8 +641,7 @@ done
 
 #define all used dirs    
 TARGETDIR=$1
-MODULEDIR=$(cd $(dirname $0)/..; pwd)
-CONFIGDIR=$MODULEDIR/test
+CONFIGDIR=$(cd $(dirname $0)/..; echo $PWD)/test
 
 export PASSWORD='changeit'
 DAYS=10000
@@ -652,32 +651,24 @@ if [ -z "$TARGETDIR" ]; then
     exit -1
 fi
 
-mkdir -p $TARGETDIR
-
-# check the certificate directory...
-
-X509_CERT_DIR=${TARGETDIR}/grid-security/certificates
-
-if [ ! -d $X509_CERT_DIR ]
-then
-    mkdir -p $X509_CERT_DIR
+if [ ! -d "$TARGETDIR" ]; then
+    mkdir -p $TARGETDIR
 fi
-[ "$ONLYENV" = 'yes' ] || echo "Certificate directory set to $X509_CERT_DIR"
-
 cd $TARGETDIR
-[ "$ONLYENV" = 'yes' ] || echo "Current directory now: $PWD"
-[ "$ONLYENV" = 'yes' ] || echo "Config directory now: ${CONFIGDIR}"
+# set it to an absolute path
+TARGETDIR=$PWD
+[ "$ONLYENV" = 'yes' ] || echo "Target directory: ${TARGETDIR}"
+[ "$ONLYENV" = 'yes' ] || echo "Config directory: ${CONFIGDIR}"
 
-tmpdir=$PWD/tmp
+tmpdir=$TARGETDIR/tmp
 mkdir -p $tmpdir
 trap "rm -rf $tmpdir" EXIT
-ABSTARGETDIR=$PWD
 
 for catype in $CATYPES; do
     echo "+-----------------------"
     echo "| $catype"
     echo "+-----------------------"
-    cd $ABSTARGETDIR
+    cd $TARGETDIR
 
     export CATYPE=${catype}
     export CA_DIR=${catype}-ca
@@ -705,11 +696,11 @@ for catype in $CATYPES; do
         echo "CA directory already exists: $CA_DIR"
     else
         cp -a $CONFIGDIR/${catype}-ca $CA_DIR
-       result=$?
-       if [ $result -ne 0 ];then
-           echo The copying of CA ${catype} failed with error code $result
-           exit -1
-       fi
+        result=$?
+        if [ $result -ne 0 ];then
+            echo The copying of CA ${catype} failed with error code $result
+            exit -1
+        fi
     fi
 
     if [ $catype != "fake" ]
@@ -729,17 +720,17 @@ for catype in $CATYPES; do
         if [ -d $X509_CERT_DIR ]
         then
             cp $CA_DIR/${catype}.cert $X509_CERT_DIR/${hash_number}.0
-           result=$?
-           if [ $result -ne 0 ];then
-               echo "The copying of ${CA_DIR}/${catype}.cert to \
-                      $X509_CERT_DIR/${hash_number}.0 failed with error code $result";
-           fi
+            result=$?
+            if [ $result -ne 0 ];then
+                echo "The copying of ${CA_DIR}/${catype}.cert to \
+                          $X509_CERT_DIR/${hash_number}.0 failed with error code $result";
+            fi
             cp $tmpdir/temporary_signing_policy.file $X509_CERT_DIR/${hash_number}.signing_policy
-           result=$?
-           if [ $result -ne 0 ];then
-               echo "The copying of $tmpdir/temporary_signing_policy.file to \
-                      $X509_CERT_DIR/${hash_number}.signing_policy failed with error code $result";
-           fi
+            result=$?
+            if [ $result -ne 0 ];then
+                echo "The copying of $tmpdir/temporary_signing_policy.file to \
+                          $X509_CERT_DIR/${hash_number}.signing_policy failed with error code $result";
+            fi
             rm $tmpdir/temporary_signing_policy.file
         else
             echo "The standard globus directory $X509_CERT_DIR does not exist!";
@@ -758,10 +749,10 @@ done
 
 
 [ "$ONLYENV" = 'yes' ] || echo "Easy usage environmental variable settings:"
-echo "export X509_CERT_DIR=$ABSTARGETDIR/grid-security/certificates"
-echo "export X509_USER_CERT=$ABSTARGETDIR/home/usercert.pem"
-echo "export X509_USER_KEY=$ABSTARGETDIR/home/userkey.pem"
+echo "export X509_CERT_DIR=$TARGETDIR/grid-security/certificates"
+echo "export X509_USER_CERT=$TARGETDIR/home/usercert.pem"
+echo "export X509_USER_KEY=$TARGETDIR/home/userkey.pem"
 if [ "$VOMS" = 'yes' ]; then
-    echo "export VOMSDIR=$ABSTARGETDIR/grid-security/vomsdir"
+    echo "export VOMSDIR=$TARGETDIR/grid-security/vomsdir"
 fi