Added "addhomedir", a utility to create home directories for new users.
[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 ! dpkg-statoverride --list /usr/bin/addhomedir > /dev/null; then
25             dpkg-statoverride --add --update root $OFFICE $SUID /usr/bin/addhomedir
26         fi
27
28         if [ -f /etc/csc/ldap.cf ] && ! dpkg-statoverride --list /etc/csc/ldap.cf > /dev/null; then
29             dpkg-statoverride --add --update $CEO staff 640 /etc/csc/ldap.cf
30         fi
31
32         if [ ! -e /etc/csc/ceo.keytab ] && [ -x /usr/sbin/kadmin.local ]; then
33             if dpkg-statoverride --list /etc/csc/ceo.keytab > /dev/null; then
34                 dpkg-statoverride --remove /etc/csc/ceo.keytab || true
35             fi    
36             echo 'warning: re-creating ceo.keytab'
37             echo 'ktadd -k /etc/csc/ceo.keytab ceo/admin' | /usr/sbin/kadmin.local || true
38             if [ -e /etc/csc/ceo.keytab ]; then
39                 echo -e "\nSuccess!"
40             else
41                 echo -e "\nFailed!"
42             fi
43         fi
44
45         if [ -f /etc/csc/ceo.keytab ] && ! dpkg-statoverride --list /etc/csc/ceo.keytab > /dev/null; then
46             dpkg-statoverride --add --update $CEO staff 640 /etc/csc/ceo.keytab
47         fi
48         
49     ;;
50     
51     abort-upgrade|abort-remove|abort-deconfigure)
52     ;;
53     
54     *)
55         echo "postinst called with unknown argument \"$1\"" >&2
56         exit 1
57     ;;
58 esac
59
60 #DEBHELPER#
61
62 exit 0