X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=openssl-c_rehash.sh;h=75a774945cf75a4a35f96cc548199e8c1270a68f;hb=47fc2171a6d77dfd1365bee4b36f625810fb98fc;hp=14f7e4c4f4a27be6cb2f06e7e83c2a07146aaa9b;hpb=408d1966528e6aec9649d491aea6e52ffc62dd0e;p=packages%2Fopenssl.git diff --git a/openssl-c_rehash.sh b/openssl-c_rehash.sh index 14f7e4c..75a7749 100644 --- a/openssl-c_rehash.sh +++ b/openssl-c_rehash.sh @@ -31,7 +31,7 @@ check_file() # make IFS a newline so we can process grep output line by line local OLDIFS=${IFS} - IFS="\n" + IFS=$( printf "\n" ) # XXX: could be more efficient to have two 'grep -m' but is -m portable? for LINE in $( grep '^-----BEGIN .*-----' ${1} ) @@ -131,14 +131,8 @@ hash_dir() 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='' @@ -177,11 +165,11 @@ hash_dir() # choose the name of an ssl application if [ -n "${OPENSSL}" ] then - SSL_CMD=${OPENSSL} + SSL_CMD=$(which ${OPENSSL} 2>/dev/null) else - SSL_CMD=openssl + SSL_CMD=/usr/bin/openssl OPENSSL=${SSL_CMD} - export ${OPENSSL} + export OPENSSL fi # fix paths @@ -189,7 +177,7 @@ PATH=${PATH}:${DIR}/bin export PATH # confirm existance/executability of ssl command -if ! [ -x $( which ${SSL_CMD} ) ] +if ! [ -x ${SSL_CMD} ] then echo "${0}: rehashing skipped ('openssl' program not available)" >&2 exit 0