Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / debian / ceph-base.postinst
1 #!/bin/sh
2 # vim: set noet ts=8:
3 # postinst script for ceph
4 #
5 # see: dh_installdeb(1)
6
7 set -e
8
9 # summary of how this script can be called:
10 #
11 #       postinst configure <most-recently-configured-version>
12 #       old-postinst abort-upgrade <new-version>
13 #       conflictor's-postinst abort-remove in-favour <package> <new-version>
14 #       postinst abort-remove
15 #       deconfigured's-postinst abort-deconfigure in-favour <failed-install-package> <version> [<removing conflicting-package> <version>]
16 #
17 # The current action is to simply remove the mistakenly-added
18 # /etc/init/ceph.conf file; this could be done in any of these cases,
19 # although technically it will leave the system in a different state
20 # than the original install that included that file.  So instead we
21 # only remove on "configure", since that's the only time we know we're
22 # successful in installing a newer package than the erroneous version.
23
24 # for details, see http://www.debian.org/doc/debian-policy/ or
25 # the debian-policy package
26
27 [ -f "/etc/default/ceph" ] && . /etc/default/ceph
28 [ -z "$SERVER_USER" ] && SERVER_USER=ceph
29 [ -z "$SERVER_GROUP" ] && SERVER_GROUP=ceph
30
31 case "$1" in
32     configure)
33         rm -f /etc/init/ceph.conf
34         [ -x /sbin/start ] && start ceph-all || :
35
36         # adjust file and directory permissions
37         for DIR in /var/lib/ceph/* ; do
38             if ! dpkg-statoverride --list $DIR >/dev/null
39             then
40                 chown $SERVER_USER:$SERVER_GROUP $DIR
41             fi
42         done
43     ;;
44     abort-upgrade|abort-remove|abort-deconfigure)
45         :
46     ;;
47
48     *)
49         echo "postinst called with unknown argument \`$1'" >&2
50         exit 1
51     ;;
52 esac
53
54 # dh_installdeb will replace this with shell code automatically
55 # generated by other debhelper scripts.
56
57 #DEBHELPER#
58
59 exit 0
60
61