diff --git a/before_install.sh b/before_install.sh index be63fd9478b..247abe99122 100755 --- a/before_install.sh +++ b/before_install.sh @@ -28,7 +28,11 @@ fi # Check if SSL certificates have been imported into Mono's certificate store. # If certs haven't been installed, some/all of the Nuget packages will fail to restore. -if [ $('certmgr -list -c Trust | grep -c -F "X.509"') -le 1 ]; then +# Note, the result of the certmgr and grep commands returns the number of installed X.509 certificates. +# We need to run the command twice -- on some systems (e.g. macOS) the certs are installed in the user store, +# and on other systems (e.g., Ubuntu) they're installed to the machine store. certmgr only shows what's in +# the selected store, which is why we need to check both. +if [ "$(certmgr -list -c Trust | grep -c -F "X.509")" -le 1 ] && [ "$(certmgr -list -c -m Trust | grep -c -F "X.509")" -le 1 ]; then echo "No SSL certificates installed so unable to restore NuGet packages." >&2; echo "Run 'mozroots --sync --import' to install certificates to Mono's certificate store." >&2; exit 1