debian/postinst
changeset 15 a9462fce24e1
parent 8 75c45a13ac8c
child 20 1ca14c3e5022
equal deleted inserted replaced
14:e23951f3f974 15:a9462fce24e1
    17 # for details, see http://www.debian.org/doc/debian-policy/ or
    17 # for details, see http://www.debian.org/doc/debian-policy/ or
    18 # the debian-policy package
    18 # the debian-policy package
    19 
    19 
    20 CONF=/etc/ca-certificates.conf
    20 CONF=/etc/ca-certificates.conf
    21 DIR=/usr/share/ca-certificates
    21 DIR=/usr/share/ca-certificates
    22 CRTS=$DIR/schlittermann/*.crt
    22 CRTS=$(cd $DIR && ls schlittermann/*.crt)
    23 
    23 
    24 hash() { openssl x509 -noout -in "$1" -hash; }
    24 hash() { openssl x509 -noout -in "$1" -hash; }
    25 
    25 
    26 case "$1" in
    26 case "$1" in
    27     configure)
    27     configure)
    28 	# aus der ca-certificates.conf entfernen
    28 	# aus der ca-certificates.conf entfernen
    29 	tmp=`mktemp`
    29 	echo "$CRTS" >> $CONF
    30 	grep -v '^schlittermann-ca\.crt$' $CONF > $tmp
    30 	update-ca-certificates --fresh
    31 	cp $tmp $CONF
       
    32 	rm -f $tmp
       
    33 
    31 
    34 	# zuerst mal gucken, ob's nicht zufällig schon in /etc/ssl/certs
    32 	# find schlittermann certs that are used somewhere
    35 	# mit rumliegt von früher
    33 	{
    36 
    34 	    echo '/etc/ssl/certs/schlittermann-ca.pem'; 
    37 	for CRT in $CRTS; do
    35 	    find /etc/ssl/certs -name '*schlittermann*' -not -type l -type f -printf '%p\n'
    38 	    CRT=$(basename $CRT)
    36 	} | sort -u | while read FILE; do
    39 	    HASH=`hash $DIR/$CRT 2>/dev/null || echo 0`
    37 		found=$(grep --exclude-dir '.hg' -rlF "$FILE" /etc) || continue
    40 	    echo "$DIR/$CRT: $HASH"
    38 		{
    41 
    39 		    echo "WARNING: \`$FILE' used in:"
    42 	    for p in /etc/ssl/certs/*.crt; do
    40 		    echo "$found"
    43 		test -e "$p" || { rm -f "$p"; continue; }   # dangling symlinks
    41 		    echo "Please replace this with \`$DIR/schlittermann/schlittermann-ca-bundle.pem'"
    44 		test "$HASH" = `hash "$p"` || continue
    42 		} | sed 's/^/### /' >&2
    45 		test -L "$p" || { rm -v "$p"; continue; }
       
    46 		test `readlink "$p"` = "$DIR/$CRT" || { rm "$p"; continue; }
       
    47 	    done
    43 	    done
    48 	    grep -F -q "schlittermann/$CRT" "$CONF" || echo "schlittermann/$CRT" >> "$CONF"
       
    49 	done
       
    50 
       
    51 	update-ca-certificates
       
    52     ;;
    44     ;;
    53 
    45 
    54     abort-upgrade|abort-remove|abort-deconfigure)
    46     abort-upgrade|abort-remove|abort-deconfigure)
    55     ;;
    47     ;;
    56 
    48