if (word(2 $loadinfo()) != [pf]) { load -pf $word(1 $loadinfo()); return; };

#
# Here's the plan...
#
# Rather than have configure auto-detect where your root CA file is,
# and have that path hardcoded into the binary, we're going to do 
# that search at startup.  Then, if you want to do it some other way,
# you can!  How about that...
#
# If anyone has a better way to do this, please let me know!
#
#	I found this at http://bradconte.com/using-load_verify_locations
#
#	Debian, Ubuntu, Arch, SuSE
#	NetBSD (security/mozilla-rootcerts)
#		/etc/ssl/certs/
#	Debian, Ubuntu, Arch: (update-ca-certificates)
#		/etc/ssl/certs/ca-certificates.crt
#	Red Hat 5+, Fedora, Centos
#		/etc/pki/tls/certs/ca-bundle.crt
#	Red Hat 4
#		/usr/share/ssl/certs/ca-bundle.crt
#	FreeBSD (security/ca-root-nss)
#		/usr/local/share/certs/ca-root-nss.crt
#	FreeBSD (pre-2008 security/ca-root)
#		/usr/local/share/certs/ca-root.crt
#	OpenBSD
#		/etc/ssl/cert.pem
#	Mac OS X
#		/System/Library/OpenSSL/certs/cert.pem
#
alias setup_ssl_root_cert_file
{
	@ ssl_cert_locations[0] = [~/.sslca.bundle];
	@ ssl_cert_locations[1] = [/etc/ssl/certs/ca-certificates.crt];
	@ ssl_cert_locations[2] = [/etc/pki/tls/certs/ca-bundle.crt];
	@ ssl_cert_locations[3] = [/usr/share/ssl/certs/ca-bundle.crt];
	@ ssl_cert_locations[4] = [/usr/local/share/certs/ca-root-nss.crt];
	@ ssl_cert_locations[5] = [/usr/local/share/certs/ca-root.crt];
	@ ssl_cert_locations[6] = [/etc/ssl/cert.pem];
	@ ssl_cert_locations[7] = [/System/Library/OpenSSL/certs/cert.pem];

	@ ssl_cert_locations[8] = [/etc/ssl/ca.bundle];
	@ ssl_cert_locations[9] = [/usr/local/etc/ssl/ca.bundle];
	@ ssl_cert_locations[10] = [/opt/etc/ssl/ca.bundle];
	@ ssl_cert_locations[11] = [/opt/share/certs/ca.bundle];
	@ ssl_cert_locations[12] = [/usr/share/certs/ca-root-nss.crt];

	@ ssl_cert_locations[13] = [/etc/ssl/certs/];
	
	foreach ssl_cert_locations i 
	{
		echo Checking $ssl_cert_locations[$i];
		if (fexist($ssl_cert_locations[$i]) == 1)
		{
			set SSL_ROOT_CERTS_LOCATION $ssl_cert_locations[$i];
			return;
		};
	};
	xecho -b I couldn't find a root certificate file.  You'll have to /SET SSL_ROOT_CERT_FILE manually.;
};

setup_ssl_root_cert_file

#hop'2k15
