New release (version 0.2).
[public/pyceo-broken.git] / debian / postinst
1 #!/bin/bash -e
2
3 case "$1" in
4     configure|upgrade)
5
6         if getent passwd ceo > /dev/null; then
7             CEO=ceo
8             SUID=4750
9         else
10             CEO=root
11             SUID=755
12         fi
13
14         if getent group office > /dev/null; then
15             OFFICE=office
16         else
17             OFFICE=root
18         fi
19
20         if ! dpkg-statoverride --list /usr/bin/ceo > /dev/null; then
21             dpkg-statoverride --add --update $CEO $OFFICE $SUID /usr/bin/ceo
22         fi
23
24         if [ -f /etc/csc/ldap.cf ] && ! dpkg-statoverride --list /etc/csc/ldap.cf > /dev/null; then
25             dpkg-statoverride --add --update $CEO staff 640 /etc/csc/ldap.cf
26         fi
27
28         if [ ! -e /etc/csc/ceo.keytab ] && [ -x /usr/sbin/kadmin.local ]; then
29             if dpkg-statoverride --list /etc/csc/ceo.keytab > /dev/null; then
30                 dpkg-statoverride --remove /etc/csc/ceo.keytab || true
31             fi    
32             echo 'warning: re-creating ceo.keytab'
33             echo 'ktadd -k /etc/csc/ceo.keytab ceo/admin' | /usr/sbin/kadmin.local || true
34             if [ -e /etc/csc/ceo.keytab ]; then
35                 echo -e "\nSuccess!"
36             else
37                 echo -e "\nFailed!"
38             fi
39         fi
40
41         if [ -f /etc/csc/ceo.keytab ] && ! dpkg-statoverride --list /etc/csc/ceo.keytab > /dev/null; then
42             dpkg-statoverride --add --update $CEO staff 640 /etc/csc/ceo.keytab
43         fi
44         
45     ;;
46     
47     abort-upgrade|abort-remove|abort-deconfigure)
48     ;;
49     
50     *)
51         echo "postinst called with unknown argument \"$1\"" >&2
52         exit 1
53     ;;
54 esac
55
56 #DEBHELPER#
57
58 exit 0