I'm compiling Nginx from source on Debian 12 in Bash. I'd like to select the TLS vendor (e.g. LibreSSL, OpenSSL) via a preflight variable ($nginx_tls_vendor). An example configure command without the variable stuff looks like this:
./configure \
--with-foo \
[…]
--with-openssl=/src/vendor/library-1.2.3 \
--with-openssl-opt="baz" \
[…]
--with-bar \
The values of the --with-openssl and --with-openssl-opt flags depend on $nginx_tls_vendor. Broadly like this for each vendor:
if [ "$nginx_tls_vendor" = "libressl" ] \
; then \
--with-openssl=/src/libressl/libressl-1.2.3 \
--with-openssl-opt="baz-libressl etc" \
; fi
if [ "$nginx_tls_vendor" = "openssl" ] \
; then \
--with-openssl=/src/openssl/openssl-3.2.1 \
--with-openssl-opt="baz-openssl etc" \
; fi
I haven't yet figured out how to use one or more if checks inline within a command. I am reasonably comfortable with an if wrapper around an entire command, but this doesn't apply here. I would like to use two inline if checks to find the TLS vendor and apply the relevant flags.
I've tried various things that might work but they end up breaking my download-and-compile script.
I would be grateful for some guidance and / or further reading so I can integrate two consecutive if checks around the two --with-openssl and --with-openssl-opt flags.
Thank you.
\in theifline there? That makes it really hard to read. You can writeif [ condition ]; thenand just start a new line, orif [ condition ](without the;, that isn't needed if you add a newline) and have thethenin a new line, and you don't needthen \, you can just move straight on to the next line. None of this is related to your question, just pointing it out FYI. – terdon Mar 30 '24 at 21:48configureflag stuff is split over ~60 lines in my IDE, so I can add / remove stuff in testing with a full history of what I've done. – Pete Cooper Mar 31 '24 at 11:32