Install /usr/etc/gss/mech if required
[mech_eap.git] / debian / moonshot-gss-eap.postinst
1 #!/bin/sh
2 set -e
3
4 case "$1" in
5   configure)
6         if [ -z "$2" ]; then
7             # krb5 prior to 1.12.1+dfsg-2 didn't support loading
8             # gssapi mechanism definitions from /etc/gss/mech.d.  To
9             # make matters worse, sysconfdir was set incorrectly so it
10             # wants the mechanism definition in /usr/etc/gss/mech.
11             # Starting in 1.12.1+dfsg-2, the krb5 package ships
12             # /etc/gss/mech.d/README.  There doesn't seem to be a
13             # great mechanism for a postinst script to actually probe
14             # the version of another installed package, so we'll treat
15             # that file as a flag file (as suggested in that README)
16             # and if that's not present we'll populate
17             # /usr/etc/gss/mech.  Since moonshot-gss-eap enters Debian
18             # after krb5 1.12.1+dfsg-2, the moonshot-gss-eap will not
19             # violate FHS by creating /usr/etc when run with
20             # consistent dependencies in Debian.  Backported version
21             # of moonshot-gss-eap may choose to work with older krb5
22             # rather than being strict with regard to FHS.  That's
23             # kind of the point.
24             if [ ! -e /etc/gss/mech.d/README ]; then
25                 oid_aes128=1.3.6.1.5.5.15.1.1.17
26                 oid_aes256=1.3.6.1.5.5.15.1.1.18
27                 mechfile=/usr/etc/gss/mech
28                 mkdir -p /usr/etc/gss
29                 test -e $mechfile |touch $mechfile
30                 fgrep $oid_aes128 $mechfile ||echo eap-aes128 $oid_aes128 mech_eap.so >>$mechfile
31                 fgrep $oid_aes256 $mechfile ||echo eap-aes256 $oid_aes256 mech_eap.so >>$mechfile
32                 fi
33             fi
34         ;;
35     esac
36
37     #DEBHELPER#
38
39 exit 0