#!/bin/bash -e

cd $tmpdir

cat > $tmpdir/note <<- EOF
echo "\$@" >> $tmpdir/log
EOF
chmod +x $tmpdir/note

cat > $tmpdir/entrycb1 <<- EOF
id=EntryCB1
ca_name=CAB1
other_root_cert_files=$tmpdir/bundle1
pre_certsave_command=$tmpdir/note Running pre-save for EntryCAB1
pre_certsave_uid=$UID
post_certsave_command=$tmpdir/note Running post-save for EntryCAB1
post_certsave_uid=$UID
EOF
cat > $tmpdir/entrycb2 <<- EOF
id=EntryCB2
ca_name=CAB2
pre_certsave_command=$tmpdir/note Running pre-save for EntryCAB2
pre_certsave_uid=$UID
post_certsave_command=$tmpdir/note Running post-save for EntryCAB2
post_certsave_uid=$UID
EOF
cat > $tmpdir/entrycb3 <<- EOF
id=EntryCB3
ca_name=CAB3
pre_certsave_command=$tmpdir/note Running pre-save for EntryCAB3
pre_certsave_uid=$UID
post_certsave_command=$tmpdir/note Running post-save for EntryCAB3
post_certsave_uid=$UID
EOF
cat > $tmpdir/entrycd1 <<- EOF
id=EntryCD1
ca_name=CAD1
root_cert_dbs=$tmpdir/db1
pre_certsave_command=$tmpdir/note Running pre-save for EntryCAD1
pre_certsave_uid=$UID
post_certsave_command=$tmpdir/note Running post-save for EntryCAD1
post_certsave_uid=$UID
EOF
cat > $tmpdir/entrycd2 <<- EOF
id=EntryCD2
ca_name=CAD2
pre_certsave_command=$tmpdir/note Running pre-save for EntryCAD2
pre_certsave_uid=$UID
post_certsave_command=$tmpdir/note Running post-save for EntryCAD2
post_certsave_uid=$UID
EOF
cat > $tmpdir/entrycd3 <<- EOF
id=EntryCD3
ca_name=CAD3
pre_certsave_command=$tmpdir/note Running pre-save for EntryCAD3
pre_certsave_uid=$UID
post_certsave_command=$tmpdir/note Running post-save for EntryCAD3
post_certsave_uid=$UID
EOF
cat > $tmpdir/entrycda <<- EOF
id=EntryCDA
ca_name=CADA
pre_certsave_command=$tmpdir/note Running pre-save for EntryCADA
pre_certsave_uid=$UID
post_certsave_command=$tmpdir/note Running post-save for EntryCADA
post_certsave_uid=$UID
EOF

cat > $tmpdir/cab1 <<- EOF
id=CAB1
ca_type=EXTERNAL
ca_root_cert_files=$tmpdir/bundle1,$tmpdir/bundle-all
ca_other_root_cert_files=
ca_other_cert_files=
ca_root_cert_dbs=
ca_other_root_cert_dbs=
ca_other_cert_dbs=
ca_root_certs=Root Certificate B1
 -----BEGIN CERTIFICATE-----
 MIIDzzCCAregAwIBAgIDAWweMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYDVQQGEwJB
 VDFIMEYGA1UECgw/QS1UcnVzdCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBp
 bSBlbGVrdHIuIERhdGVudmVya2VociBHbWJIMRkwFwYDVQQLDBBBLVRydXN0LW5R
 dWFsLTAzMRkwFwYDVQQDDBBBLVRydXN0LW5RdWFsLTAzMB4XDTA1MDgxNzIyMDAw
 MFoXDTE1MDgxNzIyMDAwMFowgY0xCzAJBgNVBAYTAkFUMUgwRgYDVQQKDD9BLVRy
 dXN0IEdlcy4gZi4gU2ljaGVyaGVpdHNzeXN0ZW1lIGltIGVsZWt0ci4gRGF0ZW52
 ZXJrZWhyIEdtYkgxGTAXBgNVBAsMEEEtVHJ1c3QtblF1YWwtMDMxGTAXBgNVBAMM
 EEEtVHJ1c3QtblF1YWwtMDMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
 AQCtPWFuA/OQO8BBC4SAzewqo51ru27CQoT3URThoKgtUaNR8t4j8DRE/5TrzAUj
 lUC5B3ilJfYKvUWG6Nm9wASOhURh73+nyfrBJcyFLGM/BWBzSQXgYHiVEEvc+RFZ
 znF/QJuKqiTfC0Li21a8StKlDJu3Qz7dg9MmEALP6iPESU7l0+m0iKsMrmKS1GWH
 2WrX9IWf5DMiJaXlyDO6w8dB3F/GaswADm0yqLaHNgBid5seHzTLkDx4iHQF63n1
 k3Flyp3HaxgtPVxO59X4PzF9j4fsCiIvI+n+u33J4PTs63zEsMMtYrWac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hsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxGGuoYQ992zPlm
 hpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X
 dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3
 P6CxB9bpT9zeRXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9Y
 iQBCYz95OdBEsIJuQRno3eDBiFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5no
 xqE=
 -----END CERTIFICATE-----
