#!/bin/bash

echo Erstes sudo um folgende Befehle ohne weiter PW Eingabe durchführen zu können
sudo ls /

echo Tools installieren
sudo apt-get install libnss3-tools 

cd /tmp
echo CACert CA Certs herunterladen
wget http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt

echo Installation für Chromium
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n ca-cert -i /tmp/root.crt
certutil -d sql:$HOME/.pki/nssdb -A -t ",," -n ca-cert-class3 -i /tmp/class3.crt 

echo Zertifikate installieren
sudo cp root.crt /usr/local/share/ca-certificates/cacert-root.crt
sudo cp class3.crt /usr/local/share/ca-certificates/cacert-class3.crt
sudo update-ca-certificates 

echo Installation für Firefox
for certDB in $(find ~/ -name "cert8.db")
do
 certdir=$(dirname ${certDB});
 certutil -A -n "${certname}" -t "TCu,Cu,Tu" -i ${certfile} -d dbm:${certdir} > /dev/null 2>&1
 echo -n .
 sleep 1
done
echo -n .
for certDB in $(find ~/ -name "cert9.db")
do
 certdir=$(dirname ${certDB});
 certutil -A -n "${certname}" -t "TCu,Cu,Tu" -i ${certfile} -d sql:${certdir} > /dev/null 2>&1
 echo -n .
 sleep 1
done
echo

echo Entferne Downloads
sudo rm /tmp/class3.crt
sudo rm /tmp/root.crt

echo Ende
