rootcerts/rootcerts.sh

15 lines
571 B
Bash

#!/bin/bash
DIR=~/rootcerts
mkdir -p "${DIR}"
curl --insecure https://git.dmin.pro/arturius/rootcerts/raw/branch/master/rootcerts.pem.txt > ${DIR}/rootcerts.pem
cat "${DIR}/rootcerts.pem" | (cd $DIR && split -p '-----BEGIN CERTIFICATE-----' - cert- )
for c in ${DIR}/cert-* ; do
echo "security -v add-trusted-cert -d -r trustRoot -k \"/Library/Keychains/System.keychain\" \"$c\"" >> "${DIR}/tmp.sh"
done
if [ "$1" = "DS" ]; then
sudo sh "${DIR}/tmp.sh"
else
osascript -e "do shell script \"sh ${DIR}/tmp.sh\" with administrator privileges"
fi
rm -rf "${DIR}"