ca_pre_save_command=$tmpdir/note Running pre-save for CAB1
ca_pre_save_uid=$UID
ca_post_save_command=$tmpdir/note Running post-save for CAB1
ca_post_save_uid=$UID
EOF
cat > $tmpdir/cab2 <<- EOF
id=CAB2
ca_type=EXTERNAL
ca_external_helper=$tmpdir/no-such-helper.sh
ca_root_cert_files=
ca_other_root_cert_files=$tmpdir/bundle2,$tmpdir/bundle-all
ca_other_cert_files=
ca_root_cert_dbs=
ca_other_root_cert_dbs=
ca_other_cert_dbs=
ca_root_certs=Root Certificate B2
 -----BEGIN CERTIFICATE-----
 MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UE
 BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz
 dCBDb21tZXJjaWFsMB4XDTEwMDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDEL
 MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp
 cm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
 AQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6EqdbDuKP
 Hx6GGaeqtS25Xw2K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DVQQDDBdBZmZpcm1UcnVzdCBQ
 cmVtaXVtIEVDQzAeFw0xMDAxMjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJ
 BgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1UcnVzdDEgMB4GA1UEAwwXQWZmaXJt
 VHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNMF4bFZ0D
 0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQN8O9
 ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G
 A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G
 A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs
 aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I
 flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ==
 -----END CERTIFICATE-----
ca_pre_save_command=$tmpdir/note Running pre-save for CAB2
ca_pre_save_uid=$UID
ca_post_save_command=$tmpdir/note Running post-save for CAB2
ca_post_save_uid=$UID
EOF
cat > $tmpdir/cab3 <<- EOF
id=CAB3
ca_type=EXTERNAL
ca_external_helper=$tmpdir/no-such-helper.sh
ca_root_cert_files=
ca_other_root_cert_files=
ca_other_cert_files=$tmpdir/bundle3,$tmpdir/bundle-all
ca_root_cert_dbs=
ca_other_root_cert_dbs=
ca_other_cert_dbs=
ca_root_certs=Root Certificate B3
 -----BEGIN CERTIFICATE-----
 MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEc
 MBoGA1UEChMTQW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBP
 bmxpb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fTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7Rl+lwrrw7GWzbITAPBgNV
 HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZbNshMBgG
 A1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3
 DQEBCwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8j
 vZfza1zv7v1Apt+hk6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kP
 DpFrdRbhIfzYJsdHt6bPWHJxfrrhTZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pc
 maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D
 lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv
 KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
 -----END CERTIFICATE-----
ca_pre_save_command=$tmpdir/note Running pre-save for CAB3
ca_pre_save_uid=$UID
ca_post_save_command=$tmpdir/note Running post-save for CAB3
ca_post_save_uid=$UID
EOF
cat > $tmpdir/cad1 <<- EOF
id=CAD1
ca_type=EXTERNAL
ca_external_helper=$tmpdir/no-such-helper.sh
ca_root_cert_files=
ca_other_root_cert_files=
ca_other_cert_files=
ca_root_cert_dbs=$tmpdir/db1,$tmpdir/dba
ca_other_root_cert_dbs=$tmpdir/dba
ca_other_cert_dbs=$tmpdir/dba
ca_root_certs=Root Certificate D1
 -----BEGIN CERTIFICATE-----
 MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ
 RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD
 VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTA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mrEzMqnji3jG8CcmPHc3ceCQa6Oyh7pEfJYWsICCD8igWKH7y6xsL+z27s
 EzNxZy5p+qksP2bAEllNC1QCkoS72xLvg3BweMhT+t/Gxv/ciC8HwEmdMldg0/L2
 mSlf56oBzKwzqBwKu5HEA6BvtjT5htOzdlSY9EqBs1OdTUDs5XcTRa9bqh/YL0yC
 e/4qxFi7T/ye/QNlGioOw6UgFpRreaaiErS7GqQjel/wroQk5PMr+4okoyeYZdow
 dXb8GZHo2+ubPzK/QJcHJrrM85SFSnonk8+QQtS4Wxam58tAA915
 -----END CERTIFICATE-----
