]> git.pld-linux.org Git - packages/openssl.git/blobdiff - openssl-c_rehash.sh
- rel 6
[packages/openssl.git] / openssl-c_rehash.sh
index 2bddc5a24f830cef630c45b8218f425f8e3589e4..068a0608f763cfe34e8860980e1defdb94a6a6f5 100644 (file)
@@ -31,7 +31,7 @@ check_file()
 
     # make IFS a newline so we can process grep output line by line
     local OLDIFS=${IFS}
-    IFS=$( printf "\n" )
+    IFS="\n"
 
     # XXX: could be more efficient to have two 'grep -m' but is -m portable?
     for LINE in $( grep '^-----BEGIN .*-----' ${1} )
@@ -106,7 +106,7 @@ link_hash()
     do
        if [ ${FINGERPRINT} = $( fingerprint ${LINKFILE} ${2} ) ]
        then
-           printf "WARNING: Skipping duplicate file ${1}\n" >&2
+           echo "WARNING: Skipping duplicate file ${1}" >&2
            return 1
        fi      
 
@@ -114,7 +114,7 @@ link_hash()
        LINKFILE=${HASH}.${TAG}${SUFFIX}
     done
 
-    printf "${1} => ${LINKFILE}\n"
+    echo "${1} => ${LINKFILE}"
 
     # assume any system with a POSIX shell will either support symlinks or
     # do something to handle this gracefully
@@ -127,18 +127,12 @@ link_hash()
 # hash_dir create hash links in a given directory
 hash_dir()
 {
-    printf "Doing ${1}\n"
+    echo "Doing ${1}"
 
     cd ${1}
 
-    for FILE in *
+    ls -1 * 2>/dev/null | while read FILE
     do
-       # no files in directory at all, no point in continuing
-       if ! [ -f ${FILE} ]
-       then
-           return 1
-       fi
-
         if echo ${FILE} | grep -q -E '^[[:xdigit:]]{8}\.r?[[:digit:]]+$' \
                && [ -h "${FILE}" ]
         then
@@ -146,14 +140,8 @@ hash_dir()
         fi
     done
 
-    for FILE in *.pem
+    ls -1 *.pem 2>/dev/null | while read FILE
     do
-       # no pem files so FILE gets set to the unexpanded *.pem
-       if ! [ -f ${FILE} ]
-       then
-           break
-       fi
-
        check_file ${FILE}
         local FILE_TYPE=${?}
        local TYPE_STR=''
@@ -165,7 +153,7 @@ hash_dir()
         then
             TYPE_STR='crl'
         else
-            printf "WARNING: ${FILE} does not contain a certificate or CRL: skipping\n" >&2
+            echo "WARNING: ${FILE} does not contain a certificate or CRL: skipping" >&2
            continue
         fi
 
@@ -191,7 +179,7 @@ export PATH
 # confirm existance/executability of ssl command
 if ! [ -x $( which ${SSL_CMD} ) ]
 then
-    printf "${0}: rehashing skipped ('openssl' program not available)\n" >&2
+    echo "${0}: rehashing skipped ('openssl' program not available)" >&2
     exit 0
 fi
 
This page took 0.02928 seconds and 4 git commands to generate.