certctl: don't fall over flat with relative DESTDIR
Up until now, all of our DESTDIR use has been with absolute paths. It turned out that the cd in/out dance we do here breaks us down later on, as the relative path no longer resolves. Convert EXTENSIONS to an ERE that we'll use to grep ls -1 of the dir we're inspecting, rather than cd'ing into it and globbing it up. MFC after: 3 days
This commit is contained in:
parent
3d7650f04c
commit
09841aabfa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=361148
@ -34,7 +34,7 @@
|
|||||||
: ${BLACKLISTPATH:=${DESTDIR}/usr/share/certs/blacklisted:${DESTDIR}/usr/local/etc/ssl/blacklisted}
|
: ${BLACKLISTPATH:=${DESTDIR}/usr/share/certs/blacklisted:${DESTDIR}/usr/local/etc/ssl/blacklisted}
|
||||||
: ${CERTDESTDIR:=${DESTDIR}/etc/ssl/certs}
|
: ${CERTDESTDIR:=${DESTDIR}/etc/ssl/certs}
|
||||||
: ${BLACKLISTDESTDIR:=${DESTDIR}/etc/ssl/blacklisted}
|
: ${BLACKLISTDESTDIR:=${DESTDIR}/etc/ssl/blacklisted}
|
||||||
: ${EXTENSIONS:="*.pem *.crt *.cer *.crl *.0"}
|
: ${FILEPAT:="\.pem$|\.crt$|\.cer$|\.crl$|\.0$"}
|
||||||
: ${VERBOSE:=0}
|
: ${VERBOSE:=0}
|
||||||
|
|
||||||
############################################################ GLOBALS
|
############################################################ GLOBALS
|
||||||
@ -104,13 +104,11 @@ do_scan()
|
|||||||
for CPATH in "$@"; do
|
for CPATH in "$@"; do
|
||||||
[ -d "$CPATH" ] || continue
|
[ -d "$CPATH" ] || continue
|
||||||
echo "Scanning $CPATH for certificates..."
|
echo "Scanning $CPATH for certificates..."
|
||||||
cd "$CPATH"
|
for CFILE in $(ls -1 "${CPATH}" | grep -Ee "${FILEPAT}"); do
|
||||||
for CFILE in $EXTENSIONS; do
|
[ -e "$CPATH/$CFILE" ] || continue
|
||||||
[ -e "$CFILE" ] || continue
|
|
||||||
[ $VERBOSE -gt 0 ] && echo "Reading $CFILE"
|
[ $VERBOSE -gt 0 ] && echo "Reading $CFILE"
|
||||||
"$CFUNC" "$CPATH/$CFILE"
|
"$CFUNC" "$CPATH/$CFILE"
|
||||||
done
|
done
|
||||||
cd -
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user