ca_pre_save_command=$tmpdir/note Running pre-save for CAD1
ca_pre_save_uid=$UID
ca_post_save_command=$tmpdir/note Running post-save for CAD1
ca_post_save_uid=$UID
EOF
cat > $tmpdir/cad2 <<- EOF
id=CAD2
ca_type=EXTERNAL
ca_external_helper=$tmpdir/no-such-helper.sh
ca_root_cert_files=
ca_other_root_cert_files=
ca_other_cert_files=
ca_root_cert_dbs=$tmpdir/dba
ca_other_root_cert_dbs=$tmpdir/db2,$tmpdir/dba
ca_other_cert_dbs=$tmpdir/dba
ca_root_certs=Root Certificate D2
 -----BEGIN CERTIFICATE-----
 MIIEDzCCAvegAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJTSzET
 MBEGA1UEBxMKQnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UE
 AxMIQ0EgRGlzaWcwHhcNMDYwMzIyMDEzOTM0WhcNMTYwMzIyMDEzOTM0WjBKMQsw
 CQYDVQQGEwJTSzETMBEGA1UEBxMKQnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcg
 YS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
 ggEKAoIBAQCS9jHBfYj9mQGp2HvycXXxMcbzdWb6UShGhJd4NLxs/LxFWYgmGErE
 Nx+hSkS943EE9UQX4j/8SFhvXJ56CbpR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6RAqTCpIb5HNlpW
 /zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g
 PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u
 QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY
 SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv
 IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
 RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4
 zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd
 BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB
 ZQ==
 -----END CERTIFICATE-----
ca_pre_save_command=$tmpdir/note Running pre-save for CAD2
ca_pre_save_uid=$UID
ca_post_save_command=$tmpdir/note Running post-save for CAD2
ca_post_save_uid=$UID
EOF
cat > $tmpdir/cad3 <<- EOF
id=CAD3
ca_type=EXTERNAL
ca_external_helper=$tmpdir/no-such-helper.sh
ca_root_cert_files=
ca_other_root_cert_files=
ca_other_cert_files=
ca_root_cert_dbs=,$tmpdir/dba
ca_other_root_cert_dbs=,$tmpdir/dba,
ca_other_cert_dbs=$tmpdir/db3,$tmpdir/dba
ca_root_certs=Root Certificate D3
 -----BEGIN CERTIFICATE-----
 MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTEL
 MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE
 BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPI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td/vjzOUrMR
 FcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+7UCmnYR0ObncHoUW2ikbhiMA
 ybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW//1IMwrh3KWB
 kJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
 l7+ijrRU
 -----END CERTIFICATE-----
ca_pre_save_command=$tmpdir/note Running pre-save for CAD3
ca_pre_save_uid=$UID
ca_post_save_command=$tmpdir/note Running post-save for CAD3
ca_post_save_uid=$UID
EOF
cat > $tmpdir/cada <<- EOF
id=CADA
ca_type=EXTERNAL
ca_external_helper=$tmpdir/no-such-helper.sh
ca_root_cert_files=$tmpdir/bundle-all
ca_other_root_cert_files=
ca_other_cert_files=
ca_root_cert_dbs=$tmpdir/dba
ca_other_root_cert_dbs=,$tmpdir/dba
ca_other_cert_dbs=,$tmpdir/dba
ca_root_certs=Root Certificate DA
 -----BEGIN CERTIFICATE-----
 MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDEL
 MAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMp
 IDIwMDcgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAi
 BgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMjAeFw0wNzExMDUwMDAw
 MDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
 d3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBGb3Ig
 YXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9v
 dCBDQSAtIEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/
 BebfowJPDQfGAFG6DAJSLSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6
 papu+7qzcMBniKI11KOasf2twu8x+qi58/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8E
 BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUmtgAMADna3+FGO6Lts6K
 DPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUNG4k8VIZ3
 KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41ox
 XZ3Krr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
 -----END CERTIFICATE-----
ca_pre_save_command=$tmpdir/note Running pre-save for CADA
ca_pre_save_uid=$UID
ca_post_save_command=$tmpdir/note Running post-save for CADA
ca_post_save_uid=$UID
EOF

run="$toolsdir/hooks -e entrycb1 -e entrycb2 -e entrycb3 -e entrycd1 -e entrycd2 -e entrycd3 -c cab1 -c cab2 -c cab3 -c cad1 -c cad2 -c cad3 -c cada"
for target in EntryCB1 EntryCB2 EntryCD1 EntryCD2 CAB1 CAB2 CAD1 CAD2 CADA ; do
	: > $tmpdir/log
	echo '['$target' -B]'
	$run -B $target
	cat $tmpdir/log
	: > $tmpdir/log
	echo '['$target' -C]'
	$run -C $target
	cat $tmpdir/log
done

echo OK.
