Statistics
| Branch: | Tag: | Revision:

root / debian / ganeti.postinst.in @ 45b6a5b4

History | View | Annotate | Download (1.9 kB)

1
#!/bin/sh
2
# postinst script for ganeti
3

    
4
set -e
5

    
6
# summary of how this script can be called:
7
#        * <postinst> `configure' <most-recently-configured-version>
8
#        * <old-postinst> `abort-upgrade' <new version>
9
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
10
#          <new-version>
11
#        * <postinst> `abort-remove'
12
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
13
#          <failed-install-package> <version> `removing'
14
#          <conflicting-package> <version>
15
# for details, see http://www.debian.org/doc/debian-policy/ or
16
# the debian-policy package
17

    
18

    
19
case "$1" in
20
    configure)
21
#GANETI_USERS#
22

    
23
	# Remove stale PID files
24
	# Ganeti versions prior to 2.8.0~rc4 leave Haskell daemon pidfiles
25
	# behind. If these are root-owned, starting the daemons as unprivileged
26
	# users will fail.
27

    
28
	# All daemons have been stopped during prerm, so it's safe to remove
29
	# their PID files.
30
	for daemon in confd mond luxid; do
31
		rm -f /var/run/ganeti/ganeti-${daemon}.pid
32
	done
33

    
34
	# Also remove luxid's socket
35
	rm -f /var/run/ganeti/socket/ganeti-query
36

    
37
	# Since 2.9.0, mond runs as root, so remove the old gnt-mond user (that
38
	# was also created during 2.9.0~rcX.
39
	if [ -n "$2" ] && dpkg --compare-versions "$2" lt 2.9.0 && \
40
			getent passwd gnt-mond >/dev/null; then
41
		find /var/log/ganeti -user gnt-mond -exec chown root:root {} \;
42
		deluser --system gnt-mond || true
43
	fi
44
    ;;
45

    
46
    abort-upgrade|abort-remove|abort-deconfigure)
47
    ;;
48

    
49
    *)
50
        echo "postinst called with unknown argument \`$1'" >&2
51
        exit 1
52
    ;;
53
esac
54

    
55
# dh_installdeb will replace this with shell code automatically
56
# generated by other debhelper scripts.
57

    
58
#DEBHELPER#
59

    
60
# Fix jobqueue archive permissions
61
# This may take a while, so we only do this if necessary
62
find /var/lib/ganeti/queue/archive -mindepth 1 -maxdepth 1 \
63
		-type d -not -user "@GNTMASTERUSER@" 2>/dev/null | while read dirname; do
64
	/usr/lib/ganeti/ensure-dirs --full-run
65
	break
66
done
67

    
68
exit 0