debian/postinst
changeset 0 0d5304552597
child 1 700a4aa21234
equal deleted inserted replaced
-1:000000000000 0:0d5304552597
       
     1 #!/bin/sh
       
     2 # postinst script for ca-certificates-schlittermann
       
     3 #
       
     4 # see: dh_installdeb(1)
       
     5 
       
     6 set -e
       
     7 
       
     8 # summary of how this script can be called:
       
     9 #        * <postinst> `configure' <most-recently-configured-version>
       
    10 #        * <old-postinst> `abort-upgrade' <new version>
       
    11 #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
       
    12 #          <new-version>
       
    13 #        * <postinst> `abort-remove'
       
    14 #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
       
    15 #          <failed-install-package> <version> `removing'
       
    16 #          <conflicting-package> <version>
       
    17 # for details, see http://www.debian.org/doc/debian-policy/ or
       
    18 # the debian-policy package
       
    19 
       
    20 CONF=/etc/ca-certificates.conf
       
    21 DIR=/usr/share/ca-certificates
       
    22 CRT=schlittermann-ca.crt
       
    23 
       
    24 hash() { openssl x509 -noout -in "$1" -subject_hash; }
       
    25 
       
    26 case "$1" in
       
    27     configure)
       
    28 	# zuerst mal gucken, ob's nicht zufällig schon in /etc/ssl/certs
       
    29 	# mit rumliegt von früher
       
    30 
       
    31 	HASH=`hash $DIR/$CRT`
       
    32 	echo "$DIR/$CRT: $HASH"
       
    33 
       
    34 	for p in /etc/ssl/certs/*.crt; do
       
    35 	    test -e "$p" || { rm -f "$p"; continue; }
       
    36 	    test "$HASH" = `hash "$p"` || continue
       
    37 	    test -L "$p" || { rm -v "$p"; continue; }
       
    38 	    test `readlink "$p"` = "$DIR/$CRT" || { rm "$p"; continue; }
       
    39 	done
       
    40 	grep -q "$CRT" "$CONF" || echo "$CRT" >> "$CONF"
       
    41 	update-ca-certificates
       
    42     ;;
       
    43 
       
    44     abort-upgrade|abort-remove|abort-deconfigure)
       
    45     ;;
       
    46 
       
    47     *)
       
    48         echo "postinst called with unknown argument \`$1'" >&2
       
    49         exit 1
       
    50     ;;
       
    51 esac
       
    52 
       
    53 # dh_installdeb will replace this with shell code automatically
       
    54 # generated by other debhelper scripts.
       
    55 
       
    56 #DEBHELPER#
       
    57 
       
    58 exit 0
       
    59 
       
    60