A few build system questions

Conrad Meyer cem at freebsd.org
Fri Aug 3 05:39:03 UTC 2018


On Thu, Aug 2, 2018 at 7:29 PM, Eric McCorkle <eric at metricspace.net> wrote:
> For future reference, this seems to be more or less what I'm after:
>
> for f in /etc/trust/root/certs/*.pub.pem; do echo -n "static const char
> `basename ${f%%.*}`_data[] = {"; openssl x509 -outform DER -in
> /etc/trust/root/certs/local.pub.pem |  hexdump -v -e '1/1 "0x%02x,"';
> echo "};"; done

Another option instead of the hexdump format is just "xxd -i" (xxd is
part of vim), although that works best if the intermediary output is
written to a file (it populates the struct name automatically).
Something like:

for f in .../*pub.pem; do openssl x509 -outform DER -in ... >
"$(basename "...")_data" && xxd -i "$(basename "...")_data" ; done

Its output is nicely formatted with spaces and line wrapping.

Best,
Conrad


More information about the freebsd-hackers mailing list