Skip to content

Instantly share code, notes, and snippets.

@qmx
Created June 18, 2015 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qmx/2b5e156eb9e2b79fb407 to your computer and use it in GitHub Desktop.
Save qmx/2b5e156eb9e2b79fb407 to your computer and use it in GitHub Desktop.
diff --git a/PKGBUILD.old b/PKGBUILD
index 4c46ccf..69e3ce2 100644
--- a/PKGBUILD.old
+++ b/PKGBUILD
@@ -15,32 +15,30 @@ source=(
'http://acraiz.icpbrasil.gov.br/credenciadas/CertificadosAC-ICP-Brasil/ACcompactado.zip'
)
-sha512sums=(
- 'c2777e058734f5b70f6d9d9550cd36596e6002ecfefbe2836b495c640de133f55859339e0438ce76fcf70c3bc3221ae2204ce99608dcbe9561f9b13f237fb9c9'
- )
+sha512sums=('2429d45630caa57852ca01141fb70c3a0c37388bdc9d5c04691da13a386ac2b3755ff2bd241ea751e0449a1f030311609c9f6f85a77bb93d05ade542582e2882')
package() {
local cert_tag='icp_br'
cd ${srcdir}
- for cert in $(find * -name '*.crt'); do
+ find * -name '*.crt' -print0 | while IFS= read -r -d '' cert; do
#'tag' each certificate's filename, so it's easier to identify them, since
#looks like we cannot put them in a subdirectory anymore.
- local new_cert_name=${cert_tag}.${cert}
+ local new_cert_name=${cert_tag}.$(echo ${cert} | tr ' ' '_')
#avanced debugging techniques
- #echo "> processing $cert (to become $new_cert_name)"
+ echo "> processing $cert (to become $new_cert_name)"
#some certificates are distributed with a .crt extension but are actually
#in DER format instead of PEM (probably because government). If that's the
#case, we convert them to PEM so everything works properly.
if [ "$(file $cert | cut -f2 -d\: | tr -d ' ')" = "data" ]; then
local cert_der=${cert}.der
- mv ${cert} ${cert_der}
+ mv "${cert}" ${cert_der}
/usr/bin/openssl x509 -in ${cert_der} -inform der -out ${new_cert_name}
rm $cert_der
msg2 "Converted '$(basename $cert)' from DER to PEM"
else
- mv ${cert} ${new_cert_name}
+ mv "${cert}" ${new_cert_name}
fi
done
install -d -m0755 $pkgdir/etc/ca-certificates/trust-source/anchors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment