#!/bin/sh ## Author: Dodji Seketeli certs_dir="/etc/pki/tls/certs" cert_hash() { openssl x509 -hash -noout -in $1 } die() { echo $1 exit -1 } test -f $1 || die "Could not acces '$1'" cert_name=$(basename $1) hash=$(cert_hash $1) if test $1 != $certs_dir/$cert_name; then test -d $certs_dir || mkdir -p $certs_dir cp -f $1 $certs_dir fi ln -s $certs_dir/$cert_name $certs_dir/$hash.0