@@ -8,32 +8,38 @@ echo "System password requested to install certificate authority on host..."
8
8
9
9
if [ " $( uname) " == " Darwin" ]; then
10
10
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain rootCA.pem
11
+ echo " {\" policies\" : {\" Certificates\" : {\" ImportEnterpriseRoots\" : true}}}" | sudo tee policies.json
11
12
13
+ FIREFOX_FOUND=0
12
14
# ## Check if Firefox is installed
13
- FFoxBin=" /Applications/Firefox.app/Contents/MacOS/firefox-bin"
14
- if [ -f " $FFoxBin " ]; then
15
- echo " {\" policies\" : {\" Certificates\" : {\" ImportEnterpriseRoots\" : true}}}" | sudo tee policies.json
15
+ for FFoxAppDir in \
16
+ ' /Applications/Firefox.app' \
17
+ ' /Applications/Firefox Developer Edition.app' \
18
+ ; do
16
19
17
- # ## Check if distribution directory exists
18
- DistDirectory=" /Applications/Firefox.app/Contents/Resources/distribution"
19
- if [ ! -d " $DistDirectory " ]; then
20
+ FFoxBin=$FFoxAppDir /Contents/MacOS/firefox-bin
21
+ if [[ -f $FFoxBin ]]; then
22
+ printf ' Firefox compatible found at: %s\n' " $FFoxAppDir " >&2
23
+ FIREFOX_FOUND=1
24
+
25
+ # ## Copy the newly created policies.json to the Certificates directory
26
+ DistDirectory=$FFoxAppDir /Contents/Resources/distribution
20
27
sudo mkdir -p " $DistDirectory "
21
- fi
22
- # ## Move the newly created policies.json to the Certificates directory
23
- sudo mv policies.json " $DistDirectory " /policies.json
28
+ sudo cp policies.json " $DistDirectory " /policies.json
24
29
25
- # ## Check if Certificates directory exists
26
- CertDirectory=" /Library/Application Support/Mozilla/Certificates"
27
- if [ ! -d " $CertDirectory " ]; then
28
- sudo mkdir -p " $CertDirectory "
29
30
fi
31
+ done
30
32
31
- # ## Move the newly created .pem to the Certificates directory
32
- sudo mv rootCA.pem " $CertDirectory " /rootCA.pem
33
- else
34
- sudo rm rootCA.pem
33
+ if [[ $FIREFOX_FOUND -ne 0 ]]; then
34
+ # ## Copy the newly created .pem to the Certificates directory
35
+ CertDirectory=' /Library/Application Support/Mozilla/Certificates'
36
+ printf ' Installing CA certificate to: %s\n' " $CertDirectory " >&2
37
+ sudo mkdir -p " $CertDirectory "
38
+ sudo cp rootCA.pem " $CertDirectory " /rootCA.pem
35
39
fi
36
40
41
+ rm -f policies.json rootCA.pem
42
+
37
43
else
38
44
39
45
# ## Requirement: apt install libnss3-tools
0 commit comments